:root {
  --bg: #f7f4ee; --card: #ffffff; --ink: #1f2933; --muted: #6b7280; --line: #e7e2d8;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: #e6f4f1;
  --amber: #b45309; --amber-bg: #fef3c7; --ok: #15803d; --ok-bg: #ecfdf3; --danger: #b91c1c;
  --radius: 18px; --shadow: 0 6px 24px rgba(31, 41, 51, .08);
  font-family: 'Inter', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); line-height: 1.7; min-height: 100dvh; }
main { max-width: 560px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(32px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.55rem; line-height: 1.35; margin: .2em 0 .3em; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; line-height: 1.4; margin: .2em 0 .4em; }
p { margin: .4em 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60dvh; text-align: center; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin: 14px 0; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.back { background: none; border: none; color: var(--muted); font: inherit; padding: 8px 4px; cursor: pointer; }
.stepdots { display: flex; gap: 6px; margin-left: auto; }
.stepdots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.stepdots span.on { background: var(--accent); }
.kicker { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 12px 20px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); width: 100%; font-size: 1.05rem; }
.btn.line { background: #06c755; border-color: #06c755; color: #fff; width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: .92rem; }
.btn.block { width: 100%; }
.btn.play.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* mic */
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 18px 0 6px; }
.mic { width: 84px; height: 84px; border-radius: 50%; border: none; background: var(--accent); color: #fff; cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 8px 24px rgba(15, 118, 110, .35); transition: transform .08s; -webkit-tap-highlight-color: transparent; }
.mic svg { width: 34px; height: 34px; }
.mic.rec { background: #dc2626; box-shadow: 0 0 0 calc(var(--lvl, 0) * 26px) rgba(220, 38, 38, .18), 0 8px 24px rgba(220, 38, 38, .35); }
.mic.busy { background: var(--muted); pointer-events: none; }
.mic-label { color: var(--muted); font-size: .92rem; min-height: 1.5em; }

/* text */
.en { font-size: 1.35rem; font-weight: 600; line-height: 1.5; }
.en.big { font-size: 1.55rem; }
.th { color: var(--muted); font-size: 1.02rem; }
.end { text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 3px; text-underline-offset: 5px; color: var(--amber); }
.peek { cursor: pointer; }
.peek .th { display: none; }
.peek.open .th { display: block; }
.peek-hint { color: var(--accent); font-size: .85rem; }
.sentence-list > div { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.sentence-list > div:last-child { border-bottom: none; }

/* feedback */
.fb { border-radius: var(--radius); padding: 16px; margin-top: 14px; border: 1px solid var(--line); background: var(--card); }
.fb.clear { background: var(--ok-bg); border-color: #bbf7d0; }
.fb.polish { background: #fffdf5; border-color: #fde68a; }
.fb.together, .fb.nothing { background: #f8fafc; }
.fb-head { font-weight: 700; font-size: 1.08rem; }
.fb-words { font-size: 1.2rem; line-height: 1.9; margin: 10px 0; }
.w-focus { background: var(--amber-bg); color: var(--amber); border-radius: 6px; padding: 0 4px; font-weight: 700; }
.w-skipped { color: #9ca3af; text-decoration: underline dotted; text-underline-offset: 5px; }
.cue { background: var(--amber-bg); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }

/* home */
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.days { list-style: none; padding: 0; margin: 0; }
.days li { display: flex; gap: 12px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.days li:last-child { border-bottom: none; }
.dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; font-weight: 700; flex: 0 0 auto; background: var(--line); color: var(--muted); }
.days li.done .dot { background: var(--ok); color: #fff; }
.days li.now .dot { background: var(--accent); color: #fff; }
.days li.locked { opacity: .55; }
.days .dtitle { font-size: .95rem; line-height: 1.4; }

/* forms */
label.q { display: block; font-weight: 600; margin: 16px 0 6px; }
label.q .en-sub { font-weight: 400; color: var(--muted); font-size: .85rem; display: block; }
input[type=text], textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; background: #fff; color: var(--ink); }
textarea { min-height: 76px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 14px; font: inherit; cursor: pointer; color: var(--ink); }
.choice.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale .choice { border-radius: 12px; padding: 12px 0; font-weight: 700; }

.done-check { width: 84px; height: 84px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 42px; margin: 10px auto; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare .card { margin: 0; text-align: center; }
.big-num { font-size: 1.9rem; font-weight: 700; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 12px; opacity: 0; transition: .25s; pointer-events: none; max-width: 90vw; text-align: center; z-index: 10; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.err { color: var(--danger); }
