/* Biberbande Punkteblock – Birkenpapier, Biberbraun, ein Akzent: Flusswasser */
@font-face { font-family: 'Bricolage'; src: url('fonts/bricolage.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('fonts/figtree.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }

:root {
  --bg: #f1e9da;
  --paper: #fbf7ef;
  --paper-2: #f4ecdf;
  --paper-3: #ebe1d0;
  --ink: #2a2017;
  --ink-2: #66574a;
  --ink-3: #9b8b78;
  --line: rgba(42, 32, 23, .09);
  --line-2: rgba(42, 32, 23, .2);
  --accent: #1d676c;
  --accent-ink: #fbf7ef;
  --accent-soft: rgba(29, 103, 108, .11);
  --danger: #a8432b;
  --shadow-1: 0 1px 1px rgba(74, 48, 24, .05), 0 2px 10px -2px rgba(74, 48, 24, .1);
  --shadow-2: 0 2px 4px rgba(74, 48, 24, .06), 0 16px 36px -14px rgba(74, 48, 24, .32);
  --inner: inset 0 1px 0 rgba(255, 255, 255, .7);
  --r-xl: 24px; --r-lg: 20px; --r-md: 14px; --r-sm: 10px;
  --spring: cubic-bezier(.34, 1.45, .64, 1);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font-d: 'Bricolage', ui-rounded, system-ui, sans-serif;
  --font-b: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --dock-h: 0px;
  /* Kartenfarben: von gut (0) bis schlecht (9, Wasserratte) */
  --c0: #23756a; --c1: #337f65; --c2: #4f8a5c; --c3: #789152; --c4: #9d8c40;
  --c5: #b67f35; --c6: #bf6e31; --c7: #b95d30; --c8: #a94b2e; --c9: #86352b;
  color-scheme: light;
}
.v-0 { --c: var(--c0); } .v-1 { --c: var(--c1); } .v-2 { --c: var(--c2); } .v-3 { --c: var(--c3); } .v-4 { --c: var(--c4); }
.v-5 { --c: var(--c5); } .v-6 { --c: var(--c6); } .v-7 { --c: var(--c7); } .v-8 { --c: var(--c8); } .v-9 { --c: var(--c9); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-b);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
/* Licht vom Fluss oben rechts, Holz unten links – fest hinter dem Inhalt */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(29, 103, 108, .10), transparent 60%),
    radial-gradient(90% 50% at 0% 100%, rgba(138, 90, 52, .10), transparent 60%);
}
/* feine Papierkörnung */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .15 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body.locked { overflow: hidden; }
#app { position: relative; z-index: 1; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { font-family: var(--font-d); margin: 0; letter-spacing: -.015em; }
.muted { color: var(--ink-3); font-size: 13px; font-weight: 600; }
.hint { color: var(--ink-2); font-size: 13.5px; margin: 10px 2px 0; }
.center { text-align: center; display: block; margin-left: auto; margin-right: auto; }
.eyebrow { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px calc(28px + env(safe-area-inset-bottom));
}
body.has-dock .wrap { padding-bottom: calc(var(--dock-h) + 24px); }

/* ---------- Kopfleiste ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: rgba(241, 233, 218, .86);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 1px 0 var(--line);
}
.bar-title { display: flex; align-items: center; gap: 8px; font-family: var(--font-d); font-weight: 750; font-size: 18px; flex: 1; }
.bar-title .mini { width: 28px; height: 28px; }
.bar-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--paper);
  box-shadow: var(--shadow-1), var(--inner);
  color: var(--ink);
  transition: transform .2s var(--spring), opacity .2s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn:disabled { opacity: .35; box-shadow: none; }
.icon-btn.ghost { background: transparent; box-shadow: none; color: var(--ink-3); width: 38px; height: 38px; }

/* ---------- Setup ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 26px 4px 22px; }
.hero-mark { width: 74px; height: 74px; filter: drop-shadow(0 10px 14px rgba(74, 48, 24, .22)); transform: rotate(-6deg); }
.hero h1 { font-size: clamp(38px, 11vw, 50px); font-weight: 800; line-height: .95; }
.lede { margin: 8px 0 0; color: var(--ink-2); font-size: 15.5px; max-width: 34ch; }

.panel {
  background: var(--paper);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1), var(--inner);
  padding: 18px 16px 16px;
  margin-bottom: 12px;
}
.panel h2 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }

.names { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.name-row { display: grid; grid-template-columns: 26px 1fr 38px; align-items: center; gap: 6px; }
.seat { font-family: var(--font-d); font-weight: 700; color: var(--ink-3); text-align: center; font-size: 15px; }
.name-row input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font: 600 17px var(--font-b);
  color: var(--ink);
  background: var(--paper-2);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.name-row input::placeholder { color: var(--ink-3); font-weight: 500; }
.name-row input:focus { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 4px var(--accent-soft); }
.name-row input[aria-invalid] { border-color: var(--danger); }
.add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 46px; margin-top: 10px;
  border-radius: var(--r-md);
  border: 1.5px dashed var(--line-2);
  color: var(--ink-2);
  font-weight: 650;
}
.add .ico { width: 18px; height: 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 15px;
  border-radius: 999px;
  background: var(--paper-2);
  font-weight: 650;
  font-size: 15px;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .15s, color .15s, transform .2s var(--spring);
}
.chip.on { background: var(--ink); color: var(--paper); }
.chip:active { transform: scale(.95); }

.stepper { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; gap: 10px; }
.step {
  height: 52px; border-radius: 16px;
  background: var(--paper-2);
  font: 600 26px var(--font-d);
  transition: transform .2s var(--spring);
}
.step:active { transform: scale(.92); }
.step:disabled { opacity: .35; }
.stepval { text-align: center; display: grid; gap: 2px; }
.stepval b { font: 800 36px/1 var(--font-d); font-variant-numeric: tabular-nums; }
.stepval span, .stepval .link { font-size: 13px; color: var(--ink-2); }

.resume {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--ink); color: var(--paper);
  border-radius: var(--r-xl);
  padding: 16px 16px 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-2);
}
.resume .eyebrow { color: #9fd0cc; }
.resume b { display: block; font: 700 18px var(--font-d); margin-top: 2px; }
.resume-names { display: block; font-size: 13.5px; color: rgba(251, 247, 239, .7); margin-top: 2px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 42px; padding: 0 16px 0 12px;
  border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font-weight: 700;
}
.pill .ico { width: 16px; height: 16px; fill: currentColor; stroke: none; }

.error {
  margin: 4px 2px 12px;
  padding: 10px 14px;
  border-radius: var(--r-md);
  background: rgba(168, 67, 43, .1);
  color: var(--danger);
  font-weight: 650;
  font-size: 14.5px;
}

.primary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  height: 54px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 17px var(--font-b);
  box-shadow: 0 10px 22px -10px rgba(20, 80, 84, .75), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform .2s var(--spring), filter .2s;
}
.primary.big { height: 58px; font-size: 17.5px; }
.primary:active { transform: scale(.98); filter: brightness(.95); }
.primary.danger { background: var(--danger); box-shadow: 0 10px 22px -10px rgba(168, 67, 43, .7); }
.secondary {
  height: 50px; width: 100%;
  border-radius: 15px;
  background: var(--paper);
  font-weight: 700;
  box-shadow: var(--shadow-1), var(--inner);
  transition: transform .2s var(--spring);
}
.secondary:active { transform: scale(.98); }
.secondary:disabled { opacity: .4; }
.link { color: var(--accent); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; padding: 8px 4px; }
.setup .primary { margin-top: 6px; }
.setup .link.center { margin-top: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Durchgang ---------- */
.roundcard {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  margin: 4px 0 12px;
  border-radius: var(--r-xl);
  background: var(--paper);
  box-shadow: var(--shadow-2), var(--inner);
}
.roundcard.editing { box-shadow: 0 0 0 2px var(--c5), var(--shadow-2); }
.rc-main { display: grid; }
.rc-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.roundcard.editing .rc-label { color: var(--c6); }
.rc-num { font: 800 46px/1 var(--font-d); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.rc-num small { font-size: 22px; font-weight: 600; color: var(--ink-3); margin-left: 2px; letter-spacing: 0; }
.rc-side { display: grid; justify-items: end; text-align: right; min-width: 0; }
.rc-start { font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.rc-who { font: 700 19px var(--font-d); max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pips { display: flex; gap: 4px; margin-top: 8px; }
.pips i { width: 8px; height: 8px; border-radius: 99px; background: var(--paper-3); transition: width .3s var(--ease); }
.pips i.done { background: var(--accent); opacity: .5; }
.pips i.now { background: var(--accent); width: 20px; }

.editbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 14px; margin: -4px 0 12px;
  border-radius: var(--r-md);
  background: rgba(191, 110, 49, .12);
  color: #7d4520;
  font-weight: 650; font-size: 14.5px;
}
.editbar span { flex: 1; }
.editbar .ico { width: 18px; height: 18px; }

.entries { display: grid; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 46px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-1), var(--inner);
  scroll-margin: 70px 0 calc(var(--dock-h) + 12px);
  cursor: pointer;
  transition: box-shadow .2s var(--ease), transform .25s var(--spring);
}
.row.active { box-shadow: 0 0 0 2px var(--accent), var(--shadow-2); }
.row:active { transform: scale(.99); }
.who { display: grid; min-width: 0; }
.who .nm { font-weight: 700; font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  justify-self: start;
  margin-top: 2px;
  font-size: 10.5px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent);
}
.slots { display: flex; gap: 5px; }
.slot {
  width: 34px; height: 46px;
  display: grid; place-items: center;
  border-radius: 8px;
}
.slot.empty { background: var(--paper-2); box-shadow: inset 0 0 0 1.5px var(--line); }
.slot.next { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); animation: breathe 1.6s ease-in-out infinite; }
.slot.card { font-size: 22px; animation: drop .32s var(--spring) both; }
.sumpill {
  width: 151px; height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 8px;
  background: var(--paper-2);
  font: 650 13px var(--font-b);
  color: var(--ink-2);
}
.sumpill.empty { color: var(--ink-3); }
.sumpill.next { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.rowsum { text-align: right; font: 800 25px var(--font-d); font-variant-numeric: tabular-nums; }
.rowsum.pending { color: var(--ink-3); font-weight: 600; font-size: 19px; }

/* Spielkarte */
.card {
  position: relative;
  overflow: hidden;
  background: #fffaf1;
  color: var(--c);
  font-family: var(--font-d);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 30%, transparent), 0 1px 2px rgba(74, 48, 24, .12);
}
.card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); }

/* ---------- Eingabe-Dock ---------- */
.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(251, 247, 239, .9);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -14px 34px -16px rgba(74, 48, 24, .35), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.dock-in { max-width: 532px; margin: 0 auto; display: grid; gap: 10px; }
.dock-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dock-who { display: grid; min-width: 0; }
.dock-who b { font: 750 17px var(--font-d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-who small { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--paper-3); flex: none; }
.seg button { height: 34px; padding: 0 13px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: background .15s, color .15s; }
.seg button.on { background: var(--ink); color: var(--paper); }
.dock-hint { margin: 0; text-align: center; color: var(--ink-2); font-size: 14px; font-weight: 600; }

.cardpad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.key.card {
  height: 64px;
  border-radius: 12px;
  display: grid; place-content: center; justify-items: center; gap: 1px;
  transition: transform .18s var(--spring), opacity .2s;
}
.key.card:active { transform: scale(.9) rotate(-2deg); }
.key.card:disabled { opacity: .32; filter: saturate(.3); }
.kv { font-size: 28px; line-height: 1; }
.kl { font: 650 10.5px var(--font-b); color: var(--ink-3); letter-spacing: .01em; }
.rat {
  position: absolute; top: 6px; right: 6px;
  font: 750 8.5px var(--font-b); letter-spacing: .06em; text-transform: uppercase;
  color: var(--c9);
}
.numpad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.key.num {
  height: 52px;
  border-radius: 12px;
  background: #fffaf1;
  font: 750 24px var(--font-d);
  box-shadow: inset 0 0 0 1.5px var(--line), 0 1px 2px rgba(74, 48, 24, .1);
  transition: transform .18s var(--spring);
}
.key.num:active { transform: scale(.92); }
.key.num.del { grid-column: span 2; font-size: 22px; }
.key.num.go { grid-column: span 3; background: var(--ink); color: var(--paper); font: 700 16px var(--font-b); box-shadow: none; }
.key.num.go:disabled { opacity: .35; }

/* ---------- Spielstand ---------- */
.board {
  margin-top: 18px;
  background: var(--paper);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1), var(--inner);
  padding: 16px 14px 12px;
}
.board.empty { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); text-align: center; color: var(--ink-3); font-size: 14.5px; padding: 18px; }
.board.empty p { margin: 0; }
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 2px 10px; }
.board-head h2 { font-size: 17px; font-weight: 700; }
.rank { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 2px; }
.rank li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 44px;
  align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 12px;
}
.rank li.lead { background: var(--accent-soft); }
.rank .rk { font: 700 15px var(--font-d); color: var(--ink-3); }
.rank .nm { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .gap { font-size: 12.5px; color: var(--ink-3); font-weight: 650; font-variant-numeric: tabular-nums; }
.rank li.lead .gap { color: var(--accent); }
.rank .tot { font: 800 20px var(--font-d); text-align: right; font-variant-numeric: tabular-nums; }

.tablewrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; -webkit-overflow-scrolling: touch; }
.hist { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.hist th, .hist td { padding: 8px 6px; text-align: center; white-space: nowrap; }
.hist thead th {
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  max-width: 76px; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 1.5px solid var(--line);
}
.hist .rcol { position: sticky; left: 0; background: var(--paper); width: 40px; color: var(--ink-3); font-weight: 700; z-index: 1; }
.hist tbody td { font: 650 17px var(--font-d); border-bottom: 1px solid var(--line); }
.hist tbody tr[data-act] { cursor: pointer; }
.hist tbody tr.editing td, .hist tbody tr.editing th { background: rgba(191, 110, 49, .1); }
.hist td.best { color: var(--accent); font-weight: 800; }
.hist tfoot td { font: 800 20px var(--font-d); padding-top: 10px; }
.hist tfoot td.lead { color: var(--accent); }
.hist tfoot td.lead::after { content: ''; display: block; height: 3px; width: 22px; margin: 3px auto 0; border-radius: 3px; background: var(--accent); }
.rbtn { min-width: 30px; height: 30px; border-radius: 9px; background: var(--paper-2); font: 700 14px var(--font-d); color: var(--ink-2); }

/* ---------- Spielende ---------- */
.champ { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 18px 4px 18px; }
.champ-mark { width: 82px; height: 82px; filter: drop-shadow(0 12px 16px rgba(74, 48, 24, .25)); animation: hop 1.2s var(--spring) .2s both; }
.champ h1 { font-size: clamp(28px, 8.4vw, 38px); font-weight: 800; line-height: 1.02; margin-top: 4px; overflow-wrap: anywhere; }
.champ .lede { margin-top: 6px; }
.podium { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.podium li {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center; gap: 12px;
  padding: 12px 16px 12px 12px;
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-1), var(--inner);
}
.podium li.win { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-2); }
.medal { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font: 800 18px var(--font-d); background: var(--paper-2); color: var(--ink-2); }
.podium li.win .medal { background: rgba(251, 247, 239, .18); color: var(--accent-ink); }
.podium .nm { font: 700 18px var(--font-d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .tot { font: 800 24px var(--font-d); text-align: right; font-variant-numeric: tabular-nums; display: grid; justify-items: end; line-height: 1; }
.podium .tot small { font: 650 11px var(--font-b); opacity: .65; margin-top: 3px; }
.actions { display: grid; gap: 8px; margin-top: 16px; }
.actions .hint { margin: 0 0 6px; }

/* ---------- Sheet, Toast, Konfetti ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(42, 32, 23, .38); animation: fade .2s ease both; }
.sheet {
  position: fixed; z-index: 51;
  left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 26px 26px 0 0;
  background: var(--paper);
  box-shadow: 0 -20px 50px -20px rgba(42, 32, 23, .5);
  animation: sheet .42s var(--spring) both;
}
.sheet h2 { font-size: 22px; font-weight: 800; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sheet-text { color: var(--ink-2); margin: 8px 0 18px; }
.rules h3 { font-size: 15.5px; font-weight: 750; margin: 18px 0 4px; color: var(--accent); }
.rules p, .rules li { color: var(--ink-2); font-size: 15px; }
.rules p { margin: 0; }
.rules ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.rules b { color: var(--ink); }
.cards-note { margin-top: 18px !important; padding: 12px 14px; border-radius: var(--r-md); background: var(--paper-2); font-size: 14px !important; }

.toast {
  position: fixed; z-index: 60;
  left: 50%; bottom: calc(var(--dock-h) + 14px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-weight: 650; font-size: 14px;
  box-shadow: var(--shadow-2);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .35s var(--spring);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.has-dock .toast { bottom: calc(var(--dock-h) + 14px); }

.confetti { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -16px; left: var(--x);
  width: 9px; height: 13px; border-radius: 2px;
  background: var(--c);
  animation: fall var(--t) var(--d) cubic-bezier(.3, .6, .5, 1) forwards;
}

/* ---------- Bewegung ---------- */
.fresh > * { animation: rise .5s var(--ease) both; }
.fresh > *:nth-child(2) { animation-delay: .04s; }
.fresh > *:nth-child(3) { animation-delay: .08s; }
.fresh > *:nth-child(4) { animation-delay: .12s; }
.fresh > *:nth-child(5) { animation-delay: .16s; }
.fresh > *:nth-child(n+6) { animation-delay: .2s; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet { from { transform: translateY(100%); } }
@keyframes drop { from { transform: translateY(-8px) scale(.85); opacity: 0; } }
@keyframes breathe { 50% { background: rgba(29, 103, 108, .2); } }
@keyframes hop { 0% { transform: translateY(14px) rotate(-10deg) scale(.8); opacity: 0; } 60% { transform: translateY(-6px) rotate(4deg); } 100% { transform: none; } }
@keyframes fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--r)); } }

@media (hover: hover) {
  .icon-btn:hover:not(:disabled), .secondary:hover:not(:disabled), .key.num:hover { filter: brightness(1.03); box-shadow: var(--shadow-2), var(--inner); }
  .key.card:hover:not(:disabled) { transform: translateY(-2px); }
  .primary:hover { filter: brightness(1.06); }
  .hist tbody tr[data-act]:hover td { background: var(--paper-2); }
  .row:hover:not(.active) { box-shadow: 0 0 0 1.5px var(--line-2), var(--shadow-1); }
}

@media (max-width: 370px) {
  .wrap { padding-left: 12px; padding-right: 12px; }
  .row { gap: 8px; padding: 9px 10px 9px 12px; grid-template-columns: minmax(0, 1fr) auto 38px; }
  .slot { width: 30px; height: 42px; }
  .slots { gap: 4px; }
  .sumpill { width: 132px; height: 42px; }
  .rowsum { font-size: 22px; }
  .key.card { height: 58px; }
  .kv { font-size: 25px; }
  .cardpad, .numpad { gap: 6px; }
  .seg button { padding: 0 10px; }
  .hero-mark { width: 60px; height: 60px; }
}
@media (max-height: 680px) {
  .key.card { height: 54px; }
  .kv { font-size: 24px; }
  .key.num { height: 46px; }
  .kl { font-size: 9.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
