/* Unterwegs - styled after karlisjonass.com: ivory canvas, slate ink, terracotta primary,
   Inter + Plus Jakarta Sans, flat shapes (8px radius, 1px borders, no shadows). Mobile first (360px up).
   Brand colours are used for fills, borders and graphics. Where a brand colour is too light for
   text on ivory/white, a darker "-ink" variant of the same hue is used for the letters. */

:root {
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;

  --bg: #FAF9F5;            /* ivory */
  --bg-2: #F1EFE6;
  --paper: #FFFFFF;
  --ink: #141413;           /* slate ink */
  --ink-soft: #66645C;
  --line: #E8E6DC;
  --line-strong: #8F8D84;

  --accent: #D97757;        /* terracotta */
  --accent-ink: #A4472A;
  --btn: #B5502F;           /* terracotta, darkened until white text reads at 4.5:1 */
  --btn-hover: #9E4528;
  --btn-ink: #FFFFFF;
  --focus: #3A6B99;

  --der: #5E92C4;  --der-ink: #3A6B99;      /* blue */
  --das: #788C5D;  --das-ink: #566A41;      /* green */
  --die: #C46686;  --die-ink: #A23F65;      /* rose */
  --pl: #8E8BB6;   --pl-ink: #6A6794;       /* heather */
  --lv0: #8F8D84; --lv1: #D97757; --lv2: #6F9488; --lv3: #B98A1F; --lv4: #8F8DB5;
  --good: #566A41; --bad: #A23F65;

  --lift: 0 8px 20px rgba(20, 20, 19, .18);   /* only while a card is being dragged */
  --radius: 8px;
  --radius-sm: 6px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"] { color-scheme: dark; }

/* the dark palette is written twice: once for the OS preference, once for the manual switch */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141413; --bg-2: #1D1C1A; --paper: #1E1D1B; --ink: #FAF9F5; --ink-soft: #B0AEA5;
    --line: #34332F; --line-strong: #78766E;
    --accent: #D97757; --accent-ink: #E8A084; --btn: #D97757; --btn-hover: #E58A6C; --btn-ink: #141413; --focus: #8DB6DD;
    --der-ink: #8DB6DD; --das-ink: #A0B684; --die-ink: #E08BAA; --pl-ink: #B9B6DA;
    --lv0: #8A887F; --lv2: #9DBDB3; --lv3: #E2BA6E; --lv4: #B3B0D6;
    --good: #A0B684; --bad: #E08BAA;
    --lift: 0 8px 20px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #141413; --bg-2: #1D1C1A; --paper: #1E1D1B; --ink: #FAF9F5; --ink-soft: #B0AEA5;
  --line: #34332F; --line-strong: #78766E;
  --accent: #D97757; --accent-ink: #E8A084; --btn: #D97757; --btn-hover: #E58A6C; --btn-ink: #141413; --focus: #8DB6DD;
  --der-ink: #8DB6DD; --das-ink: #A0B684; --die-ink: #E08BAA; --pl-ink: #B9B6DA;
  --lv0: #8A887F; --lv2: #9DBDB3; --lv3: #E2BA6E; --lv4: #B3B0D6;
  --good: #A0B684; --bad: #E08BAA;
  --lift: 0 8px 20px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--font-body); min-height: 100vh;
}
h1, h2, h3, .serif { font-family: var(--font-head); letter-spacing: -0.02em; }
h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 .3rem; line-height: 1.15; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 1.4rem 0 .6rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 0; }
p { margin: 0 0 .6rem; }
.soft { color: var(--ink-soft); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button { font: inherit; color: inherit; }

/* ---------- layout ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px;
  padding: 6px var(--gutter); background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; color: var(--ink); margin-right: auto;
  font: 700 1.1rem var(--font-head); letter-spacing: -0.02em;
}
.brand .ico { color: var(--accent); display: inline-flex; }
.brand span { white-space: nowrap; }
.brand small { font: 500 .8rem var(--font-body); color: var(--ink-soft); letter-spacing: 0; }
.icon-btn {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: var(--radius); cursor: pointer; color: var(--ink);
}
.icon-btn:hover { background: var(--bg-2); }
.icon-btn svg { width: 24px; height: 24px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button {
  min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; background: transparent;
  cursor: pointer; font-weight: 600; letter-spacing: .02em;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

main { max-width: 980px; margin: 0 auto; padding: 18px var(--gutter) 110px; }
.screen-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.screen-head h1 { margin: 0; flex: 1; }
.back { flex: none; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.grid.tight { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px;
  border: 1px solid var(--btn); border-radius: var(--radius); background: var(--btn); color: var(--btn-ink);
  font-weight: 600; text-align: center; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn:active { transform: translateY(1px); }
.btn.alt { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn.alt:hover { background: var(--bg-2); border-color: var(--line-strong); }
.btn.big { min-height: 76px; font: 700 1.25rem var(--font-head); letter-spacing: -0.02em; flex-direction: column; gap: 2px; width: 100%; }
.btn.big small { font: 400 .85rem var(--font-body); letter-spacing: 0; opacity: .9; }
.btn[disabled], .btn[aria-disabled="true"] { filter: grayscale(1); opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 160px; }

/* ---------- badges ---------- */
.stamp {
  display: inline-flex; align-items: center; justify-content: center; text-align: center; min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-ink);
  font-weight: 700; font-size: .72rem; line-height: 1; text-transform: uppercase; letter-spacing: .03em;
}
.lvl {
  --lvc: var(--lv0);
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: var(--radius-sm);
  border: 1px solid var(--lvc); color: var(--ink); font-size: .72rem; font-weight: 600; letter-spacing: .02em; background: var(--paper);
}
.lvl::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--lvc); }
.lv-0 { --lvc: var(--lv0); } .lv-1 { --lvc: var(--lv1); } .lv-2 { --lvc: var(--lv2); }
.lv-3 { --lvc: var(--lv3); } .lv-4 { --lvc: var(--lv4); }
.lvl.lv-0::before { background: transparent; border: 1.5px dashed var(--lvc); }
.lvl.lv-4::before { border-radius: 2px; transform: rotate(45deg); }

/* ---------- tiles (decks, games) ---------- */
.tile {
  position: relative; display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%;
  padding: 14px; min-height: 96px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper); cursor: pointer; transition: border-color .15s ease;
}
.tile:hover { border-color: var(--line-strong); }
.tile[aria-pressed="true"], .tile.on {
  border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--paper)); box-shadow: inset 0 0 0 1px var(--accent);
}
.tile .top { display: flex; align-items: center; gap: 10px; }
.tile .titles { min-width: 0; }
.tile .titles h3 { overflow-wrap: anywhere; }
.tile .check {
  margin-left: auto; width: 26px; height: 26px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none;
}
.tile[aria-pressed="true"] .check { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.tile.disabled { cursor: not-allowed; border-style: dashed; background: transparent; color: var(--ink-soft); }
.tile.disabled h3 { color: var(--ink-soft); }
.tile .why { font-size: .85rem; color: var(--ink-soft); }
.bar { height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; background: var(--accent); }

.callout { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--paper); }
.callout.warn { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 6px; text-align: center; }
.stat b { display: block; font: 700 1.3rem var(--font-head); letter-spacing: -0.02em; white-space: nowrap; }
.stat span { font-size: .78rem; color: var(--ink-soft); }

.hero { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; margin-bottom: 14px; }
.hero h1 { font-size: 2.1rem; }
.hero p { max-width: 36em; margin-bottom: 18px; }

.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px;
}
.actionbar .info { flex: 1; min-width: 0; font-weight: 600; }
.actionbar .btn { flex: none; }

/* ---------- flip cards ---------- */
.flipwrap { position: relative; }
.flip {
  display: block; width: 100%; aspect-ratio: 3 / 2; min-height: 130px; perspective: 900px; cursor: pointer;
  background: none; border: 0; padding: 0; text-align: center;
}
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.flip.is-flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 26px 10px 28px; border-radius: var(--radius); background: var(--paper);
  border: 2px solid var(--cardc, var(--line-strong)); overflow: hidden; overflow-y: auto;
}
.face.back { transform: rotateY(180deg); }
.face .meta { position: absolute; top: 6px; left: 8px; right: 8px; display: flex; justify-content: space-between; align-items: center; }
.face .word { font: 700 1.3rem/1.15 var(--font-head); letter-spacing: -0.02em; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.grid.tight .face .word { font-size: 1.1rem; }
.face .art { color: var(--cardt, var(--cardc)); }
.face .sub { font-size: .8rem; color: var(--ink-soft); }
.face .ex { font-size: .78rem; color: var(--ink-soft); margin-top: 4px; }
.face.back .word { font-size: 1.1rem; }
.face .word.md { font-size: 1.02rem; }
.face .word.sm { font-size: .84rem; line-height: 1.25; }
.g-der { --cardc: var(--der); --cardt: var(--der-ink); }
.g-das { --cardc: var(--das); --cardt: var(--das-ink); }
.g-die { --cardc: var(--die); --cardt: var(--die-ink); }
.g-pl { --cardc: var(--pl); --cardt: var(--pl-ink); }
.g-none { --cardc: var(--line-strong); --cardt: var(--ink); }
.flip.unseen { cursor: default; }
.flip.unseen .face { border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--ink-soft); }
.flip.unseen .word { color: var(--ink-soft); font-size: 2rem; }
.speak { position: absolute; right: 4px; bottom: 4px; z-index: 2; width: 44px; height: 44px; }
.needs-voice { display: none !important; }
body.has-voice .needs-voice { display: inline-flex !important; }
body.has-voice .no-voice-only { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .flip-inner { transition: none; }
  .flip .face.back { transform: none; opacity: 0; }
  .flip.is-flipped .face.back { opacity: 1; z-index: 1; }
  .flip.is-flipped .flip-inner { transform: none; }
  .flip.is-flipped .face.front { opacity: 0; }
}

/* ---------- results and feedback stamps ---------- */
.result-top { text-align: center; padding: 30px 0 4px; position: relative; }
.big-stamp {
  display: inline-block; font: 700 1.5rem var(--font-head); text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-ink); border: 2px solid currentColor; padding: 10px 20px; border-radius: var(--radius);
  transform: rotate(-4deg); animation: stampIn .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes stampIn { 0% { transform: scale(2.4) rotate(-20deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-4deg); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.shake { animation: shake .3s 2; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 12px; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); border-left: 6px solid var(--cardc, var(--line-strong));
}
.list .what { flex: 1 1 150px; min-width: 0; }
.lvchange { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }
.list .what b { overflow-wrap: anywhere; font-family: var(--font-head); letter-spacing: -0.02em; }
.arrow { font-weight: 700; }
.arrow.up { color: var(--good); } .arrow.down { color: var(--bad); }

.playhead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.playhead .bar { flex: 1; }
.playbox { max-width: 560px; margin: 0 auto; }
.playbox .flip { aspect-ratio: 4 / 3; }
.playbox .row { margin-top: 14px; }

/* form bits */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .lab { font-weight: 600; }
select { min-height: 44px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); color: var(--ink); font: inherit; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.switch input { width: 24px; height: 24px; accent-color: var(--btn); margin: 0 6px 0 0; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--bg);
  padding: 10px 18px; border-radius: var(--radius); font-weight: 500; max-width: 90vw; text-align: center;
}
.keys { margin: 0 0 10px; padding-left: 1.1rem; } .keys li { margin-bottom: 4px; }

/* ---------- games: shared ---------- */
.tip {
  margin: 8px 0 0; padding: 6px 10px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: var(--radius-sm); font-size: .8rem; text-align: left; color: var(--ink);
}
.face .tip { width: 100%; }
.status { min-height: 1.5em; margin: 0 0 10px; font-weight: 600; }

/* Karteikarten */
.flip.study { aspect-ratio: 4 / 3; min-height: 230px; }
.flip.study .face { padding-top: 34px; }
.flip.study .face .word { font-size: 1.7rem; }
.flip.study .face.back { justify-content: center; }
.flip.study .face .word.md { font-size: 1.25rem; }
.flip.study .face .word.sm { font-size: 1rem; }
.rate .btn { flex-direction: column; gap: 0; min-height: 56px; padding: 8px 16px; }
.rate .btn small { font-weight: 400; font-size: .75rem; opacity: .9; }

/* Sortieren */
.sortstage { min-height: 210px; display: flex; align-items: center; justify-content: center; margin: 6px 0 14px; position: relative; }
.sortcard {
  width: min(100%, 320px); padding: 34px 14px 18px; text-align: center; background: var(--paper); border: 2px solid var(--line-strong);
  border-radius: var(--radius); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; position: relative;
}
.sortcard.drag { cursor: grabbing; z-index: 5; box-shadow: var(--lift); }
.sortcard .meta { position: absolute; top: 8px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; }
.sortcard .word { font: 700 1.9rem/1.15 var(--font-head); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.sortcard .tr, .fbpanel .tr { color: var(--ink-soft); margin-top: 4px; }
.fbpanel {
  width: min(100%, 420px); text-align: center; padding: 14px 14px 16px; background: var(--paper);
  border: 2px solid var(--cardc, var(--line-strong)); border-radius: var(--radius); position: relative;
}
.fbpanel .word { font: 700 1.7rem var(--font-head); letter-spacing: -0.02em; margin-top: 10px; }
.fbpanel .art { color: var(--cardt, var(--cardc)); }
.fbpanel .speak { position: static; margin: 4px auto 0; }
.fbpanel .btn { margin-top: 10px; }
.fbpanel.bad .big-stamp { color: var(--bad); }
.fbpanel.ok .big-stamp { color: var(--good); }
.big-stamp.small {
  display: inline-block; max-width: 100%; white-space: normal; font-size: .95rem; letter-spacing: .04em; padding: 8px 12px;
  transform: rotate(-2deg); animation-name: stampInSm;
}
@keyframes stampInSm { 0% { transform: scale(2) rotate(-12deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-2deg); opacity: 1; } }
.piles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 130px; padding: 8px 4px; cursor: pointer;
  background: var(--paper); border: 2px solid var(--cardc); border-radius: var(--radius); transition: background-color .15s ease;
}
.pile .ptitle { font: 700 1.5rem var(--font-head); letter-spacing: -0.02em; color: var(--cardt, var(--cardc)); }
.pile .pcount { font: 600 .85rem var(--font-body); color: var(--ink-soft); }
.pile .chipcol { display: flex; flex-direction: column; gap: 3px; width: 100%; }
.mini { font-size: .72rem; padding: 1px 4px; border-radius: 4px; background: color-mix(in srgb, var(--cardc) 14%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.bad { text-decoration: line-through; }
.pile.hot { background: color-mix(in srgb, var(--cardc) 20%, var(--paper)); }
.pile.correct { outline: 3px solid var(--good); outline-offset: 2px; }
.pile.wrongpick { border-style: dashed; }

/* Memory */
.mgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.mtile { aspect-ratio: 3 / 4; padding: 0; border: 0; background: none; perspective: 700px; cursor: pointer; min-width: 44px; min-height: 44px; }
.mt-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .4s; transform-style: preserve-3d; }
.mtile.up .mt-inner, .mtile.done .mt-inner { transform: rotateY(180deg); }
.mt-face {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: var(--radius); overflow-wrap: break-word; hyphens: none;
}
.mt-face.cover {   /* the dotted canvas from the website */
  font: 700 1.6rem var(--font-head); color: var(--accent-ink); border: 1px solid var(--line);
  background-color: var(--bg-2); background-image: radial-gradient(var(--line-strong) 1.2px, transparent 1.2px); background-size: 14px 14px;
}
.mt-face.text { transform: rotateY(180deg); background: var(--paper); border: 2px solid var(--line-strong); font: 700 .9rem/1.15 var(--font-head); letter-spacing: -0.02em; }
.mt-face.text.s { font-size: .76rem; } .mt-face.text.xs { font-size: .64rem; }
.mt-text { display: block; max-width: 100%; }
.mtile.done .mt-face.text { border-color: var(--cardc, var(--line-strong)); background: color-mix(in srgb, var(--cardc, var(--line-strong)) 12%, var(--paper)); }
.mt-face .art, .mtile.done .art { color: var(--cardt, var(--cardc)); }
.mtile:focus-visible .mt-face { outline: 3px solid var(--focus); }
@media (min-width: 700px) { .mtile { aspect-ratio: 4 / 3; } .mt-face.text { font-size: 1.15rem; } .mt-face.text.s { font-size: 1rem; } .mt-face.text.xs { font-size: .85rem; } }

/* Artikel-Tore: a dotted canvas like the one on the website */
.arena {
  position: relative; height: 270px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px;
  background-color: var(--bg); background-image: radial-gradient(var(--line) 1.5px, transparent 1.5px); background-size: 18px 18px;
}
.arena::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); opacity: .6; }
.faller { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: center; padding-top: 4px; will-change: transform; }
.dropcard {
  width: min(70%, 230px); padding: 12px 10px 10px; text-align: center; background: var(--paper); border: 2px solid var(--cardc, var(--line-strong));
  border-radius: var(--radius); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.dropcard.drag { cursor: grabbing; z-index: 5; box-shadow: var(--lift); }
.dropcard .word { font: 700 1.5rem/1.15 var(--font-head); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.dropcard .art { color: var(--cardt, var(--cardc)); }
.dropcard .tr { color: var(--ink-soft); font-size: .9rem; }
.arena .fbpanel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-height: 96%; overflow-y: auto; }
.timebar { position: absolute; left: 8px; right: 8px; bottom: 10px; height: 8px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.timebar i { display: block; height: 100%; width: 100%; background: var(--accent); }
.gates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gate {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 76px; padding: 8px 4px; cursor: pointer;
  background: var(--paper); border: 2px solid var(--cardc); border-radius: var(--radius); transition: background-color .15s ease;
}
.gate .gtext { font: 700 1.35rem var(--font-head); letter-spacing: -0.02em; color: var(--cardt, var(--cardc)); text-align: center; overflow-wrap: anywhere; line-height: 1.1; }
.gate .gnum { position: absolute; top: 3px; left: 7px; font: 600 .7rem var(--font-body); color: var(--ink-soft); }
.gate.hot { background: color-mix(in srgb, var(--cardc) 20%, var(--paper)); }
.gate.correct { outline: 3px solid var(--good); outline-offset: 2px; }
.gate.wrongpick { border-style: dashed; }
.gates:has(.g-pl) .gtext { font-size: 1rem; }

/* Satz-Karten */
.sk-trans { font: 700 1.15rem/1.3 var(--font-head); letter-spacing: -0.02em; margin: 0 0 12px; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; justify-content: center; }
.slot {
  position: relative; min-width: 66px; min-height: 62px; padding: 20px 4px 4px; display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: color-mix(in srgb, var(--paper) 60%, transparent);
}
.slot .sn { position: absolute; top: 2px; left: 6px; font: 600 .72rem var(--font-body); color: var(--ink-soft); }
.slot .seat { position: absolute; top: 2px; right: 6px; font: 700 .62rem var(--font-body); text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); }
.slot.verbseat { border-color: var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 12%, var(--paper)); }
.slot.endseat { border-color: var(--pl); border-style: solid; }
.slot.endseat .seat { color: var(--pl-ink); }
.slot.filled { border-style: solid; }
.slot.wrong { border-color: var(--die); background: color-mix(in srgb, var(--die) 14%, var(--paper)); }
.punct { align-self: center; font: 700 1.6rem var(--font-head); }
.hand { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 56px; padding: 8px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); }
.wc {
  min-height: 44px; min-width: 44px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); cursor: grab;
  font: 600 1rem var(--font-head); letter-spacing: -0.02em; touch-action: none; user-select: none; -webkit-user-select: none;
}
.wc.drag { cursor: grabbing; z-index: 6; position: relative; box-shadow: var(--lift); }
.slot .wc { min-height: 38px; padding: 4px 8px; }
.tailbox { margin-top: 12px; }

/* Dialog-Wahl */
.chat { display: grid; gap: 8px; }
.bubble { position: relative; max-width: 90%; padding: 8px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--paper); }
.bubble.them { justify-self: start; border-top-left-radius: 2px; }
.bubble.me { justify-self: end; border-top-right-radius: 2px; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--paper)); }
.bubble .who { font: 700 .72rem var(--font-body); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.bubble .de { font: 600 1.05rem/1.3 var(--font-head); letter-spacing: -0.02em; }
.bubble .tr { font-size: .85rem; color: var(--ink-soft); }
.bubble.now { padding-right: 52px; border-color: var(--ink); }
.bubble.now .speak { right: 0; top: 0; bottom: auto; }
.choices { display: grid; gap: 8px; margin-top: 6px; }
.choice { position: relative; min-height: 56px; justify-content: center; padding-left: 34px; }
.choice .gnum { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font: 700 .85rem var(--font-body); color: var(--ink-soft); }
.choice .word { font: 600 1rem/1.25 var(--font-head); letter-spacing: -0.02em; }
.choice.right { border-color: var(--das); background: color-mix(in srgb, var(--das) 14%, var(--paper)); cursor: default; }
.choice.wrong { border-color: var(--die); background: color-mix(in srgb, var(--die) 12%, var(--paper)); cursor: default; }
.choice.dim { opacity: .55; cursor: default; }

/* Duell */
.duelbar { height: 12px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; margin: 6px 0 10px; }
.duelbar i { display: block; height: 100%; background: var(--accent); }
.duelq { text-align: center; margin-bottom: 10px; }
.duelq .word { font: 700 1.8rem/1.15 var(--font-head); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.duelq .art { color: var(--cardt, var(--cardc)); }
.duelq .tr { color: var(--ink-soft); }
.duelopts { display: grid; gap: 8px; }
.opt { position: relative; min-height: 56px; align-items: center; justify-content: center; text-align: center; padding-left: 30px; padding-right: 10px; }
.opt .gnum { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font: 700 .8rem var(--font-body); color: var(--ink-soft); }
.opt .word { font: 600 1.1rem/1.2 var(--font-head); letter-spacing: -0.02em; }
.opt.right { border-color: var(--das); background: color-mix(in srgb, var(--das) 16%, var(--paper)); }
.opt.wrong { border-color: var(--die); background: color-mix(in srgb, var(--die) 14%, var(--paper)); }
.opt[disabled] { cursor: default; }
.duelresult { text-align: center; margin-top: 10px; }
.duel.two { display: grid; gap: 8px; }
.duel.two .pane { padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--paper) 70%, transparent); }
.duel.two .pane.p1 { border-color: var(--der); border-width: 2px; } .duel.two .pane.p2 { border-color: var(--die); border-width: 2px; }
.duel.two .phead { font-size: .85rem; margin-bottom: 4px; }
.duel.two .duelq .word { font-size: 1.4rem; }
@media (pointer: coarse) { .duel.two .pane.p2 { transform: rotate(180deg); } }          /* the player across the table reads it upright */
@media (pointer: fine) and (min-width: 700px) {
  .duel.two { grid-template-columns: 1fr 1fr; }
  .duel.two .mid { grid-column: 1 / -1; order: 3; }
  .duel.two .pane.p1 { order: 1; } .duel.two .pane.p2 { order: 2; }
}
.playbox:has(.duel.two) { max-width: 760px; }

/* ---------- motion (all of it is switched off by prefers-reduced-motion below) ---------- */
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes dealIn { from { opacity: 0; transform: translateY(-16px) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes stampFlash { 0% { transform: translate(-50%, -50%) scale(2.2) rotate(-16deg); opacity: 0; } 35% { opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1) rotate(-6deg); opacity: .95; } }
main.enter { animation: screenIn .25s ease-out; }
.list li { animation: rise .3s both; animation-delay: calc(var(--i, 0) * 45ms); }
.arrow.up { display: inline-block; animation: pop .5s .35s both; }
.sortcard { animation: dealIn .28s ease-out; }
.mtile.pop { animation: pop .45s; }
.choice.right, .opt.right { animation: pop .4s; }
.choice.wrong, .opt.wrong { animation: shake .3s 2; }
.stampflash {
  position: absolute; left: 50%; top: 50%; z-index: 4; pointer-events: none; padding: 8px 18px; border: 2px solid var(--good);
  border-radius: var(--radius); color: var(--good); font: 700 1.4rem var(--font-head); text-transform: uppercase; letter-spacing: .06em;
  background: color-mix(in srgb, var(--paper) 85%, transparent); animation: stampFlash .38s cubic-bezier(.2, 1.4, .4, 1) both;
}

@media (max-width: 419px) {
  .brand small { display: none; }
  .topbar { padding-left: 10px; padding-right: 10px; gap: 2px; }
}
@media (min-width: 700px) {
  :root { --gutter: 24px; }
  .grid.tight { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .hero h1 { font-size: 2.6rem; }
  .actionbar { justify-content: center; }
  .actionbar .info { flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
