/* Vokabelheft – Version 3: "Nebel & Salbei"
   Hintergrundverlauf, Farbtöne und Anzeige lassen sich in den Einstellungen ändern (Variablen --bg-image, data-tone, .no-xp).
   Alle bestehenden Klassen, IDs und Variablen (--dx, --rot, --tilt) bleiben erhalten. */
@font-face { font-family: "Chorus"; src: url("fonts/chorus-latin-italic.woff") format("woff"); font-style: italic; font-weight: 400 700; font-display: swap; }

:root {
  --bg: #A9B8A2;
  --bg-end: #B7C5B6;
  --bg-image: radial-gradient(70% 36% at 0% 14%, rgba(111, 141, 138, .5), transparent 72%), radial-gradient(62% 30% at 100% 4%, rgba(240, 200, 178, .6), transparent 72%), linear-gradient(170deg, #A9B8A2, #D3DCC6, #E7ECDD, #B7C5B6);
  --ink: #14201E;
  --muted: #4F5F58;
  --surface: rgba(255, 255, 255, .42);
  --surface-2: rgba(255, 255, 255, .72);
  --line: rgba(20, 32, 30, .16);
  --edge: rgba(255, 255, 255, .7);
  --pill: #1D3438;
  --pill-ink: #FFFFFF;
  --accent: #C9BFFF;
  --accent-ink: #1D3438;
  --accent-strong: #5B4BC4;
  --good: #1F7A55;
  --danger: #B3261E;
  --auto: #5B4BC4;
  --meter-on: #1D3438;
  --veil: .6;
  --script-a: #1D3438;
  --script-b: #5B4BC4;
  --sheet: color-mix(in srgb, var(--bg) 22%, #fff);
  --box: #1D3438;
  --box-ink: #D3DCC6;
  /* Karteikarte */
  --paper: #F8F8F4;
  --paper-2: #E6E7DF;
  --paper-ink: #1D2A2A;
  --pen: #1D3438;
  --card-line: #A7B0AA;
  --margin: #E2231A;
  --flame: #E58A1F;
  --flame-in: #FFD36B;
  --ice: #5BB5E8;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-hand: "Kalam", "Neucha", "Segoe Print", "Bradley Hand", cursive;
  --font-script: "Chorus", "Snell Roundhand", "Apple Chancery", "URW Chancery L", "Segoe Script", cursive;
  --gutter-l: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --r-lg: 24px;
  --glass-blur: blur(18px) saturate(1.3);
  --shadow-card: 0 1px 1px rgba(20, 40, 30, .3), 0 22px 32px -16px rgba(20, 40, 30, .6);
  color-scheme: light;
}
:root[data-tone="dark"] {
  --ink: #F3F1EA;
  --muted: #C9D3CE;
  --surface: rgba(255, 255, 255, .12);
  --surface-2: rgba(255, 255, 255, .22);
  --line: rgba(255, 255, 255, .22);
  --edge: rgba(255, 255, 255, .3);
  --pill: #F2EEE4;
  --pill-ink: #1D3438;
  --accent-strong: #C9BFFF;
  --good: #9BF0C4;
  --danger: #FFC0B5;
  --auto: #FFE0A8;
  --meter-on: #F2EEE4;
  --veil: .14;
  --script-a: #FFFFFF;
  --script-b: #C9BFFF;
  --sheet: color-mix(in srgb, var(--bg) 55%, #000);
  --shadow-card: 0 1px 1px rgba(0, 0, 0, .3), 0 24px 34px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background-color: var(--bg); background-image: var(--bg-image); background-attachment: fixed; color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  -webkit-tap-highlight-color: transparent; overflow: hidden; overscroll-behavior: none;
}
/* weiche Lichtschleier */
body::before, body::after { content: ""; position: fixed; pointer-events: none; z-index: 0; border-radius: 50%; background: #fff; filter: blur(30px); opacity: var(--veil); }
body::before { left: -30%; top: 34%; width: 160%; height: 13%; transform: rotate(-12deg); }
body::after { left: -30%; top: 74%; width: 160%; height: 12%; transform: rotate(-8deg); opacity: calc(var(--veil) * .8); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
[hidden] { display: none !important; }

#app { height: 100%; height: 100dvh; position: relative; z-index: 1; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
/* Lernansicht: kein Scrollen, kein Zoomen, keine Textauswahl */
#study { touch-action: none; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* ---------- Glas ---------- */
.avatar, .stat, .nb-cover, .dirpill, .lang-btn, .icon-btn, .btn, .in, .strip.paper, .authcard, .freezes {
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}

/* ---------- Karteikarte (Basis) ---------- */
.paper { background-color: var(--paper); color: var(--paper-ink); border-radius: 3px; box-shadow: var(--shadow-card); }

/* ---------- Übersicht ---------- */
.scrollwrap { position: relative; flex: 1; min-height: 0; }
.scrollwrap::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 130px; pointer-events: none; background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--bg-end) 94%, transparent)); }
.scroll { height: 100%; overflow-y: auto; display: flex; flex-direction: column; padding-block: 6px 130px; padding-left: var(--gutter-l); padding-right: var(--gutter-r); -webkit-overflow-scrolling: touch; }
.scroll > * { flex: none; }
.toprow { order: 1; display: block; margin-top: 12px; }
#goBtn { order: 2; }
.stats { order: 3; }
h1.title { order: 4; }
#langline { order: 5; }
.dirpill { order: 6; }
ul.decks { order: 7; }

/* Slogan in Schreibschrift */
.hand {
  font-family: var(--font-script); font-style: italic; font-weight: 500; font-size: clamp(2.6rem, 13.5vw, 3.7rem); line-height: 1.02; letter-spacing: .005em; margin: 14px 0 0; padding: .05em .1em .12em 0;
  color: var(--script-a); background: linear-gradient(100deg, var(--script-a) 30%, var(--script-b) 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
#goBtn { align-self: flex-start; margin-top: 18px; min-height: 58px; padding: 0 30px 0 24px; box-shadow: 0 18px 30px -12px rgba(10, 30, 32, .55); }
#goBtn::before { content: ""; width: 0; height: 0; border-left: 14px solid currentColor; border-top: 9px solid transparent; border-bottom: 9px solid transparent; }

h1.title { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.1; letter-spacing: -.03em; margin: 24px 0 0; }
.sub { color: var(--muted); margin: 4px 0 0; font-size: .95rem; }
.dirpill {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin: 12px 0 14px; padding: 0 18px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--edge); font-weight: 600; box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5);
}
.dirpill b { font-size: 1.15rem; }
.dirpill:active { transform: scale(.98); }
.icon-btn:active { transform: scale(.94); }
#dirBtn { font-weight: 700; }
.empty { color: var(--muted); }

/* Einstellungen: Zahnrad unten rechts */
.avatar { display: grid; place-items: center; background: var(--surface); border: 1px solid var(--edge); box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5), 0 14px 26px -16px rgba(10, 30, 32, .6); }
.avatar.gear { position: absolute; z-index: 3; right: var(--gutter-r); bottom: calc(16px + var(--safe-b)); width: 56px; height: 56px; border-radius: 50%; }
.avatar svg { width: 26px; height: 26px; }
.avatar:active { transform: scale(.95); }

/* Statistik-Kacheln */
.stats { display: grid; grid-template-columns: 1.35fr 1.15fr 1fr; gap: 8px; margin: 20px 0 0; }
.no-xp .stats { grid-template-columns: 1fr 1fr; }
.no-xp .stat.level { display: none; }
.stat {
  display: flex; flex-direction: column; gap: 1px; padding: 12px; min-width: 0; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--edge); box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5);
}
.stat b { font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.stat span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .bar { display: block; height: 5px; padding: 0; margin-top: 8px; border-radius: 3px; background: var(--line); overflow: hidden; }
.stat .bar u { display: block; height: 100%; width: 0; background: var(--pill); border-radius: 3px; transition: width .5s ease; }
.stat.goal.done .bar u { background: var(--good); }
.stat.streak { flex-direction: row; align-items: center; gap: 6px; text-align: left; min-height: 68px; padding: 12px 10px 12px 12px; }
.stat.streak .sv { display: flex; flex-direction: column; min-width: 0; }
.stat.streak.off .sv b { color: var(--muted); }
.stat.streak:active { background: var(--surface-2); }
.flame { width: 26px; height: 32px; flex: none; }
.flame .fo { fill: var(--flame); } .flame .fi { fill: var(--flame-in); }
.off .flame .fo, .flame.off .fo { fill: var(--line); } .off .flame .fi, .flame.off .fi { fill: rgba(255, 255, 255, .35); }
.risk .flame { animation: flick 1.6s ease-in-out infinite; }
.risk .flame .fo { fill: color-mix(in srgb, var(--flame) 60%, var(--line)); } .risk .flame .fi { fill: color-mix(in srgb, var(--flame-in) 55%, var(--line)); }
@keyframes flick { 50% { transform: scale(1.08); } }

/* Serie: Wochenstreifen, Sheet, Feier */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: 100%; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wd small { font-size: 12px; color: var(--muted); font-weight: 600; }
.wd.now small { color: var(--ink); }
.wd .dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); color: #fff; }
.wd .dot svg { width: 18px; height: 18px; }
.wd.done .dot { background: var(--flame); border-color: var(--flame); }
.wd.frozen .dot { background: var(--ice); border-color: var(--ice); }
.wd.today .dot { border-color: var(--flame); border-style: dashed; }
.wd.future .dot { opacity: .5; }
.bigflame { display: grid; place-items: center; }
.bigflame .flame { width: 92px; height: 115px; }
.bignum { font-family: var(--font-display); font-weight: 600; font-size: 4.6rem; line-height: 1; letter-spacing: -.04em; color: var(--flame); text-align: center; }
.bigflame.off + .bignum { color: var(--muted); }
.cent { text-align: center; }
.freezes { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--edge); }
.freezes .snow { display: flex; gap: 4px; color: var(--ice); }
.freezes .snow svg { width: 22px; height: 22px; }
.freezes .snow .empty { color: var(--line); }
.freezes p { margin: 0; font-size: 14px; color: var(--muted); }
.streak-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px var(--gutter-r) 8px var(--gutter-l); max-width: 460px; width: 100%; margin: 0 auto; }
.streak-body h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.9rem; letter-spacing: -.02em; color: var(--ink); text-align: center; line-height: 1.15; }
.streak-body .bigflame .flame { animation: pop-in .6s cubic-bezier(.2, 1.5, .4, 1); }
.streak-body .bignum { animation: pop-in .6s cubic-bezier(.2, 1.5, .4, 1) .1s backwards; }
.streak-body .wd.today.done .dot { animation: pop-in .5s cubic-bezier(.2, 1.6, .4, 1) .5s backwards; }
@keyframes pop-in { from { transform: scale(.3); opacity: 0; } }
.note { margin: 0; text-align: center; color: var(--muted); }
.note b { color: var(--ink); }

.d-head { display: flex; align-items: flex-end; height: 56px; padding: 0 22px 8px; border-bottom: 1px solid var(--line); }
.d-title { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; line-height: 1.1; letter-spacing: -.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Listen als Glas-Zeilen */
ul.decks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.deck { position: relative; display: block; min-width: 0; }
.nb { position: relative; display: block; width: 100%; height: 96px; text-align: left; isolation: isolate; transition: transform .15s ease; --p: 0%; }
.nb:active { transform: scale(.985); }
.nb-cover { position: absolute; inset: 0; border-radius: 24px; background: var(--surface); border: 1px solid var(--edge); box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .55), 0 14px 26px -20px rgba(10, 30, 32, .6); }
.nb-coil { display: none; }
.nb-title { position: absolute; left: 18px; right: 140px; top: 13px; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.2; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-count { position: absolute; left: 18px; right: 110px; top: 43px; font-size: .86rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb::after { content: ""; position: absolute; z-index: 1; left: 18px; right: 18px; bottom: 14px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--pill) var(--p), var(--line) var(--p)); }
.nb-badge {
  position: absolute; z-index: 2; top: 39px; right: 18px; padding: 3px 12px 4px; border-radius: 999px; background: var(--pill); color: var(--pill-ink);
  font-size: 12.5px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap;
}
:root:not([data-tone="dark"]) .nb-badge:not(.new):not(.done) { color: #D6CCFF; }
.nb-badge.new, .nb-badge.done { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.deck.pinned .nb::before { content: ""; position: absolute; z-index: 2; left: 0; top: 20px; bottom: 20px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent-strong); }
.nb-tools { position: absolute; z-index: 3; top: 5px; right: 6px; display: flex; }
.nb-tools button { width: 40px; height: 40px; display: grid; place-items: center; color: var(--ink); }
.nb-tools svg { width: 18px; height: 18px; padding: 8px; box-sizing: content-box; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.nb-tools button:active svg { background: rgba(255, 255, 255, .6); }
.nb-pin[aria-pressed="true"] svg { background: var(--pill); color: var(--pill-ink); fill: currentColor; }

/* Schwebende Hauptaktion */
.fab {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: max-content; z-index: 3; bottom: calc(16px + var(--safe-b)); min-height: 56px; padding: 0 24px 0 10px; border-radius: 999px;
  background: var(--pill); color: var(--pill-ink); font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 16px 30px -10px rgba(10, 30, 32, .6);
}
.fab b { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-size: 1.4rem; line-height: 1; font-weight: 500; }
.fab:active { transform: scale(.97); }

/* Sprach-Tabs oben */
.langbar { order: -1; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: calc(14px + var(--safe-t)) var(--gutter-r) 2px var(--gutter-l); }
.langbar::-webkit-scrollbar { display: none; }
.lang-btn { flex: none; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border-radius: 999px; color: var(--ink); background: var(--surface); border: 1px solid var(--edge); box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5); transition: background .2s ease, color .2s ease; }
.lang-btn b { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; letter-spacing: .04em; line-height: 1.1; }
.lang-btn small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lang-btn[aria-pressed="true"] { background: var(--pill); color: var(--pill-ink); border-color: var(--pill); box-shadow: 0 12px 20px -10px rgba(10, 30, 32, .6); }

/* ---------- Kopfleisten ---------- */
header.bar { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; gap: 8px; padding: calc(12px + var(--safe-t)) var(--gutter-r) 0 var(--gutter-l); }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; font-size: 1.4rem; background: var(--surface); border: 1px solid var(--edge); line-height: 1; box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5); }
.bar-title { text-align: center; min-width: 0; }
.bar-title b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-title span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meter { display: flex; gap: 4px; padding: 16px var(--gutter-r) 0 var(--gutter-l); }
.meter i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background .25s ease; }
.meter i.on { background: var(--meter-on); }

/* ---------- Lernen: Karteikarte (etwas weiter unten) ---------- */
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 76px var(--gutter-r) 14px var(--gutter-l); }
.deckstack { position: relative; isolation: isolate; width: min(100%, 460px); container-type: inline-size; }
@media (max-height: 640px) { .deckstack { width: min(100%, calc((100svh - 340px) * 1.45)); } .stage { padding-top: 40px; } }
.deckstack::before, .deckstack::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 3px; opacity: 0; transition: opacity .2s ease; background-color: var(--paper-2); box-shadow: 0 1px 2px rgba(20, 40, 30, .35); }
.deckstack::before { transform: translate(5px, 7px) rotate(1.4deg); }
.deckstack::after { transform: translate(-4px, 12px) rotate(-1.2deg); }
.deckstack[data-stack="1"]::before, .deckstack[data-stack="2"]::before, .deckstack[data-stack="2"]::after { opacity: 1; }

.card { position: relative; width: 100%; aspect-ratio: 1.45; perspective: 1400px; cursor: pointer; transform: translate(var(--dx, 0px), 0) rotate(calc(var(--tilt, 0deg) + var(--rot, 0deg))); user-select: none; -webkit-user-select: none; touch-action: none; border-radius: 3px; }
.card.dragging { transition: none; }
.card-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, .7, .2, 1); }
.card.flipped .card-inner { transform: rotateY(180deg); }
.card.instant .card-inner { transition: none; }
.card.in { animation: cardin .26s ease-out; }
.card.out-r { animation: cardout-r .23s ease-in forwards; }
.card.out-l { animation: cardout-l .23s ease-in forwards; }
@keyframes cardin { from { transform: translate(-4px, 12px) rotate(-1.2deg) scale(.985); opacity: .6; } }
@keyframes cardout-r { from { transform: translate(var(--dx, 0px), 0) rotate(var(--rot, 0deg)); } to { transform: translate(120%, -24px) rotate(16deg); opacity: 0; } }
@keyframes cardout-l { from { transform: translate(var(--dx, 0px), 0) rotate(var(--rot, 0deg)); } to { transform: translate(-120%, 16px) rotate(-14deg); opacity: 0; } }

/* Karteikarte: roter Kopfstrich bei 24 %, darunter 4 graue Linien */
.face { --lh: 44px; position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
@supports (width: 1cqw) { .face { --lh: 10.48cqw; } }
.face.back { transform: rotateY(180deg); }
.face .head { flex: none; height: 24%; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 0 22px 5px; border-bottom: 2px solid var(--margin); font-family: var(--font-hand); font-weight: 700; font-size: 1rem; line-height: 1.1; color: var(--pen); }
.face .head span:last-child { font-weight: 400; font-size: .92rem; color: color-mix(in srgb, var(--paper-ink) 58%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lines { flex: none; height: calc(var(--lh) * 4); padding: 0 22px; overflow: hidden; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--lh) - 2px), var(--card-line) calc(var(--lh) - 2px), var(--card-line) var(--lh)); }
.word { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: clamp(1.35rem, 7.4cqw, 2.4rem); line-height: var(--lh); color: var(--pen); overflow-wrap: anywhere; }
.word .art { font-weight: 400; color: color-mix(in srgb, var(--paper-ink) 60%, transparent); margin-right: .35em; font-size: .8em; }
.gloss { margin: 0; font-family: var(--font-hand); font-size: clamp(1rem, 4.6cqw, 1.3rem); line-height: var(--lh); color: color-mix(in srgb, var(--paper-ink) 60%, transparent); }
.tap { position: absolute; right: 16px; bottom: 9px; font-size: 12px; color: color-mix(in srgb, var(--paper-ink) 50%, transparent); }
.newtag { position: absolute; left: 22px; bottom: 7px; font-family: var(--font-hand); font-size: 1rem; color: var(--margin); }

/* Wischen: X und Haken im Kreis */
.swipe-tag { position: absolute; top: 50%; margin-top: -36px; z-index: 3; pointer-events: none; opacity: 0; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; border: 3px solid; background: color-mix(in srgb, var(--paper) 90%, transparent); box-shadow: 0 10px 20px -8px rgba(0, 0, 0, .4); }
.swipe-tag svg { width: 36px; height: 36px; }
.swipe-tag.know { left: 12px; color: #1F7A55; border-color: #1F7A55; }
.swipe-tag.again { right: 12px; color: #D7261E; border-color: #D7261E; }

.strip.paper { align-self: center; max-width: calc(100% - var(--gutter-l) - var(--gutter-r)); margin: 2px auto 12px; padding: 8px 20px 4px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 56px; transform: none; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); border: 1px solid var(--edge); box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5); }
.slot { width: 1.4rem; height: 2.2rem; display: grid; place-items: center; border-bottom: 2px solid color-mix(in srgb, var(--ink) 45%, transparent); font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1; color: var(--ink); }
.slot.hint { animation: pop .2s ease; }
.slot.sep { width: .7rem; border-bottom-color: transparent; }
.slot.punct { width: .8rem; border-bottom-color: transparent; }
@keyframes pop { from { transform: translateY(5px); opacity: .3; } }

.xp-pop { position: absolute; left: 50%; bottom: 6px; z-index: 4; transform: translateX(-50%); pointer-events: none; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--good); animation: xp 1s ease-out forwards; }
@keyframes xp { from { opacity: 0; transform: translate(-50%, 10px); } 20% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -34px); } }

.actions { padding: 4px var(--gutter-r) calc(14px + var(--safe-b)) var(--gutter-l); display: flex; flex-direction: column; gap: 10px; }
.pair { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.btn { min-height: 58px; border-radius: 999px; font-weight: 700; font-size: 1.05rem; border: 1px solid var(--edge); background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 22px; transition: transform .1s ease; box-shadow: inset 1px 1px 0 rgba(255, 255, 255, .5); }
.btn:active { transform: scale(.98); }
.btn.primary, .btn.accent { background: var(--pill); color: var(--pill-ink); border-color: var(--pill); box-shadow: 0 14px 26px -12px rgba(10, 30, 32, .6); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 70%, transparent); background: transparent; box-shadow: none; }
.btn.hintbtn { min-height: 52px; border-style: dashed; border-color: color-mix(in srgb, var(--ink) 50%, transparent); background: transparent; box-shadow: none; }
.btn.link { min-height: 48px; border: 0; background: none; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.btn[disabled] { opacity: .45; cursor: default; }
.count { font-size: .9rem; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- Editor + Formulare ---------- */
.ebody { flex: 1; min-height: 0; overflow-y: auto; padding: 18px var(--gutter-r) 20px var(--gutter-l); display: flex; flex-direction: column; gap: 14px; }
.flabel { font-size: 14px; font-weight: 600; color: var(--muted); }
.in { width: 100%; min-width: 0; height: 52px; padding: 0 16px; background: var(--surface); border: 1px solid var(--edge); border-radius: 18px; font-family: var(--font-body); font-size: 1.05rem; color: var(--ink); }
.in:focus-visible { outline: 0; border-color: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-strong) 30%, transparent); }
.in::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.in.name { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; letter-spacing: -.01em; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; padding: 0 4px; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.erows { display: flex; flex-direction: column; gap: 8px; }
.erow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 8px; align-items: center; }
.erow .in { height: 48px; padding: 0 12px; font-size: 1rem; border-radius: 16px; }
.rm { width: 44px; height: 44px; border-radius: 50%; font-size: 1.5rem; color: var(--muted); line-height: 1; }
.rm:active { background: var(--surface-2); }
.rm[disabled] { opacity: .35; }
.add { min-height: 54px; border: 1.5px dashed color-mix(in srgb, var(--ink) 50%, transparent); border-radius: 999px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 8px; }
.msg { min-height: 1.4em; margin: 0; color: var(--danger); font-size: 14px; font-weight: 600; }
.hintline { margin: 0; font-size: 14px; color: var(--muted); }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tools .btn { min-height: 52px; font-size: 1rem; }
.btn.autobtn { min-height: 52px; font-size: 1rem; border-color: var(--auto); color: var(--auto); background: transparent; box-shadow: none; }
.in.auto { color: var(--auto); }
.hintline a { color: var(--auto); }
.check { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 500; }
.check input { width: 24px; height: 24px; accent-color: var(--pill); }

/* ---------- Anmeldung ---------- */
.auth-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 20px var(--gutter-r) 8px var(--gutter-l); }
.authcard { width: min(100%, 440px); padding: 0 0 26px; transform: none; overflow: hidden; border-radius: 28px; background: var(--surface); color: var(--ink); border: 1px solid var(--edge); box-shadow: 0 24px 40px -22px rgba(10, 30, 32, .6); }
.authcard .d-head { padding-right: 22px; }
.authcard form { padding: 6px 22px 0; display: flex; flex-direction: column; gap: 4px; }
.authcard .flabel { margin-top: 12px; }
.authcard .msg { margin-top: 10px; }
.authintro { font-family: var(--font-script); font-style: italic; font-weight: 500; font-size: clamp(3rem, 15vw, 4rem); letter-spacing: .005em; line-height: 1; margin: 0 0 6px; text-align: left; color: var(--script-a); }
.authwrap { width: min(100%, 440px); }
.authwrap .sub { margin: 0 4px 18px; }

/* ---------- Fertig / Testergebnis (Karteikarte) ---------- */
.done-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px var(--gutter-r) 20px var(--gutter-l); }
.donecard { position: relative; width: min(100%, 440px); padding: 0 0 72px; transform: rotate(-1deg); overflow: hidden; }
.donecard .d-head { height: 64px; padding: 0 22px 6px; border-bottom: 2px solid var(--margin); }
.donecard .d-title { font-family: var(--font-hand); font-weight: 700; font-size: 1.25rem; color: var(--pen); }
.donecard .lines { --lh: 44px; height: auto; min-height: calc(var(--lh) * 4); }
.donecard h2 { margin: 0; font-family: var(--font-hand); font-weight: 700; font-size: 1.6rem; line-height: var(--lh); color: var(--pen); }
#done.test .donecard h2 { font-size: 2.1rem; }
.donecard p { margin: 0; font-family: var(--font-hand); font-size: 1.1rem; line-height: var(--lh); }
.stamp { position: absolute; right: 18px; bottom: 18px; padding: 3px 14px; border: 3px solid var(--margin); border-radius: 4px; color: var(--margin); font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; letter-spacing: .02em; transform: rotate(-9deg); opacity: .92; outline: 1.5px solid var(--margin); outline-offset: 2px; animation: stampin .35s cubic-bezier(.2, 1.6, .4, 1) .15s backwards; }
@keyframes stampin { from { transform: rotate(-9deg) scale(2.2); opacity: 0; } }

/* ---------- Sheet (Einstellungen, Import) & Toast ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 24, 22, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .2s ease; }
.sheet-panel { position: relative; width: min(100%, 520px); padding: 26px var(--gutter-r) calc(18px + var(--safe-b)) var(--gutter-l); border-radius: 32px 32px 0 0; background: var(--sheet); color: var(--ink); border: 1px solid var(--edge); border-bottom: 0; box-shadow: 0 -16px 40px rgba(0, 0, 0, .3); display: flex; flex-direction: column; gap: 14px; animation: up .25s cubic-bezier(.2, .8, .2, 1); max-height: 92dvh; overflow-y: auto; }
.sheet-panel h2 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; letter-spacing: -.02em; }
.sheet-panel p { margin: 0; color: var(--muted); }
.sheet textarea { width: 100%; min-height: 160px; padding: 12px 14px; border: 1px solid var(--edge); border-radius: 20px; background: var(--surface); font-family: var(--font-body); font-size: 1.05rem; resize: vertical; }
.sheet textarea:focus-visible { outline: 0; border-color: var(--accent-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-strong) 30%, transparent); }
.stepper { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; gap: 8px; text-align: center; }
.stepper .icon-btn { width: 56px; height: 56px; }
.stepper b { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.stepper span { display: block; font-size: 13px; color: var(--muted); }
/* Einstellungen: Abschnitte, Schalter, Design */
.set { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.set:first-of-type { border-top: 0; padding-top: 4px; }
.switch { position: relative; display: flex; align-items: center; gap: 14px; min-height: 48px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 52px; height: 30px; margin: 0; }
.switch i { flex: none; width: 52px; height: 30px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s ease; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .2s ease; }
.switch input:checked + i { background: var(--pill); }
.switch input:checked + i::after { transform: translateX(22px); background: var(--pill-ink); }
.switch input:focus-visible + i { outline: 3px solid var(--accent-strong); outline-offset: 2px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: .92rem; }
.chip i { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.chip.on { border-color: var(--pill); box-shadow: 0 0 0 1.5px var(--pill); }
.gprev { height: 56px; border-radius: 18px; border: 1px solid var(--edge); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.clist { display: flex; flex-direction: column; gap: 8px; }
.crow { display: grid; grid-template-columns: 56px 1fr 44px; gap: 12px; align-items: center; }
.crow input[type="color"] { width: 56px; height: 44px; padding: 0; border: 1px solid var(--edge); border-radius: 14px; background: none; cursor: pointer; }
.crow input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.crow input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 10px; }
.crow input[type="color"]::-moz-color-swatch { border: 0; border-radius: 10px; }
.chex { font-variant-numeric: tabular-nums; color: var(--muted); letter-spacing: .05em; font-size: .95rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }

.toast { position: fixed; left: 50%; top: calc(14px + var(--safe-t)); z-index: 30; transform: translateX(-50%); max-width: min(92vw, 420px); padding: 12px 20px; border-radius: 22px; background: var(--pill); color: var(--pill-ink); font-weight: 600; text-align: center; box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .5); animation: toast 3.2s ease forwards; pointer-events: none; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 8%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-weight: 500; font-size: 1.3rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .card-inner, .btn, .nb, .lang-btn, .deckstack::before, .deckstack::after, .meter i, .stat .bar u, .switch i, .switch i::after { transition: none; }
  .card.in, .slot.hint, .stamp, .xp-pop, .toast, .sheet-panel, .sheet-bg, .risk .flame { animation: none; }
  .toast { opacity: 1; }
}
