/* =====================================================================
   VokaFlow – Styles (Mobile first, Dark default, Light optional)
   Design-Tokens oben – Farben nur über Variablen verwenden!
   ===================================================================== */

:root,
[data-theme="dark"] {
  --bg: #1d2231;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(124, 156, 255, .12), transparent 60%),
             radial-gradient(900px 500px at 110% 10%, rgba(52, 211, 180, .08), transparent 60%);
  --surface: #262c3e;
  --surface-2: #30374c;
  --surface-3: #3a4259;
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #eceff7;
  --text-2: #b9c0d3;
  --muted: #8f98af;
  --primary: #7c9cff;
  --primary-2: #5f80f5;
  --primary-ink: #0f1424;
  --accent: #34d3b4;
  --success: #3ccf8e;
  --success-bg: rgba(60, 207, 142, .14);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, .14);
  --warning: #fbbf24;
  --area-general: #60a5fa;
  --area-realestate: #f5a524;
  --area-patois: #2fbf71;
  /* Lernstand – sequenziell (ein Farbton, hell → dunkel = mehr Wissen) */
  --st-new: #3a4259;
  --st-learning: #4f63a8;
  --st-known: #6d8bf0;
  --st-mastered: #a9bdff;
  --shadow: 0 10px 30px rgba(0, 0, 0, .25);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .18);
  --overlay: rgba(10, 13, 22, .55);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f5fa;
  --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(124, 156, 255, .16), transparent 60%),
             radial-gradient(900px 500px at 110% 10%, rgba(52, 211, 180, .12), transparent 60%);
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --surface-3: #e2e7f2;
  --border: rgba(20, 30, 60, .09);
  --border-strong: rgba(20, 30, 60, .18);
  --text: #1a2034;
  --text-2: #424b63;
  --muted: #6b7489;
  --primary: #4f6ef0;
  --primary-2: #3d5ad8;
  --primary-ink: #ffffff;
  --accent: #10a98b;
  --success: #16a36a;
  --success-bg: rgba(22, 163, 106, .12);
  --danger: #dc4c4c;
  --danger-bg: rgba(220, 76, 76, .1);
  --warning: #d48a00;
  --area-general: #3b82f6;
  --area-realestate: #e08a00;
  --area-patois: #16a34a;
  --st-new: #e2e7f2;
  --st-learning: #b4c3f7;
  --st-known: #7a95f0;
  --st-mastered: #3d5ad8;
  --shadow: 0 10px 30px rgba(30, 40, 80, .10);
  --shadow-sm: 0 2px 8px rgba(30, 40, 80, .07);
  --overlay: rgba(20, 25, 40, .35);
  color-scheme: light;
}

:root {
  --radius: 18px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
  --topbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); text-decoration: none; }
code { font-size: .85em; background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0; }
.ico { width: 22px; height: 22px; flex: none; }
.flag { width: 1.4em; height: .95em; border-radius: 3px; display: inline-block; vertical-align: -.12em; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); overflow: hidden; }
.area-icon .flag { width: 30px; height: 20px; }
.area-tab .flag { width: 30px; height: 20px; margin: 3px 0; }
.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; gap: 8px; }
.gap { gap: 10px; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { max-width: 720px; margin: 0 auto; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: calc(var(--topbar-h) + var(--safe-t)); padding: var(--safe-t) 14px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.12rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { display: block; color: var(--muted); font-size: .75rem; margin-top: -1px; }
.topbar-actions { display: flex; gap: 4px; }
.brand-logo { width: 32px; height: 32px; display: block; }
.view { padding: 16px 14px calc(var(--tabbar-h) + var(--safe-b) + 28px); outline: none; }
.view.enter { animation: viewIn .28s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 6px 6px var(--safe-b);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--border);
  max-width: 720px; margin: 0 auto;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .7rem; font-weight: 600; border-radius: 14px; position: relative;
  transition: color .2s;
}
.tab .ico { width: 24px; height: 24px; transition: transform .2s; }
.tab.active { color: var(--primary); }
.tab.active::before {
  content: ""; position: absolute; top: 4px; width: 46px; height: 30px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 16%, transparent); z-index: -1;
}
.tab:active .ico { transform: scale(.9); }
body.immersive .tabbar, body.immersive .topbar { display: none; }
body.immersive .view { padding-bottom: calc(var(--safe-b) + 16px); padding-top: calc(var(--safe-t) + 10px); }

/* ---------- Basis-Komponenten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.card + .card, section.card { margin-bottom: 14px; }
.section-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 22px 4px 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 650; font-size: .95rem; background: var(--surface-2); color: var(--text);
  transition: transform .12s, background .2s, opacity .2s; user-select: none; text-align: center;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--primary-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn.success { background: var(--success); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost { background: var(--surface-2); border-color: var(--border); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: .85rem; border-radius: 11px; }
.btn.big { min-height: 60px; font-size: 1.05rem; }
.btn.block { display: flex; width: 100%; }
.btn .ico { width: 20px; height: 20px; }
.btn:disabled { opacity: .5; }
.danger-text { color: var(--danger) !important; }
.btn-list { display: grid; gap: 8px; margin-top: 10px; }
.btn-list .btn { justify-content: flex-start; }

.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px;
  border: 0; background: transparent; color: var(--text-2);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn.boxed { background: var(--surface-2); border: 1px solid var(--border); height: 46px; width: 46px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll-x { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.chips.scroll-x::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
}
.chip .ico { width: 16px; height: 16px; }
.chip.selectable { min-height: 36px; }
.chip.selectable.active { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.chip-fire { color: #ff9a3c; }
.chip.emo { font-size: 1.25rem; padding: 2px 10px; }
.chip-sep { flex: none; width: 1px; background: var(--border-strong); margin: 4px 2px; }

.segmented { display: flex; background: var(--surface-2); padding: 4px; border-radius: 14px; gap: 4px; border: 1px solid var(--border); }
.seg { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 10px; font-weight: 650; font-size: .88rem; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; white-space: nowrap; }
.seg .ico { width: 16px; height: 16px; }
.seg.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .seg.active { background: var(--surface-3); }

.input, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s; resize: none; font-size: 16px;
}
.input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.input.big { font-size: 1.15rem; min-height: 56px; }
.input.ok { border-color: var(--success); background: var(--success-bg); }
.input.bad { border-color: var(--danger); background: var(--danger-bg); }

.search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 0 12px; min-height: 46px; }
.search .ico { color: var(--muted); width: 20px; height: 20px; }
.search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; min-height: 44px; font-size: 16px; }
.search:focus-within { border-color: var(--primary); }

/* Fortschrittsring */
.ring { position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.ring circle { fill: none; }
.ring-bg { stroke: var(--surface-3); }
.ring-fg { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2, .8, .2, 1); }
.ring-inner { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; text-align: center; line-height: 1.05; }
.ring-inner strong { font-size: 1.1rem; }
.ring-inner small { font-size: .62rem; color: var(--muted); }

/* Stapel-Balken Lernstand */
.stackbar { display: flex; height: 8px; border-radius: 99px; background: var(--st-new); overflow: hidden; gap: 2px; margin-top: 12px; }
.stackbar span { display: block; height: 100%; border-radius: 4px; transition: width .6s; }
.stackbar span[style*="width:0%"] { display: none; }
.stackbar.lg-bar { height: 14px; }
.sb-mastered { background: var(--st-mastered); }
.sb-known { background: var(--st-known); }
.sb-learning { background: var(--st-learning); }
.sb-new { background: var(--st-new); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .78rem; color: var(--text-2); margin: 10px 0 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid var(--border-strong); }

.sbadge { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.sbadge.s-new { background: var(--surface-3); color: var(--text-2); }
.sbadge.s-learning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.sbadge.s-known { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
.sbadge.s-mastered { background: var(--success-bg); color: var(--success); }

.lang-tag { display: inline-flex; gap: 6px; align-items: center; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* ---------- Home ---------- */
.hero { position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--primary) 22%, transparent), transparent 70%); pointer-events: none; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.eyebrow { color: var(--muted); font-size: .9rem; font-weight: 600; }
.hero-title { font-size: 1.45rem; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; }
.levelbar { height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 16px; }
.levelbar div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .8s; }

.area-grid { display: grid; gap: 10px; }
.area-card { display: block; color: inherit; border-left: 4px solid var(--area); transition: transform .15s; }
.area-card:active { transform: scale(.985); }
.area-head { display: flex; align-items: center; gap: 12px; }
.area-head h4 { font-size: 1rem; }
.area-icon { font-size: 1.7rem; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--area) 16%, transparent); flex: none; }
.due-badge { background: var(--area); color: #fff; font-weight: 800; font-size: .8rem; min-width: 28px; height: 28px; padding: 0 8px; border-radius: 99px; display: grid; place-items: center; }
.area-card .stackbar .sb-mastered { background: var(--area); }
.area-card .stackbar .sb-known { background: color-mix(in srgb, var(--area) 65%, var(--surface)); }
.area-card .stackbar .sb-learning { background: color-mix(in srgb, var(--area) 35%, var(--surface)); }

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; color: var(--text-2); font-size: .78rem; font-weight: 650; text-align: center; border-radius: var(--radius); }
.quick .ico { width: 26px; height: 26px; color: var(--primary); }
.quick:active { transform: scale(.96); }
.wod { display: flex; gap: 14px; align-items: center; cursor: pointer; }
.wod-img { font-size: 2.6rem; width: 64px; height: 64px; display: grid; place-items: center; background: var(--surface-2); border-radius: 16px; flex: none; overflow: hidden; }
.wod-en { font-size: 1.25rem; font-weight: 700; }
.patois-line { color: var(--area-patois); margin-top: 3px; }

/* ---------- Lernen ---------- */
.area-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.area-tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-weight: 650; font-size: .85rem; }
.area-tab span:first-child { font-size: 1.4rem; }
.area-tab.active { border-color: var(--area); background: color-mix(in srgb, var(--area) 14%, var(--surface)); color: var(--text); box-shadow: 0 0 0 1px var(--area) inset; }
.area-summary { display: flex; align-items: center; gap: 16px; border-left: 4px solid var(--area); }
.area-summary .ring-fg { stroke: var(--area); }
.mini-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.mini-stats b { color: var(--text); }
.options { display: grid; gap: 14px; }
.opt { display: grid; gap: 7px; min-width: 0; }
.opt > label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.opt-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; text-align: left; padding: 14px; transition: transform .12s, border-color .2s; }
.mode:active { transform: scale(.97); border-color: var(--primary); }
.mode-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.mode-text strong { display: block; font-size: .95rem; }
.mode-text small { display: block; color: var(--muted); font-size: .76rem; line-height: 1.3; margin-top: 2px; }

/* ---------- Session ---------- */
.session { display: flex; flex-direction: column; min-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 26px); }
.session-head { display: flex; align-items: center; gap: 10px; }
.progress { flex: 1; height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--area, var(--primary)), var(--accent)); border-radius: 99px; transition: width .4s; }
.xp-pill { font-weight: 800; font-size: .8rem; color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); padding: 5px 10px; border-radius: 99px; white-space: nowrap; }
.session-meta { display: flex; justify-content: space-between; margin: 8px 4px 14px; }
.stage { flex: 1; display: flex; flex-direction: column; gap: 14px; }
.stage.enter { animation: viewIn .25s ease both; }

.qcard { text-align: center; padding: 22px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.card-q { font-size: 1.6rem; font-weight: 750; letter-spacing: -.01em; overflow-wrap: anywhere; }
.card-a { font-size: 1.5rem; font-weight: 700; color: var(--primary); overflow-wrap: anywhere; }
.card-q.long, .card-a.long { font-size: 1.12rem; line-height: 1.4; }
.card-img { font-size: 3.4rem; line-height: 1; }
.card-img.sm { font-size: 2.4rem; }
.card-img.xl { font-size: 6rem; padding: 10px 0; }
.card-img .vimg { max-width: 100%; max-height: 180px; border-radius: 14px; object-fit: cover; }
.card-img.xl .vimg { max-height: 240px; }
.vemoji { display: inline-block; }
.vimg { display: block; }

.flip-wrap { perspective: 1200px; flex: 1; display: flex; min-height: 300px; max-height: 480px; }
.flip { position: relative; flex: 1; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.2, .8, .2, 1); cursor: pointer; outline: none; touch-action: pan-y; }
.flip.flipped { 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: 14px; padding: 24px 20px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--shadow); overflow-y: auto; }
.face.back { transform: rotateY(180deg); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.flip-hint { position: absolute; bottom: 14px; }
.extra { color: var(--text-2); font-size: .95rem; }
.extra.ex { font-style: italic; }
.extra.note { display: flex; gap: 6px; align-items: flex-start; font-size: .85rem; color: var(--muted); text-align: left; }
.extra.note .ico { width: 16px; height: 16px; margin-top: 2px; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rate-btn { border: 1px solid var(--border); border-radius: 14px; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: var(--surface); font-size: .85rem; }
.rate-btn small { font-size: .7rem; color: var(--muted); }
.rate-btn:active { transform: scale(.95); }
.r-again strong { color: var(--danger); } .r-hard strong { color: var(--warning); } .r-good strong { color: var(--success); } .r-easy strong { color: var(--primary); }

.choices { display: grid; gap: 10px; }
.choice-btn { display: flex; align-items: center; gap: 12px; text-align: left; min-height: 58px; padding: 12px 14px; border-radius: 15px; background: var(--surface); border: 1.5px solid var(--border); font-size: 1rem; font-weight: 600; transition: transform .12s, border-color .2s, background .2s; overflow-wrap: anywhere; }
.choice-btn:active { transform: scale(.98); }
.choice-btn .kbd { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: .78rem; font-weight: 800; }
.choice-btn.correct { border-color: var(--success); background: var(--success-bg); }
.choice-btn.correct .kbd { background: var(--success); color: #fff; }
.choice-btn.wrong { border-color: var(--danger); background: var(--danger-bg); animation: shake .35s; }
.choice-btn:disabled { cursor: default; }

.write-form { display: grid; gap: 10px; }
.hint-line { min-height: 1.2em; color: var(--warning); letter-spacing: .04em; }

.puzzle-answer { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; padding: 12px; border-radius: 16px; border: 2px dashed var(--border-strong); background: var(--surface); }
.puzzle-answer.solved { border-style: solid; border-color: var(--success); background: var(--success-bg); }
.puzzle-answer.letters { gap: 5px; }
.puzzle-tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.tile { min-width: 44px; min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); font-weight: 700; font-size: 1.05rem; box-shadow: 0 2px 0 var(--border-strong); transition: transform .1s, opacity .2s; }
.letters .tile { min-width: 40px; padding: 0 8px; text-transform: none; }
.tile:active { transform: translateY(2px); box-shadow: none; }
.tile.used { opacity: .2; }
.tile.placed { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.match-col { display: grid; gap: 10px; align-content: start; }
.match-btn { min-height: 64px; padding: 8px 10px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--border); font-weight: 600; font-size: .92rem; overflow-wrap: anywhere; transition: all .2s; }
.match-btn.sel { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 16%, var(--surface)); transform: scale(1.02); }
.match-btn.wrong { border-color: var(--danger); background: var(--danger-bg); animation: shake .35s; }
.match-btn.done { opacity: 0; transform: scale(.85); pointer-events: none; }

.blitz-top { display: flex; align-items: center; gap: 8px; }
.blitz-time { flex: 1; height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.blitz-time div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width .1s linear; }
.blitz-time div.low { background: var(--danger); }
.blitz-card { flex: 1; justify-content: center; min-height: 260px; transition: background .15s, border-color .15s; touch-action: pan-y; }
.blitz-eq { font-size: 1.4rem; color: var(--muted); font-weight: 300; }
.blitz-card.flash-ok { border-color: var(--success); background: var(--success-bg); }
.blitz-card.flash-bad { border-color: var(--danger); background: var(--danger-bg); }
.blitz-btns .btn { flex: 1; }

.feedback {
  position: sticky; bottom: 0; margin: 14px -14px calc(-1 * (var(--safe-b) + 16px)); padding: 16px 16px calc(16px + var(--safe-b));
  display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--border);
  animation: slideUp .25s ease both; z-index: 5;
}
.feedback.ok { background: color-mix(in srgb, var(--success) 18%, var(--surface)); }
.feedback.bad { background: color-mix(in srgb, var(--danger) 16%, var(--surface)); }
.feedback .fb-text { flex: 1; min-width: 0; }
.feedback .fb-text strong { font-size: 1.1rem; }
.feedback.ok .fb-text strong { color: var(--success); }
.feedback.bad .fb-text strong { color: var(--danger); }
.feedback p { font-size: .9rem; margin-top: 2px; overflow-wrap: anywhere; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }

/* Zusammenfassung */
.summary { text-align: center; display: grid; gap: 14px; padding-top: 10px; }
.summary-emoji { font-size: 4.4rem; line-height: 1; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.summary h2 { font-size: 1.6rem; }
.summary-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sstat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 4px; display: grid; gap: 2px; }
.sstat b { font-size: 1.3rem; }
.sstat small { font-size: .7rem; color: var(--muted); }
.sstat.ok b { color: var(--success); } .sstat.bad b { color: var(--danger); } .sstat.xp b { color: var(--warning); }
.goal-line { display: flex; align-items: center; gap: 14px; text-align: left; }
.new-badges, .wrong-list { text-align: left; }
.new-badges h3, .wrong-list h3 { margin-bottom: 8px; }
.badge-row { display: flex; gap: 12px; align-items: center; padding: 6px 0; }
.summary-actions { display: grid; gap: 8px; }
.wl-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 11px 2px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; font-size: .92rem; }
.wl-item:last-child { border-bottom: 0; }
.wl-item span:last-child { text-align: right; }

/* ---------- Wörterliste ---------- */
.search-wrap { display: grid; gap: 10px; padding-bottom: 8px; }
.search-wrap.sticky { position: sticky; top: calc(var(--topbar-h) + var(--safe-t)); z-index: 10; background: var(--bg); margin: -16px -14px 0; padding: 12px 14px 10px; border-bottom: 1px solid var(--border); }
.list-count { margin: 10px 4px 6px; }
.word-list { display: grid; gap: 6px; }
.word-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 11px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); min-height: 60px; }
.word-row:active { background: var(--surface-2); }
.wr-img { width: 36px; height: 36px; display: grid; place-items: center; font-size: 1.5rem; flex: none; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.wr-img .vimg { width: 100%; height: 100%; object-fit: cover; }
.wr-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--st-new); }
.wr-dot.s-learning { background: var(--warning); } .wr-dot.s-known { background: var(--primary); } .wr-dot.s-mastered { background: var(--success); }
.wr-text { flex: 1; min-width: 0; display: grid; }
.wr-de { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-en { color: var(--text-2); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-pa { color: var(--area-patois); }
.wr-side { display: flex; align-items: center; gap: 6px; flex: none; }
.area-dots { display: flex; gap: 3px; }
.area-dots i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.star.on { color: var(--warning); }
.due-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.more-sentinel { height: 40px; }
.fab { position: fixed; right: max(18px, calc(50% - 360px + 18px)); bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; color: var(--primary-ink); background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 45%, transparent); z-index: 25; }
.fab .ico { width: 28px; height: 28px; }
.fab:active { transform: scale(.94); }
.empty { text-align: center; padding: 40px 10px; display: grid; gap: 12px; justify-items: center; }

/* Detail-Sheet */
.detail { display: grid; gap: 12px; }
.detail-img { font-size: 4rem; text-align: center; }
.detail-img .vimg { max-height: 200px; margin: 0 auto; border-radius: 16px; }
.dl .big-text { font-size: 1.2rem; font-weight: 650; margin-top: 2px; overflow-wrap: anywhere; }
.prog-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.prog-row.focus { font-weight: 700; }
.prog-row > span:first-child { min-width: 100px; }

/* Recherche */
.research { display: grid; gap: 10px; }
.rs-group { display: grid; gap: 6px; }
.rs-links { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-link { display: inline-flex; align-items: center; gap: 5px; padding: 8px 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: .84rem; font-weight: 600; min-height: 38px; }
.rs-link .ico { width: 14px; height: 14px; color: var(--muted); }
.rs-link:active { background: var(--surface-3); }
.research-card summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; min-height: 28px; }
.research-card summary::-webkit-details-marker { display: none; }
.research-card summary .ico { color: var(--primary); }

/* Formular */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > label { font-weight: 650; font-size: .9rem; }
.img-edit { display: flex; gap: 12px; align-items: flex-start; }
.img-preview { position: relative; width: 84px; height: 84px; flex: none; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; font-size: 2.8rem; overflow: hidden; color: var(--muted); }
.img-preview .vimg { width: 100%; height: 100%; object-fit: cover; }
.auto-tag { position: absolute; bottom: 3px; right: 6px; font-size: .62rem; }
.dupe-box { background: color-mix(in srgb, var(--warning) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warning) 35%, transparent); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; font-size: .85rem; }
.dupe { text-align: left; background: none; border: 0; padding: 4px 0; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; }
.form-error { color: var(--danger); font-weight: 600; font-size: .9rem; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Statistik ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi { display: grid; gap: 2px; }
.kpi small { color: var(--muted); font-weight: 650; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.kpi b { font-size: 1.5rem; letter-spacing: -.02em; }
.chart-card h3 { margin-bottom: 4px; }
.barchart { position: relative; display: flex; align-items: flex-end; gap: 5px; height: 160px; margin-top: 18px; padding-bottom: 22px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border: 0; background: none; padding: 0; position: relative; }
.bar { width: 100%; max-width: 26px; background: color-mix(in srgb, var(--primary) 55%, var(--surface-3)); border-radius: 4px 4px 0 0; transition: height .6s; }
.bar.hit { background: var(--primary); }
.bar-col.sel .bar, .bar-col:hover .bar { outline: 2px solid var(--text-2); outline-offset: 1px; }
.bar-label { position: absolute; bottom: -20px; font-size: .68rem; color: var(--muted); }
.goal-line-h { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--muted); opacity: .6; pointer-events: none; margin-bottom: 22px; }
.goal-line-h span { position: absolute; right: 0; top: -16px; font-size: .62rem; color: var(--muted); }
.chart-tip { margin-top: 12px; min-height: 1.2em; }
.area-stat { margin-top: 14px; }
.stat-nums { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.badge { display: grid; justify-items: center; gap: 2px; text-align: center; padding: 12px 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); opacity: .45; filter: grayscale(1); }
.badge.on { opacity: 1; filter: none; border-color: color-mix(in srgb, var(--warning) 40%, transparent); background: color-mix(in srgb, var(--warning) 9%, var(--surface)); }
.badge-ico { font-size: 1.8rem; }
.badge b { font-size: .78rem; }
.badge small { font-size: .65rem; color: var(--muted); line-height: 1.25; }

/* ---------- Einstellungen ---------- */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch-row:last-child { border-bottom: 0; }
.switch-row small { display: block; font-size: .78rem; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--surface-3); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(20px); }
section.card > h3 { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
section.card > .opt + .opt { margin-top: 14px; }
.about { text-align: center; display: grid; justify-items: center; gap: 4px; padding: 20px 0; }
.about .brand-logo { width: 48px; height: 48px; margin-bottom: 6px; }

/* ---------- Sheet, Toast, Konfetti ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--overlay); opacity: 0; transition: opacity .25s; backdrop-filter: blur(2px); }
.sheet { position: relative; width: 100%; max-width: 720px; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-radius: 24px 24px 0 0; padding: 8px 18px calc(22px + var(--safe-b)); transform: translateY(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow); border: 1px solid var(--border); }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-handle { width: 42px; height: 5px; border-radius: 99px; background: var(--surface-3); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { font-size: 1.15rem; }

.toast-root { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 12px); z-index: 200; display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 14px; }
.toast { max-width: 520px; padding: 12px 16px; border-radius: 14px; background: var(--surface-3); color: var(--text); font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); opacity: 0; transform: translateY(-10px); transition: all .25s; border: 1px solid var(--border-strong); }
.toast.show { opacity: 1; transform: none; }
.toast.success { background: color-mix(in srgb, var(--success) 25%, var(--surface)); }
.toast.error { background: color-mix(in srgb, var(--danger) 25%, var(--surface)); }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 300; display: none; }

.boot { display: grid; place-items: center; gap: 14px; padding-top: 30vh; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (min-width: 560px) {
  .area-grid { grid-template-columns: repeat(3, 1fr); }
  .mode-grid { grid-template-columns: repeat(3, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .badge-grid { grid-template-columns: repeat(4, 1fr); }
  .view { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 370px) {
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-stats { grid-template-columns: repeat(2, 1fr); }
  .opt-row { grid-template-columns: 1fr; }
  .card-q { font-size: 1.35rem; }
}
@media (hover: hover) {
  .card.mode:hover, .area-card:hover, .quick:hover, .word-row:hover { border-color: var(--border-strong); }
  .choice-btn:not(:disabled):hover, .match-btn:hover { border-color: var(--primary); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   v1.1 – Lückentext, Prüfung, Dialoge, Grammatik
   ===================================================================== */
.feature-card { display: flex; align-items: center; gap: 14px; color: inherit; border-left: 4px solid var(--area); margin-top: 14px; }
.feature-card small { display: block; font-size: .8rem; margin-top: 2px; }
.feature-ico { font-size: 1.7rem; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--area) 16%, transparent); flex: none; }
.intro-card p { color: var(--text-2); font-size: .92rem; }
.chip-ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }

/* Lückentext */
.cloze-hint { font-size: 1.05rem; color: var(--text-2); }
.cloze-sentence { text-align: center; display: grid; gap: 10px; justify-items: center; }
.cloze-sentence p { font-size: 1.3rem; font-weight: 650; line-height: 2; }
.gap { display: inline-block; min-width: 70px; padding: 0 8px; margin: 0 2px; border-bottom: 3px solid var(--border-strong); border-radius: 6px 6px 0 0; color: var(--primary); line-height: 1.5; }
.gap.current { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent); animation: pulse 1.4s ease-in-out infinite; }
.gap.filled { border-color: var(--success); color: var(--success); min-width: 0; }
.gap.revealed { border-color: var(--danger); color: var(--danger); min-width: 0; }
@keyframes pulse { 50% { background: color-mix(in srgb, var(--primary) 26%, transparent); } }
.cloze-opts { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cloze-opts .tile { min-height: 52px; font-size: 1.05rem; padding: 0 16px; }

/* Wort-Vergleich (Schreiben bei Sätzen) */
.dw-ok { color: var(--success); }
.dw-miss { color: var(--danger); font-weight: 700; text-decoration: underline wavy; text-underline-offset: 3px; }

/* Prüfung */
.exam-tag { display: flex; align-items: center; gap: 6px; color: var(--warning); font-weight: 700; justify-content: center; }
.exam-tag .ico { width: 16px; height: 16px; }
.exam-grade { display: flex; align-items: center; gap: 16px; text-align: left; }
.grade { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: #fff; flex: none; background: var(--muted); }
.grade.g1, .grade.g2 { background: var(--success); } .grade.g3 { background: var(--primary); } .grade.g4 { background: var(--warning); } .grade.g5, .grade.g6 { background: var(--danger); }
.exam-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); text-align: left; }
.exam-row:last-child { border-bottom: 0; }
.exam-mark { font-weight: 800; width: 20px; flex: none; }
.exam-row.ok .exam-mark { color: var(--success); } .exam-row.bad .exam-mark { color: var(--danger); }
.exam-row p { overflow-wrap: anywhere; }
.exam-row s { color: var(--danger); }

/* Dialoge */
.dlg-list { display: grid; gap: 10px; }
.dlg-item { display: flex; align-items: center; gap: 14px; color: inherit; }
.dlg-item small { display: block; font-size: .8rem; margin-top: 2px; }
.dlg-ico { font-size: 1.8rem; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 15px; background: var(--surface-2); flex: none; }
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }
.bubble { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: .98rem; animation: viewIn .25s ease both; box-shadow: var(--shadow-sm); }
.bubble.left { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.bubble.right { align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--primary-ink); border-bottom-right-radius: 6px; }
.bubble.right.corrected { background: color-mix(in srgb, var(--warning) 22%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent); }
.bubble .de { font-size: .84rem; opacity: .8; margin-top: 6px; }
.bubble-de { border: 0; background: none; padding: 4px 0 0; font-size: .75rem; font-weight: 700; color: inherit; opacity: .65; text-decoration: underline; }
.dlg-task { margin-top: 14px; }
.task-card { display: grid; gap: 10px; }
.task-text { font-size: 1.08rem; font-weight: 650; }
.tip-box { border-radius: 14px; padding: 12px 14px; font-size: .92rem; }
.tip-box.ok { background: var(--success-bg); } .tip-box.bad { background: var(--danger-bg); }
.tip-box.ok > b { color: var(--success); } .tip-box.bad > b { color: var(--danger); }
.summary-mini { text-align: center; display: grid; gap: 4px; }
.summary-emoji.sm { font-size: 3rem; }

/* Grammatik */
.gram-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.gram-item { display: grid; gap: 4px; justify-items: start; color: inherit; position: relative; }
.gram-item.done::after { content: "✓"; position: absolute; top: 12px; right: 14px; color: var(--success); font-weight: 800; }
.gram-ico { font-size: 1.5rem; line-height: 1; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); flex: none; }
.gram-ico.lg { font-size: 1.9rem; width: 56px; height: 56px; }
.gram-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.gram-explain p { color: var(--text-2); line-height: 1.6; }
.gram-explain b { color: var(--area-patois); }
.gram-table { display: grid; gap: 2px; margin-top: 12px; border-radius: 12px; overflow: hidden; }
.gram-table > div { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 8px; padding: 8px 10px; background: var(--surface-2); font-size: .85rem; }
.gram-table b { color: var(--area-patois); }
.gram-ex { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; gap: 3px; }
.gram-ex:last-of-type { border-bottom: 0; }
.gram-ex .pa { font-weight: 700; font-size: 1.05rem; color: var(--area-patois); }
#quiz { margin-top: 16px; }
@media (min-width: 560px) { .gram-grid { grid-template-columns: repeat(3, 1fr); } }
