/* === BULLETPROOF SCROLL FOUNDATION === */
*, *::before, *::after { box-sizing: border-box }
html { /* nothing */ }
body {
  margin: 0;
  font-family: "Inter", -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* === BRAND PALETTE — navy/sky/B&W + red for don'ts/contrast (locked 2026-05-04) === */
/* Hex: navy-2 #060D55 · navy #00225F · navy-3 #0B114D · deep #000D8F · sky #5B8DFF · red #FF4757 */
/* === DARK (default) === */
:root {
  --bg: #0B114D;        /* navy-3 */
  --bg-2: #060D55;      /* navy-2 */
  --card: #00225F;      /* navy */
  --card-2: rgba(91,141,255,0.08);
  --fg: #FFFFFF;
  --muted: rgba(255,255,255,0.62);
  --border: rgba(91,141,255,0.22);
  --brand: #5B8DFF;     /* sky */
  --brand-glow: rgba(91,141,255,0.28);
  --accent: #5B8DFF;    /* sky (unified — no second hue) */
  --accent-2: #000D8F;  /* deep (was warm/coral) */
  --hot: #FF4757;       /* red — for don'ts / contrast (per Nurbolat 2026-05-04) */
  --warn: #FF4757;      /* red — same role */
  --good: #FFFFFF;      /* white for max contrast on navy */
}

/* === LIGHT theme (greeting bright bg — Nurbolat liked this) === */
[data-theme="light"] {
  --bg: #FFFFFF;
  --bg-2: #F2F5FF;
  --card: #FFFFFF;
  --card-2: #F2F5FF;
  --fg: #00225F;        /* navy */
  --muted: #5B8DFF;     /* sky for muted text — readable on white */
  --border: rgba(0,34,95,0.14);
  --brand: #000D8F;     /* deep — strong primary on white */
  --brand-glow: rgba(0,13,143,0.16);
  --accent: #000D8F;    /* deep */
  --accent-2: #00225F;  /* navy */
  --hot: #FF4757;       /* red — for don'ts / contrast */
  --warn: #FF4757;      /* red — same role */
  --good: #060D55;      /* navy-2 for done state */
}

/* === Theme-toggle button — bottom-left floating, monochrome SVG === */
.theme-toggle {
  position: fixed;
  bottom: 18px;
  left: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--fg);
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.theme-toggle:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: 0 6px 20px var(--brand-glow); }
/* Light theme — bump contrast so toggle is noticeable on bright backgrounds */
[data-theme="light"] .theme-toggle {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
  box-shadow: 0 6px 18px var(--brand-glow), 0 2px 6px rgba(0,13,143,0.18);
}
[data-theme="light"] .theme-toggle:hover { background: var(--accent-2); color: #FFFFFF; border-color: var(--accent-2); }
.theme-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* === FLAG IMAGES — fallback when emoji font is missing === */
.flag {
  display: inline-block;
  vertical-align: -2px;
  margin: 0 2px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
[data-theme="light"] .flag {
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
}

/* === LAYOUT === */
.shell { max-width: 880px; margin: 0 auto; padding: 28px 22px 70px }

/* === TOPBAR — STATIC === */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.topbar .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px }
.topbar .logo img { width: 30px; height: 30px; border-radius: 8px }
.topbar .progress-text { color: var(--muted); font-size: 13px }

.progress-bar { height: 3px; background: var(--bg-2); position: relative; overflow: hidden }
.progress-bar > b {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--brand));
  width: 0%; transition: width .3s ease;
}

/* === MODULE NAVIGATION CHIPS === */
.modules-nav {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 32px;
  padding: 8px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
}
.modules-nav a {
  padding: 9px 14px; border-radius: 9px;
  color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.modules-nav a:hover:not(.locked) { color: var(--fg); background: var(--card-2) }
.modules-nav a.current { background: var(--brand); color: #fff; box-shadow: 0 4px 14px var(--brand-glow) }
.modules-nav a.done { color: var(--good) }
.modules-nav a.done::before { content: "✓ " }
.modules-nav a.locked {
  opacity: 0.35; cursor: not-allowed;
  pointer-events: none;
}
.modules-nav a.locked::before { content: "🔒 " }

/* === HEAD === */
.page-head { margin: 8px 0 36px }
.page-head .kicker {
  display: inline-block; padding: 5px 13px;
  background: var(--brand-glow); color: var(--accent);
  font-size: 11px; font-weight: 700; letter-spacing: 0.13em;
  text-transform: uppercase; border-radius: 999px;
  margin-bottom: 16px;
}
.page-head h1 {
  font-size: clamp(34px, 5vw, 50px); line-height: 1.04;
  margin: 0 0 14px; font-weight: 900; letter-spacing: -0.025em;
  color: var(--fg);
}
.page-head .sub {
  color: var(--muted); font-size: 17px; line-height: 1.55; margin: 0; max-width: 660px;
}
.page-head .meta {
  display: flex; gap: 18px; margin-top: 16px;
  color: var(--muted); font-size: 13px;
}

/* === BODY TEXT === */
.body-text { font-size: 17px; line-height: 1.7; font-weight: 450 }
.body-text p { margin: 0 0 18px; color: var(--fg); opacity: 0.92 }
.body-text strong { color: var(--fg); opacity: 1; font-weight: 700 }
.body-text em { color: var(--accent); font-style: normal; font-weight: 600 }

/* === ASYMMETRIC BENTO GRID === */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.bento .b {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 22px;
  position: relative;
}
.bento .b.span-2 { grid-column: span 2 }
.bento .b.span-3 { grid-column: span 3 }
.bento .b.span-4 { grid-column: span 4 }
.bento .b.span-6 { grid-column: span 6 }
.bento .b.tall { padding: 28px 24px }
.bento .b.accent { border-color: var(--accent); background: linear-gradient(160deg, var(--card), color-mix(in srgb, var(--accent) 8%, var(--card))) }
.bento .b.brand { border-color: var(--brand); background: linear-gradient(160deg, var(--card), color-mix(in srgb, var(--brand) 10%, var(--card))) }
.bento .b.warm { border-color: var(--accent-2); background: linear-gradient(160deg, var(--card), color-mix(in srgb, var(--accent-2) 8%, var(--card))) }
.bento .b .lbl {
  font-size: 11px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}
.bento .b.warm .lbl { color: var(--accent-2) }
.bento .b.brand .lbl { color: var(--brand) }
.bento .b h3 { margin: 0 0 8px; font-size: 19px; font-weight: 800; color: var(--fg) }
/* slightly bolder + slightly darker bento text per Nurbolat 2026-05-04 */
.bento .b p { margin: 0; color: var(--fg); opacity: 0.86; font-size: 14.5px; line-height: 1.6; font-weight: 500 }
.bento .b p strong { color: var(--fg); opacity: 1; font-weight: 700 }
.bento .b p + p { margin-top: 10px }
.bento .b .big {
  font-size: clamp(30px, 4vw, 44px); font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--brand));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  line-height: 1; letter-spacing: -0.03em;
  margin: 0 0 6px;
}
/* warm-variant big text — solid accent-2 (no red gradient that was bleeding into stats) */
.bento .b.warm .big {
  background: none;
  -webkit-text-fill-color: var(--accent-2);
  color: var(--accent-2);
}

@media (max-width: 700px) {
  .bento { grid-template-columns: repeat(2, 1fr) }
  .bento .b.span-2, .bento .b.span-3, .bento .b.span-4, .bento .b.span-6 { grid-column: span 2 }
}

/* === CALLOUT (used sparingly) === */
.callout {
  background: var(--card); border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 14px; padding: 18px 22px;
  margin: 22px 0;
}
.callout.warn { border-left-color: var(--accent-2) }
.callout.good { border-left-color: var(--good) }
.callout.hot { border-left-color: var(--hot) }
/* hot-soft — same colour family as hot but gentler tint (Nurbolat: slightly darker red) */
.callout.hot-soft { border-left-color: #C72A38; background: color-mix(in srgb, #C72A38 4%, var(--card)) }
.callout .lbl {
  font-size: 11px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--brand); margin-bottom: 6px;
}
.callout.warn .lbl { color: var(--accent-2) }
.callout.good .lbl { color: var(--good) }
.callout.hot .lbl { color: var(--hot) }
.callout.hot-soft .lbl { color: #C72A38 }
.callout p { margin: 0; font-size: 16px; line-height: 1.6; font-weight: 500 }
.callout p + p { margin-top: 10px }
.callout strong { color: var(--fg) }

/* === MICRO-QUIZ === */
.gate-quiz {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px;
  margin: 38px 0 26px;
}
.gate-quiz h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800 }
/* Quiz Q text — slightly bolder and darker per Nurbolat 2026-05-04 */
.gate-quiz .q-sub { color: var(--fg); opacity: 0.9; font-size: 15px; font-weight: 600; line-height: 1.55; margin: 0 0 14px }
.gate-quiz .options { display: flex; flex-direction: column; gap: 8px }
.gate-quiz label {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px;
  background: var(--card-2); border: 1.5px solid var(--border);
  border-radius: 10px; cursor: pointer;
  font-size: 14px;
}
.gate-quiz label:hover { border-color: var(--brand) }
.gate-quiz label input { accent-color: var(--brand) }
.gate-quiz label.selected { border-color: var(--brand); background: var(--brand-glow) }
.gate-quiz .feedback { margin-top: 12px; font-size: 14px; min-height: 20px; color: var(--muted) }
.gate-quiz .feedback.good { color: var(--good) }
.gate-quiz .feedback.bad { color: var(--hot) }

/* === PAGE NAV === */
.page-nav { display: flex; gap: 12px; margin: 36px 0 12px }
.page-nav a {
  flex: 1; padding: 14px 18px; border-radius: 12px;
  text-decoration: none; font-weight: 700; font-size: 14px;
  text-align: center;
  transition: transform .15s, opacity .15s;
}
.page-nav .prev { background: var(--card); color: var(--muted); border: 1px solid var(--border) }
.page-nav .prev:hover { color: var(--fg) }
.page-nav .next { background: var(--brand); color: #fff; box-shadow: 0 6px 22px var(--brand-glow) }
.page-nav .next:hover { transform: translateY(-1px) }
.page-nav .next.locked { background: var(--card-2); color: var(--muted); cursor: not-allowed; box-shadow: none; pointer-events: none }

/* === FOOTER === */
.foot { margin-top: 50px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; text-align: center }
.foot a { color: var(--accent); text-decoration: none }

/* === GATE OVERLAY === */
.gate-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate-overlay.hidden { display: none }
.gate-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; padding: 34px 30px;
  max-width: 460px; width: 100%;
}
.gate-card h2 { text-align: center; margin: 0 0 8px; font-size: 22px }
.gate-card .gate-sub { color: var(--muted); text-align: center; font-size: 14px; line-height: 1.5; margin: 0 0 22px }
.gate-card input {
  width: 100%; padding: 14px 16px;
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 10px; color: var(--fg); font-size: 16px;
  margin-bottom: 12px; font-family: inherit; outline: none;
}
.gate-card input:focus { border-color: var(--brand) }
.gate-card button {
  width: 100%; padding: 14px 24px;
  background: var(--brand); color: #fff;
  border: 0; border-radius: 10px; font-weight: 700; font-size: 15px;
  cursor: pointer; font-family: inherit;
}
.gate-card button:hover { opacity: 0.92 }
.gate-card button:disabled { opacity: 0.5; cursor: not-allowed }
.gate-card .err { color: var(--hot); font-size: 13px; min-height: 18px; text-align: center; margin: 8px 0 0 }
.gate-card .step { display: none }
.gate-card .step.active { display: block }
.gate-card .gate-mascot {
  width: 64px; height: 64px; border-radius: 50%;
  margin: 0 auto 14px; overflow: hidden;
  background: linear-gradient(135deg, var(--brand), var(--accent));
}
.gate-card .gate-mascot img { width: 100%; height: 100%; object-fit: cover }
.gate-card .back {
  background: transparent; color: var(--muted); border: 0;
  padding: 12px; margin-top: 8px; cursor: pointer;
  font-family: inherit; font-size: 13px; width: 100%;
}

/* === SEXY GREETING ANIMATION === */
.greet-hero {
  text-align: left;
  padding: 32px 0 20px;
}
.greet-hero .label-glow {
  display: inline-block; padding: 5px 14px;
  background: var(--brand-glow); color: var(--accent);
  font-size: 11px; font-weight: 800; letter-spacing: 0.16em;
  text-transform: uppercase; border-radius: 999px;
  margin-bottom: 22px;
  animation: glow-fade .9s ease-out 0.05s both;
}
.greet-hero h1.greet-line {
  font-size: clamp(40px, 7vw, 68px); line-height: 1.04;
  margin: 0 0 8px; font-weight: 900; letter-spacing: -0.03em;
  color: var(--fg);
}
.greet-hero h1.greet-line .salute { display: inline-block }
.greet-hero h1.greet-line .name {
  display: inline-block;
  color: var(--accent);
}
.greet-hero h1.greet-line .salute span,
.greet-hero h1.greet-line .name span {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px) scale(0.85);
  filter: blur(8px);
  animation: letter-pop .55s cubic-bezier(.22,1,.36,1) forwards;
}
.greet-hero h1.greet-line .salute span { color: var(--fg); }
.greet-hero h1.greet-line .name span { color: var(--accent); }
.greet-hero h1.greet-line .punch {
  font-size: clamp(28px, 4.6vw, 44px); display: block;
  color: var(--muted); font-weight: 700;
  margin-top: 8px;
  opacity: 0;
  animation: fade-up .6s ease-out 1.2s forwards;
}
@keyframes letter-pop {
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0) }
}
@keyframes name-reveal {
  from { opacity: 0; transform: translateY(20px) scale(0.95) }
  to { opacity: 1; transform: translateY(0) scale(1) }
}
@keyframes glow-fade { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: none } }
@keyframes gradient-pan {
  0%,100% { background-position: 0% 50% }
  50% { background-position: 100% 50% }
}

/* === GREET COMPACT (used inside module pages, not animated) === */
.greet {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 16px 18px;
  margin: 0 0 28px;
}
.greet .av { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; overflow: hidden }
.greet .av img { width: 100%; height: 100%; object-fit: cover }
.greet .text { font-size: 16px }
.greet b { color: var(--fg) }

/* === MOBILE === */
@media (max-width: 600px) {
  .shell { padding: 18px 16px 50px }
  .page-head h1 { font-size: 28px }
  .modules-nav { padding: 6px; gap: 4px }
  .modules-nav a { padding: 7px 10px; font-size: 12px }
}
