:root {
  --bg: #f4f1ff; --card: #ffffff; --ink: #231a4d; --muted: #6f6894; --line: #e4def9;
  --pri: #6c4cf5; --pri2: #8f73ff; --ok: #1fb877; --okbg: #e3f8ee; --bad: #ef4d62; --badbg: #fde8eb;
  --gold: #ffb830; --teal: #14b8c4; --pink: #ff6fae; --shadow: 0 6px 0 rgba(60, 40, 160, .10), 0 10px 30px rgba(60, 40, 160, .10);
  --r: 20px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: Nunito, system-ui, sans-serif; font-size: 17px; line-height: 1.45;
  background-image: radial-gradient(circle at 10% 0%, #e7e0ff 0, transparent 40%), radial-gradient(circle at 100% 30%, #dcf6f8 0, transparent 35%);
  min-height: 100vh; }
button { font-family: inherit; }
#app { max-width: 920px; margin: 0 auto; padding: 16px 16px 80px; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 28px; font-weight: 900; } h2 { font-size: 22px; font-weight: 900; } h3 { font-size: 18px; font-weight: 800; }
.muted { color: var(--muted); } .small { font-size: 14px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.btn { border: 0; border-radius: 16px; padding: 14px 20px; font-size: 17px; font-weight: 800; cursor: pointer; background: var(--pri); color: #fff;
  box-shadow: 0 5px 0 #4a2fc9; transition: transform .08s, box-shadow .08s, filter .2s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #4a2fc9; }
.btn:disabled { filter: grayscale(.7) opacity(.6); cursor: default; }
.btn.ok { background: var(--ok); box-shadow: 0 5px 0 #138a58; } .btn.gold { background: var(--gold); color: #3d2a00; box-shadow: 0 5px 0 #c98700; }
.btn.ghost { background: #fff; color: var(--pri); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.btn.big { width: 100%; padding: 18px; font-size: 19px; }
.btn.sm { padding: 8px 14px; font-size: 15px; border-radius: 12px; box-shadow: 0 3px 0 #4a2fc9; }
.btn.ghost.sm { box-shadow: 0 3px 0 var(--line); }
input, textarea { font-family: inherit; font-size: 18px; width: 100%; border: 3px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--ink); background: #fff; outline: none; transition: border-color .2s; }
input:focus, textarea:focus { border-color: var(--pri2); }
textarea { min-height: 140px; resize: vertical; line-height: 1.5; }
label { font-weight: 800; display: block; margin: 10px 0 4px; }

/* top bar */
.top { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.top .lvl { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; background: #fff; border-radius: 18px; padding: 8px 14px; box-shadow: var(--shadow); cursor: pointer; }
.lvlnum { width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--pri), var(--pink)); color: #fff; font-weight: 900; display: grid; place-items: center; font-size: 19px; flex: none; }
.xpbar { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 3px; }
.xpbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ffd76b); border-radius: 99px; transition: width 1s cubic-bezier(.2, .9, .3, 1.2); }
.chip { background: #fff; border-radius: 16px; padding: 10px 14px; font-weight: 900; box-shadow: var(--shadow); display: flex; gap: 6px; align-items: center; border: 0; font-size: 17px; color: var(--ink); cursor: pointer; }
.chip.fire { color: #e8590c; }

/* mascot */
.mascot { display: flex; gap: 12px; align-items: flex-end; margin: 4px 0 16px; }
.owl { font-size: 58px; animation: bob 3s ease-in-out infinite; filter: drop-shadow(0 6px 4px rgba(0,0,0,.12)); flex: none; line-height: 1; }
.bubble { background: #fff; border-radius: 18px 18px 18px 4px; padding: 12px 16px; box-shadow: var(--shadow); font-weight: 700; position: relative; animation: pop .4s; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes floatup { 0% { transform: translateY(0) scale(.8); opacity: 0; } 20% { opacity: 1; transform: translateY(-10px) scale(1.2); } 100% { transform: translateY(-90px) scale(1); opacity: 0; } }
@keyframes slidein { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes spin { to { transform: rotate(360deg); } }
.slidein { animation: slidein .35s ease-out both; }
.shake { animation: shake .45s; }
.popin { animation: pop .45s both; }

/* home */
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
@media (max-width: 640px) { .hero { grid-template-columns: 1fr; } }
.action { border: 0; text-align: left; border-radius: 24px; padding: 20px; color: #fff; cursor: pointer; position: relative; overflow: hidden; min-height: 150px; transition: transform .15s; box-shadow: 0 7px 0 rgba(0,0,0,.18); }
.action:hover { transform: translateY(-3px) rotate(-.5deg); } .action:active { transform: translateY(3px); }
.action h2 { color: #fff; font-size: 23px; } .action p { margin: 4px 0 0; opacity: .95; font-weight: 700; }
.action .ico { position: absolute; right: 10px; bottom: -8px; font-size: 84px; opacity: .9; transform: rotate(-10deg); }
.a1 { background: linear-gradient(135deg, #6c4cf5, #a55cf7); } .a2 { background: linear-gradient(135deg, #ff7a59, #ff4f8b); }
.a3 { background: linear-gradient(135deg, #14b8c4, #1fb877); } .a4 { background: linear-gradient(135deg, #ffb830, #ff8a1f); }
.countdown { background: linear-gradient(135deg, #231a4d, #4a3a99); color: #fff; border-radius: 20px; padding: 14px 18px; display: flex; align-items: center; gap: 14px; margin-bottom: 16px; box-shadow: var(--shadow); }
.countdown b { font-size: 34px; font-weight: 900; color: var(--gold); }
.skill { background: #fff; border-radius: 18px; padding: 14px 10px; text-align: center; cursor: pointer; border: 3px solid transparent; box-shadow: var(--shadow); transition: transform .12s, border-color .2s; position: relative; }
.skill:hover { transform: translateY(-3px); border-color: var(--pri2); }
.skill .em { font-size: 30px; } .skill .nm { font-weight: 800; font-size: 14px; margin-top: 4px; line-height: 1.15; }
.ring { width: 64px; height: 64px; margin: 0 auto; position: relative; }
.ring svg { transform: rotate(-90deg); } .ring .em { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; }
.skill .weak { position: absolute; top: 6px; right: 8px; font-size: 12px; background: var(--badbg); color: var(--bad); border-radius: 99px; padding: 1px 7px; font-weight: 900; }
.group-title { font-weight: 900; color: var(--muted); text-transform: uppercase; font-size: 13px; letter-spacing: .08em; margin: 14px 0 8px; }
.badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge { width: 74px; text-align: center; font-size: 12px; font-weight: 800; line-height: 1.15; }
.badge .b { width: 58px; height: 58px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: linear-gradient(135deg, #fff6d8, #ffe08a); box-shadow: 0 4px 0 #e9b93d; }
.badge.off { opacity: .35; filter: grayscale(1); }
.list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; border-bottom: 2px dashed var(--line); gap: 10px; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.grade { font-weight: 900; font-size: 22px; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; }
.gr1, .gr2 { background: var(--ok); } .gr3 { background: var(--teal); } .gr4 { background: var(--gold); } .gr5, .gr6 { background: var(--bad); } .grx { background: var(--muted); }

/* round */
.progress { height: 16px; background: #fff; border-radius: 99px; overflow: hidden; box-shadow: inset 0 2px 4px rgba(0,0,0,.08); flex: 1; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #5be0a6); transition: width .5s cubic-bezier(.2, .9, .3, 1.3); border-radius: 99px; }
.combo { font-weight: 900; color: #e8590c; min-width: 70px; text-align: right; font-size: 18px; }
.combo.hot { animation: pulse .6s infinite; }
.q { font-size: 21px; font-weight: 800; white-space: pre-line; margin-bottom: 14px; }
.ctx { background: #f7f5ff; border-left: 5px solid var(--pri2); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 18px; white-space: pre-line; }
.tag { display: inline-flex; gap: 6px; align-items: center; background: #efeaff; color: var(--pri); border-radius: 99px; padding: 4px 12px; font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.tag.rev { background: #fff1d6; color: #b36b00; }
.opt { display: block; width: 100%; text-align: left; border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 14px 16px; font-size: 18px; font-weight: 700; margin-bottom: 10px; cursor: pointer; color: var(--ink); transition: transform .1s, border-color .15s, background .15s; box-shadow: 0 4px 0 var(--line); }
.opt:hover:not(:disabled) { border-color: var(--pri2); transform: translateY(-2px); }
.opt.right { border-color: var(--ok); background: var(--okbg); box-shadow: 0 4px 0 #9fe3c3; }
.opt.wrong { border-color: var(--bad); background: var(--badbg); box-shadow: 0 4px 0 #f6b3bd; }
.opt:disabled { cursor: default; }
.fb { border-radius: 18px; padding: 16px; margin-top: 14px; animation: slidein .3s; }
.fb.ok { background: var(--okbg); } .fb.bad { background: var(--badbg); } .fb.mid { background: #fff5dc; }
.fb h3 { margin-bottom: 4px; }
.xpfloat { position: fixed; font-weight: 900; font-size: 30px; color: var(--gold); text-shadow: 0 2px 0 #c98700; pointer-events: none; animation: floatup 1.3s ease-out forwards; z-index: 50; }
.order-pool .opt, .order-ans .opt { font-size: 16px; }
.order-ans { min-height: 60px; border: 3px dashed var(--line); border-radius: 16px; padding: 8px; margin-bottom: 12px; }
.order-ans .opt { border-color: var(--pri2); background: #f7f5ff; }
.order-ans .num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--pri); color: #fff; font-size: 14px; margin-right: 8px; }
.diff span { display: inline-block; padding: 2px 6px; border-radius: 8px; margin: 2px; font-weight: 800; }
.diff .ok { background: var(--okbg); } .diff .no { background: var(--badbg); }
.speak { font-size: 44px; width: 96px; height: 96px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--teal), var(--ok)); color: #fff; cursor: pointer; box-shadow: 0 6px 0 #0f8a74; }
.speak:active { transform: translateY(4px); box-shadow: 0 2px 0 #0f8a74; }
.better { background: #fff; border-radius: 12px; padding: 10px 12px; margin-top: 8px; border: 2px solid var(--line); white-space: pre-line; }
.stars { font-size: 56px; letter-spacing: 6px; }
.stars span { display: inline-block; animation: pop .5s both; }
.spinner { width: 44px; height: 44px; border: 6px solid var(--line); border-top-color: var(--pri); border-radius: 50%; animation: spin 1s linear infinite; margin: 10px auto; }

/* story */
.timer { display: grid; place-items: center; position: relative; width: 220px; height: 220px; margin: 0 auto; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer .t { font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer.warn .t { color: var(--bad); animation: pulse 1s infinite; }
.topic { background: linear-gradient(135deg, #fff8e1, #ffe9b8); border-radius: 20px; padding: 18px; border: 3px solid #ffd76b; }
.topic h2 { font-family: Caveat, cursive; font-size: 38px; font-weight: 600; color: #6b3f00; }
.check li { margin: 6px 0; font-weight: 700; list-style: none; }
.check { padding-left: 0; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.thumbs img { width: 90px; height: 120px; object-fit: cover; border-radius: 10px; border: 3px solid var(--line); }
.bigscore { text-align: center; }
.bigscore .n { font-size: 76px; font-weight: 900; line-height: 1; background: linear-gradient(135deg, var(--pri), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.area { margin: 10px 0; }
.area .bar { height: 14px; background: var(--line); border-radius: 99px; overflow: hidden; }
.area .bar i { display: block; height: 100%; border-radius: 99px; transition: width 1.2s ease-out; }
table.rub { width: 100%; border-collapse: collapse; font-size: 15px; }
table.rub td { padding: 10px 6px; border-bottom: 2px solid var(--line); vertical-align: top; }
table.rub td.p { font-weight: 900; white-space: nowrap; text-align: right; font-size: 17px; }
.mk { border-radius: 14px; padding: 12px; margin-bottom: 10px; border-left: 6px solid var(--muted); background: #faf9ff; }
.mk .z { font-weight: 800; }
.mk-rechtschreibung, .mk-grammatik, .mk-zeitform, .mk-zeichensetzung, .mk-woertliche_rede { border-color: var(--bad); }
.mk-satzanfang, .mk-wortwahl, .mk-anschaulichkeit { border-color: var(--gold); }
.mk-spannung, .mk-aufbau { border-color: var(--teal); }
.mk-lob { border-color: var(--ok); background: var(--okbg); }
.transcript { white-space: pre-wrap; font-family: Caveat, cursive; font-size: 24px; line-height: 1.35; background: repeating-linear-gradient(#fff, #fff 31px, #dfe8ff 32px); padding: 14px; border-radius: 12px; }
.transcript mark { border-radius: 6px; padding: 0 2px; }
mark.m-bad { background: #ffd2d8; } mark.m-style { background: #ffeab0; } mark.m-good { background: #c7f3dd; } mark.m-plot { background: #c8f1f4; }
.tips li { margin: 8px 0; font-weight: 700; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
@media (max-width: 560px) { .ba { grid-template-columns: 1fr; } }
.ba > div { border-radius: 12px; padding: 10px; } .ba .b1 { background: #f1eff8; } .ba .b2 { background: var(--okbg); }

/* cheat sheet */
.sheet h3 { color: var(--pri); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills span { background: #efeaff; border-radius: 99px; padding: 5px 12px; font-weight: 700; font-size: 15px; }
.vtab { width: 100%; border-collapse: collapse; font-size: 15px; }
.vtab td { padding: 5px 6px; border-bottom: 1px solid var(--line); } .vtab td:nth-child(2) { font-weight: 900; color: var(--pri); }

/* toasts & overlays */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 800; animation: pop .4s; box-shadow: var(--shadow); }
.toast.badge-t { background: linear-gradient(135deg, #ffb830, #ff7a59); font-size: 18px; }
.overlay { position: fixed; inset: 0; background: rgba(35, 26, 77, .6); display: grid; place-items: center; z-index: 90; animation: slidein .3s; padding: 16px; }
.overlay .card { max-width: 380px; text-align: center; animation: pop .5s; }
.back { background: none; border: 0; color: var(--pri); font-weight: 900; font-size: 17px; cursor: pointer; padding: 6px 0; margin-bottom: 8px; }
.login { max-width: 400px; margin: 8vh auto 0; text-align: center; }
.hr { height: 2px; background: var(--line); margin: 14px 0; }
.dayb { display: flex; align-items: flex-end; gap: 6px; height: 110px; }
.dayb div { flex: 1; background: linear-gradient(0deg, var(--pri), var(--pri2)); border-radius: 6px 6px 0 0; min-height: 3px; position: relative; }
.dayb span { position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.pbar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--ok); }
.kbd { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.kbd button { border: 2px solid var(--line); background: #fff; border-radius: 10px; font-size: 18px; font-weight: 800; padding: 4px 12px; cursor: pointer; }
