:root {
  --ink: #111;
  --paper: #f6f5f1;
  --card: #fff;
  --line: #e4e1d8;
  --muted: #6b6860;
  --accent: #ffc83d;      /* No B.S. yellow */
  --accent-ink: #111;
  --good: #2f7d4a;
  --good-bg: #e8f4ec;
  --warn: #a6550b;
  --warn-bg: #fff3e0;
  --bad: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.04);
  --font: 'Raleway', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--paper); color: var(--ink); font-size: 17px; line-height: 1.55; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 800; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: inherit; }
.boot { text-align: center; padding: 30vh 1rem; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.error { color: var(--bad); font-weight: 600; }
.good { color: var(--good); font-weight: 700; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 700; font-size: .95rem; padding: .7rem 1.1rem; border-radius: 10px; border: 2px solid var(--ink); background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { background: #f1efe8; }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #333; }
.btn.ghost { border-color: var(--line); }
.btn.small { padding: .4rem .8rem; min-height: 36px; font-size: .85rem; }
.btn.block { display: flex; width: 100%; margin: .5rem 0; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.danger, .link.danger { color: var(--bad); }
.btn.google { background: #fff; border-color: #dadce0; }
.btn.google .g { font-weight: 800; color: #4285f4; font-size: 1.1rem; }
.btn.mark { margin-top: .5rem; }
.btn.mark.on { background: var(--good); border-color: var(--good); color: #fff; }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* forms */
.field { margin: .9rem 0; }
.field label { display: block; font-weight: 700; margin-bottom: .35rem; }
.opt { font-weight: 600; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
input, textarea, select { width: 100%; font: inherit; font-size: 16px; padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
textarea { resize: vertical; min-height: 6rem; }
input:focus, textarea:focus, select:focus { border-color: var(--ink); outline: none; }
.need { border-color: var(--bad) !important; background: #fff6f5; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { width: 1.3rem; height: 1.3rem; flex: none; margin-top: .15rem; accent-color: var(--ink); }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 0 0 1rem; box-shadow: var(--shadow); }

/* gate */
.gate { max-width: 460px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.gate-top { text-align: right; }
.brand-box { display: inline-flex; flex-direction: column; align-items: center; background: var(--ink); color: #fff; border: 4px solid #fff; outline: 2px solid var(--ink); padding: .8rem 1.4rem; margin: 2rem auto .8rem; position: relative; left: 50%; transform: translateX(-50%); }
.brand-box span { font-weight: 800; font-size: 1.6rem; letter-spacing: .02em; }
.brand-box strong { color: var(--accent); font-weight: 800; letter-spacing: .25em; text-transform: uppercase; font-size: .9rem; }
.tagline { text-align: center; color: var(--muted); }
.gate-card h1 { font-size: 1.35rem; }
.code-input { font-size: 1.3rem; text-align: center; letter-spacing: .08em; text-transform: uppercase; margin: .6rem 0; font-weight: 700; }
.or { text-align: center; color: var(--muted); margin: 1rem 0; position: relative; }
.or::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { background: var(--card); padding: 0 .6rem; position: relative; }
.restore { display: inline-block; margin-top: .4rem; cursor: pointer; }

/* shell */
.top { position: sticky; top: 0; z-index: 5; background: var(--ink); color: #fff; display: flex; justify-content: space-between; align-items: center; padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top)); }
.logo { text-decoration: none; display: flex; align-items: baseline; gap: .35rem; }
.logo span { font-weight: 800; font-size: 1.15rem; }
.logo strong { color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: .15em; font-size: .8rem; }
.top-right { display: flex; gap: .8rem; align-items: center; }
.top .lang { color: #fff; font-size: .9rem; }
.sync { font: inherit; font-size: .75rem; font-weight: 700; border-radius: 99px; padding: .25rem .6rem; border: 0; cursor: pointer; }
.sync.ok { background: #2a2a2a; color: #9fd8b0; cursor: default; }
.sync.saving { background: #2a2a2a; color: #ddd; cursor: default; }
.sync.warn { background: var(--accent); color: var(--ink); }
main { max-width: 720px; margin: 0 auto; padding: 1.2rem 1rem 6.5rem; outline: none; }
.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: .3rem 0; padding-bottom: max(.3rem, env(safe-area-inset-bottom)); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; text-decoration: none; font-size: .72rem; font-weight: 700; color: var(--muted); padding: .25rem 0; }
.tabs a .ic { font-size: 1.25rem; line-height: 1.3; filter: grayscale(1); opacity: .6; }
.tabs a.on { color: var(--ink); }
.tabs a.on .ic { filter: none; opacity: 1; }

/* home */
.hero h1 { font-size: 1.6rem; margin-bottom: .2rem; }
.progress-wrap { margin: 1rem 0 1.1rem; }
.progress-label { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: .35rem; }
.progress { height: 14px; background: #ece9e0; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), #f0a500); border-radius: 99px; transition: width .4s; }
.section-h { margin: 1.4rem 0 .7rem; }
.lesson-list { list-style: none; padding: 0; margin: 0; }
.lesson-item { display: flex; align-items: center; gap: .9rem; text-decoration: none; padding: .9rem 1rem; }
.lesson-item:hover { border-color: var(--ink); }
.lesson-item .num { flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 800; }
.lesson-item.done .num { background: var(--good); }
.lesson-item .txt { flex: 1; display: flex; flex-direction: column; }
.status { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: .2rem .5rem; border-radius: 6px; white-space: nowrap; }
.status.done { background: var(--good-bg); color: var(--good); }
.status.started { background: #fff6d6; color: #8a6400; }
.status.none { background: #f0eee8; color: var(--muted); }
.banner { border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.banner.warn { background: var(--warn-bg); border: 1px solid #f3cf9c; color: #5c3200; }
.banner.danger { background: #fdecea; border: 2px solid var(--bad); color: #7a1410; font-weight: 600; }
.banner.danger .btn.primary { background: var(--bad); border-color: var(--bad); }
.subtitle { font-weight: 700; font-size: 1.1rem; margin-bottom: .3rem; }
.guarantee { margin: 0 0 1rem; padding: 1rem 1.2rem; background: #fffcf0; border-left: 5px solid var(--accent); border-radius: var(--radius); }
.guarantee p { margin: .5rem 0 0; }
.guarantee .sig { font-weight: 800; }

/* lesson */
.back { display: inline-block; margin-bottom: .8rem; font-size: .9rem; }
.lesson-head { margin-bottom: 1rem; }
.eyebrow { font-size: .8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .3rem; }
.sample { background: var(--accent); color: var(--ink); padding: .05rem .4rem; border-radius: 4px; }
.part { border-left: 5px solid var(--line); }
.part.picture { border-left-color: #7a6cf0; }
.part.must { border-left-color: var(--ink); }
.part.quick { border-left-color: var(--accent); }
.part.allin { border-left-color: #e8572a; }
.part.is-done { background: #fbfdfb; }
.part-h { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.part-h h2 { margin: 0; }
.listen { font: inherit; font-size: .8rem; font-weight: 700; border: 1.5px solid var(--line); background: #fff; border-radius: 99px; padding: .3rem .7rem; cursor: pointer; white-space: nowrap; min-height: 34px; }
.listen.speaking { background: var(--ink); color: #fff; border-color: var(--ink); }
.picture p { font-size: 1.05rem; }
.ai { border: 2px dashed #c9c4b6; box-shadow: none; background: #fdfcf8; }
.ai .prompt { white-space: pre-wrap; word-break: break-word; background: #f3f1ea; border-radius: 10px; padding: .9rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; line-height: 1.5; max-height: 16rem; overflow: auto; }
.ai .tip { background: var(--warn-bg); padding: .5rem .7rem; border-radius: 8px; }
.ai-steps-preview { padding-left: 1.3rem; }
.lesson-foot { margin-top: 1.4rem; }

/* money */
.total { text-align: center; }
.total .big { font-size: 2.6rem; font-weight: 800; color: var(--good); line-height: 1.1; }
.sales { list-style: none; padding: 0; margin: 0; }
.sale { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; }
.empty { text-align: center; padding: 1.5rem 0; }

/* audit */
fieldset.q { border: 1px solid var(--line); }
fieldset.q legend { font-weight: 700; padding: 0; float: left; width: 100%; margin-bottom: .7rem; }
.seg { clear: both; display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: block; text-align: center; padding: .6rem .3rem; border: 2px solid var(--line); border-radius: 10px; font-weight: 700; font-size: .9rem; }
.seg input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); }
.leaks { list-style: none; padding: 0; }
.leak { border-left: 5px solid var(--line); }
.leak.high { border-left-color: var(--bad); }
.leak.mid { border-left-color: #e8902a; }
.leak.low { border-left-color: var(--accent); }

/* badges */
.badges { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .2rem; margin: 0; }
.badge .b-ic { font-size: 2.4rem; }
.badge.locked .b-ic { filter: grayscale(1); opacity: .3; }
.badge.locked strong { color: var(--muted); }
.badge.got { border-color: var(--accent); background: #fffcf0; }
.b-state { font-weight: 700; margin-top: .2rem; }

/* toasts */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 5.5rem; z-index: 20; display: flex; flex-direction: column; gap: .5rem; align-items: center; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: .75rem 1.1rem; border-radius: 12px; font-weight: 700; box-shadow: 0 6px 24px rgba(0,0,0,.2); transition: opacity .4s, transform .4s; text-align: center; }
.toast.badge { background: var(--accent); color: var(--ink); font-size: 1.05rem; }
.toast.warn { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (min-width: 760px) {
  body { font-size: 18px; }
  h1 { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
