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

:root {
  --bg: #12131f;
  --panel: #1d1f33;
  --panel-2: #262946;
  --ink: #f3f1ff;
  --muted: #a9a6c9;
  --gold: #ffc94a;
  --teal: #3ee0c4;
  --pink: #ff6fa8;
  --red: #ff5d5d;
  --green: #5be37d;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(circle at 20% 0%, #24204a 0%, var(--bg) 55%) fixed;
  color: var(--ink);
  font-family: 'Lexend', system-ui, sans-serif;
  font-size: 20px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--teal); }
.wrap { max-width: 920px; margin: 0 auto; padding: 24px 16px 60px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.brand { font-weight: 800; font-size: 24px; letter-spacing: .5px; }
.brand span { color: var(--gold); }

.panel { background: var(--panel); border-radius: var(--radius); padding: 24px; border: 2px solid #2f3256; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 18px;
  padding: 12px 22px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--gold); color: #241a00; box-shadow: 0 4px 0 #b88a12;
  transition: transform .08s; text-decoration: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #b88a12; }
.btn.secondary { background: var(--panel-2); color: var(--ink); box-shadow: 0 4px 0 #15162a; }
.btn.small { font-size: 15px; padding: 8px 14px; }
.btn:disabled { opacity: .45; cursor: default; }

input[type=text], input[type=password] {
  font: inherit; width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 2px solid #3a3d66; background: #10111c; color: var(--ink);
}
input:focus { outline: 3px solid var(--teal); outline-offset: 1px; }
label { display: block; font-size: 16px; color: var(--muted); margin: 14px 0 6px; }
.error { color: var(--red); min-height: 1.6em; font-size: 16px; }

/* XP bar */
.player { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lvl { background: var(--pink); color: #2a0015; font-weight: 800; border-radius: 12px; padding: 6px 12px; }
.xpbar { flex: 1; min-width: 180px; height: 18px; background: #0d0e18; border-radius: 99px; overflow: hidden; border: 2px solid #2f3256; }
.xpbar > div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--gold)); transition: width .6s; }

/* quest map */
.quest { margin-top: 28px; }
.quest h2 { margin: 0 0 4px; }
.quest p.blurb { color: var(--muted); margin: 0 0 16px; font-size: 17px; }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--panel-2); border-radius: var(--radius); padding: 16px; border: 2px solid transparent;
  transition: transform .1s, border-color .1s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--gold); }
.tile .icon { font-size: 36px; }
.tile .subj { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.tile .name { font-weight: 600; margin: 2px 0 6px; }
.tile .meta { font-size: 14px; color: var(--gold); }
.tile.done { border-color: var(--green); }
.tile.done .meta::after { content: '  ✅'; }
.tile.locked { opacity: .45; pointer-events: none; }
.badge-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.badge { background: var(--panel-2); padding: 6px 12px; border-radius: 99px; font-size: 15px; }

/* lesson */
.progress-dots { display: flex; gap: 6px; margin-bottom: 18px; }
.progress-dots span { flex: 1; height: 8px; border-radius: 99px; background: #2f3256; }
.progress-dots span.on { background: var(--teal); }
.reading { font-size: 26px; line-height: 1.8; }
.reading .word { cursor: pointer; border-radius: 6px; padding: 0 2px; }
.reading .word:hover { background: #33366a; }
.reading .word.speaking { background: var(--gold); color: #241a00; }
.speak { background: var(--teal); color: #002a22; box-shadow: 0 4px 0 #1d9b86; }
.choices { display: grid; gap: 12px; margin-top: 18px; }
.choice { text-align: left; justify-content: flex-start; background: var(--panel-2); color: var(--ink); box-shadow: 0 4px 0 #15162a; font-size: 20px; }
.choice.right { background: var(--green); color: #00260b; }
.choice.wrong { background: var(--red); color: #2a0000; }
.feedback { margin-top: 16px; font-size: 20px; min-height: 1.6em; }
.step-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 16px; }
.big-emoji { font-size: 64px; text-align: center; }

.spell-input { font-size: 28px !important; letter-spacing: 3px; text-align: center; max-width: 360px; }

/* drawing */
.draw-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; align-items: center; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: #fff; }
canvas.pad { width: 100%; max-width: 700px; aspect-ratio: 7 / 5; background: #f5ecd7; border-radius: 14px; touch-action: none; display: block; }

/* parent */
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid #2f3256; }
.drawings { display: flex; gap: 12px; flex-wrap: wrap; }
.drawings img { width: 180px; border-radius: 10px; background: #f5ecd7; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

@media (max-width: 600px) {
  body { font-size: 18px; }
  .reading { font-size: 22px; }
  .panel { padding: 18px; }
}
