/* MPA — design tokens iOS/Apple + base */
:root {
  --bg: #f5f5f7;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e8e8ed;
  --label: #1d1d1f;
  --label-secondary: rgba(29, 29, 31, 0.62);
  --label-tertiary: rgba(29, 29, 31, 0.32);
  --separator: rgba(29, 29, 31, 0.12);
  --separator-strong: rgba(29, 29, 31, 0.22);
  --fill: rgba(120, 120, 128, 0.10);
  --fill-strong: rgba(120, 120, 128, 0.18);
  --accent: #0066cc;
  --accent-soft: rgba(0, 102, 204, 0.10);
  --accent-strong: #004fa3;
  --green: #34c759;
  --green-strong: #248a3d;
  --red: #ff3b30;
  --red-strong: #c41e1e;
  --orange: #ff9500;
  --orange-strong: #c93400;
  --yellow: #ffcc00;
  --purple: #af52de;
  --pink: #ff2d55;
  --indigo: #5856d6;
  --teal: #5ac8fa;

  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
  --shadow-lg: 0 1px 3px rgba(0,0,0,0.06), 0 24px 56px rgba(0,0,0,0.08);
  --shadow-pop: 0 1px 2px rgba(0,0,0,0.06), 0 12px 30px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--label); -webkit-font-smoothing: antialiased; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif; }
button { font-family: inherit; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* Type scale */
.h-display { font: 900 88px/0.96 'Inter', sans-serif; letter-spacing: -3px; }
.h-1 { font: 800 56px/1.04 'Inter', sans-serif; letter-spacing: -2px; }
.h-2 { font: 800 40px/1.1 'Inter', sans-serif; letter-spacing: -1.2px; }
.h-3 { font: 700 28px/1.2 'Inter', sans-serif; letter-spacing: -0.5px; }
.h-4 { font: 600 22px/1.25 'Inter', sans-serif; letter-spacing: -0.3px; }
.h-5 { font: 600 17px/1.3 'Inter', sans-serif; }
.body { font: 400 17px/1.5 'Inter', sans-serif; }
.body-l { font: 400 21px/1.45 'Inter', sans-serif; color: var(--label-secondary); }
.foot { font: 400 14px/1.4 'Inter', sans-serif; color: var(--label-secondary); }
.cap { font: 600 12px/1.3 'Inter', sans-serif; text-transform: uppercase; letter-spacing: 0.6px; color: var(--label-secondary); }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }

.text-c { text-align: center; }
.muted { color: var(--label-secondary); }
.tertiary { color: var(--label-tertiary); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; user-select: none;
  background: var(--fill); color: var(--label);
  padding: 11px 22px; border-radius: 999px;
  font: 600 15px 'Inter', sans-serif;
  transition: transform .08s ease, background .12s ease, box-shadow .12s ease;
}
.btn:hover { background: var(--fill-strong); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.tinted { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.lg { padding: 14px 28px; font-size: 16px; }
.btn.xl { padding: 18px 36px; font-size: 17px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }

/* Cards */
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card.lg { border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.card.flat { box-shadow: none; border: 0.5px solid var(--separator); }
.card.outlined { box-shadow: none; border: 1.5px solid var(--accent); }

/* Inputs */
.input, textarea.input {
  width: 100%; outline: none; resize: vertical;
  background: var(--bg-secondary); border: 0.5px solid var(--separator);
  border-radius: 12px; padding: 14px 16px;
  font: 400 15px/1.45 'Inter', sans-serif; color: var(--label);
  transition: border .15s ease, box-shadow .15s ease;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.error { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255,149,0,0.12); }
.input.ok    { border-color: var(--green); }
textarea.input { min-height: 80px; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--fill); color: var(--label-secondary);
  padding: 5px 11px; border-radius: 999px;
  font: 600 12px 'Inter', sans-serif;
}
.chip.tinted { background: var(--accent-soft); color: var(--accent); }
.chip.green  { background: rgba(52,199,89,0.14); color: var(--green-strong); }
.chip.orange { background: rgba(255,149,0,0.14); color: var(--orange-strong); }
.chip.red    { background: rgba(255,59,48,0.14); color: var(--red-strong); }
.chip.purple { background: rgba(175,82,222,0.14); color: #6e27a3; }
.chip.dark   { background: var(--label); color: #fff; }

/* Progress */
.progress { width: 100%; height: 5px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
.progress > .fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .35s ease; }

.dots { display: flex; gap: 6px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bg-tertiary); transition: all .2s; }
.dot.active { width: 28px; border-radius: 4px; background: var(--accent); }
.dot.done { background: var(--accent); }

/* Layout helpers */
.row { display: flex; }
.col { display: flex; flex-direction: column; }
.center { align-items: center; justify-content: center; }
.between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 4px } .gap-2 { gap: 8px } .gap-3 { gap: 12px } .gap-4 { gap: 16px } .gap-5 { gap: 20px } .gap-6 { gap: 28px } .gap-8 { gap: 36px }
.grow { flex: 1; }

/* Sections */
.container { max-width: 1180px; margin: 0 auto; padding: 0 36px; }
.section { padding: 100px 0; }
.section.tight { padding: 70px 0; }

/* Site nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245,245,247,0.72);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.nav-logo { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.nav-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--label); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 800 13px 'Inter', sans-serif; letter-spacing: -0.5px;
}
.nav-name { font: 600 16px 'Inter', sans-serif; }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-link { font: 500 14px 'Inter', sans-serif; color: var(--label); cursor: pointer; padding: 6px 0; opacity: 0.85; }
.nav-link:hover { opacity: 1; }

/* Caret */
.caret { display: inline-block; width: 3px; height: 0.85em; vertical-align: -0.1em; background: currentColor; margin-left: 3px; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
@keyframes l3Fade { from { opacity: 0.35; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }
@keyframes howtoRing { 0% { transform: scale(0.4); opacity: 0.5; } 100% { transform: scale(2); opacity: 0; } }
@keyframes howtoBob { 0%, 100% { transform: translate(0,0); } 50% { transform: translate(-2px,-2px); } }
@keyframes howtoFly { 0% { opacity: 0; transform: translate(95px,-46px) scale(0.7) rotate(-7deg); } 22% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(-46px,58px) scale(0.96) rotate(0deg); } }
@keyframes howtoDot { 0%, 64%, 100% { transform: translateY(0); opacity: 0.4; } 32% { transform: translateY(-4px); opacity: 1; } }
@keyframes howtoProgress { from { width: 0%; } to { width: 100%; } }
@keyframes howtoPop { 0% { transform: translateY(8px) scale(0.96); opacity: 0; } 100% { transform: translateY(0) scale(1); opacity: 1; } }

/* Lesson scaffold */
.lesson-shell { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; }
.lesson-bar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(245,245,247,0.85);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.lesson-bar-inner { height: 56px; display: flex; align-items: center; gap: 16px; }
.lesson-step { padding: 60px 0 80px; }
.lesson-step .stage { max-width: 760px; margin: 0 auto; padding: 0 36px; }

/* Drag */
.frag {
  background: #fff;
  border: 0.5px solid var(--separator);
  border-radius: 12px;
  padding: 12px 14px;
  font: 500 14px/1.45 'Inter', sans-serif;
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  transition: transform .12s ease, box-shadow .15s ease;
}
.frag:hover { transform: translateY(-1px); box-shadow: var(--shadow-pop); }
.frag.dragging { opacity: .35; transform: rotate(-1deg); }
.frag.placed { background: var(--accent-soft); border-color: var(--accent); cursor: default; }
.drop {
  border: 1.5px dashed var(--separator-strong);
  border-radius: 14px;
  padding: 14px;
  background: rgba(255,255,255,0.5);
  min-height: 68px;
  transition: all .15s ease;
}
.drop.over { border-color: var(--accent); border-style: solid; background: var(--accent-soft); }
.drop.filled { border-style: solid; border-color: var(--accent); background: var(--bg-secondary); }
.drop.wrong { border-color: var(--red); background: rgba(255,59,48,0.06); }

/* Tab segment */
.seg { display: flex; background: var(--fill); border-radius: 12px; padding: 3px; gap: 3px; }
.seg .opt {
  flex: 1; text-align: center;
  padding: 10px 12px; border-radius: 9px;
  font: 600 14px 'Inter', sans-serif;
  color: var(--label-secondary); cursor: pointer;
  transition: all .15s ease;
}
.seg .opt:hover { color: var(--label); }
.seg .opt.active { background: #fff; color: var(--label); box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

/* Reveal */
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .4s ease, transform .4s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Phone bezel */
.phone {
  width: 320px; aspect-ratio: 9 / 19;
  background: #1d1d1f; border-radius: 42px; padding: 9px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.06);
}
.phone-screen { width: 100%; height: 100%; background: var(--bg); border-radius: 34px; overflow: hidden; position: relative; padding: 18px; display: flex; flex-direction: column; gap: 12px; }

/* Stars */
.stars { display: flex; gap: 3px; }

/* Hero gradient text helper */
.grad-accent { background: linear-gradient(135deg, var(--accent), var(--purple)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* Scenario card */
.scenario {
  border-radius: 16px;
  padding: 18px;
  background: var(--bg-secondary);
  border: 0.5px solid var(--separator);
  cursor: pointer;
  transition: all .15s ease;
}
.scenario:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.scenario.selected { border-color: var(--accent); background: var(--accent-soft); }
.scenario.correct { border-color: var(--green); background: rgba(52,199,89,0.06); }
.scenario.wrong { border-color: var(--red); background: rgba(255,59,48,0.04); }

/* Mobile */
@media (max-width: 768px) {
  .h-display { font-size: 56px; letter-spacing: -2px; }
  .h-1 { font-size: 36px; letter-spacing: -1.2px; }
  .h-2 { font-size: 28px; }
  .body-l { font-size: 17px; }
  .section { padding: 64px 0; }
  .nav-links > .nav-link:not(:last-child) { display: none; }
  .container { padding: 0 22px; }
}

/* Tagline rotator */
.rotator-line { display: flex; flex-direction: column; gap: 4px; min-height: 2.1em; }
.rotator-fixed { color: var(--label); }
.rotator-changing { color: var(--accent); min-height: 1em; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal { background: var(--bg-secondary); border-radius: 22px; max-width: 520px; width: 100%; padding: 32px; box-shadow: var(--shadow-lg); }

/* Footer */
.footer { padding: 60px 0 40px; border-top: 0.5px solid var(--separator); background: var(--bg-secondary); }

/* Pillar icons */
.pillar-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center; color: #fff;
}
