/* 28 Days of AI — mobile-first. All colours and sizes come from these tokens. */
:root {
  --ink: #0f2a43;
  --ink-soft: #4a5d70;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --line: #dde4ec;
  --brand: #0b5cad;
  --brand-dark: #084a8c;
  --brand-tint: #e8f1fb;
  --sun: #fcc419;
  --sun-tint: #fff6d6;
  --good: #1a7f4b;
  --good-tint: #e4f5ec;
  --bad: #b3261e;
  --bad-tint: #fdecea;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 42, 67, 0.06), 0 6px 20px rgba(15, 42, 67, 0.06);
  --gutter: 16px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; font-size: 17px; overflow-x: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 7vw, 44px); }
h2 { font-size: clamp(22px, 5vw, 30px); }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
a { color: var(--brand); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wrap { width: 100%; max-width: 640px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap-wide { max-width: 980px; }
.stack > * + * { margin-top: 16px; }
.center { text-align: center; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.hidden { display: none !important; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px var(--gutter); max-width: 980px; margin: 0 auto; }
.logo { font-weight: 800; font-size: 18px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 14px; border: 0; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--brand); color: #fff; width: 100%; transition: background 0.15s, transform 0.05s; }
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-sun { background: var(--sun); color: var(--ink); }
.btn-sun:hover { background: #f0b400; }
.btn-ghost { background: transparent; color: var(--brand); border: 2px solid var(--line); }
.btn-ghost:hover { background: var(--brand-tint); }
.btn-inline { width: auto; min-height: 44px; padding: 0 16px; }
.link-btn { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 10px; min-height: 44px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-tint { background: var(--brand-tint); border-color: transparent; box-shadow: none; }
.card-sun { background: var(--sun-tint); border-color: transparent; box-shadow: none; }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-dark); }
.pill-sun { background: var(--sun); color: var(--ink); }

/* Forms */
label { font-weight: 600; display: block; margin-bottom: 6px; }
input[type='text'], input[type='email'], textarea { width: 100%; min-height: 52px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; font: inherit; color: inherit; background: #fff; }
input:focus, textarea:focus { border-color: var(--brand); outline: none; }
.field-error { color: var(--bad); font-size: 15px; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 15px; }
.check input { width: 22px; height: 22px; margin-top: 1px; flex: none; }

/* Option buttons (quiz + lesson quiz): every choice visible, one tap. */
.options { display: grid; gap: 10px; }
.option { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 56px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font: inherit; color: inherit; cursor: pointer; }
.option:hover { border-color: var(--brand); }
.option .emoji { font-size: 22px; flex: none; }
.option.is-selected { border-color: var(--brand); background: var(--brand-tint); }
.option.is-correct { border-color: var(--good); background: var(--good-tint); }
.option.is-wrong { border-color: var(--bad); background: var(--bad-tint); }
.option[disabled] { cursor: default; }

/* Progress bar */
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.3s; }

/* Landing */
.hero { padding: 28px 0 36px; }
.hero h1 span { color: var(--brand); }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ticks li { padding-left: 28px; position: relative; }
.ticks li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--good-tint); color: var(--good); font-weight: 800; font-size: 13px; display: grid; place-items: center; margin-top: 3px; }
.section { padding: 36px 0; }
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.week-num { font-size: 13px; font-weight: 800; color: var(--brand); text-transform: uppercase; letter-spacing: 0.06em; }
details { border-bottom: 1px solid var(--line); padding: 14px 0; }
summary { font-weight: 700; cursor: pointer; min-height: 32px; }
details p { margin-top: 10px; color: var(--ink-soft); }
.footer { padding: 28px 0 100px; color: var(--ink-soft); font-size: 14px; }
.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); z-index: 5; }
.sticky-cta .btn { max-width: 608px; margin: 0 auto; display: flex; }
@media (min-width: 720px) { .sticky-cta { display: none; } .footer { padding-bottom: 40px; } }

/* Quiz */
.quiz-head { display: flex; align-items: center; gap: 12px; padding: 12px var(--gutter); max-width: 640px; margin: 0 auto; }
.quiz-head .bar { flex: 1; }
.back { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--ink); }
.back[disabled] { visibility: hidden; }
.step { padding-block: 12px 40px; }
.step h1 { font-size: clamp(24px, 6vw, 32px); }

/* Price */
.price { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; }
.price small { font-size: 16px; font-weight: 600; color: var(--ink-soft); }

/* App shell */
.app-main { padding-block: 8px 96px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tab { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; min-height: 56px; font-size: 12px; font-weight: 600; color: var(--ink-soft); text-decoration: none; }
.tab span:first-child { font-size: 20px; }
.tab.is-active { color: var(--brand); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; }
.tile b { display: block; font-size: 22px; }
.tile span { font-size: 12px; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; min-height: 56px; }
.lesson-row:last-child { border-bottom: 0; }
.lesson-num { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--brand-tint); color: var(--brand-dark); flex: none; }
.lesson-row.is-done .lesson-num { background: var(--good-tint); color: var(--good); }
.lesson-row.is-locked { color: var(--ink-soft); }
.lesson-row.is-locked .lesson-num { background: var(--line); color: var(--ink-soft); }
.lesson-row .grow { flex: 1; min-width: 0; }

/* Lesson player */
.hook { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 24px 20px; }
.hook .stat { display: inline-block; background: rgba(255, 255, 255, 0.16); padding: 6px 14px; border-radius: 12px; font-weight: 800; font-size: 22px; margin-bottom: 14px; }
.hook h2 { color: #fff; }
.bullets { padding-left: 20px; margin: 0; display: grid; gap: 8px; }
.prompt-box { background: #fff; border: 2px dashed var(--brand); border-radius: 12px; padding: 14px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.lesson-nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); }
.lesson-nav .inner { display: flex; gap: 10px; width: 100%; max-width: 608px; margin: 0 auto; }
.lesson-nav .btn-ghost { width: 56px; flex: none; padding: 0; }
.explain { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--brand-tint); }

/* Coach */
.chat { display: grid; gap: 10px; }
.msg { max-width: 88%; padding: 12px 14px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-user { justify-self: end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg-assistant { justify-self: start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; min-height: 44px; font: inherit; font-size: 15px; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--brand); }
.composer { position: fixed; left: 0; right: 0; bottom: calc(57px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); padding: 10px var(--gutter); }
.composer form { display: flex; gap: 8px; max-width: 608px; margin: 0 auto; }
.composer textarea { min-height: 48px; max-height: 120px; resize: none; }
.composer .btn { width: 64px; flex: none; min-height: 48px; padding: 0; }

/* Certificate */
.certificate { background: #fff; border: 6px double var(--brand); border-radius: 8px; padding: 28px 20px; text-align: center; }
.certificate .who { font-size: clamp(24px, 6vw, 34px); font-weight: 800; margin: 8px 0; }

/* Advertising-cookie choice (shown only where the law requires it) */
.consent { position: fixed; left: 12px; right: 12px; bottom: 84px; z-index: 30; max-width: 616px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; font-size: 15px; }
.consent p { margin: 0 0 12px; }
.consent-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* On/off switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-weight: 400; margin: 0; cursor: pointer; }
input[role='switch'] { appearance: none; -webkit-appearance: none; flex: none; width: 52px; height: 32px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background 0.15s; }
input[role='switch']::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.15s; }
input[role='switch']:checked { background: var(--good); }
input[role='switch']:checked::after { transform: translateX(20px); }

/* Legal pages */
.legal h2 { font-size: 20px; margin-top: 28px; }
.legal .bullets { margin-bottom: 12px; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 20; max-width: calc(100% - 32px); box-shadow: var(--shadow); }

@media print {
  body { background: #fff; }
  .tabs, .top, .no-print, .toast { display: none !important; }
  .app-main { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
