/* Darts Counter – Layout: Tab-App. Handy: Leiste unten, Tablet/Desktop: Seitenleiste links.
   Farben angelehnt an die Dartscheibe: Grün = Double, Rot = Triple. */
:root {
  --bg: #f2f4f1;
  --surface: #ffffff;
  --surface-2: #e8ece7;
  --fg: #131a15;
  --muted: #5b685f;
  --line: #dbe1da;
  --accent: #1d7a4b;
  --accent-fg: #ffffff;
  --double: #1d7a4b;
  --triple: #c42f28;
  --single: #2a5b8c;
  --gray: #6b746e;
  --warn: #c9711c;
  --gold: #c29224;
  --scrim: rgba(10, 16, 12, 0.45);
  --setup-tint: rgba(100, 110, 104, 0.18);
  --shadow: 0 10px 30px rgba(10, 20, 14, 0.18);

  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --nav-w: 232px;
  --tab-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c110e;
    --surface: #161d18;
    --surface-2: #202923;
    --fg: #e7ede8;
    --muted: #93a197;
    --line: #27312b;
    --accent: #3cae74;
    --accent-fg: #06140c;
    --double: #3cae74;
    --triple: #ef5b51;
    --single: #7fb4ea;
    --gray: #98a29c;
    --warn: #f0a04b;
    --gold: #e3b84c;
    --scrim: rgba(0, 0, 0, 0.6);
    --setup-tint: rgba(150, 160, 154, 0.12);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c110e;
  --surface: #161d18;
  --surface-2: #202923;
  --fg: #e7ede8;
  --muted: #93a197;
  --line: #27312b;
  --accent: #3cae74;
  --accent-fg: #06140c;
  --double: #3cae74;
  --triple: #ef5b51;
  --single: #7fb4ea;
  --gray: #98a29c;
  --warn: #f0a04b;
  --gold: #e3b84c;
  --scrim: rgba(0, 0, 0, 0.6);
  --setup-tint: rgba(150, 160, 154, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
svg.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }

/* ---------- Grundlayout ---------- */
.layout { min-height: 100%; }
.main {
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 24px);
  max-width: 760px;
  margin: 0 auto;
}
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 4px max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tab-h) ; border: 0; background: none; color: var(--muted);
  font-size: 11px; font-weight: 600;
}
.tab svg.i { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--accent); }
.brand { display: none; }

@media (min-width: 900px) {
  .tabbar {
    top: 0; right: auto; width: var(--nav-w); bottom: 0;
    display: flex; flex-direction: column; gap: 4px;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 12px 20px max(12px, env(safe-area-inset-left, 0px));
    border-top: 0; border-right: 1px solid var(--line);
    background: var(--surface);
  }
  .brand {
    display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px;
    font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: 0.01em;
  }
  .brand svg { width: 30px; height: 30px; }
  .tab {
    flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 12px;
    border-radius: var(--radius-sm); font-size: 15px;
  }
  .tab svg.i { width: 20px; height: 20px; }
  .tab[aria-current="page"] { background: color-mix(in srgb, var(--accent) 13%, transparent); }
  .main { margin-left: calc(var(--nav-w) + max(0px, (100% - var(--nav-w) - 760px) / 2)); padding-bottom: 40px; }
}

/* ---------- Kopfzeile ---------- */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg);
}
.header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding-top: 6px;
  background: var(--bg);
}
.header .spacer { flex: 1; }
.title-row { padding: 0 0 6px; }
.title-row h1 {
  margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 36px; line-height: 1.05;
  letter-spacing: 0.005em; text-wrap: balance;
}
.title-row h1.sm { font-size: 28px; }
.back {
  display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; color: var(--accent);
  font-weight: 600; padding: 8px 6px 8px 0; margin-left: -4px;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 40px; height: 40px; padding: 0 10px; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600;
}
.icon-btn svg.i { width: 20px; height: 20px; }

/* ---------- Gruppierte Listen ---------- */
.section { margin-top: 22px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 4px 6px; color: var(--muted); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.section-head button { text-transform: none; letter-spacing: 0; font-size: 14px; }
.section-foot { margin: 6px 4px 0; color: var(--muted); font-size: 13px; }
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
}
.card > .row + .row, .card > .row + .rowwrap, .card > .rowwrap + .row, .card > .rowwrap + .rowwrap { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 10px 14px; width: 100%;
  border: 0; background: none; text-align: left;
}
.row > .grow { flex: 1; min-width: 0; }
.row .sub { color: var(--muted); font-size: 13px; }
.row .sub2 { color: var(--muted); font-size: 12px; }
.row.link:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.row .chev { color: var(--muted); opacity: 0.6; }
.row .value { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.row .label { color: var(--muted); flex: 1; }
.row.action { color: var(--accent); font-weight: 600; }
.row.action.center { justify-content: center; }
.row.danger { color: var(--triple); font-weight: 600; }
.row.empty { color: var(--muted); }
.rowwrap { display: flex; align-items: center; }
.rowwrap > .row { flex: 1; min-width: 0; }
.rowwrap > .del { margin-right: 8px; }
.strong { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

select.plain {
  border: 0; background: none; color: var(--accent); font-weight: 600; text-align: right;
  padding: 6px 2px; max-width: 60%;
}
.name-input {
  flex: 1; min-width: 0; border: 0; background: none; padding: 6px 0; font-size: 16px;
}
.name-input::placeholder { color: var(--muted); }

/* Schalter */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--surface-2);
  transition: background 0.2s;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.25); transition: transform 0.2s;
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Stepper */
.stepper { display: inline-flex; border-radius: 9px; background: var(--surface-2); overflow: hidden; flex: none; }
.stepper button { width: 44px; height: 34px; border: 0; background: none; font-size: 20px; font-weight: 600; }
.stepper button + button { border-left: 1px solid var(--line); }
.stepper button:disabled { opacity: 0.3; }

/* Segmente */
.segmented {
  display: flex; padding: 3px; gap: 3px; background: var(--surface-2); border-radius: 10px;
}
.segmented button {
  flex: 1; border: 0; background: none; padding: 7px 6px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); white-space: nowrap;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; border: 0;
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 650;
}
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.block { width: 100%; }
.btn.danger { background: color-mix(in srgb, var(--triple) 12%, transparent); color: var(--triple); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn:disabled { opacity: 0.4; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 4px 0; }

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%; background: var(--pc); color: #fff;
  font-weight: 700; font-size: 14px;
}
.avatar.s { width: 22px; height: 22px; font-size: 10px; }
.pos {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); font-weight: 700;
}
.del { border: 0; background: none; color: var(--triple); padding: 6px; display: inline-flex; }
.del svg.i { width: 24px; height: 24px; }
.mini { border: 0; background: var(--surface-2); border-radius: 8px; width: 36px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.mini:disabled { opacity: 0.3; }

/* Kennzahlen */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 14px 8px; }
.tile { text-align: center; min-width: 0; }
.tile b {
  display: block; font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.1;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile span { color: var(--muted); font-size: 12px; }

.empty-state { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state svg { width: 46px; height: 46px; color: var(--muted); opacity: 0.6; }
.empty-state h2 { color: var(--fg); font-size: 20px; margin: 10px 0 4px; }

.mode-icon { color: var(--accent); width: 30px; display: inline-flex; justify-content: center; flex: none; }
.mode-icon svg.i { width: 24px; height: 24px; }
.trophy { color: var(--gold); }
.win { color: var(--warn); font-size: 12px; font-weight: 600; display: inline-flex; gap: 4px; align-items: center; }
.ok { color: var(--accent); }
.bad { color: var(--triple); }

/* ---------- Spiel / Training ---------- */
.stage {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column;
  background: var(--bg);
  padding: env(safe-area-inset-top, 0px) max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  transition: background-color 0.25s;
}
.stage.setup { background: color-mix(in srgb, var(--gray) 16%, var(--bg)); }
.stage-head { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.stage-head h1 { flex: 1; margin: 0; text-align: center; font-family: var(--font-display); font-size: 21px; font-weight: 700; }
.stage-head .side { width: 92px; display: flex; }
.stage-head .side.r { justify-content: flex-end; }
.stage-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.stage-col { display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0; }
.stage-col.info { flex: none; }
.stage-col.pad { margin-top: 0; }
/* Sehr flache Bildschirme (Handy quer): nichts überlappen lassen, notfalls scrollen. */
@media (max-height: 520px) {
  .stage { overflow-y: auto; }
  .stage-body, .stage-col { flex-shrink: 0; }
  .stage-col.info { flex: none; }
  .key { min-height: 34px !important; font-size: 16px; }
  .key.mod { min-height: 30px !important; }
}
/* Tastenfeld immer unten, auch auf breiten Bildschirmen; dort mittig und nicht zu breit. */
@media (min-width: 820px) {
  .stage-body { width: 100%; max-width: 1100px; margin: 0 auto; padding-top: 8px; }
  .stage-col.pad { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
}

.scoreboard {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  padding: 2px;
}
.scoreboard::-webkit-scrollbar { display: none; }
.pcard {
  flex: 0 0 calc((100% - 10px * (var(--n) - 1)) / var(--n)); scroll-snap-align: center;
  padding: 10px 8px; border-radius: 16px; text-align: center; min-width: 0;
  background: color-mix(in srgb, var(--gray) 9%, transparent);
  border: 3px solid transparent;
}
.pcard.active { background: color-mix(in srgb, var(--pc) 18%, transparent); border-color: var(--pc); }
.pcard .who { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 650; }
.pcard .rest {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(44px, 13vw, 64px); line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.pcard .meta { display: flex; gap: 10px; justify-content: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.pcard .meta .warn { color: var(--warn); }

.visit { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.visit .turn { font-weight: 650; }
.slots { display: flex; gap: 8px; width: 100%; align-items: center; }
.slot {
  flex: 1; min-height: 42px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; background: color-mix(in srgb, var(--gray) 13%, transparent);
  font-weight: 650; font-size: 19px; font-variant-numeric: tabular-nums;
}
.slots .total { min-width: 60px; font-family: var(--font-display); font-weight: 700; font-size: 30px; font-variant-numeric: tabular-nums; }
.hint { color: var(--accent); font-weight: 650; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.hint.warn { color: var(--warn); }
.msg { color: var(--muted); font-size: 14px; min-height: 1.4em; }
.setup-line { font-weight: 650; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }

/* Tastenfeld */
.keypad { display: flex; flex-direction: column; gap: 6px; }
.keypad .mods, .keypad .bottom { display: flex; gap: 6px; }
.keypad .grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.key {
  --k: var(--accent);
  flex: 1; min-height: 46px; border: 0; border-radius: 10px;
  background: color-mix(in srgb, var(--k) 14%, transparent); color: var(--k);
  font-weight: 650; font-size: 19px; font-variant-numeric: tabular-nums;
  transition: transform 0.08s, background-color 0.1s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.key:active:not(:disabled) { transform: scale(0.96); background: color-mix(in srgb, var(--k) 30%, transparent); }
.key:disabled { opacity: 0.35; }
.key.mod { min-height: 40px; font-size: 16px; }
.key.on { background: var(--k); color: #fff; }
.key.k-single { --k: var(--single); }
.key.k-double { --k: var(--double); }
.key.k-triple { --k: var(--triple); }
.key.k-gray { --k: var(--gray); }
.key.k-undo { --k: var(--warn); }
.key.big { min-height: 88px; font-size: 22px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.key.filled { background: var(--k); color: #fff; }
@media (min-height: 760px) { .key { min-height: 54px; } .key.mod { min-height: 46px; } }
@media (min-width: 820px) and (min-height: 560px) { .key { min-height: 58px; } .key.mod { min-height: 46px; } }
@media (max-height: 640px) { .key { min-height: 40px; font-size: 17px; } .key.mod { min-height: 34px; } .pcard .rest { font-size: 40px; } }

.overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: var(--scrim);
}
.dialog {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: 22px; padding: 22px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.dialog h2 { margin: 0; font-size: 21px; text-wrap: balance; }
.dialog p { margin: 0; color: var(--muted); }
.dialog .big-trophy { width: 56px; height: 56px; color: var(--gold); margin: 0 auto; }
.dialog input[type="text"] {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); font-size: 16px;
}
.dialog .stack { display: flex; flex-direction: column; gap: 8px; }

.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto; background: var(--bg);
  border-radius: 20px 20px 0 0; padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 20px; } }
.sheet-head { display: flex; align-items: center; min-height: 48px; position: sticky; top: -8px; background: var(--bg); z-index: 1; }
.sheet-head h2 { flex: 1; margin: 0; text-align: center; font-size: 17px; }
.sheet-head .side { width: 70px; display: flex; justify-content: flex-end; }

/* Training */
.big-target { font-family: var(--font-display); font-weight: 700; font-size: clamp(72px, 24vw, 112px); line-height: 1; text-align: center; font-variant-numeric: tabular-nums; }
.big-label { text-align: center; color: var(--muted); font-weight: 650; }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.meta-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; gap: 10px; }
.train { flex: 1; display: flex; flex-direction: column; gap: 14px; max-width: 600px; width: 100%; margin: 0 auto; padding-top: 6px; }
.train .grow { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 6px; text-align: center; }
.hits4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hits4 .key { min-height: 80px; font-size: 34px; font-family: var(--font-display); font-weight: 700; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.center { text-align: center; }
.radio-row input { accent-color: var(--accent); width: 20px; height: 20px; }

/* Statistik */
.summary-head { text-align: center; padding: 10px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.summary-head svg { width: 46px; height: 46px; color: var(--gold); }
.summary-head h2 { margin: 0; font-family: var(--font-display); font-size: 32px; }
.summary-head .sub { color: var(--muted); font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; margin-top: 16px; }
.scard { border-radius: 16px; padding: 14px 16px; background: color-mix(in srgb, var(--pc) 9%, var(--surface)); }
.scard .top { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.scard .top .grow { flex: 1; min-width: 0; }
.scard .bigs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; text-align: center; }
.scard .bigs b { display: block; font-family: var(--font-display); font-size: 27px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.scard .bigs span { color: var(--muted); font-size: 12px; }
.scard .kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid color-mix(in srgb, var(--fg) 8%, transparent); }
.scard .kv span:first-child { color: var(--muted); }
.scard .kv span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Graph */
.chart { padding: 12px 14px 10px; }
.chart .chead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.chart .chead h3 { margin: 0; font-size: 16px; }
.chart .cval { text-align: right; }
.chart .cval b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.chart .cval span { color: var(--muted); font-size: 12px; }
.chart .plot { margin-top: 8px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart .plot svg { display: block; width: 100%; height: 190px; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart .dot { fill: var(--accent); }
.chart .dot.sel { stroke: var(--surface); stroke-width: 2; }
.chart .trend { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; }
.chart .rule { stroke: var(--muted); stroke-opacity: 0.45; }
.chart .nodata { color: var(--muted); font-size: 14px; min-height: 120px; display: flex; align-items: center; justify-content: center; text-align: center; }
.chart .tl { margin-top: 6px; font-size: 14px; font-weight: 650; display: inline-flex; gap: 6px; align-items: center; }
.tl.up { color: var(--accent); }
.tl.down { color: var(--warn); }
.tl.flat { color: var(--muted); }

.colors { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 14px; }
.colors button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--pc); box-shadow: 0 0 0 0 var(--fg); }
.colors button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--fg); }

textarea.paste {
  width: 100%; min-height: 110px; border: 0; background: none; padding: 12px 14px; resize: vertical;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg);
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 60;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 14px);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.stage ~ .toast { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 56px); }

/* ---------- Gastmodus / Freunde-Bereich */
.modebar {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 0; padding: 9px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--muted);
}
.modebar .grow { flex: 1; min-width: 0; }
.modebar b { color: var(--fg); }
.modebar .link-btn { font-size: 13px; white-space: nowrap; text-decoration: none; }
.modebar.warn { border-color: var(--warn); color: var(--fg); }
.sync-state { white-space: nowrap; font-size: 12px; }
.sync-state.s-offline, .sync-state.s-error { color: var(--warn); }
.sync-state.s-idle { color: var(--accent); }

/* ---------- Hilfe-Kasten zwischen Wurfanzeige und Tastenfeld */
.helper {
  width: 100%; max-width: 760px; margin: 0 auto; box-sizing: border-box; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: stretch;
  padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.hbox {
  flex: 1 1 200px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px; border-radius: 10px; border: 0; font: inherit; font-size: 14px; font-weight: 600; text-align: center;
  background: var(--surface-2); color: var(--fg);
}
.hbox .i { flex: none; width: 18px; height: 18px; }
.hbox.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.hbox.on.setup { color: var(--fg); }
.hbox.off, .hbox:disabled { color: color-mix(in srgb, var(--muted) 60%, var(--surface)); background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
button.hbox { cursor: pointer; }
button.hbox:disabled { cursor: default; }
button.hbox.act:not(:disabled) { color: var(--fg); }
button.hbox.act:not(:disabled):hover { background: color-mix(in srgb, var(--fg) 10%, var(--surface-2)); }
.hbox.small { flex: 0 0 auto; padding: 6px 16px; }
.hbox.on.setup { flex: 1 1 160px; }
.hbox.act.danger:not(:disabled) { color: var(--triple); }
@media (max-height: 640px) { .hbox { min-height: 34px; font-size: 13px; } .helper { padding: 6px; } }

/* Ein- und Ausstieg auf „Neues Spiel“ */
.row.rule { flex-direction: column; align-items: stretch; gap: 8px; }
.rule-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rule-head .sub2 { text-align: right; }
.rule-head .strong { white-space: nowrap; }

/* Spielart-Auswahl: Segmente in einer Zeile */
.row .segmented { flex: 0 0 auto; min-width: 120px; }

/* Cricket */
.keypad .grid.c3 { grid-template-columns: repeat(3, 1fr); }
.cricket { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.crow { display: grid; grid-template-columns: 54px repeat(var(--n), minmax(0, 1fr)); align-items: stretch; border-top: 1px solid var(--line); }
.crow.head { border-top: 0; }
.crow > span { display: flex; align-items: center; justify-content: center; min-height: 34px; }
.crow .cn { font-family: var(--font-display); font-weight: 700; font-size: 20px; }
.crow.dead .cn { color: var(--muted); text-decoration: line-through; }
.crow .cp { flex-direction: column; padding: 6px 4px; gap: 0; min-width: 0; font-size: 13px; font-weight: 650; }
.crow .cp b { font-family: var(--font-display); font-size: 28px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.crow .cp span { max-width: 100%; }
.crow .active { background: color-mix(in srgb, var(--pc) 16%, transparent); }
.crow.head .cp.active { box-shadow: inset 0 -3px 0 var(--pc); }
.mk { width: 24px; height: 24px; fill: none; stroke: var(--pc); stroke-width: 2.6; stroke-linecap: round; }
@media (max-height: 700px) { .crow > span { min-height: 28px; } .mk { width: 20px; height: 20px; } .crow .cp b { font-size: 22px; } }

/* Killer */
.killers { display: flex; flex-direction: column; gap: 6px; }
.kcard { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; border: 2px solid transparent; background: color-mix(in srgb, var(--gray) 9%, transparent); font-weight: 650; min-width: 0; }
.kcard.active { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 16%, transparent); }
.kcard.out { opacity: 0.45; }
.kcard.out .grow { text-decoration: line-through; }
.kcard .knum { font-family: var(--font-display); font-size: 22px; font-weight: 700; min-width: 42px; text-align: right; }
.kbadge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 99px; background: var(--triple); color: #fff; }
.hearts { display: inline-flex; gap: 1px; color: var(--triple); }
.hearts .i { width: 16px; height: 16px; }
.hearts .lost { color: color-mix(in srgb, var(--gray) 35%, transparent); }

/* Impressum und Datenschutz */
.legal-page { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; line-height: 1.6; }
.legal-page h1 { font-family: var(--font-display); font-size: 40px; line-height: 1.1; margin: 8px 0 16px; }
.legal-page h2 { font-size: 19px; margin: 28px 0 8px; }
.legal-page h3 { font-size: 16px; margin: 18px 0 4px; }
.legal-page p, .legal-page ul { margin: 0 0 10px; }
.legal-page ul { padding-left: 22px; }
.legal-page a { color: var(--accent); }
.legal-page code { font-size: 0.92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
.legal-page .lead { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.legal-nav { font-weight: 650; }
.legal-nav a { text-decoration: none; }
.legal-links, .legal-date { color: var(--muted); font-size: 14px; margin-top: 28px !important; }
.legal-foot { text-align: center; font-size: 13px; color: var(--muted); padding: 24px 16px 12px; }
.legal-foot a { color: var(--muted); }
