/* ==========================================================================
   StudyGo v2 – Styles
   Verspielt, hochwertig, „tactile“: kräftige Farben, dicke Buttons mit
   Unterkante, große Flächen, weiche Schatten. Mobile-first, Dark Mode.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap');

:root {
  --primary: #2848B8;
  --primary-dark: #1E378F;
  --primary-soft: #E6ECFB;
  --green: #2FB67C;
  --green-dark: #23935F;
  --green-soft: #DDF5EA;
  --yellow: #F5B940;
  --yellow-dark: #C68F1A;
  --yellow-soft: #FFF4D1;
  --red: #E85D5D;
  --red-dark: #C24545;
  --red-soft: #FFE3E3;
  --blue: #2CB5C9;
  --blue-soft: #DDF5F7;
  --pink: #F472B6;
  --orange: #FB923C;

  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --surface-2: #EEF0F6;
  --text: #14203F;
  --text-2: #66698A;
  --text-3: #A3A6BD;
  --border: #E3E5EF;
  --border-strong: #D2D5E4;

  --shadow-sm: 0 1px 2px rgba(34, 33, 58, .05);
  --shadow: 0 8px 24px rgba(34, 33, 58, .08);
  --shadow-lg: 0 18px 48px rgba(34, 33, 58, .16);

  --radius: 20px;
  --radius-sm: 14px;
  --radius-lg: 28px;

  --topbar-h: 60px;
  --nav-h: 68px;
  --max-w: 720px;

  --font: "Nunito", -apple-system, BlinkMacSystemFont, "SF Pro Rounded", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --primary: #6F8CF0;
  --primary-dark: #4F6BD6;
  --primary-soft: #1E2C5E;
  --green-soft: #143723;
  --yellow-soft: #3a2d0c;
  --red-soft: #3f1a1a;
  --blue-soft: #10304a;
  --bg: #0B1330;
  --surface: #141F42;
  --surface-2: #1C2A55;
  --text: #F2F3F9;
  --text-2: #A9A7C4;
  --text-3: #6E6C8A;
  --border: #2F2E45;
  --border-strong: #3E3C58;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
}

html[data-anim="off"] *, html[data-anim="off"] *::before, html[data-anim="off"] *::after { animation: none !important; transition: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-weight: 600; background: var(--bg); color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; font-weight: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4 { margin: 0; font-weight: 900; letter-spacing: -.01em; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; }
.mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.spacer { height: 12px; }

/* ---------- Layout ---------- */
#app { min-height: 100vh; min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 2px solid var(--border); padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: var(--max-w); margin: 0 auto; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 1.2rem; }
.brand-logo { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(135deg, #0F1A3D, var(--primary)); color: #fff; display: grid; place-items: center; font-size: 1.05rem; box-shadow: 0 4px 10px rgba(106, 90, 224, .35); }
.stats { display: flex; gap: 6px; }
.stat { background: var(--surface-2); border-radius: 999px; padding: 6px 11px; font-size: .82rem; font-weight: 800; white-space: nowrap; }
.stat.bump { animation: bump .45s ease; }
@keyframes bump { 0% { transform: scale(1);} 40% { transform: scale(1.25);} 100% { transform: scale(1);} }

.view { max-width: var(--max-w); margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }

.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 2px solid var(--border); padding-bottom: env(safe-area-inset-bottom); display: flex; justify-content: center; }
.navitem { flex: 1; max-width: 150px; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .68rem; font-weight: 800; color: var(--text-3); transition: color .15s; }
.navitem .navicon { font-size: 1.4rem; line-height: 1; transition: transform .15s; }
.navitem.active { color: var(--primary); }
.navitem.active .navicon { transform: translateY(-2px) scale(1.12); }
.navitem:active .navicon { transform: scale(.9); }

/* ---------- Typo ---------- */
.page-title { font-size: 1.75rem; margin-bottom: 4px; }
.page-sub { color: var(--text-2); margin-bottom: 18px; }
.section-title { font-size: 1.05rem; margin: 22px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------- Buttons (chunky) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 15px 20px; border-radius: 16px; font-weight: 900; font-size: 1rem; line-height: 1; letter-spacing: .01em; background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); transition: transform .08s, box-shadow .08s, filter .15s; user-select: none; -webkit-user-select: none; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--primary-dark); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.block { width: 100%; }
.btn.big { padding: 18px 24px; font-size: 1.1rem; border-radius: 20px; }
.btn.green { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); } .btn.green:active { box-shadow: 0 1px 0 var(--green-dark); }
.btn.yellow { background: var(--yellow); color: #3b2a00; box-shadow: 0 4px 0 var(--yellow-dark); } .btn.yellow:active { box-shadow: 0 1px 0 var(--yellow-dark); }
.btn.red { background: var(--red); box-shadow: 0 4px 0 var(--red-dark); } .btn.red:active { box-shadow: 0 1px 0 var(--red-dark); }
.btn.blue { background: var(--blue); color: #062a3d; box-shadow: 0 4px 0 #1a9bd6; } .btn.blue:active { box-shadow: 0 1px 0 #1a9bd6; }
.btn.ghost { background: var(--surface); color: var(--text); border: 2px solid var(--border-strong); box-shadow: 0 3px 0 var(--border-strong); } .btn.ghost:active { box-shadow: 0 0 0 var(--border-strong); }
.btn.soft { background: var(--primary-soft); color: var(--primary); box-shadow: none; } .btn.soft:active { transform: scale(.97); }
.btn.sm { padding: 9px 14px; font-size: .85rem; border-radius: 12px; box-shadow: none; }
.btn.icon { width: 42px; height: 42px; padding: 0; border-radius: 12px; font-size: 1.1rem; box-shadow: none; }
.btn-link { color: var(--primary); font-weight: 800; padding: 6px 4px; }
.btn-row { display: flex; gap: 10px; }
.btn-row > .btn { flex: 1; }

/* ---------- Cards / Tiles ---------- */
.card { background: var(--surface); border-radius: var(--radius); border: 2px solid var(--border); padding: 18px; }
.card.pop { box-shadow: 0 4px 0 var(--border); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.tile { position: relative; overflow: hidden; background: var(--surface); border-radius: var(--radius); border: 2px solid var(--border); box-shadow: 0 4px 0 var(--border); padding: 16px 14px 14px; min-height: 130px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; text-align: left; width: 100%; transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); }
.tile:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.tile .tile-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; font-size: 1.55rem; color: #fff; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.tile .tile-name { font-weight: 900; font-size: 1rem; }
.tile .tile-meta { color: var(--text-2); font-size: .76rem; font-weight: 700; }
.tile.add { border: 2px dashed var(--border-strong); background: transparent; box-shadow: none; align-items: center; justify-content: center; color: var(--text-2); font-weight: 900; }
.tile.add .tile-icon { background: var(--surface-2); color: var(--text-2); box-shadow: none; }

.list-item { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); box-shadow: 0 3px 0 var(--border); padding: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; transition: transform .1s, box-shadow .1s; }
.list-item:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.list-item .li-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; color: #fff; }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 900; }
.list-item .li-sub { color: var(--text-2); font-size: .8rem; margin-top: 2px; }
.list-item .li-arrow { color: var(--text-3); font-size: 1.2rem; }

/* ---------- Progress bars ---------- */
.bar { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--primary); width: 0; transition: width .6s cubic-bezier(.2,.8,.2,1); position: relative; }
.bar > span::after { content: ""; position: absolute; left: 6px; right: 6px; top: 3px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.35); }
.bar.green > span { background: var(--green); }
.bar.yellow > span { background: var(--yellow); }
.bar.thin { height: 8px; } .bar.thin > span::after { display: none; }
.bar.big { height: 18px; }
.bar-label { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 800; color: var(--text-2); margin-bottom: 6px; }

/* ---------- Hero / Startseite ---------- */
.hero { background: linear-gradient(135deg, #0F1A3D 0%, #1F3A8F 60%, #2848B8 100%); color: #fff; border-radius: var(--radius-lg); padding: 22px 20px; box-shadow: 0 14px 34px rgba(15, 26, 61, .35); margin-bottom: 16px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -50px; top: -50px; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,255,255,.12); }
.hero h1 { font-size: 1.55rem; margin-bottom: 4px; }
.hero p { opacity: .92; font-size: .92rem; }
.hero .bar { background: rgba(255,255,255,.25); margin-top: 12px; }
.hero .bar > span { background: #fff; } .hero .bar > span::after { background: rgba(0,0,0,.08); }
.hero .bar-label { color: rgba(255,255,255,.92); }
.hero.goal-done { background: linear-gradient(135deg, #1B6B4F 0%, #2FB67C 70%, #5ED0A0 100%); box-shadow: 0 14px 34px rgba(47,182,124,.35); }
.hero-mascot { position: absolute; right: 4px; top: 6px; width: 118px; height: 96px; animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-4deg);} 50% { transform: translateY(-6px) rotate(4deg);} }
.hero-body { position: relative; z-index: 1; padding-right: 96px; }

.level-box { display: flex; align-items: center; gap: 14px; }
.level-badge { width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, #F7C948, #E29A1A); color: #fff; display: grid; place-items: center; font-weight: 900; font-size: 1.25rem; box-shadow: 0 6px 14px rgba(251,146,60,.4), inset 0 -3px 0 rgba(0,0,0,.15); }

.today-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 13px 14px; margin-bottom: 10px; box-shadow: 0 3px 0 var(--border); }
.today-item .ti-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; color: #fff; flex-shrink: 0; }
.today-item .ti-title { font-weight: 900; font-size: .95rem; }
.today-item .ti-sub { color: var(--text-2); font-size: .78rem; }
.today-item.warn { border-color: var(--yellow); background: var(--yellow-soft); }
.today-item.urgent { border-color: var(--red); background: var(--red-soft); }

/* ---------- Lernpfad ---------- */
.path { position: relative; padding: 10px 0 20px; }
.path-node-wrap { position: relative; display: flex; align-items: center; min-height: 118px; }
.path-node-wrap.left { justify-content: flex-start; padding-left: 12%; }
.path-node-wrap.right { justify-content: flex-end; padding-right: 12%; }
.path-node-wrap.center { justify-content: center; }
.path-node { position: relative; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; color: #fff; background: var(--surface-2); border: 0; box-shadow: 0 7px 0 var(--border-strong); transition: transform .1s, box-shadow .1s; }
.path-node:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--border-strong); }
.path-node.done { background: var(--green); box-shadow: 0 7px 0 var(--green-dark); }
.path-node.active { background: var(--primary); box-shadow: 0 7px 0 var(--primary-dark); }
.path-node.active::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 4px solid var(--primary); opacity: .35; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .35;} 50% { transform: scale(1.12); opacity: .12;} }
.path-node.locked { color: var(--text-3); filter: grayscale(1); opacity: .8; }
.path-node.final { width: 96px; height: 96px; font-size: 2.4rem; background: var(--yellow); box-shadow: 0 7px 0 var(--yellow-dark); color: #fff; }
.path-node.final.locked { background: var(--surface-2); box-shadow: 0 7px 0 var(--border-strong); }
.path-label { position: absolute; left: 50%; transform: translateX(-50%); bottom: -30px; white-space: nowrap; font-size: .72rem; font-weight: 900; color: var(--text-2); text-align: center; }
.path-stars { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); font-size: .8rem; letter-spacing: -2px; white-space: nowrap; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.path-start { position: absolute; top: -34px; left: 50%; transform: translateX(-50%); background: var(--surface); color: var(--primary); border: 2px solid var(--primary); border-radius: 10px; padding: 4px 10px; font-size: .72rem; font-weight: 900; letter-spacing: .06em; animation: bob 1.2s ease-in-out infinite; white-space: nowrap; }
.path-start::after { content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%) rotate(45deg); width: 10px; height: 10px; background: var(--surface); border-right: 2px solid var(--primary); border-bottom: 2px solid var(--primary); }
@keyframes bob { 0%,100% { transform: translate(-50%, 0);} 50% { transform: translate(-50%, -5px);} }
.path-line { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.path-node-wrap > * { z-index: 1; }
.path-unit { display: flex; align-items: center; gap: 12px; background: var(--primary); color: #fff; border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 4px 0 var(--primary-dark); margin-bottom: 8px; }
.path-unit b { display: block; font-size: 1rem; }
.path-unit span { font-size: .8rem; opacity: .9; }

/* ---------- Lernmodi-Auswahl ---------- */
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .mode-grid { grid-template-columns: repeat(3, 1fr); } }
.mode-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); box-shadow: 0 4px 0 var(--border); padding: 14px; text-align: left; transition: transform .1s, box-shadow .1s; }
.mode-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border); }
.mode-btn .mb-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; }
.mode-btn b { font-size: .95rem; }
.mode-btn span { font-size: .75rem; color: var(--text-2); font-weight: 700; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: 16px; margin: 14px 0; }
.tab { flex: 1; padding: 10px 6px; border-radius: 12px; font-weight: 900; font-size: .82rem; color: var(--text-2); transition: background .15s, color .15s; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 800; font-size: .82rem; margin-bottom: 6px; color: var(--text-2); }
.input, .select, .textarea { width: 100%; padding: 13px 14px; border-radius: 14px; border: 2px solid var(--border-strong); background: var(--surface); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 1rem; font-weight: 700; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
.select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; transition: transform .1s; }
.color-dot.selected { border-color: var(--text); transform: scale(1.12); }
.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-pick { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); font-size: 1.3rem; display: grid; place-items: center; border: 2px solid transparent; }
.icon-pick.selected { border-color: var(--primary); background: var(--primary-soft); }
.toggle { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 2px solid var(--border); gap: 12px; }
.toggle:last-child { border-bottom: 0; }
.toggle-label { font-weight: 900; }
.toggle-sub { color: var(--text-2); font-size: .8rem; }
.switch { position: relative; width: 52px; height: 30px; border-radius: 999px; background: var(--border-strong); transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.2); transition: transform .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(22px); }

/* ---------- Option tiles ---------- */
.option-tile { display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; background: var(--surface); border: 2px solid var(--border); box-shadow: 0 4px 0 var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; transition: border-color .15s, transform .1s, box-shadow .1s; }
.option-tile:hover { border-color: var(--primary); }
.option-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border); }
.option-tile .ot-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--primary-soft); display: grid; place-items: center; font-size: 1.6rem; flex-shrink: 0; }
.option-tile .ot-title { font-weight: 900; font-size: 1.02rem; }
.option-tile .ot-sub { color: var(--text-2); font-size: .8rem; font-weight: 700; }

/* ---------- OCR ---------- */
.ocr-preview { width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--radius-sm); background: var(--surface-2); display: block; }
.ocr-status { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--primary-soft); border-radius: var(--radius-sm); color: var(--primary); font-weight: 800; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(106,90,224,.25); border-top-color: var(--primary); animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Karten-Editor ---------- */
.edit-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.edit-card .ec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.edit-card .ec-num { font-weight: 900; color: var(--text-3); font-size: .78rem; }
.edit-card .textarea { min-height: 54px; padding: 10px 12px; font-size: .95rem; }
.edit-card .ec-label { font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 6px 0 4px; }
.tag { display: inline-block; font-size: .7rem; font-weight: 900; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }

/* ---------- Übungen (gemeinsam) ---------- */
.ex-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.ex-head .bar { flex: 1; }
.ex-head .hearts { font-size: .85rem; font-weight: 900; color: var(--red); white-space: nowrap; }
.ex-prompt { font-size: .8rem; font-weight: 900; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }
.ex-q { background: var(--surface); border-radius: var(--radius-lg); border: 2px solid var(--border); box-shadow: 0 5px 0 var(--border); padding: 26px 22px; text-align: center; font-size: 1.25rem; font-weight: 900; margin-bottom: 16px; min-height: 110px; display: grid; place-items: center; animation: cardIn .3s ease; line-height: 1.35; word-break: break-word; }
@keyframes cardIn { from { opacity: 0; transform: translateX(30px) rotate(1.5deg);} to { opacity: 1; transform: none;} }
.ex-q.small { font-size: 1.05rem; padding: 18px; min-height: 80px; }

.flashcard-wrap { perspective: 1200px; margin: 4px 0 18px; }
.flashcard { position: relative; min-height: 290px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 6px 0 var(--border), var(--shadow); border: 2px solid var(--border); padding: 28px 24px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; animation: cardIn .3s ease; }
.flashcard.flip { animation: flipIn .35s ease; }
@keyframes flipIn { 0% { transform: rotateY(90deg); opacity: .3;} 100% { transform: rotateY(0); opacity: 1;} }
.flashcard .fc-label { position: absolute; top: 16px; left: 20px; font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.flashcard .fc-text { font-size: 1.35rem; font-weight: 900; line-height: 1.35; word-break: break-word; }
.flashcard .fc-answer { font-size: 1.2rem; font-weight: 800; color: var(--primary); line-height: 1.4; }
.flashcard .fc-divider { width: 60px; height: 4px; border-radius: 4px; background: var(--border); margin: 18px 0; }
.flashcard .fc-question-small { font-size: .95rem; color: var(--text-2); font-weight: 700; }
.rate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rate-btn { padding: 15px 8px; border-radius: 18px; font-weight: 900; font-size: .88rem; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .08s, box-shadow .08s; }
.rate-btn span:first-child { font-size: 1.4rem; }
.rate-btn.r0 { background: var(--red); box-shadow: 0 4px 0 var(--red-dark); }
.rate-btn.r1 { background: var(--yellow); color: #3b2a00; box-shadow: 0 4px 0 var(--yellow-dark); }
.rate-btn.r2 { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.rate-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }

.quiz-options { display: grid; gap: 10px; }
.quiz-opt { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 2px solid var(--border-strong); border-radius: 16px; padding: 14px 16px; font-weight: 800; font-size: 1rem; box-shadow: 0 4px 0 var(--border-strong); transition: transform .08s, border-color .15s, background .2s; }
.quiz-opt .qo-letter { width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-weight: 900; flex-shrink: 0; }
.quiz-opt:hover { border-color: var(--primary); }
.quiz-opt:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border-strong); }
.quiz-opt:disabled { pointer-events: none; }
.quiz-opt.correct { background: var(--green-soft); border-color: var(--green); box-shadow: 0 4px 0 var(--green); animation: pop .4s ease; }
.quiz-opt.correct .qo-letter { background: var(--green); color: #fff; }
.quiz-opt.wrong { background: var(--red-soft); border-color: var(--red); box-shadow: 0 4px 0 var(--red); animation: shake .4s ease; }
.quiz-opt.wrong .qo-letter { background: var(--red); color: #fff; }
.quiz-opt.dim { opacity: .45; }
@keyframes pop { 0% { transform: scale(1);} 40% { transform: scale(1.04);} 100% { transform: scale(1);} }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-6px);} 75% { transform: translateX(6px);} }
.tf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-row .btn { padding: 22px; font-size: 1.1rem; }

.write-input { width: 100%; padding: 16px; border-radius: 16px; border: 2px solid var(--border-strong); background: var(--surface); font-size: 1.1rem; font-weight: 800; outline: none; text-align: center; }
.write-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.write-input.ok { border-color: var(--green); background: var(--green-soft); }
.write-input.bad { border-color: var(--red); background: var(--red-soft); }

.feedback { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation: slideUp .25s cubic-bezier(.2,.8,.2,1); border-top: 3px solid; }
.feedback.ok { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.feedback.bad { background: var(--red-soft); border-color: var(--red); color: var(--red-dark); }
html[data-theme="dark"] .feedback.ok { color: #86efac; } html[data-theme="dark"] .feedback.bad { color: #fca5a5; }
.feedback-inner { max-width: var(--max-w); margin: 0 auto; }
.feedback .fb-title { font-size: 1.15rem; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.feedback .fb-sub { font-size: .92rem; font-weight: 700; margin-top: 4px; }
.feedback .btn { margin-top: 12px; }
.feedback.ok .btn { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.feedback.bad .btn { background: var(--red); box-shadow: 0 4px 0 var(--red-dark); }

/* Zuordnen */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match-tile { min-height: 76px; padding: 12px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border-strong); box-shadow: 0 4px 0 var(--border-strong); font-weight: 800; font-size: .9rem; display: grid; place-items: center; text-align: center; transition: transform .1s, opacity .3s, background .2s, border-color .2s; word-break: break-word; }
.match-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--border-strong); }
.match-tile.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 4px 0 var(--primary); }
.match-tile.ok { border-color: var(--green); background: var(--green-soft); box-shadow: 0 4px 0 var(--green); animation: pop .35s ease; }
.match-tile.gone { opacity: 0; pointer-events: none; transform: scale(.85); }
.match-tile.bad { border-color: var(--red); background: var(--red-soft); animation: shake .35s ease; }
.match-timer { text-align: center; font-weight: 900; color: var(--text-2); margin-bottom: 12px; font-size: 1.1rem; }

/* ---------- Ergebnis ---------- */
.result-hero { text-align: center; padding: 26px 16px 8px; }
.result-hero .big-emoji { font-size: 4rem; animation: bounce .8s ease; display: block; }
@keyframes bounce { 0% { transform: scale(.3); opacity: 0;} 50% { transform: scale(1.15);} 70% { transform: scale(.95);} 100% { transform: scale(1); opacity: 1;} }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.result-stat { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 14px 8px; text-align: center; box-shadow: 0 3px 0 var(--border); }
.result-stat b { display: block; font-size: 1.4rem; }
.result-stat span { font-size: .72rem; color: var(--text-2); font-weight: 800; }
.stars-big { font-size: 2.6rem; letter-spacing: 2px; margin: 6px 0; }
.stars-big .off { opacity: .2; filter: grayscale(1); }
.stars-big span { display: inline-block; animation: starIn .5s ease backwards; }
.stars-big span:nth-child(2) { animation-delay: .2s; } .stars-big span:nth-child(3) { animation-delay: .4s; }
@keyframes starIn { from { transform: scale(0) rotate(-30deg); opacity: 0;} to { transform: none; opacity: 1;} }
.grade-ring { width: 130px; height: 130px; border-radius: 50%; margin: 10px auto; display: grid; place-items: center; font-size: 1.8rem; font-weight: 900; background: conic-gradient(var(--green) calc(var(--pct) * 1%), var(--surface-2) 0); position: relative; }
.grade-ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.grade-ring span { position: relative; }

/* ---------- Statistik / Abzeichen ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.stat-card { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: 0 3px 0 var(--border); }
.stat-card .sc-icon { font-size: 1.5rem; }
.stat-card .sc-value { font-size: 1.5rem; font-weight: 900; margin-top: 6px; }
.stat-card .sc-label { color: var(--text-2); font-size: .76rem; font-weight: 800; }
.subject-progress { margin-bottom: 14px; }
.subject-progress .sp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.subject-progress .sp-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1rem; }
.subject-progress .sp-name { font-weight: 900; flex: 1; }
.subject-progress .sp-pct { font-weight: 800; color: var(--text-2); font-size: .85rem; }
.badge-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (min-width: 560px) { .badge-grid { grid-template-columns: repeat(6, 1fr); } }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 10px 4px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border); }
.badge .b-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; background: linear-gradient(135deg, var(--yellow), var(--orange)); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.badge .b-name { font-size: .66rem; font-weight: 900; line-height: 1.15; }
.badge.locked { opacity: .45; } .badge.locked .b-icon { background: var(--surface-2); filter: grayscale(1); box-shadow: none; }

/* ---------- Zusammenfassung / Plan ---------- */
.summary-box { background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 18px; }
.summary-box li { margin-bottom: 8px; line-height: 1.5; }
.summary-box ul { margin: 0; padding-left: 20px; }
.keyterms { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.keyterms .chip { background: var(--primary-soft); color: var(--primary); }
.plan-box { display: flex; align-items: center; gap: 12px; border-radius: var(--radius); padding: 14px 16px; border: 2px solid var(--border); background: var(--surface); }
.plan-box .pb-days { width: 58px; height: 58px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; text-align: center; line-height: 1; flex-shrink: 0; }
.plan-box .pb-days b { font-size: 1.4rem; display: block; }
.plan-box .pb-days span { font-size: .6rem; font-weight: 900; text-transform: uppercase; }
.plan-box.tight .pb-days { background: var(--yellow-soft); color: var(--yellow-dark); }
.plan-box.late .pb-days, .plan-box.past .pb-days { background: var(--red-soft); color: var(--red-dark); }
.plan-box.done .pb-days { background: var(--green-soft); color: var(--green-dark); }

/* ---------- Onboarding ---------- */
.onboard { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.onboard-card { width: 100%; max-width: 440px; text-align: center; animation: fadeIn .3s ease; }
.onboard-card .ob-mascot { width: 240px; height: 190px; margin: 0 auto 10px; animation: floaty 3s ease-in-out infinite; }
.onboard-card h1 { font-size: 1.8rem; margin-bottom: 8px; }
.onboard-card p { color: var(--text-2); margin-bottom: 22px; }
.dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 18px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.dots span.on { background: var(--primary); width: 22px; border-radius: 4px; }
.goal-pick { display: grid; gap: 10px; margin-bottom: 20px; text-align: left; }
.goal-opt { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border-strong); box-shadow: 0 3px 0 var(--border-strong); font-weight: 800; }
.goal-opt.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 3px 0 var(--primary); }
.goal-opt small { color: var(--text-2); font-weight: 700; }
.avatar-pick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.avatar-pick button { width: 54px; height: 54px; border-radius: 16px; background: var(--surface); border: 2px solid var(--border-strong); font-size: 1.7rem; display: grid; place-items: center; }
.avatar-pick button.selected { border-color: var(--primary); background: var(--primary-soft); transform: scale(1.08); }

/* ---------- Empty state / header ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--text-2); }
.empty .empty-icon { font-size: 3rem; margin-bottom: 8px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.back-btn { width: 42px; height: 42px; border-radius: 13px; background: var(--surface); border: 2px solid var(--border); box-shadow: 0 3px 0 var(--border); display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.back-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.page-head .ph-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-size: 1.3rem; }
.page-head h1 { font-size: 1.35rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modal / Toast / FX ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 18, 40, .55); z-index: 60; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .15s; backdrop-filter: blur(2px); }
@media (min-width: 560px) { .modal-backdrop { align-items: center; } }
.modal { background: var(--surface); width: 100%; max-width: 480px; border-radius: 26px 26px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); animation: slideUp .25s cubic-bezier(.2,.8,.2,1); max-height: 90vh; overflow-y: auto; }
@media (min-width: 560px) { .modal { border-radius: 26px; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0;} to { transform: none; opacity: 1;} }
.modal h2 { font-size: 1.2rem; margin-bottom: 14px; }
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; font-size: .9rem; max-width: 90vw; }
.toast.success { background: var(--green); color: #fff; }
.toast.error { background: var(--red); color: #fff; }
.toast.badge { background: linear-gradient(135deg, var(--yellow), var(--orange)); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.95);} to { opacity: 1; transform: none;} }
.xp-float { position: fixed; z-index: 80; font-weight: 900; color: var(--yellow); font-size: 1.3rem; text-shadow: 0 2px 6px rgba(0,0,0,.25); animation: floatUp 1s ease forwards; pointer-events: none; }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(10px) scale(.8);} 20% { opacity: 1; transform: translateY(0) scale(1.1);} 100% { opacity: 0; transform: translateY(-60px) scale(1);} }
.confetti { position: fixed; top: -10px; width: 10px; height: 14px; z-index: 80; pointer-events: none; animation: confettiFall linear forwards; border-radius: 2px; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0); opacity: 1;} 100% { transform: translateY(105vh) rotate(720deg); opacity: .6;} }

.kbd-hint { color: var(--text-3); font-size: .75rem; text-align: center; margin-top: 10px; }
@media (max-width: 559px) { .kbd-hint { display: none; } }
.danger-zone { border-color: var(--red-soft); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 7px 12px; border-radius: 999px; background: var(--surface-2); font-weight: 800; font-size: .8rem; }
.chip.green { background: var(--green-soft); color: var(--green-dark); }
.chip.red { background: var(--red-soft); color: var(--red-dark); }
.chip.yellow { background: var(--yellow-soft); color: #8a5a00; }
.chip.blue { background: var(--blue-soft); color: #0b6a99; }
html[data-theme="dark"] .chip.green { color: #86efac; } html[data-theme="dark"] .chip.red { color: #fca5a5; } html[data-theme="dark"] .chip.yellow { color: #fde68a; } html[data-theme="dark"] .chip.blue { color: #7dd3fc; }

/* ---------- Aufgaben-Hilfe ---------- */
.explain-box { line-height: 1.55; font-weight: 600; }
.explain-box .md-h { font-size: 1rem; margin: 14px 0 6px; color: var(--primary); }
.explain-box .md-h:first-child { margin-top: 0; }
.explain-box p { margin: 0 0 8px; }
.explain-box ul, .explain-box ol { margin: 0 0 8px; padding-left: 22px; }
.explain-box li { margin-bottom: 4px; }
.explain-box code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* ---------- Streak / Flamme ---------- */
.level-badge.flame { background: linear-gradient(135deg, #F7C948, #E29A1A); font-size: 1.6rem; }
.level-badge.flame.off { background: var(--surface-2); filter: grayscale(1); opacity: .6; box-shadow: none; }
.week-dots { display: flex; gap: 4px; margin-top: 4px; }
.week-dots .wd { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.week-dots .wd span { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: .85rem; border: 2px solid transparent; }
.week-dots .wd.on span { background: var(--yellow-soft); }
.week-dots .wd.today span { border-color: var(--primary); }
.week-dots .wd small { font-size: .62rem; font-weight: 800; color: var(--text-3); }
.xp-float { color: var(--green); }

/* ---------- Streak-Feier (Vollbild) ---------- */
.streak-screen { position: fixed; inset: 0; z-index: 120; background: linear-gradient(170deg, #0F1A3D 0%, #1F3A8F 60%, #2848B8 100%); color: #fff; display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .3s ease; overflow-y: auto; }
.ss-inner { width: 100%; max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.ss-mascot { width: 250px; height: 200px; animation: floaty 3s ease-in-out infinite; filter: drop-shadow(0 12px 30px rgba(44,181,201,.35)); }
.ss-number { font-size: 6rem; line-height: 1; font-weight: 900; color: #F5B940; text-shadow: 0 6px 0 rgba(0,0,0,.18); animation: bounce .8s ease; letter-spacing: -.02em; }
.ss-label { font-size: 1.3rem; font-weight: 900; margin-top: 4px; opacity: .95; }
.ss-milestone { margin-top: 10px; background: rgba(245,185,64,.18); border: 2px solid #F5B940; color: #F5B940; padding: 6px 14px; border-radius: 999px; font-weight: 900; font-size: .85rem; }
.ss-week { display: flex; gap: 8px; margin: 26px 0 10px; }
.ss-day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ss-day small { font-size: .7rem; font-weight: 900; opacity: .8; }
.ss-day span { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; font-weight: 900; font-size: 1rem; color: #1F2452; border: 2px solid transparent; }
.ss-day.on span { background: #F5B940; box-shadow: 0 3px 0 #C68F1A; }
.ss-day.today span { border-color: #fff; }
.ss-text { opacity: .9; font-size: .95rem; margin: 6px 0 22px; max-width: 300px; }
.ss-share { width: 100%; background: #fff; color: #1F2452; box-shadow: 0 4px 0 #C9CCE0; }
.ss-share:active { box-shadow: 0 1px 0 #C9CCE0; }
.ss-continue { margin-top: 16px; color: #fff; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; padding: 10px; opacity: .9; }
