@font-face { font-family: Nunito; font-weight: 600; font-display: swap; src: url(media/fonts/nunito-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Nunito; font-weight: 700; font-display: swap; src: url(media/fonts/nunito-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url(media/fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url(media/fonts/inter-latin-500-normal.woff2) format("woff2"); }

:root {
  --green: #58CC02;
  --green-deep: #2E6B5E;
  --green-press: #24564B;
  --green-ink: #24564B;
  --green-soft: #E3F0EC;
  --green-wash: #E7F8D8;
  --bg: #F6F4EF;
  --card: #fff;
  --line: #E4E6E2;
  --ink: #1F2A27;
  --muted: #5F6B67;
  --clay: #A8432F;
  --clay-soft: #F3E1DC;
  --ok: #2F7D4F;
  --err: #B5532E;
  --gold: #A07B00;
  --blue: #3B82D6;
  --shadow: 0 1px 3px rgba(31, 42, 39, .06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --head: Nunito, "Trebuchet MS", system-ui, sans-serif;
  --body: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: #E7EFEA;
  color: var(--ink);
  font: 400 16px/1.45 var(--body);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px rgba(31, 42, 39, .05);
}
.loading { padding: 32px 20px; color: var(--muted); }
.landing {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: min(480px, 100%);
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: var(--bg);
  display: block;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.landing img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
  user-select: none;
}
.landing:focus { outline: none; }
.landing:focus-visible { outline: 3px solid var(--green-deep); outline-offset: -6px; }
.brand-banner {
  display: block;
  width: calc(100% + 32px);
  max-width: none;
  height: auto;
  margin: -8px -16px 12px;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: var(--bg);
}
.screen { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.stage { flex: 1; overflow: auto; padding: 8px 16px 20px; -webkit-overflow-scrolling: touch; }
.stage > .btn { margin-bottom: 12px; }
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + var(--safe-t)) 12px 8px;
}
.icon-btn {
  width: 48px; height: 48px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px; background: var(--card); color: var(--muted);
  border: 1px solid var(--line); text-decoration: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.progress { flex: 1; height: 14px; background: #E6E8E4; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: inherit; }
h1, h2, .en, .due-n {
  font-family: var(--head);
  letter-spacing: -.02em;
}
h1 { font-size: 32px; line-height: 1.15; font-weight: 700; margin: 4px 0 6px; }
h2 { font-size: 28px; line-height: 1.2; font-weight: 700; margin: 0 0 8px; }
.h-sm { font-family: var(--head); font-size: 18px; margin: 16px 0 8px; }
.sub { color: var(--muted); margin: 0 0 12px; }
.fine, .legend { color: var(--muted); font-size: 14px; line-height: 1.4; }
.center { text-align: center; }
.kicker {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted); font-weight: 500;
}
.kicker.cap {
  font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
}
.dialect {
  display: inline-block; margin: 0 0 14px;
  background: var(--green-soft); color: var(--green-ink);
  border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px;
}
.stat-row { display: flex; gap: 8px; margin: 4px 0 8px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  min-height: 48px; padding: 8px 12px;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--head); font-weight: 700; box-shadow: var(--shadow);
}
.stat .star { color: var(--gold); }
.streak { color: #C46A2A; }
.hearts { display: inline-flex; gap: 2px; color: #E7C9C4; letter-spacing: 0; }
.hearts i { font-style: normal; }
.hearts i.on { color: #D15B6A; }
.challenge {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
  border: 2px solid #8ED96A; background: linear-gradient(#F4FBEA, #fff);
  border-radius: 18px; padding: 10px 12px; margin-bottom: 10px;
}
.challenge strong { display: block; color: var(--green-ink); font-family: var(--head); }
.challenge em { display: block; font-style: normal; color: var(--muted); font-size: 14px; }
.challenge .target {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center; background: #F8E4E0; color: var(--clay); font-weight: 700;
}
.challenge .count {
  margin-left: auto; background: var(--green-soft); color: var(--green-ink);
  border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 14px;
}
.switch { display: flex; gap: 8px; margin-bottom: 8px; }
.switch button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  min-height: 40px; padding: 0 14px;
}
.switch button.on { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.path {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  padding: 8px; box-shadow: var(--shadow);
}
.node {
  display: flex; gap: 12px; align-items: center;
  text-decoration: none; padding: 4px 8px; border-radius: 16px;
}
.node .bubble {
  width: 56px; height: 56px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--head); font-weight: 700; font-size: 20px;
  background: #fff; color: var(--green-deep); border: 2px solid var(--green-deep);
}
.node.done .bubble { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.node.now .bubble { background: var(--green); color: #fff; border-color: var(--green); box-shadow: 0 0 0 6px #E5F6CC; }
.node.pronoun .bubble { background: var(--blue); color: #fff; border-color: var(--blue); }
.node-copy { flex: 1; min-width: 0; }
.node-copy strong { display: block; font-family: var(--head); font-size: 18px; }
.node-copy em { display: block; font-style: normal; color: var(--muted); font-size: 14px; }
.bar { display: block; height: 8px; background: #ECEEEA; border-radius: 99px; margin: 6px 0; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--green); }
.quick { display: flex; gap: 8px; margin-top: 14px; }
.quick a {
  flex: 1; text-align: center; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  min-height: 48px; display: grid; place-items: center; font-weight: 600; color: var(--green-deep);
}
.dock {
  flex: none; display: flex; flex-direction: column; gap: 8px;
  padding: 8px 16px calc(10px + var(--safe-b));
  background: var(--bg); border-top: 1px solid var(--line);
}
.dock-row { display: flex; gap: 8px; }
.dock-row .btn { flex: 1; font-size: 15px; padding-inline: 10px; white-space: nowrap; }
.actions { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; border-radius: 16px; border: 0; text-decoration: none;
  font-weight: 700; font-size: 17px; padding: 12px 16px;
}
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--green); color: #fff; box-shadow: 0 3px 0 #46A302; }
.btn.primary:active { transform: translateY(1px); box-shadow: none; }
.btn.primary:disabled { opacity: .45; box-shadow: none; }
.btn.secondary { background: #fff; color: var(--green-deep); border: 2px solid var(--green-soft); }
.btn.ghost { background: #fff; color: var(--muted); border: 2px solid var(--line); min-height: 48px; }
.btn.slim { min-height: 48px; width: auto; padding-inline: 18px; }
.btn.record {
  background: #fff; color: var(--clay); border: 2px solid var(--clay-soft); font-weight: 700;
}
.btn.record.on { background: var(--clay-soft); }
.btn.record .dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--clay);
}
.btn.record.on .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.tabs {
  flex: none; display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tabs a {
  flex: 1; min-height: 64px; text-decoration: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 13px; font-weight: 600;
}
.tabs a.on { color: var(--green-deep); }
.tab-mark { width: 22px; height: 18px; border-radius: 6px; background: #E6E8E4; }
.tabs a.on .tab-mark { background: #D7EFE4; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 20px;
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card.flush { padding: 8px; }
.card.plain { padding: 8px; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.native-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green-soft); color: var(--green-ink);
  border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600;
}
.native-pill.off { background: #F4E8E2; color: var(--err); }
.syl { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip {
  min-width: 56px; min-height: 48px; padding: 8px 14px;
  border-radius: 12px; border: 1.5px solid var(--line); background: #F7F8F6;
  font-family: var(--head); font-weight: 700; font-size: 20px;
}
.chip.played { background: var(--green-soft); color: var(--green-deep); border-color: #BFD9D1; }
.chip.now { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.syl.answer { min-height: 56px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.gs { color: var(--clay); text-decoration: none; font-size: .7em; }
.note { margin-top: 8px; color: var(--muted); font-size: 14px; }
.note summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.player-card { margin-top: 8px; }
.player-line { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; }
.player-line.faint { opacity: .7; }
.play-row {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; background: #F4F7F5; border-radius: 14px; min-height: 56px; padding: 8px 10px; margin: 6px 0;
}
.play-dot {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 50%;
  background: var(--green-deep); color: #fff; display: grid; place-items: center;
}
.play-dot svg { width: 18px; height: 18px; }
.wave { display: flex; align-items: center; gap: 3px; height: 28px; flex: 1; }
.wave i {
  display: block; width: 4px; height: 8px; border-radius: 99px; background: #B7D7CC;
}
.wave.on i { background: var(--green); animation: bar .8s ease-in-out infinite; }
.wave.on i:nth-child(2n) { animation-delay: .15s; }
.wave.on i:nth-child(3n) { animation-delay: .3s; }
@keyframes bar { 50% { height: 22px; } }
.seg-row { display: flex; flex-wrap: wrap; gap: 8px; }
.list { display: flex; flex-direction: column; gap: 8px; }
.row, .mini {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; text-align: left; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 14px; min-height: 56px;
}
.mini { background: #F7F8F6; }
.row small, .mini small, .choice small, .prow em { color: var(--muted); font-style: normal; font-size: 14px; }
.row .n {
  width: 28px; height: 28px; border-radius: 50%; background: var(--green-soft);
  color: var(--green-deep); display: inline-grid; place-items: center; font-weight: 700; margin-bottom: 4px;
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile, .choice {
  width: 100%; text-align: left; background: #fff; border: 2px solid var(--line);
  border-radius: 16px; min-height: 64px; padding: 12px 14px; font-weight: 700;
}
.tile.sel, .choice.sel { border-color: var(--green); background: #F3FBEA; }
.tile.matched, .choice.good { border-color: var(--green-deep); background: var(--green-soft); color: var(--green-ink); }
.tile.bad, .choice.bad { border-color: var(--err); background: #FBF1EC; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.feedback { font-weight: 700; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: var(--err); }
.score { font-family: var(--head); font-size: 28px; font-weight: 700; color: var(--green-deep); margin: 0; }
.due-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 2px solid #B7E39A; background: #F3FBEC; border-radius: 18px; padding: 14px;
}
.due-n { font-size: 32px; font-weight: 700; margin: 0; color: var(--green-deep); }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.score-pill {
  border: 2px solid #B7D7CC; background: #F3FBEC; color: var(--green-ink);
  border-radius: 16px; padding: 12px 14px; font-weight: 700; text-align: center;
}
.mic {
  width: 84px; height: 84px; border-radius: 50%; border: 0; display: block; margin: 12px auto 4px;
  background: radial-gradient(circle at 50% 45%, #C45B48, #A8432F);
  box-shadow: inset 0 0 0 10px #F3E1DC;
}
.mic.on { box-shadow: inset 0 0 0 10px #F3E1DC, 0 0 0 8px #F8EBE7; }
.sel-label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.sel-label select {
  display: block; width: 100%; margin-top: 6px; min-height: 48px;
  border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 0 10px;
}
.mascot { width: 88px; height: 88px; object-fit: contain; display: block; margin: 8px auto; }
.skip { text-align: right; }
.skip a { color: var(--muted); text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.prow {
  display: flex; gap: 12px; align-items: center; text-decoration: none;
  padding: 10px 8px; border-radius: 14px;
}
.pchip {
  width: 72px; min-height: 64px; flex: none; border-radius: 16px;
  display: grid; place-items: center; text-align: center; padding: 6px;
  background: #F3FBEA; border: 2px solid #B7E39A;
  font-family: var(--head); font-weight: 700;
}
.prow strong { display: block; }
.flag { display: block; }
.story-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.lang { display: flex; background: #fff; border-radius: 999px; border: 1px solid var(--line); overflow: hidden; flex: none; }
.lang button { border: 0; background: transparent; min-height: 40px; padding: 0 12px; }
.lang button.on { background: var(--green-deep); color: #fff; }
.thread { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 16px; }
.bubble-row { display: flex; flex-direction: column; align-items: flex-start; max-width: 92%; }
.bubble-row.mine { align-self: flex-end; align-items: flex-end; }
.who { font-size: 13px; color: var(--muted); margin: 0 8px 4px; }
.bubble {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 8px 12px 8px 8px;
  font-family: var(--head); font-weight: 700; font-size: 18px;
}
.bubble-row.mine .bubble { background: var(--green-soft); }
.bubble-row.playing .bubble { outline: 2px solid var(--green); }
.finder {
  position: relative; border-radius: 28px; overflow: hidden; height: 168px;
  background: linear-gradient(#8AA4B5, #C4B49A 55%, #8C7A62);
  margin-bottom: 0;
}
.finder video, .finder-fallback { width: 100%; height: 168px; object-fit: cover; display: block; }
.finder-fallback {
  display: grid; place-items: center; padding: 16px; text-align: center; color: #fff;
}
.finder-fallback .btn { max-width: 220px; }
.finder-frame {
  position: absolute; left: 50%; top: 18%; width: 34%; aspect-ratio: 1;
  transform: translateX(-50%); border: 3px solid rgba(255,255,255,.85); border-radius: 18px;
  pointer-events: none;
}
.word-card {
  position: relative; margin: -28px 8px 12px;
  background: #fff; border-radius: 18px; padding: 12px 14px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.word-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.word-chip {
  min-height: 44px; padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
}
.word-chip.on { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.pending {
  background: #FBF6EE; color: #7A5A10; border-radius: 12px; padding: 10px 12px; font-size: 14px;
}
.warn { color: var(--err); min-height: 0; }
.xp-pill {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; font-family: var(--head); font-weight: 700; color: var(--gold);
}
.faint { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid #8ED96A; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .wave.on i, .btn.record.on .dot { animation: none; }
}
