:root {
  --ink: #2b2140;
  --muted: #7a7090;
  --bg: #fff8ef;
  --card: #ffffff;
  --purple: #7b4fd6;
  --purple-soft: #efe7ff;
  --green: #22a55b;
  --green-soft: #e3f7ea;
  --red: #e0475b;
  --red-soft: #fde8eb;
  --sun: #ffb020;
  --line: #eadfce;
  --font: "Chalkboard SE", "Comic Sans MS", "Comic Neue", "Marker Felt", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}
#app {
  min-height: 100%;
  padding: max(20px, env(safe-area-inset-top)) 28px max(24px, env(safe-area-inset-bottom));
  max-width: 900px; margin: 0 auto;
  display: flex; flex-direction: column;
}
button { font-family: inherit; color: inherit; border: 0; cursor: pointer; touch-action: manipulation; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.bar .back { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 10px 18px; font-size: 22px; }
.bar .progress { font-size: 22px; color: var(--muted); }
.stars { font-size: 26px; font-weight: bold; color: var(--ink); white-space: nowrap; }
.stars .s { color: var(--sun); }

/* ---------- home ---------- */
.home-title { text-align: center; margin: 24px 0 4px; font-size: 52px; color: var(--purple); }
.home-sub { text-align: center; margin: 0 0 28px; font-size: 22px; color: var(--muted); }
.tiles { display: grid; gap: 18px; }
.big {
  display: flex; align-items: center; gap: 22px; text-align: left;
  background: var(--card); border: 3px solid var(--line); border-radius: 28px;
  padding: 22px 26px; box-shadow: 0 6px 0 var(--line);
}
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--line); }
.big .ico { font-size: 56px; width: 80px; text-align: center; }
.big .t { font-size: 32px; font-weight: bold; }
.big .d { font-size: 19px; color: var(--muted); margin-top: 4px; }
.big.purple { border-color: #cdb8f5; box-shadow: 0 6px 0 #cdb8f5; }
.big.green { border-color: #a9e2c0; box-shadow: 0 6px 0 #a9e2c0; }
.big.sun { border-color: #ffd98a; box-shadow: 0 6px 0 #ffd98a; }
.home-foot { margin-top: auto; padding-top: 28px; display: flex; justify-content: space-between; align-items: center; }
.link { background: none; font-size: 18px; color: var(--muted); text-decoration: underline; padding: 10px; }

/* ---------- practice ---------- */
.stage { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 8px; }
.prompt { font-size: 26px; color: var(--muted); text-align: center; margin: 0; }
.hear-row { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }
.hear {
  width: 150px; height: 150px; border-radius: 50%;
  background: var(--purple); color: #fff; font-size: 64px;
  box-shadow: 0 8px 0 #5733a8;
}
.hear:active { transform: translateY(5px); box-shadow: 0 3px 0 #5733a8; }
.hear.talking { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.pill {
  background: var(--purple-soft); color: var(--purple); border-radius: 999px;
  padding: 14px 22px; font-size: 22px; font-weight: bold;
}

.slots { display: flex; gap: 8px; justify-content: center; min-height: 96px; flex-wrap: wrap; }
.slot {
  width: 72px; height: 90px; border-radius: 16px; background: var(--card);
  border: 3px dashed var(--line); font-size: 60px; display: flex; align-items: center; justify-content: center;
}
.slot.filled { border-style: solid; border-color: #cdb8f5; }
.slot.cursor { border-color: var(--purple); }

.keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; width: 100%; max-width: 760px; }
.key {
  height: 78px; border-radius: 18px; background: var(--card); font-size: 46px;
  border: 2px solid var(--line); box-shadow: 0 5px 0 var(--line);
}
.key:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); background: var(--purple-soft); }
.key.wide { grid-column: span 2; font-size: 30px; }
.key.go { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 5px 0 #17803f; grid-column: 1 / -1; font-size: 32px; }
.key.go:active { box-shadow: 0 1px 0 #17803f; }

.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; width: 100%; max-width: 680px; }
.choice {
  height: 130px; border-radius: 24px; background: var(--card); font-size: 64px;
  border: 3px solid var(--line); box-shadow: 0 6px 0 var(--line);
}
.choice:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--line); }
.choice.right { background: var(--green-soft); border-color: var(--green); }
.choice.wrong { background: var(--red-soft); border-color: var(--red); opacity: 0.7; }

/* ---------- feedback ---------- */
.result { text-align: center; }
.result h2 { font-size: 44px; margin: 6px 0; }
.result.ok h2 { color: var(--green); }
.result.no h2 { color: var(--red); }
.word-big { font-size: 84px; letter-spacing: 4px; margin: 6px 0; }
.word-big .ph { color: var(--purple); text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 10px; }
.word-big .si { color: #b8aecb; }
.attempt { font-size: 40px; letter-spacing: 3px; color: var(--muted); }
.attempt .bad { color: var(--red); text-decoration: line-through; }
.hint { font-size: 24px; background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 12px 20px; display: inline-block; }
.examples { font-size: 30px; display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; }
.next {
  background: var(--purple); color: #fff; font-size: 30px; font-weight: bold;
  border-radius: 22px; padding: 18px 46px; box-shadow: 0 6px 0 #5733a8;
}
.next:active { transform: translateY(4px); box-shadow: 0 2px 0 #5733a8; }

.cheer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.cheer span { position: absolute; top: -40px; font-size: 40px; animation: drop 1.4s ease-in forwards; }
@keyframes drop { to { transform: translateY(110vh) rotate(260deg); } }

/* ---------- test ---------- */
.paper-note { font-size: 22px; color: var(--muted); text-align: center; max-width: 560px; }
.count-big { font-size: 40px; font-weight: bold; }
.check-list { width: 100%; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check-row { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 8px 12px; font-size: 30px; }
.check-row .btns { display: flex; gap: 8px; }
.yn { width: 56px; height: 56px; border-radius: 14px; font-size: 28px; background: #f4efe7; }
.yn.on.y { background: var(--green); color: #fff; }
.yn.on.n { background: var(--red); color: #fff; }

/* ---------- grown-ups ---------- */
.panel { background: var(--card); border: 2px solid var(--line); border-radius: 20px; padding: 18px 20px; margin-top: 16px; font-family: -apple-system, system-ui, sans-serif; -webkit-user-select: text; user-select: text; }
.panel h3 { margin: 0 0 10px; font-size: 20px; }
.panel p { margin: 6px 0; color: var(--muted); font-size: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid #f0e8dc; }
th { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.meter { height: 10px; border-radius: 5px; background: #f0e8dc; overflow: hidden; width: 90px; }
.meter i { display: block; height: 100%; background: var(--green); }
.meter.low i { background: var(--red); }
.meter.mid i { background: var(--sun); }
.sbtn { font-family: -apple-system, system-ui, sans-serif; font-size: 15px; padding: 8px 12px; border-radius: 10px; background: #f4efe7; margin-right: 6px; }
.sbtn.rec { background: var(--red); color: #fff; }
.sbtn.has { background: var(--green-soft); color: #17803f; }
.row-flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
select, input[type=range] { font-size: 16px; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red); }

@media (max-height: 760px) {
  .hear { width: 120px; height: 120px; font-size: 52px; }
  .key { height: 64px; font-size: 38px; }
  .slot { width: 60px; height: 76px; font-size: 50px; }
}

/* ---------- week editor ---------- */
.inp { font-family: -apple-system, system-ui, sans-serif; font-size: 16px; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; min-width: 90px; }
.inp.wide { min-width: 180px; }
.area { min-height: 90px; resize: vertical; }
.row-flex label { display: flex; gap: 8px; align-items: center; }
.row-flex label .inp { width: auto; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.ptog { font-family: var(--font); font-size: 22px; padding: 10px 4px; border-radius: 12px; background: #f4efe7; border: 2px solid transparent; }
.ptog.on { background: var(--purple-soft); border-color: var(--purple); color: var(--purple); font-weight: bold; }
details summary { cursor: pointer; color: var(--purple); font-size: 15px; }
