:root {
  --paper: #F3EEE4; --card: #FBF8F2; --sand: #EAE3D6; --ink: #16130F; --ink2: #2A251F; --muted: #5B544A;
  --line: #D8CFBF; --line2: #B9AF9F; --red: #C4321A; --red-d: #8E2210; --red-b: #E4502F; --ok: #2F6B3A; --ok-bg: #E3EEDD;
  --warn-bg: #F6E3C8; --bad-bg: #F5D9D2;
  --head: 'Archivo', 'Arial Narrow', sans-serif; --body: 'Instrument Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --r: 18px; --shadow: 6px 6px 0 var(--ink);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; min-height: 100dvh; }
a { color: var(--red); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgba(243, 238, 228, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.top .in { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; min-height: 58px; }
.logo { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: var(--ink); }
.logo b { font-family: 'Noto Serif JP', serif; font-weight: 900; font-size: 22px; color: var(--red); }
.logo span { font-family: var(--head); font-stretch: 62%; font-weight: 900; font-size: 26px; letter-spacing: .02em; }
.nav { display: flex; gap: 4px; margin-left: 18px; }
.nav a { text-decoration: none; color: var(--ink2); font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: 10px; }
.nav a.on { background: var(--ink); color: var(--paper); }
.top .sp { flex: 1; }
.streak { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-weight: 700; font-size: 14px; background: var(--card); border: 1px solid var(--line); padding: 6px 10px; border-radius: 999px; }
.streak svg { width: 16px; height: 16px; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); display: none; padding-bottom: var(--safe-b); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; text-decoration: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabs a svg { width: 22px; height: 22px; }
.tabs a.on { color: var(--red); }
main { max-width: 980px; margin: 0 auto; padding: 22px 16px 60px; }
.narrow { max-width: 680px; margin: 0 auto; }
@media (max-width: 760px) {
  .nav { display: none; }
  .tabs { display: flex; }
  main { padding-bottom: calc(96px + var(--safe-b)); }
  .hide-m { display: none !important; }
}

/* ---------- type ---------- */
h1, h2, h3 { margin: 0; }
.h-xl { font-family: var(--head); font-stretch: 62%; font-weight: 900; text-transform: uppercase; font-size: clamp(40px, 8vw, 64px); line-height: .92; }
.h-l { font-family: var(--head); font-stretch: 62%; font-weight: 900; text-transform: uppercase; font-size: clamp(30px, 6vw, 42px); line-height: .95; }
.h-m { font-size: 21px; font-weight: 700; line-height: 1.25; }
.h-s { font-size: 17px; font-weight: 700; }
.kick { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 17px; line-height: 1.5; color: var(--ink2); margin: 0; }
p { line-height: 1.55; }

/* ---------- blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.card.hard { border: 2px solid var(--ink); box-shadow: var(--shadow); }
.card.dark { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.card.dark .muted { color: #B9AF9F; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.l { gap: 22px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .grid3 { gap: 8px; } }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-width: 0; }
.stat b { display: block; font-family: var(--head); font-stretch: 62%; font-weight: 900; font-size: 34px; line-height: 1; }
.stat span { font-size: 13px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--sand); color: var(--ink2); }
.pill.red { background: var(--red); color: #fff; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.dark { background: var(--ink); color: var(--paper); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px; border-radius: 14px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 700; font-size: 16px; text-decoration: none; transition: transform .08s; }
.btn:active { transform: translateY(1px); }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.red:hover { background: var(--red-d); border-color: var(--red-d); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.soft { background: var(--sand); border-color: var(--sand); color: var(--ink); }
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--red); font-weight: 600; text-decoration: underline; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; }
.input { min-height: 50px; padding: 0 14px; border: 1.5px solid var(--line2); border-radius: 12px; background: #fff; font-size: 16px; width: 100%; }
textarea.input { padding: 12px 14px; min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--red); flex-shrink: 0; }
.err { background: var(--bad-bg); color: var(--red-d); border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.note { background: var(--sand); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.5; }
.note.ok { background: var(--ok-bg); color: #1F4A28; }
.note.warn { background: var(--warn-bg); }

/* ---------- auth ---------- */
.auth { max-width: 460px; margin: 4vh auto 0; }
.seg { display: flex; background: var(--sand); padding: 4px; border-radius: 14px; gap: 4px; }
.seg button { flex: 1; min-height: 42px; border: 0; background: transparent; border-radius: 11px; font-weight: 700; color: var(--ink2); }
.seg button.on { background: var(--ink); color: var(--paper); }

/* ---------- home ---------- */
.hero-next { display: grid; gap: 18px; }
.circuit { display: flex; gap: 6px; flex-wrap: wrap; }
.circuit span { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 5px 8px; border-radius: 8px; border: 1px solid #4A433A; color: #D8CFBF; }
.circuit span.done { background: var(--red); border-color: var(--red); color: #fff; }
.level { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); overflow: hidden; }
.level-h { display: flex; gap: 14px; align-items: center; padding: 16px 18px; }
.level-h .cefr { font-family: var(--head); font-stretch: 62%; font-weight: 900; font-size: 26px; min-width: 64px; }
.level.locked { opacity: .72; background: transparent; border-style: dashed; }
.mod { border-top: 1px solid var(--line); }
.mod-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: none; border: 0; width: 100%; text-align: left; }
.mod-h .num { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.mod-h .bar { height: 6px; background: var(--sand); border-radius: 3px; overflow: hidden; width: 70px; flex-shrink: 0; }
.mod-h .bar i { display: block; height: 100%; background: var(--red); }
.lessons { padding: 0 10px 12px; display: grid; gap: 6px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 12px; text-decoration: none; color: var(--ink); border: 1px solid transparent; }
.lesson-row:hover { background: var(--sand); }
.lesson-row .st { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--mono); font-size: 12px; font-weight: 700; }
.lesson-row.done .st { background: var(--ok); border-color: var(--ok); color: #fff; }
.lesson-row.cur { border-color: var(--ink); background: #fff; }
.lesson-row.cur .st { border-color: var(--red); color: var(--red); }
.lesson-row.locked { color: var(--muted); }
.lesson-row .t { flex: 1; min-width: 0; }
.lesson-row .t b { display: block; font-weight: 600; }
.lesson-row .t small { color: var(--muted); font-size: 13px; }
.lesson-row .miss { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; color: var(--red); font-weight: 700; }

/* ---------- lesson ---------- */
.lhead { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.lhead .t { flex: 1; min-width: 0; }
.steps { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps button { flex-shrink: 0; display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line2); background: var(--card); border-radius: 12px; padding: 8px 12px; font-weight: 700; font-size: 14px; }
.steps button i { font-style: normal; font-family: var(--mono); font-size: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--sand); display: inline-flex; align-items: center; justify-content: center; }
.steps button.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.steps button.on i { background: var(--red); color: #fff; }
.steps button.done i { background: var(--ok); color: #fff; }
.scene { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.scene-h { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.scene-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #F7F2E9; }
.lines { padding: 10px; display: grid; gap: 4px; }
.line { display: grid; grid-template-columns: 40px 1fr; gap: 10px; padding: 10px 8px; border-radius: 12px; cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.line:hover { background: var(--sand); }
.line.playing { background: #fff; box-shadow: inset 3px 0 0 var(--red); }
.av { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; color: #fff; flex-shrink: 0; }
.line .who { font-size: 12px; font-weight: 700; color: var(--muted); font-family: var(--mono); letter-spacing: .04em; }
.line .en { font-size: 18px; line-height: 1.4; font-weight: 500; }
.line .pt { font-size: 14px; color: var(--muted); margin-top: 2px; }
.hide-en .line .en { filter: blur(6px); }
.hide-pt .line .pt { display: none; }
.phrase-card { text-align: center; padding: 26px 20px; }
.phrase-card .en { font-size: clamp(24px, 5vw, 32px); font-weight: 600; line-height: 1.3; }
.phrase-card .pt { color: var(--muted); font-size: 16px; margin-top: 6px; }
.words { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 8px; font-size: clamp(22px, 5vw, 30px); font-weight: 600; line-height: 1.35; }
.words .w-ok { color: var(--ok); }
.words .w-miss { color: var(--red); text-decoration: underline wavy; text-underline-offset: 5px; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0; }
.mic { width: 86px; height: 86px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 0 rgba(196, 50, 26, .35); transition: box-shadow .1s, transform .1s; position: relative; }
.mic svg { width: 36px; height: 36px; }
.mic.rec { background: var(--ink); }
.mic.busy { opacity: .6; }
.mic-hint { font-size: 14px; color: var(--muted); min-height: 20px; text-align: center; }
.score { font-family: var(--head); font-stretch: 62%; font-weight: 900; font-size: 44px; line-height: 1; }
.progress-dots { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.progress-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.progress-dots i.on { background: var(--ink); }
.progress-dots i.ok { background: var(--ok); }
.progress-dots i.bad { background: var(--red); }
.sheet-bg { position: fixed; inset: 0; background: rgba(22, 19, 15, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--paper); width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 22px 20px calc(24px + var(--safe-b)); }
@media (min-width: 761px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.pron-word { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.pron-word .w { font-size: 20px; font-weight: 700; }
.wrong { color: var(--red-d); text-decoration: line-through; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line2); background: #fff; border-radius: 12px; padding: 10px 14px; font-size: 17px; font-weight: 600; min-height: 46px; }
.chip.used { visibility: hidden; }
.answer-box { min-height: 64px; border: 2px dashed var(--line2); border-radius: 14px; padding: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.opt { display: block; width: 100%; text-align: left; border: 1.5px solid var(--line2); background: #fff; border-radius: 14px; padding: 14px 16px; font-size: 17px; font-weight: 500; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrongo { border-color: var(--red); background: var(--bad-bg); }
.gram-ex { display: grid; gap: 2px; padding: 10px 12px; background: #fff; border-radius: 10px; }

/* ---------- tutor ---------- */
.chat { display: flex; flex-direction: column; gap: 10px; }
.bub { max-width: 86%; padding: 12px 14px; border-radius: 16px; font-size: 17px; line-height: 1.45; }
.bub.t { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; align-self: flex-start; }
.bub.s { background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; align-self: flex-end; }
.bub.h { background: var(--warn-bg); font-size: 15px; align-self: flex-start; border-radius: 12px; }
.bub .play { margin-left: 6px; vertical-align: middle; background: none; border: 0; color: var(--red); padding: 2px; }
.goals { display: grid; gap: 6px; }
.goal { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.goal i { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line2); flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; color: #fff; font-style: normal; font-size: 12px; }
.goal.done i { background: var(--ok); border-color: var(--ok); }
.tutor-bar { position: sticky; bottom: 0; background: linear-gradient(rgba(243,238,228,0), var(--paper) 30%); padding: 30px 0 8px; margin-top: 8px; }
@media (max-width: 760px) { .tutor-bar { padding-bottom: calc(8px + var(--safe-b)); } }
.meter { height: 8px; background: var(--sand); border-radius: 4px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--red); }
.fix { border-left: 4px solid var(--red); padding: 10px 14px; background: #fff; border-radius: 0 12px 12px 0; display: grid; gap: 4px; }

/* ---------- plans ---------- */
.plan { position: relative; }
.plan .price { font-family: var(--head); font-stretch: 62%; font-weight: 900; font-size: 52px; line-height: 1; }
.plan ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.plan li { display: flex; gap: 10px; font-size: 15px; line-height: 1.4; }
.plan li::before { content: ""; width: 8px; height: 8px; background: var(--red); border-radius: 2px; margin-top: 7px; flex-shrink: 0; }
.plan.dark li::before { background: var(--red-b); }
.strike { text-decoration: line-through; color: var(--muted); }
.paymeth { display: grid; gap: 8px; }
.paymeth label { display: flex; gap: 10px; align-items: flex-start; border: 1.5px solid var(--line2); border-radius: 12px; padding: 12px; background: #fff; cursor: pointer; }
.paymeth label.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.paymeth input { accent-color: var(--red); margin-top: 3px; }

/* ---------- misc ---------- */
.center { text-align: center; }
.done-hero { text-align: center; padding: 30px 10px; }
.done-hero .kanji { font-family: 'Noto Serif JP', serif; font-weight: 900; font-size: 72px; color: var(--red); line-height: 1; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; z-index: 80; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; justify-content: center; padding: 60px 0; }
.lock-ic { width: 18px; height: 18px; color: var(--muted); }
.foot { text-align: center; font-size: 13px; color: var(--muted); padding: 30px 0 10px; }
.foot a { color: var(--muted); }
details.faq summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.ouvir-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; gap: 8px; align-items: center; background: var(--card); padding: 8px; border-radius: 16px; border: 1px solid var(--line2); box-shadow: 0 6px 20px rgba(22,19,15,.08); }
@media (max-width: 760px) { .ouvir-bar { bottom: calc(12px + var(--safe-b)); } }
.icon-btn.tg { font-family: var(--mono); font-weight: 700; font-size: 13px; }
