@font-face { font-family: Lexend; src: url(/fonts/Lexend.ttf) format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  --blue: #006AA7; --blue-soft: #e2eef6; --yellow: #FECC02; --yellow-soft: #fff6cc; --yellow-ink: #6b5200;
  --ink: #1d2b36; --muted: #6b7c88; --line: #dde4ea; --surface: #f3f6f8; --bg: #ffffff;
  --ok: #1b7f3b; --ok-soft: #e3f3e8; --err: #b3261e; --err-soft: #fbe9e7;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Lexend, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2 { font-weight: 500; margin: 0; text-wrap: balance; }
p { margin: 0; }

.screen { min-height: 100dvh; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 18px) 22px calc(env(safe-area-inset-bottom) + 24px); }
.center { justify-content: center; text-align: center; gap: 18px; }
.logo { width: 100%; max-width: 300px; margin: 0 auto 6px; }
.tagline { font-size: 17px; font-weight: 500; color: var(--blue); }
.lead { color: var(--muted); line-height: 1.5; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.link { background: none; border: 0; color: var(--blue); font-weight: 500; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.field { display: grid; gap: 6px; text-align: left; }
.field label { font-size: 14px; font-weight: 500; }
input[type="email"], input[type="text"], select, textarea {
  font: 400 18px/1.4 Lexend, system-ui, sans-serif; color: var(--ink); width: 100%;
  border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; outline: none; background: var(--bg);
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); }
input.code { letter-spacing: .4em; text-align: center; font-size: 24px; }
.error-text { color: var(--err); font-size: 14px; min-height: 20px; }

.btn { min-height: 54px; text-align: center; line-height: 1.3; border-radius: 14px; border: 2px solid var(--blue); cursor: pointer; font-size: 16px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.secondary { background: var(--bg); color: var(--blue); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: flex; gap: 12px; margin-top: 18px; }
.btns .btn { flex: 1; }
.icon-btn { border: 0; background: none; padding: 8px; margin: -8px; color: var(--ink); cursor: pointer; display: flex; }

/* top bar */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.top img.mini { height: 34px; }

/* exercise */
.step-label { margin: 18px 0 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.instr { margin: 6px 0 0; padding: 14px 16px; border-radius: 14px; background: var(--blue); color: #fff; font-size: 18px; line-height: 1.4; font-weight: 500; min-height: 54px; }
.sent-wrap { margin-top: 24px; }
.illus { margin: 18px 0 0; display: flex; justify-content: center; }
.illus img { width: min(150px, 20dvh); aspect-ratio: 1; border-radius: 22px; display: block; }
.illus + .sent-wrap { margin-top: 14px; }
/* extra story */
.story .story-title { margin-top: 14px; font-size: 20px; text-align: center; }
.story-text { margin-top: 10px; font-size: 22px; line-height: 1.55; }
.story-text span span { border-radius: 6px; padding: 0 2px; margin: 0 -2px; transition: background-color .08s; }
.story-text span span.hl { background: var(--yellow); }
.story-tr { margin-top: 14px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.extra { margin-top: 14px; border-radius: 20px; background: var(--yellow-soft); padding: 18px 20px; display: grid; gap: 10px; }
.extra h2 { font-size: 19px; }
.extra .meta { font-size: 14px; color: var(--yellow-ink); }
.extra .btn.primary { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }
.sent { font-size: 27px; line-height: 1.45; }
.sent span { border-radius: 6px; padding: 0 2px; margin: 0 -2px; transition: background-color .08s; }
.sent span.hl { background: var(--yellow); }
.hidden-text { font-size: 27px; color: var(--line); letter-spacing: .3em; line-height: 1.2; }
.hidden-text span { font-size: 14px; letter-spacing: 0; color: var(--muted); }
.tr { margin-top: 12px; font-size: 15px; line-height: 1.5; color: var(--muted); }
.tr-toggle { margin-top: 10px; font-size: 14px; align-self: flex-start; }
.synth { margin-top: 10px; font-size: 12px; color: var(--yellow-ink); background: var(--yellow-soft); border-radius: 8px; padding: 4px 8px; align-self: flex-start; }
.bottom { margin-top: auto; padding-top: 20px; display: flex; flex-direction: column; }
.hint { min-height: 20px; margin-bottom: 12px; text-align: center; font-size: 14px; color: var(--muted); }
.hint.error { color: var(--err); }
.bubbles { display: flex; justify-content: center; align-items: flex-end; gap: 22px; }
.bubble { border: 0; background: none; padding: 0; cursor: pointer; width: 132px; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: opacity .2s, transform .12s; }
.bubble img { display: block; width: 100%; pointer-events: none; }
.bubble:disabled { opacity: .3; cursor: default; }
.bubble.playing:disabled { opacity: 1; }
.bubble.playing { animation: breathe 1.2s ease-in-out infinite; }
.bubble.recording { transform: scale(.92); animation: rec 1s ease-in-out infinite; }
.bubble.cta { animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: scale(1.07); } }
@keyframes breathe { 50% { transform: scale(1.05); } }
@keyframes rec { 50% { transform: scale(.97); } }
@media (prefers-reduced-motion: reduce) { .bubble.cta, .bubble.playing, .bubble.recording { animation: none; } }
.segment { display: flex; border-radius: 999px; background: #f0f3f5; padding: 4px; }
.segment div { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 0; border-radius: 999px; font-size: 15px; font-weight: 500; color: #8a98a3; transition: background-color .2s, color .2s; }
.segment .you.on { background: var(--yellow); color: var(--ink); }
.segment .teacher.on { background: var(--blue); color: #fff; }
.eq { display: none; gap: 2px; align-items: flex-end; height: 14px; }
.on .eq { display: inline-flex; }
.eq i { width: 3px; height: 14px; background: currentColor; border-radius: 1px; transform-origin: bottom; animation: eq .8s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.55s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }

/* writing */
.writer textarea { font-size: 22px; min-height: 96px; resize: vertical; }
.result { margin-top: 14px; display: grid; gap: 12px; }
.verdict { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.verdict .badge { border-radius: 999px; padding: 3px 12px; font-size: 14px; white-space: nowrap; }
.verdict.ok .badge { background: var(--ok-soft); color: var(--ok); }
.verdict.some .badge { background: var(--yellow); color: var(--ink); }
.verdict.many .badge { background: var(--err-soft); color: var(--err); }
.card { border-radius: 14px; padding: 12px 14px; background: #f5f7f9; }
.card.correct { background: var(--ok-soft); }
.card .label { font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.line { font-size: 21px; line-height: 1.7; }
.w { border-radius: 5px; padding: 0 2px; }
.w.err { background: var(--err-soft); color: var(--err); text-decoration: underline wavy var(--err); text-underline-offset: 4px; }
.w.extra { color: var(--err); text-decoration: line-through; text-decoration-thickness: 2px; }
.w.fix { background: #c9ecd3; color: var(--ok); font-weight: 500; }
.w.add { color: var(--ok); font-weight: 500; text-decoration: underline dashed; text-underline-offset: 4px; }
.w.swap { background: #fff1b8; text-decoration: underline var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.w.style { text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }
.gap, .l-missing { color: var(--err); font-weight: 600; }
.l-missing { font-size: .8em; vertical-align: .35em; }
.l-wrong { color: var(--err); background: #f6c9c4; border-radius: 3px; }
.l-extra { color: var(--err); text-decoration: line-through; }
.l-fix { background: #c9ecd3; color: var(--ok); font-weight: 600; border-radius: 3px; }
.notes { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 2px; }

/* popup */
.popup { position: fixed; inset: 0; z-index: 20; background: rgba(16, 30, 42, .45); display: flex; align-items: center; justify-content: center; padding: 24px; }
.popup-card { background: #fff; border-radius: 20px; padding: 26px 22px 22px; max-width: 360px; width: 100%; text-align: center; display: grid; gap: 10px; }
.popup-card img { width: 84px; margin: 0 auto; }
.popup-title { font-size: 20px; font-weight: 500; }
.popup-card p { line-height: 1.5; }
.help { text-align: left; background: #fff8d6; border-radius: 14px; padding: 14px 16px; }
.help ol { margin: 6px 0 0; padding-left: 20px; line-height: 1.55; }

/* language and placement */
.list { display: grid; gap: 8px; margin-top: 16px; }
.choice { text-align: left; border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; background: var(--bg); cursor: pointer; display: grid; gap: 2px; }
.choice:hover, .choice:focus-visible { border-color: var(--blue); outline: none; }
.choice .big { font-size: 18px; font-weight: 500; }
.choice .sub { font-size: 13px; color: var(--muted); }
.level-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 10px; }
.level-card h2 { font-size: 17px; }
.example { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; cursor: pointer; }
.play svg { width: 18px; height: 18px; }
.example .sv { font-size: 17px; }
.example .tr { margin: 2px 0 0; font-size: 14px; }

/* home */
.today { margin-top: 22px; border-radius: 20px; background: var(--blue); color: #fff; padding: 20px; display: grid; gap: 12px; }
.today h2 { font-size: 22px; }
.today .btn.primary { background: #fff; color: var(--blue); border-color: #fff; }
.today.locked { background: var(--surface); color: var(--ink); }
.today .meta { opacity: .85; font-size: 14px; }
.course { margin-top: 26px; display: grid; gap: 6px; }
.course h3 { margin: 0 0 6px; font-size: 15px; font-weight: 500; color: var(--muted); }
.line-list { list-style: none; margin: 0; padding: 0; position: relative; }
.line-list::before { content: ""; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 4px; border-radius: 2px; background: var(--line); }
.station { position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 8px 0; align-items: start; }
.station .dot { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 4px solid var(--line); z-index: 1; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.station.done .dot { background: var(--blue); border-color: var(--blue); color: #fff; }
.station.current .dot { border-color: var(--blue); color: var(--blue); box-shadow: 0 0 0 5px var(--blue-soft); }
.station .name { font-weight: 500; line-height: 1.3; }
.station .name small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.bar { margin-top: 6px; height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--yellow); border-radius: 3px; }

/* menu sheet */
.menu { position: fixed; inset: 0; background: rgba(16, 30, 42, .35); z-index: 10; display: flex; justify-content: flex-end; }
.menu-panel { width: min(88vw, 380px); height: 100%; background: #fff; overflow-y: auto; padding: calc(env(safe-area-inset-top) + 18px) 20px calc(env(safe-area-inset-bottom) + 20px); display: flex; flex-direction: column; gap: 18px; }
.menu-head { display: flex; justify-content: space-between; align-items: center; }
.menu-head img { width: 190px; }
.setting { display: grid; gap: 6px; }
.setting > span { font-size: 14px; font-weight: 500; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; }
.switch input { width: 22px; height: 22px; accent-color: var(--blue); }
.danger { color: var(--err); }
.dev { border-top: 1px dashed var(--line); padding-top: 14px; display: grid; gap: 8px; }
.dev pre { white-space: pre-wrap; font-size: 12px; background: var(--surface); border-radius: 10px; padding: 10px; max-height: 260px; overflow: auto; }

/* level info */
.level-head { display: flex; align-items: center; gap: 8px; }
.info-btn { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--blue); background: var(--bg); color: var(--blue);
  font: italic 600 13px/1 Georgia, serif; display: inline-grid; place-items: center; padding: 0; cursor: pointer; vertical-align: 2px; flex: none; }
.info-btn[aria-expanded="true"] { background: var(--blue); color: #fff; }
.info-panel { margin: 6px 0 2px; font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--blue-soft); border-radius: 10px; padding: 8px 10px; }
.station .info-btn { margin-left: 4px; }
