/* Vokaboom – Gestaltung
   Hell, freundlich und klar: weiche Farbverläufe im Hintergrund, große runde Karten, kräftiges Indigo
   als Hauptfarbe, jede Übung mit eigener Farbe. Wörter in Andika (gut lesbar für Kinder). */
:root {
  --bg: #F5F6FB;
  --bg-glow-1: #E3E5FF;
  --bg-glow-2: #FFE6F1;
  --bg-glow-3: #DDF7EE;
  --paper: #FFFFFF;
  --paper-2: #F7F8FC;
  --paper-back: #FFF9EC;
  --sunken: #EEF0F7;
  --sunken-2: #E3E6F0;
  --ink: #161A33;
  --ink-2: #4A5072;
  --ink-3: #7A80A0;
  --line: #E2E5EF;
  --line-2: #CDD2E2;
  --brand: #4F46E5;
  --brand-2: #7C3AED;
  --brand-ink: #3730A3;
  --brand-wash: #EEF0FF;
  --on-brand: #FFFFFF;
  --amber: #FFB703;
  --amber-wash: #FFF4D6;
  --pink: #EC4899;
  --green: #0E9F6E;
  --green-ink: #046C4E;
  --green-wash: #DEF7EC;
  --on-green: #FFFFFF;
  --red: #E02D4B;
  --red-wash: #FFE4E8;
  --orange: #E8730C;
  --orange-ink: #9C4A04;
  --orange-wash: #FFEDD8;
  --pic-bg: #F1F3FA;
  --hl-1: #FFC53D; --hl-2: #2DD4A7; --hl-3: #FF7EB3; --hl-4: #4CA8FF; --hl-5: #FF9F43; --hl-6: #9B7BFF;
  --s1: #4F46E5; --s1-wash: #EEF0FF;
  --s2: #DB2777; --s2-wash: #FDE7F1;
  --s3: #D97706; --s3-wash: #FFF2D9;
  --s4: #0891B2; --s4-wash: #DDF6FB;
  --s5: #059669; --s5-wash: #DCF7EC;
  --on-c: #FFFFFF;
  --shadow-card: 0 1px 2px rgba(22, 26, 51, .05), 0 18px 40px -22px rgba(42, 46, 110, .35);
  --shadow-soft: 0 1px 2px rgba(22, 26, 51, .05), 0 8px 22px -14px rgba(42, 46, 110, .32);
  --shadow-pop: 0 30px 70px -24px rgba(22, 26, 51, .45);
  --overlay: rgba(18, 20, 44, .42);
  --glass: rgba(255, 255, 255, .72);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Lexend", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-word: "Andika", "Lexend", "Segoe UI", system-ui, sans-serif;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", sans-serif;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --r-lg: 26px; --r-md: 18px; --r-sm: 13px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1022; --bg-glow-1: #23206A; --bg-glow-2: #3D1638; --bg-glow-3: #0C3A33;
    --paper: #181B33; --paper-2: #1E2240; --paper-back: #241F33; --sunken: #232746; --sunken-2: #2D3255;
    --ink: #EEF0FF; --ink-2: #BDC2E3; --ink-3: #8C92B8; --line: #2C3154; --line-2: #3A4068;
    --brand: #8B85FF; --brand-2: #B18CFF; --brand-ink: #C4C0FF; --brand-wash: #2A2A5C; --on-brand: #0E1022;
    --amber: #FFC53D; --amber-wash: #3A2F12; --pink: #FF7EB3;
    --green: #34D399; --green-ink: #8CF0C6; --green-wash: #10382C; --on-green: #062016;
    --red: #FF6B85; --red-wash: #45192A;
    --orange: #FFA552; --orange-ink: #FFC690; --orange-wash: #43290F;
    --pic-bg: #232746;
    --s1: #8B85FF; --s1-wash: #2A2A5C; --s2: #FF7EB3; --s2-wash: #43183A; --s3: #FFC53D; --s3-wash: #3A2F12;
    --s4: #4FD1E8; --s4-wash: #10343F; --s5: #34D399; --s5-wash: #10382C; --on-c: #0E1022;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -20px rgba(0, 0, 0, .75);
    --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px -12px rgba(0, 0, 0, .7);
    --overlay: rgba(4, 5, 16, .62);
    --glass: rgba(24, 27, 51, .72);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1022; --bg-glow-1: #23206A; --bg-glow-2: #3D1638; --bg-glow-3: #0C3A33;
  --paper: #181B33; --paper-2: #1E2240; --paper-back: #241F33; --sunken: #232746; --sunken-2: #2D3255;
  --ink: #EEF0FF; --ink-2: #BDC2E3; --ink-3: #8C92B8; --line: #2C3154; --line-2: #3A4068;
  --brand: #8B85FF; --brand-2: #B18CFF; --brand-ink: #C4C0FF; --brand-wash: #2A2A5C; --on-brand: #0E1022;
  --amber: #FFC53D; --amber-wash: #3A2F12; --pink: #FF7EB3;
  --green: #34D399; --green-ink: #8CF0C6; --green-wash: #10382C; --on-green: #062016;
  --red: #FF6B85; --red-wash: #45192A;
  --orange: #FFA552; --orange-ink: #FFC690; --orange-wash: #43290F;
  --pic-bg: #232746;
  --s1: #8B85FF; --s1-wash: #2A2A5C; --s2: #FF7EB3; --s2-wash: #43183A; --s3: #FFC53D; --s3-wash: #3A2F12;
  --s4: #4FD1E8; --s4-wash: #10343F; --s5: #34D399; --s5-wash: #10382C; --on-c: #0E1022;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -20px rgba(0, 0, 0, .75);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px -12px rgba(0, 0, 0, .7);
  --overlay: rgba(4, 5, 16, .62);
  --glass: rgba(24, 27, 51, .72);
  color-scheme: dark;
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 8% -8%, var(--bg-glow-1), transparent 62%),
    radial-gradient(760px 480px at 100% 4%, var(--bg-glow-2), transparent 60%),
    radial-gradient(820px 560px at 40% 110%, var(--bg-glow-3), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--glass);
}
body.has-modal { overflow: hidden; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.1; margin: 0; text-wrap: balance; letter-spacing: -.02em; }
p { margin: 0; }
a { color: var(--brand-ink); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 12px; }
code, kbd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .85em;
  background: var(--sunken); padding: .1em .45em; border-radius: 7px; white-space: nowrap;
}
kbd { box-shadow: inset 0 -2px 0 var(--line-2); }
mark {
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 60%, #DB2777);
  -webkit-background-clip: text; background-clip: text; color: transparent; padding: 0 .02em;
}
[hidden] { display: none !important; }
.icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.icon.big { width: 2rem; height: 2rem; }
.flag { width: 1.45em; height: auto; aspect-ratio: 2 / 1; border-radius: 4px; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .1); }
.muted { color: var(--ink-3); }
.small { font-size: .86rem; }
.center { text-align: center; }
.hint { color: var(--ink-2); font-size: .9rem; }
.warn { color: var(--orange-ink); background: var(--orange-wash); padding: .6rem .85rem; border-radius: 12px; font-size: .9rem; }
.warn-text { color: var(--red); }
.note { color: var(--ink-2); background: var(--amber-wash); padding: .85rem 1.1rem; border-radius: 16px; max-width: 34rem; margin-inline: auto; text-align: center; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row.center { justify-content: center; }
.label, .label-inline { font-weight: 600; font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.label small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.eyebrow { display: flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
hr { border: 0; border-top: 1px solid var(--line); margin: .4rem 0; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.topbar-inner { max-width: 1160px; margin: 0 auto; display: flex; align-items: center; gap: .75rem; min-height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; background: none; border: 0; padding: .3rem .2rem; color: var(--ink); border-radius: 14px; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.38rem; letter-spacing: -.03em; }
.brand-mark { display: block; width: 42px; height: 41px; flex: none; }
.brand-mark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.brand:hover .brand-mark svg g, .brand:hover .brand-mark svg circle { animation: boom .5s ease; transform-origin: 55px 19px; }
@keyframes boom { 0% { transform: scale(.6); opacity: .4; } 60% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
.brand-name .hot { background: linear-gradient(100deg, var(--brand), var(--brand-2) 55%, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.crumbs { display: flex; align-items: center; gap: .3rem; min-width: 0; flex: 1; overflow: hidden; }
.crumb { display: inline-flex; align-items: center; gap: .45rem; background: none; border: 0; padding: .35rem .6rem; border-radius: 10px; color: var(--ink-2); font-weight: 500; min-width: 0; }
.crumb span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.crumb:hover { background: var(--sunken); color: var(--ink); }
.crumb.current { color: var(--ink); white-space: nowrap; font-weight: 600; }
.crumb-sep { color: var(--line-2); }
.topbar-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
/* Suche in der Titelleiste */
.top-search { position: relative; display: flex; align-items: center; }
.top-search-form {
  display: none; align-items: center; gap: .35rem; width: clamp(220px, 24vw, 320px); height: 44px; padding: 0 .3rem 0 .85rem;
  border-radius: 99px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-3);
  transition: border-color .15s, box-shadow .15s;
}
.top-search-form:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.top-search-form input[type="search"] { flex: 1; min-width: 0; height: 40px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: .95rem; }
.top-search-form input[type="search"]:focus { box-shadow: none; }
.top-search .search-close { display: none; width: 34px; height: 34px; }
.top-search-form input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.pub-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 40;
  width: min(420px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow: auto; display: grid; gap: .5rem;
  padding: 10px; border-radius: 20px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
}
.pub-pop[hidden] { display: none; }
.pub-head { font-size: .78rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding: .2rem .4rem 0; }
.pub-empty { display: grid; gap: .3rem; padding: .6rem .5rem; color: var(--ink-2); font-size: .92rem; }
.pub-empty small { color: var(--ink-3); }
@media (min-width: 860px) { .top-search-form { display: flex; } .top-search .search-toggle { display: none; } }
@media (max-width: 859px) {
  .topbar.searching .top-search { position: absolute; inset: 0; z-index: 30; padding: 10px var(--gutter-r) 10px var(--gutter-l); background: var(--paper); }
  .topbar.searching .top-search-form { display: flex; width: 100%; }
  .topbar.searching .top-search .search-toggle { display: none; }
  .topbar.searching .top-search .search-close { display: inline-grid; }
  .pub-pop { left: var(--gutter-l); right: var(--gutter-r); width: auto; }
}
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 14px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2);
}
.icon-btn:hover { color: var(--ink); background: var(--paper-2); }
.icon-btn.subtle { background: transparent; border-color: transparent; color: var(--ink-3); }
.icon-btn.subtle:hover { background: var(--red-wash); color: var(--red); }
.account-btn {
  position: relative; display: inline-flex; align-items: center; gap: .45rem; min-height: 44px; max-width: 40vw;
  padding: .35rem .9rem .35rem .7rem; border-radius: 99px; border: 1px solid var(--line); background: var(--paper);
  font-weight: 600; color: var(--ink-2);
}
.account-btn:hover { color: var(--ink); border-color: var(--line-2); }
.account-btn:not(.in) { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: var(--on-brand); border-color: transparent; box-shadow: 0 8px 18px -10px var(--brand); }
.account-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--green); box-shadow: 0 0 0 3px var(--green-wash); }
.sync-dot.syncing { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-wash); animation: blink 1s ease-in-out infinite; }
.sync-dot.error { background: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
@keyframes blink { 50% { opacity: .35; } }

.view {
  max-width: 1160px; margin: 0 auto;
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
  padding-block: 32px 72px;
  outline: none;
}

/* ---------- Knöpfe ---------- */
.btn {
  --bg: var(--paper); --fg: var(--ink); --bd: var(--line-2); --sh: 0 1px 2px rgba(22, 26, 51, .06);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .55rem 1.15rem;
  border-radius: 14px; border: 1px solid var(--bd); background: var(--bg); color: var(--fg);
  font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none;
  box-shadow: var(--sh);
  transition: transform .1s ease, box-shadow .15s ease, filter .15s ease, background-color .15s ease;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { --bg: linear-gradient(135deg, var(--brand), var(--brand-2)); --fg: var(--on-brand); --bd: transparent; --sh: 0 10px 22px -12px var(--brand); background: var(--bg); }
.btn.secondary { --bg: var(--brand-wash); --fg: var(--brand-ink); --bd: transparent; --sh: none; }
.btn.ghost { --bg: var(--paper); --fg: var(--ink-2); --bd: var(--line); }
.btn.ok { --bg: var(--green); --fg: var(--on-green); --bd: transparent; --sh: 0 10px 22px -12px var(--green); }
.btn.again { --bg: var(--orange-wash); --fg: var(--orange-ink); --bd: transparent; --sh: none; }
.btn.danger { --bg: var(--red); --fg: #fff; --bd: transparent; }
.btn.danger-ghost { --bg: transparent; --fg: var(--red); --bd: var(--red-wash); --sh: none; }
.btn.big { min-height: 56px; padding: .7rem 1.6rem; font-size: 1.06rem; border-radius: 18px; }
.btn.small { min-height: 38px; padding: .35rem .85rem; font-size: .88rem; border-radius: 12px; }
.btn.round { width: 88px; height: 88px; border-radius: 50%; padding: 0; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 4px; background: var(--sunken); border-radius: 16px; }
.seg-btn {
  display: inline-flex; align-items: center; gap: .45rem;
  min-height: 40px; padding: .4rem .95rem; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-2); font-weight: 500;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn[aria-pressed="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-soft); }
.seg.small .seg-btn { min-height: 34px; padding: .28rem .75rem; font-size: .9rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 34px; padding: .3rem .8rem; border-radius: 99px; border: 1px solid var(--line); background: var(--paper); color: var(--ink-2); font-size: .88rem; font-weight: 500; }
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

input[type="text"], input[type="search"], input[type="url"], input[type="password"], input[type="email"], textarea, select {
  width: 100%; border: 1.5px solid var(--line-2); border-radius: 14px; background: var(--paper);
  padding: .6rem .85rem; min-height: 46px; color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.field { display: grid; gap: .4rem; }

/* ---------- Startseite ---------- */
.home-intro { max-width: 50rem; margin: .4rem 0 2rem; display: grid; gap: .8rem; }
.home-intro { max-width: 56rem; }
.home-intro h1 { font-size: clamp(1.9rem, 4.6vw, 3.2rem); line-height: 1.12; }
.boom { position: relative; display: inline-block; padding-right: .36em; letter-spacing: .01em; cursor: pointer; -webkit-user-select: none; user-select: none; }
.boom-l {
  display: inline-block; color: transparent;
  background: linear-gradient(100deg, var(--brand), var(--brand-2) 55%, var(--pink)) calc(var(--i) * 33.33%) 0 / 400% 100%;
  -webkit-background-clip: text; background-clip: text;
}
.boom-sparks { position: absolute; left: 42%; top: 50%; width: 0; height: 0; pointer-events: none; }
.boom-spark { position: absolute; left: -.1em; top: -.1em; width: .2em; height: .2em; border-radius: 50%; background: var(--c); opacity: 0; }
.boom.explode .boom-l { animation: boom-letter 1.1s cubic-bezier(.2, .8, .25, 1) both; animation-delay: calc(var(--i) * 25ms); }
.boom.explode .boom-spark { animation: boom-spark .8s ease-out both; }
.boom.explode .boom-burst { animation: boom-big 1.1s ease both; }
@keyframes boom-letter {
  0% { transform: none; opacity: 1; }
  10% { transform: scale(1.2); opacity: 1; }
  34% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(.85); opacity: 1; }
  50% { transform: translate(calc(var(--dx) * 1.35), calc(var(--dy) * 1.35)) rotate(calc(var(--r) * 1.6)) scale(.45); opacity: 0; }
  62% { transform: scale(.3); opacity: 0; }
  84% { transform: scale(1.15); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes boom-spark {
  0% { transform: translate(0, 0) scale(1.4); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) scale(.3); opacity: 0; }
}
@keyframes boom-big {
  0% { transform: none; }
  25% { transform: scale(2.2) rotate(18deg); }
  55% { transform: scale(.4); opacity: .3; }
  100% { transform: none; opacity: 1; }
}
.boom-burst { position: absolute; right: -.04em; top: -.02em; width: .46em; height: auto; overflow: visible; transform-origin: 10% 90%; }
@media (prefers-reduced-motion: no-preference) { .boom-burst { animation: boom-in .7s .3s ease both; transform-origin: 10% 90%; } }
@keyframes boom-in { 0% { transform: scale(.2) rotate(-20deg); opacity: 0; } 60% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); } }
.home-intro .lead { font-size: 1.12rem; color: var(--ink-2); max-width: 38rem; }
.home-grid { display: grid; gap: 22px; align-items: start; }
@media (min-width: 940px) { .home-grid { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); } }
.panel { background: var(--paper); border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); border-radius: var(--r-lg); padding: clamp(18px, 3vw, 30px); box-shadow: var(--shadow-card); min-width: 0; }
.panel h2 { font-size: 1.5rem; }
.new-set { display: grid; gap: 1.1rem; }
#vocab-input {
  line-height: 1.85; padding: .7rem 1rem; min-height: 15.5rem; resize: vertical;
  font-family: var(--font-word); font-size: 1.08rem; background: var(--paper-2);
}
.parse-preview:empty { display: none; }
.parse-preview { display: grid; gap: .6rem; }
.preview-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.preview-table { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 16px; font-family: var(--font-word); }
.pt-row { display: grid; grid-template-columns: 1fr 1fr; }
.pt-row span { padding: .4rem .8rem; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.pt-row span + span { border-left: 1px solid var(--line); }
.pt-row:last-child span { border-bottom: 0; }
.pt-head span { position: sticky; top: 0; background: var(--sunken); font-family: var(--font-body); font-weight: 600; font-size: .8rem; display: flex; align-items: center; gap: .4rem; }
.pt-row .missing { color: var(--orange); font-style: italic; }

.library { display: grid; gap: 1rem; }
.lib-list, .examples { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.lib-item { display: flex; align-items: center; gap: .3rem; border-radius: 18px; background: var(--paper-2); border: 1px solid var(--line); padding: 4px; transition: border-color .15s; }
.lib-item:hover { border-color: var(--line-2); }
.lib-item.confirm { padding: .65rem .85rem; flex-wrap: wrap; background: var(--red-wash); border-color: transparent; }
.lib-confirm { display: flex; gap: .4rem; margin-left: auto; }
.lib-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: .85rem; background: none; border: 0; text-align: left; padding: .5rem .55rem; border-radius: 14px; }
.lib-pics { display: flex; flex: none; }
.lib-pics .pic { width: 36px; border-radius: 11px; box-shadow: 0 0 0 2px var(--paper-2); }
.lib-pics .pic + .pic { margin-left: -12px; }
.lib-text { display: grid; min-width: 0; }
.lib-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lib-text small { display: flex; align-items: center; gap: .35rem; color: var(--ink-3); flex-wrap: wrap; }
.lib-sub { display: flex; align-items: center; gap: .45rem; font-size: 1.05rem; margin-top: .4rem; }
.lib-sub .icon { color: var(--brand); }
.pub-preview { max-height: 52vh; }
.pub-box { display: grid; gap: .5rem; width: 100%; text-align: left; padding: 1rem; border-radius: 18px; background: var(--paper-2); border: 1px solid var(--line); }
.lib-note { display: flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--green-ink); background: var(--green-wash); padding: .5rem .8rem; border-radius: 12px; }
.lib-note.bad { color: var(--red); background: var(--red-wash); }
.example {
  width: 100%; display: flex; align-items: center; gap: .8rem; text-align: left;
  border: 1.5px dashed var(--line-2); background: transparent; border-radius: 18px; padding: .65rem .85rem;
}
.example:hover { border-color: var(--brand); background: var(--brand-wash); }
.example span { display: grid; }
.example small { color: var(--ink-3); }
.empty { color: var(--ink-3); }

/* ---------- Bilder ---------- */
.pic {
  container-type: inline-size;
  position: relative; display: grid; place-items: center;
  width: 100%; aspect-ratio: 1; max-width: 100%;
  border-radius: 16px; overflow: hidden; background: var(--pic-bg);
}
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic-picto { background: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(22, 26, 51, .06); }
.pic-picto img { object-fit: contain; padding: 7%; }
.pic-emoji span { font-family: var(--font-emoji); font-size: 3rem; font-size: 60cqi; line-height: 1; }
.pic-color span { width: 66%; aspect-ratio: 1; border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%; background: var(--swatch); box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .12), 0 0 0 3px var(--paper); }
.pic-number span { font-family: var(--font-display); font-weight: 800; color: var(--brand); font-size: 3rem; font-size: 52cqi; line-height: 1; }
.pic-none { background: linear-gradient(135deg, var(--sunken), var(--pic-bg)); }
.pic-none span { font-family: var(--font-display); font-weight: 800; color: var(--ink-3); font-size: 2rem; font-size: 40cqi; opacity: .7; }
.pic-loading { background: linear-gradient(100deg, var(--pic-bg) 30%, var(--paper) 50%, var(--pic-bg) 70%) 0 0 / 300% 100%; animation: shimmer 1.3s linear infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
.pic.mini { width: 44px; border-radius: 11px; }

/* ---------- Portionsübersicht ---------- */
.set-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; }
.set-title-wrap { min-width: 0; display: grid; gap: .35rem; }
.set-title { font-size: clamp(2rem, 5.4vw, 3.2rem); overflow-wrap: anywhere; }
.set-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.path { list-style: none; margin: 0 0 2.6rem; padding: 0; display: grid; gap: 14px; counter-reset: step; }
@media (min-width: 720px) { .path { grid-template-columns: repeat(2, minmax(0, 1fr)); } .path .step-5 { grid-column: 1 / -1; } }
@media (min-width: 1080px) { .path { grid-template-columns: repeat(5, minmax(0, 1fr)); } .path .step-5 { grid-column: auto; } }
.step {
  --c: var(--s1); --cw: var(--s1-wash);
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .35rem 1rem; align-content: start;
  background: var(--paper); border: 1px solid color-mix(in srgb, var(--line) 60%, transparent); border-radius: 24px;
  padding: 18px; box-shadow: var(--shadow-soft); overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.step::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); opacity: .9; }
.step:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.step-2 { --c: var(--s2); --cw: var(--s2-wash); }
.step-3 { --c: var(--s3); --cw: var(--s3-wash); }
.step-4 { --c: var(--s4); --cw: var(--s4-wash); }
.step-5 { --c: var(--s5); --cw: var(--s5-wash); }
.step-no {
  position: relative; grid-row: span 2; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px;
  background: var(--cw); color: var(--c);
}
.step-no .icon { width: 27px; height: 27px; }
.step-no b {
  position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--c); color: var(--on-c); font-family: var(--font-display); font-size: .75rem; box-shadow: 0 0 0 3px var(--paper);
}
.step.done .step-no b { font-size: 0; }
.step.done .step-no b::after { content: "✓"; font-size: .8rem; }
.step-body h3 { font-size: 1.22rem; }
.step-body p { color: var(--ink-2); font-size: .94rem; }
.step-body .step-progress { margin-top: .35rem; font-size: .84rem; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.step-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.step .btn.primary { --bg: var(--c); --fg: var(--on-c); --sh: 0 10px 20px -12px var(--c); background: var(--c); color: var(--on-c); }
.step .btn.secondary { --bg: var(--cw); --fg: var(--ink); }
/* Alle Knöpfe im Lernweg gleich groß und einzeilig */
.step-actions { display: grid; }
.step-actions .btn { width: 100%; min-height: 48px; white-space: nowrap; padding-inline: .8rem; }
@media (min-width: 1080px) {
  .step-actions .btn { font-size: .94rem; padding-inline: .6rem; }
  .step { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; padding: 20px 18px 18px; }
  .step-no { grid-row: auto; }
  .step-actions { grid-column: 1; flex-direction: column; align-self: end; margin-top: .9rem; }
  .step-actions .btn { width: 100%; }
}
.stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.star { width: 1.05em; height: 1.05em; fill: var(--sunken-2); stroke: none; }
.star.on { fill: var(--amber); }
.result .stars .star { width: 52px; height: 52px; filter: drop-shadow(0 6px 10px rgba(255, 183, 3, .35)); }

.deck-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; }
.deck-head h2 { font-size: 1.65rem; }
.deck-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.pic-status { margin: .7rem 0 1.1rem; color: var(--ink-2); font-size: .92rem; display: flex; align-items: center; gap: .5rem; min-height: 1.5em; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; }
.deck-card {
  position: relative; display: grid; gap: 0; text-align: left; padding: 9px; border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  background: var(--paper); border-radius: 22px; box-shadow: var(--shadow-soft); color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease;
}
.deck-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.deck-card .pic { border-radius: 15px; }
.deck-words { display: grid; padding: .6rem .35rem .3rem; min-width: 0; line-height: 1.35; }
.deck-words strong { font-family: var(--font-word); font-size: 1.1rem; overflow-wrap: anywhere; }
.deck-words small { color: var(--ink-3); font-size: .9rem; overflow-wrap: anywhere; }
.deck-edit {
  position: absolute; top: 16px; right: 16px; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 11px; background: var(--glass); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--ink-2); box-shadow: var(--shadow-soft); opacity: 0; transition: opacity .15s;
}
.deck-card:hover .deck-edit, .deck-card:focus-visible .deck-edit { opacity: 1; }
@media (hover: none) { .deck-edit { opacity: .9; } }

.spinner { display: inline-block; width: 1em; height: 1em; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--brand); animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Übungen: gemeinsame Teile ---------- */
.mode { display: grid; gap: 14px; }
.mode-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.2rem; }
.mode-title { font-size: clamp(1.8rem, 4.4vw, 2.5rem); }
.mode-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.progress { height: 10px; border-radius: 99px; background: var(--sunken-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .35s ease; min-width: 10px; }
.progress-label { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; color: var(--ink-2); font-weight: 500; font-size: .94rem; margin-top: -4px; }
.tally { display: inline-flex; gap: .8rem; }
.tally b { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; }
.tally .ok { color: var(--green); }
.tally .again { color: var(--orange); }
.tally .bad { color: var(--red); }
.mode-hint { text-align: center; color: var(--ink-3); font-size: .9rem; }
@media (hover: none) { .mode-hint.keys { display: none; } }
.say {
  display: inline-grid; place-items: center; width: 46px; height: 46px; flex: none;
  border-radius: 50%; border: 0; background: var(--brand-wash); color: var(--brand-ink);
  transition: background-color .15s, color .15s, transform .1s;
}
.say:hover { background: var(--brand); color: var(--on-brand); }
.say:active { transform: scale(.94); }
.cw-line { display: flex; align-items: center; justify-content: center; gap: .6rem; flex-wrap: wrap; }
.cw-foreign { font-family: var(--font-word); font-weight: 700; font-size: 1.5rem; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.cw-german { font-family: var(--font-word); color: var(--ink-2); font-size: 1.15rem; text-align: center; overflow-wrap: anywhere; }
.cw-foreign.xl, .cw-german.xl { font-size: clamp(1.8rem, 7vw, 2.7rem); color: var(--ink); font-weight: 700; }
.face-label { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

.result { display: grid; justify-items: center; gap: .9rem; text-align: center; background: var(--paper); border-radius: 28px; padding: clamp(24px, 5vw, 46px) clamp(16px, 4vw, 34px); box-shadow: var(--shadow-card); }
.result h2 { font-size: clamp(1.7rem, 4.2vw, 2.3rem); }
.result-line { color: var(--ink-2); font-size: 1.06rem; max-width: 36rem; }

.banner { display: flex; align-items: flex-start; gap: .8rem; padding: .9rem 1.15rem; border-radius: 18px; text-align: left; max-width: 36rem; width: 100%; margin-inline: auto; animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.banner > .icon { width: 2.1rem; height: 2.1rem; padding: .35rem; border-radius: 50%; color: #fff; stroke-width: 3; }
.banner.good { background: var(--green-wash); color: var(--green-ink); }
.banner.good > .icon { background: var(--green); }
.banner.bad { background: var(--red-wash); color: var(--ink); }
.banner.bad > .icon { background: var(--red); }
.banner.almost { background: var(--orange-wash); color: var(--ink); }
.banner.almost > .icon { background: var(--orange); }
.banner strong { font-weight: 600; }
.banner .solution { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.banner .solution strong { font-family: var(--font-word); font-weight: 700; font-size: 1.15em; }
.banner .say { width: 38px; height: 38px; }

/* ---------- 1 · Lernkarten ---------- */
.stage { perspective: 1400px; display: grid; justify-items: center; padding-block: 6px; }
.flash { width: min(100%, 440px); aspect-ratio: 5 / 6; max-height: 64vh; container-type: inline-size; cursor: pointer; border-radius: 28px; }
.stage .flash { min-height: 340px; }
.flash-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.2, .8, .25, 1); }
.flash.is-flipped .flash-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem;
  padding: 3.2rem 1.4rem 1.6rem; border-radius: 28px; overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background: var(--paper);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  box-shadow: var(--shadow-card);
}
.face::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--brand), var(--brand-2), #DB2777); }
.face.back { transform: rotateY(180deg); background: var(--paper-back); }
.face.back::before { background: linear-gradient(90deg, var(--amber), #FF7E5F); }
.face .face-label { position: absolute; top: 1.05rem; left: 1.3rem; right: 1.3rem; text-align: left; }
.face .card-pic { width: 62%; max-width: 280px; border-radius: 22px; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .35); }
.face .card-pic.small { width: 36%; }
.face .cw-foreign.xl, .face .cw-german.xl { font-size: clamp(1.4rem, 9.5cqi, 2.7rem); }
.face .cw-foreign { font-size: clamp(1.15rem, 7cqi, 1.9rem); }
.face .cw-german { font-size: clamp(1rem, 5.5cqi, 1.4rem); }
.card-actions { display: flex; justify-content: center; gap: .8rem; flex-wrap: wrap; }
.cards-mode { overflow-x: clip; }
.card-howto { text-align: center; color: var(--ink-2); font-size: .92rem; text-wrap: balance; }
.card-howto b { font-weight: 600; white-space: nowrap; }
.card-howto b.ok { color: var(--green); }
.card-howto b.again { color: var(--orange); }
.flash.swipeable { position: relative; touch-action: pan-y; user-select: none; -webkit-user-select: none; transition: transform .25s cubic-bezier(.2, .8, .25, 1), opacity .23s ease; animation: card-in .25s ease; }
.flash.swipeable.dragging { transition: none; cursor: grabbing; }
@keyframes card-in { from { transform: scale(.94); opacity: 0; } }
.swipe-tint {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: start center; padding-top: 14%; border-radius: 28px; pointer-events: none;
  color: #fff; font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 9cqi, 2.4rem);
  opacity: 0; transition: opacity .08s;
}
.swipe-tint span { display: inline-flex; align-items: center; gap: .5rem; }
.swipe-tint .icon { width: 1.1em; height: 1.1em; stroke-width: 3; }
.swipe-tint.ok { background: #0E9F6E; }
.swipe-tint.again { background: #E8730C; }
.card-actions .btn { min-width: 160px; }
.flash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 16px; perspective: 1600px; }
.flash.mini { width: 100%; max-height: none; aspect-ratio: 3 / 4; border-radius: 22px; }
.flash.mini .face { padding: 2.3rem .8rem 1rem; gap: .5rem; border-radius: 22px; }
.flash.mini .face-label { top: .7rem; left: .9rem; font-size: .62rem; }
.flash.mini .say { width: 36px; height: 36px; }
.flash.mini .card-pic { width: 70%; }

/* ---------- 2 · Zuordnen (Memory) ---------- */
.mem-hint { margin-top: -4px; }
.mem-grid {
  --cols: 4;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: clamp(8px, 1.6vw, 14px);
  width: 100%; max-width: 760px; margin: 2px auto 0; perspective: 1200px;
}
.mem {
  position: relative; aspect-ratio: 1; padding: 0; border: 0; background: none; border-radius: 20px;
  container-type: inline-size; touch-action: manipulation; transition: transform .15s ease, opacity .3s ease;
}
.mem-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2, .8, .25, 1); }
.mem-face {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 8%; border-radius: 20px; overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background: var(--paper); border: 2px solid var(--line); box-shadow: var(--shadow-soft);
}
.mem.is-pic .mem-face { padding: 6%; }
.mem-pic { width: 100%; height: 100%; aspect-ratio: auto; border-radius: 14px; }
.mem-word { font-family: var(--font-word); font-weight: 700; color: var(--ink); text-align: center; line-height: 1.15; overflow-wrap: anywhere; font-size: clamp(.95rem, 13cqi, 1.6rem); }
.mem-word.de { color: var(--ink-2); }
.mem:hover:not(:disabled) .mem-face { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.mem.selected .mem-face { border-color: var(--brand); background: var(--brand-wash); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent), var(--shadow-soft); }
.mem.selected { transform: translateY(-3px); }
.mem.wrong .mem-face { border-color: var(--red); background: var(--red-wash); }
.mem.wrong { animation: shake .45s ease; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.mem.matched .mem-face { border-color: var(--green); background: var(--green-wash); }
.mem.matched { animation: pop-out .42s ease forwards; }
@keyframes pop-out { 0% { transform: scale(1); } 35% { transform: scale(1.08); } 100% { transform: scale(.4); opacity: 0; } }
.mem.gone { visibility: hidden; }
/* verdeckt */
.mem-grid.covered .mem:not(.open) .mem-inner { transform: rotateY(180deg); }
.mem-grid.covered .mem-front { transform: rotateY(0deg); }
.mem-back { transform: rotateY(180deg); background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; }
.mem-mark { font-family: var(--font-display); font-weight: 800; color: rgba(255, 255, 255, .9); font-size: clamp(1.4rem, 34cqi, 3rem); line-height: 1; }
.mem-back::after { content: ""; position: absolute; inset: 8px; border-radius: 14px; border: 2px dashed rgba(255, 255, 255, .28); }
.mem-clock { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mem-clock.big { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-display); font-weight: 800; font-size: 2rem; color: var(--ink); }
.mem-final { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem 1rem; }
.best-badge { background: var(--amber); color: #161A33; font-weight: 700; padding: .25rem .8rem; border-radius: 99px; }
.choose-mode { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .8rem; }
@media (max-width: 560px) {
  .mem-grid { --cols: 3 !important; }
  .mem, .mem-face { border-radius: 16px; }
  .match-mode { gap: 10px; }
  .match-mode .mode-bar { gap: .5rem; }
  .match-mode .mode-title { font-size: 1.5rem; }
  .match-mode .mode-controls { gap: .4rem; }
  .match-mode .seg.small .seg-btn { min-height: 32px; padding: .22rem .6rem; font-size: .84rem; }
  .match-mode .mem-hint { font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) { .mem.matched { animation: none; opacity: 0; } }

/* ---------- 3 · Aussprechen ---------- */
.speak-card {
  position: relative; display: grid; justify-items: center; gap: .8rem; text-align: center;
  width: min(100%, 520px); margin: 0 auto; padding: 2.4rem 1.4rem 1.8rem; border-radius: 28px; overflow: hidden;
  background: var(--paper); box-shadow: var(--shadow-card);
}
.speak-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--s3), #FF7E5F); }
.speak-card .card-pic { width: min(56%, 240px); border-radius: 22px; }
.hidden-word { color: var(--ink-3) !important; letter-spacing: .2em; }
.speak-zone { display: grid; justify-items: center; gap: .9rem; min-height: 200px; padding-top: .4rem; }
.mic {
  display: grid; place-items: center; width: 112px; height: 112px; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  box-shadow: 0 18px 36px -14px var(--brand), inset 0 -4px 0 rgba(0, 0, 0, .12);
  transition: transform .1s ease;
}
.mic .icon { width: 46px; height: 46px; }
.mic:hover { transform: translateY(-2px); }
.mic:active { transform: scale(.96); }
.mic.listening { background: linear-gradient(135deg, var(--red), #FF7E5F); animation: pulse 1.3s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--red) 55%, transparent); } 100% { box-shadow: 0 0 0 30px transparent; } }
.mic.starting { background: var(--ink-3); box-shadow: none; }
.mic-label { font-weight: 600; color: var(--ink-2); }
.mic-level { --lv: 0; width: min(240px, 80%); height: 10px; border-radius: 99px; background: var(--sunken-2); overflow: hidden; }
.mic-level span { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #A3E635); transform-origin: left; transform: scaleX(var(--lv)); transition: transform .06s linear; }
.mic-level.big { width: 100%; height: 14px; }
.help-line { display: block; margin-top: .4rem; font-size: .9rem; color: var(--ink-2); }
.ph-box { padding: 1rem; border-radius: 18px; background: var(--paper-2); border: 1px solid var(--line); display: grid; gap: .6rem; }
.ph-wait { display: grid; justify-items: center; gap: .6rem; width: min(100%, 420px); text-align: center; }
.ph-progress { width: 100%; height: 10px; border-radius: 99px; background: var(--sunken-2); overflow: hidden; }
.ph-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; transition: width .2s; }
.heard-live { min-height: 1.6em; font-family: var(--font-word); font-size: 1.25rem; font-weight: 700; color: var(--brand-ink); }
.err-code { display: block; margin-top: .3rem; font-size: .78rem; color: var(--ink-3); }
.word-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.word-chips li { display: inline-flex; align-items: center; gap: .4rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: 99px; padding: .25rem .3rem .25rem .95rem; font-family: var(--font-word); font-weight: 700; }
.word-chips .say { width: 34px; height: 34px; }

/* ---------- 4 · Hören & Schreiben, 5 · Test ---------- */
.test-card {
  position: relative; display: grid; gap: 1.1rem; justify-items: center; text-align: center; overflow: hidden;
  width: min(100%, 640px); margin: 0 auto; padding: clamp(22px, 4vw, 36px); border-radius: 28px;
  background: var(--paper); box-shadow: var(--shadow-card);
}
.test-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--s5), #A3E635); }
.dict-card::before { background: linear-gradient(90deg, var(--s4), #60A5FA); }
.test-card.setup { justify-items: stretch; text-align: left; }
.test-card.setup h2 { font-size: 1.9rem; }
.test-card .lead { color: var(--ink-2); }
.types { border: 0; padding: 0; margin: 0; display: grid; gap: .55rem; }
.types legend { margin-bottom: .5rem; }
.type-chip { display: flex; align-items: center; gap: .7rem; padding: .75rem .95rem; border-radius: 16px; border: 1.5px solid var(--line); cursor: pointer; font-weight: 500; }
.type-chip span { display: inline-flex; align-items: center; gap: .5rem; }
.type-chip input { width: 22px; height: 22px; accent-color: var(--brand); }
.type-chip:has(input:checked) { border-color: var(--brand); background: var(--brand-wash); }
.type-chip.disabled { opacity: .45; cursor: not-allowed; }
.choose-card { width: min(100%, 760px); }
.choose-card::before { background: linear-gradient(90deg, var(--s2), #FF7EB3); }
.choose-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.choose-tile {
  display: grid; gap: .55rem; justify-items: start; text-align: left; padding: 16px; border-radius: 22px;
  border: 1.5px solid var(--line); background: var(--paper-2); color: var(--ink);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.choose-tile:hover:not(:disabled) { border-color: var(--s2); transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.choose-tile:disabled { opacity: .5; cursor: not-allowed; }
.choose-tile strong { display: inline-flex; align-items: center; gap: .45rem; font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }
.choose-tile strong .icon { color: var(--s2); }
.choose-tile small { color: var(--ink-2); font-size: .9rem; }
.choose-demo { display: grid; gap: 8px; width: 100%; padding: 12px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.cd-row { display: grid; grid-template-columns: auto minmax(18px, 1fr) auto; align-items: center; gap: 8px; min-height: 44px; }
.cd-row b { font-family: var(--font-word); font-weight: 700; padding: .25rem .6rem; border-radius: 10px; border: 2px solid var(--line); background: var(--paper-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11rem; }
.cd-row i { height: 3px; border-radius: 3px; background: var(--s2); opacity: .7; }
.cd-row:nth-child(2) i { background: var(--hl-2); }
.cd-row .pic.mini { width: 44px; }
.q-kind { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--ink-2); background: var(--sunken); padding: .4rem .95rem; border-radius: 99px; }
.q-prompt { width: 100%; display: grid; justify-items: center; min-height: 90px; align-content: center; }
.q-prompt .card-pic { width: min(52%, 230px); border-radius: 22px; }
.listen-prompt { display: grid; justify-items: center; gap: .6rem; }
.dict-hint { min-height: 2.4rem; display: grid; place-items: center; }
.answer-form { display: flex; gap: .6rem; width: 100%; max-width: 30rem; }
.answer-form input { font-family: var(--font-word); font-size: 1.45rem; font-weight: 700; text-align: center; min-height: 60px; letter-spacing: .01em; border-radius: 18px; }
.answer-form .btn { min-height: 60px; border-radius: 18px; }
.answer-form input.correct { border-color: var(--green); background: var(--green-wash); }
.answer-form input.almost { border-color: var(--orange); background: var(--orange-wash); }
.answer-form input.wrong { border-color: var(--red); background: var(--red-wash); text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.answer-form input.nudge { animation: shake .4s ease; border-color: var(--orange); }
@media (max-width: 460px) { .answer-form { flex-direction: column; } }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: .6rem; width: 100%; }
.choice { display: flex; align-items: center; gap: .7rem; text-align: left; padding: .8rem 1rem; min-height: 60px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--paper-2); font-family: var(--font-word); font-weight: 700; font-size: 1.1rem; transition: border-color .12s, background-color .12s; }
.choice:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-wash); }
.choice kbd { background: var(--paper); font-family: var(--font-body); }
.choice.correct { border-color: var(--green); background: var(--green-wash); }
.choice.wrong { border-color: var(--red); background: var(--red-wash); }
.choice:disabled { cursor: default; }
.feedback { width: 100%; display: grid; gap: .8rem; }
.feedback:empty { display: none; }

.test-result { display: grid; justify-items: center; gap: 1rem; text-align: center; background: var(--paper); border-radius: 28px; padding: clamp(22px, 5vw, 42px) clamp(14px, 4vw, 34px); box-shadow: var(--shadow-card); }
.test-result h2 { font-size: clamp(1.7rem, 4.2vw, 2.3rem); }
.score-ring { position: relative; width: 156px; height: 156px; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--sunken-2); stroke-width: 12; }
.ring-fg { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dasharray .8s ease; }
.ring-fg.good { stroke: var(--green); } .ring-fg.mid { stroke: var(--amber); } .ring-fg.low { stroke: var(--red); }
.score-num { position: absolute; inset: 0; display: grid; grid-auto-flow: column; justify-content: center; align-items: center; font-family: var(--font-display); font-weight: 800; font-size: 2.7rem; font-variant-numeric: tabular-nums; }
.score-num small { font-size: .5em; margin-left: .1em; }
.review { list-style: none; margin: .6rem 0 0; padding: 0; width: 100%; max-width: 40rem; display: grid; gap: 6px; text-align: left; }
.rv { display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, 1.3fr); align-items: center; gap: .8rem; padding: .5rem .75rem; border-radius: 14px; background: var(--paper-2); border: 1px solid var(--line); }
.rv-status { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; }
.rv-status .icon { width: 18px; height: 18px; stroke-width: 3; }
.rv.correct .rv-status { background: var(--green); }
.rv.almost .rv-status { background: var(--orange); }
.rv.wrong .rv-status { background: var(--red); }
.rv-prompt { display: flex; align-items: center; gap: .4rem; min-width: 0; overflow-wrap: anywhere; color: var(--ink-2); font-family: var(--font-word); }
.rv-prompt .pic.mini { width: 40px; }
.rv-answer { overflow-wrap: anywhere; font-family: var(--font-word); }
.rv-answer s { color: var(--red); text-decoration-thickness: 2px; margin-right: .3rem; }
.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .86rem; color: var(--ink-3); font-family: var(--font-body); }

/* ---------- Dialoge ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  padding: max(16px, env(safe-area-inset-top, 0px)) var(--gutter-r) max(16px, env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: min(100%, 520px); max-height: 100%; overflow: auto; display: grid; gap: 1rem;
  background: var(--paper); border-radius: 28px; padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow-pop);
  animation: rise .2s ease;
}
@keyframes rise { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal.wide { width: min(100%, 800px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.modal-head h2 { font-size: 1.55rem; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; padding-top: .3rem; }
.edit-form { display: grid; gap: 1rem; }
.edit-table { display: grid; gap: 6px; }
.edit-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
#edit-rows { display: grid; gap: 6px; max-height: 46vh; overflow: auto; padding: 2px; }
#edit-rows input { font-family: var(--font-word); }
.edit-head span { font-size: .76rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding-left: .3rem; }
.pd-head { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.pd-head .pd-current { width: 96px; flex: none; }
.pd-head h2 { font-family: var(--font-word); font-size: 1.55rem; overflow-wrap: anywhere; letter-spacing: 0; }
.pd-head p { color: var(--ink-2); }
.pd-head .credit { font-size: .8rem; color: var(--ink-3); margin-top: .2rem; }
.pd-head .credit a { color: inherit; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--sunken); border-radius: 16px; }
.tab { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .85rem; border: 0; background: none; color: var(--ink-2); font-weight: 500; border-radius: 12px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; background: var(--paper); box-shadow: var(--shadow-soft); }
.pd-body { display: grid; gap: .8rem; min-height: 220px; align-content: start; }
.via-note { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: var(--brand-ink); background: var(--brand-wash); padding: .55rem .85rem; border-radius: 12px; }
.search-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.search-row input { flex: 1 1 200px; width: auto; }
.search-row .emoji-own { flex: 0 1 150px; }
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.cands > p, .emoji-grid > p { grid-column: 1 / -1; }
.cand { position: relative; aspect-ratio: 1; padding: 0; border: 3px solid transparent; border-radius: 18px; overflow: hidden; background: var(--pic-bg); display: grid; place-items: center; transition: border-color .12s, transform .12s; }
.cand img { width: 100%; height: 100%; object-fit: cover; }
.cand span { position: absolute; left: 0; right: 0; bottom: 0; padding: .2rem .45rem; font-size: .7rem; background: rgba(14, 16, 34, .62); color: #fff; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cand:hover { border-color: color-mix(in srgb, var(--brand) 35%, transparent); transform: translateY(-1px); }
.cand.chosen { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.cand.failed { opacity: .45; cursor: not-allowed; }
.cand.failed img { visibility: hidden; }
.cand.failed span { position: static; background: none; color: var(--ink-3); white-space: normal; text-align: center; }
.cand.loading { cursor: wait; }
.cand.picto { background: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(22, 26, 51, .06); }
.cand.picto img { object-fit: contain; padding: 8%; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; max-height: 320px; overflow: auto; padding: 2px; }
.emoji-btn { aspect-ratio: 1; border: 2px solid transparent; border-radius: 14px; background: var(--pic-bg); font-family: var(--font-emoji); font-size: 1.8rem; line-height: 1; display: grid; place-items: center; padding: 0; transition: transform .1s, border-color .1s; }
.emoji-btn:hover { border-color: var(--brand); transform: scale(1.06); }
.emoji-btn .swatch { width: 60%; aspect-ratio: 1; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 2px var(--paper); }
.emoji-btn .num { font-family: var(--font-display); font-weight: 800; color: var(--brand); font-size: 1.4rem; }
.own-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .own-grid { grid-template-columns: 1.2fr 1fr; } }
.drop { position: relative; display: grid; justify-items: center; align-content: center; gap: .4rem; text-align: center; padding: 1.6rem 1rem; border: 2px dashed var(--line-2); border-radius: 20px; cursor: pointer; color: var(--ink-2); min-height: 190px; }
.drop:hover, .drop:focus-within { border-color: var(--brand); background: var(--brand-wash); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop small { color: var(--ink-3); }
.own-url { display: grid; gap: .6rem; align-content: start; }
.own-side { display: grid; gap: 1rem; align-content: start; }
.web-search { display: grid; gap: .6rem; align-content: start; padding: 1rem; border-radius: 20px; background: var(--paper-2); border: 1px solid var(--line); }
.howto { margin: 0; padding-left: 1.2rem; color: var(--ink-2); display: grid; gap: .2rem; }
.paste-zone {
  min-height: 72px; padding: .8rem 1rem; border: 2px dashed var(--line-2); border-radius: 16px; background: var(--paper);
  display: grid; place-items: center; text-align: center; color: var(--ink-3); cursor: text; outline: none;
}
.paste-zone:empty::before { content: attr(data-placeholder); }
.paste-zone:focus { border-color: var(--brand); background: var(--brand-wash); }
.settings { display: grid; gap: 1rem; }
.switch { display: flex; align-items: center; gap: .7rem; font-weight: 500; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--brand); }
input[type="range"] { accent-color: var(--brand); width: 100%; }
.share-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; resize: vertical; word-break: break-all; }

/* Teilen: nur QR-Code */
.share-modal { width: min(100%, 480px); }
.qr-box { display: grid; justify-items: center; gap: .9rem; text-align: center; }
.qr-btn { padding: 14px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; width: min(100%, 320px); border-radius: 24px; box-shadow: var(--shadow-card); }
.qr { display: block; width: 100%; height: auto; }
.qr-caption { color: var(--ink-2); max-width: 26rem; }
.qr-full {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: #fff; color: #161A33;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.qr-full-inner { display: grid; justify-items: center; gap: 1rem; text-align: center; width: 100%; }
.qr-full h2 { font-size: clamp(1.4rem, 4vw, 2.6rem); color: #161A33; }
.qr-full .qr { width: min(78vh, 92vw); }
.qr-full p { font-size: clamp(1.1rem, 2.5vw, 1.6rem); font-weight: 600; color: #161A33; }
.qr-full .btn { --bg: #fff; --fg: #161A33; --bd: #CDD2E2; }

/* Konto */
.auth-modal { width: min(100%, 440px); }
.auth-seg { width: 100%; }
.auth-seg .seg-btn { flex: 1; justify-content: center; }
.auth-form { display: grid; gap: .9rem; }
.form-error { color: var(--red); font-size: .9rem; font-weight: 500; }
.form-error:empty { display: none; }
.form-info { color: var(--green-ink); background: var(--green-wash); font-size: .9rem; padding: .6rem .85rem; border-radius: 12px; }
.form-info:empty { display: none; }
.link-btn { justify-self: center; background: none; border: 0; padding: .3rem .5rem; color: var(--brand-ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; border-radius: 8px; }
.account-card { display: flex; align-items: center; gap: .9rem; padding: .9rem; border-radius: 18px; background: var(--paper-2); border: 1px solid var(--line); }
.account-card strong { font-size: 1.15rem; }
.account-avatar { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; flex: none; }
.pw-change summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.pw-change[open] summary { margin-bottom: .7rem; }

/* ---------- Bilder prüfen ---------- */
.pics-lead { color: var(--ink-2); max-width: 46rem; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rrow { display: grid; grid-template-columns: minmax(140px, 210px) minmax(0, 1fr); gap: .6rem 1.2rem; align-items: center; background: var(--paper); border-radius: 22px; padding: 12px 14px; box-shadow: var(--shadow-soft); }
.rrow-word { display: grid; min-width: 0; font-family: var(--font-word); }
.rrow-word strong { font-size: 1.2rem; overflow-wrap: anywhere; }
.rrow-word small { color: var(--ink-2); font-size: 1rem; overflow-wrap: anywhere; }
.rrow-cands { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-height: 92px; }
.rcand {
  position: relative; width: 92px; aspect-ratio: 1; padding: 0; flex: none; overflow: hidden;
  display: grid; place-items: center; border: 3px solid transparent; border-radius: 18px; background: var(--pic-bg); color: var(--ink-2);
}
.rcand:hover { border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.rcand img { width: 100%; height: 100%; object-fit: cover; }
.rcand.picto { background: #FFFFFF; box-shadow: inset 0 0 0 1px rgba(22, 26, 51, .06); }
.rcand.picto img { object-fit: contain; padding: 8%; }
.rcand .emo { font-family: var(--font-emoji); font-size: 2.9rem; line-height: 1; }
.rcand .swatch { width: 60%; aspect-ratio: 1; border-radius: 50%; background: var(--swatch); }
.rcand .num { font-family: var(--font-display); font-weight: 800; color: var(--brand); font-size: 2.2rem; }
.rcand.text { background: transparent; border: 2px dashed var(--line-2); font-weight: 600; font-size: .8rem; gap: 0; align-content: center; }
.rcand.text .icon { width: 1.4rem; height: 1.4rem; }
.rcand.chosen { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.rcand.chosen::after { content: "✓"; position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-size: .8rem; font-weight: 800; display: grid; place-items: center; }
.rcand.text.chosen { border-style: solid; background: var(--brand-wash); color: var(--brand-ink); }
.rcand.failed { display: none; }
.rcand.loading { background: transparent; }
.credits { margin-top: 1rem; font-size: .78rem; color: var(--ink-3); }
.credits:empty { display: none; }
.credits a { color: inherit; }
@media (max-width: 560px) {
  .rrow { grid-template-columns: 1fr; }
  .rcand { width: 76px; }
  .rcand .emo { font-size: 2.3rem; }
}

/* ---------- Meldungen & Konfetti ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: max(18px, env(safe-area-inset-bottom, 0px)); z-index: 60; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding-left: var(--gutter-l); padding-right: var(--gutter-r); }
.toast { max-width: 32rem; background: #161A33; color: #fff; padding: .75rem 1.2rem; border-radius: 16px; font-weight: 500; box-shadow: var(--shadow-pop); animation: toast-in .2s ease; }
.toast.bad { background: var(--red); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .3s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .brand-name { font-size: 1.15rem; }
  .crumb .flag { display: none; }
  .crumb.current, .crumb-sep.sep-current { display: none; }
  .account-btn span { display: none; }
  .account-btn { padding: .35rem .7rem; }
  .card-actions .btn { min-width: 0; flex: 1; }
  .step { padding: 16px 14px; gap: .3rem .85rem; }
  .step-no { width: 46px; height: 46px; border-radius: 15px; }
  .step-actions { grid-column: 1 / -1; }
  .step-actions .btn { flex: 1 1 auto; }
  .deck-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .rv { grid-template-columns: 30px minmax(0, 1fr); }
  .rv-answer { grid-column: 2; }
}
@media (max-width: 380px) { .brand-name { display: none; } }
@media (max-width: 560px) {
  .cards-mode { gap: 10px; }
  .cards-mode .mode-bar { gap: .5rem; }
  .cards-mode .mode-title { font-size: 1.5rem; }
  .cards-mode .label-inline { display: none; }
  .cards-mode .mode-controls { gap: .4rem; }
  .cards-mode .seg.small .seg-btn { min-height: 32px; padding: .22rem .6rem; font-size: .84rem; }
  .cards-mode .card-howto { font-size: .84rem; }
  .stage .flash { min-height: 300px; max-height: 56vh; }
}

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