/* Code and Compile brand: white + navy, orange accent, Montserrat headings, pill buttons */
:root {
  --bg: #FFFFFF;
  --bg-soft: #F9FAFB;
  --text: #040710;
  --text-2: #4D5562;
  --muted: #6B7280;
  --glass: rgba(255, 255, 255, 0.82);
  --glass-strong: #FFFFFF;
  --border: #E5E7EB;
  --border-strong: #D2D5DA;
  --track: #EEF0F3;
  --accent: #E99450;          /* brand orange, for fills */
  --accent-ink: #040710;      /* text on orange */
  --accent-text: #B4581F;     /* orange that is readable as text on white */
  --btn-bg: #121826;          /* navy pill buttons, as on the website */
  --btn-ink: #FFFFFF;
  --amber: #B4581F;
  --true: #067647;
  --glow-1: #EEBB8E;
  --glow-2: #E0E6E8;
  --glow-opacity: 0.45;
  --nav-bg: rgba(255, 255, 255, 0.88);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --bar-bg: #040710;
  --bar-ink: #F3F4F6;
  --card-solid: #FFFFFF;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #040710;
  --bg-soft: #0A0E19;
  --text: #F3F4F6;
  --text-2: #C9CDD4;
  --muted: #9AA1AD;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --track: rgba(255, 255, 255, 0.12);
  --accent: #E99450;
  --accent-ink: #040710;
  --accent-text: #F0A868;
  --btn-bg: #E99450;
  --btn-ink: #040710;
  --amber: #F0A868;
  --true: #47CD89;
  --glow-1: #E99450;
  --glow-2: #2A3550;
  --glow-opacity: 0.16;
  --nav-bg: rgba(10, 14, 25, 0.75);
  --shadow: none;
  --bar-bg: #121826;
  --bar-ink: #F3F4F6;
  --card-solid: #121826;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}
button, input { font: inherit; color: inherit; }
a { color: var(--accent-text); }

h1, h2, h3, .title, .h2, .h3, .score, .verdict, .face .q, .logo, .stat .v {
  font-family: "Montserrat", "Inter", system-ui, sans-serif;
}
.mono { font-variant-numeric: tabular-nums; }
.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
}
.muted { color: var(--muted); }

/* Logo: one image per theme */
.logo { display: inline-flex; align-items: center; }
.logo-img { height: 100%; width: auto; display: block; }
.logo-img.dark { display: none; }
:root[data-theme="dark"] .logo-img.light { display: none; }
:root[data-theme="dark"] .logo-img.dark { display: block; }
.hl { color: var(--accent-text); }

/* Landing illustration */
.hero { margin: 18px -6px 6px; }
.hero-art { width: 100%; height: auto; display: block; filter: drop-shadow(0 14px 24px rgba(16, 24, 40, 0.10)); }
.hero-art .c-card { fill: var(--card-solid); stroke: var(--border-strong); stroke-width: 1.2; }
.hero-art .c-front { stroke: var(--accent); stroke-width: 1.6; }
.hero-art .c-line { fill: none; stroke: var(--text-2); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.hero-art .c-flip { stroke: var(--accent-text); }
.hero-art .c-accent { fill: var(--accent); }
.hero-art .c-node { fill: var(--card-solid); stroke: var(--text-2); stroke-width: 2.4; }
.hero-art .c-label { font: 600 12px "Montserrat", "Inter", sans-serif; letter-spacing: 0.12em; fill: var(--muted); }
.hero-art .c-hub { font: 700 7px "Inter", sans-serif; fill: var(--accent-ink); }
.hero-art .c-chip { fill: var(--bg-soft); stroke: var(--accent); stroke-width: 1.2; }
.hero-art .c-chip-t { font: 700 9px "Inter", sans-serif; letter-spacing: 0.08em; fill: var(--accent-text); }
.hero-art .c-bar { fill: var(--track); }
.hero-art .c-spark { fill: var(--accent); opacity: 0.85; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }

/* Announcement bar, like the website */
.announce {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
  margin: -24px -20px 0; padding: 12px 20px;
  background: var(--bar-bg); color: var(--bar-ink);
  font-size: 14px; text-align: center; text-decoration: none;
}
.announce strong { color: var(--accent); font-weight: 600; white-space: nowrap; }

/* Background glows (soft, brand orange) */
.glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  opacity: var(--glow-opacity);
  z-index: 0;
}
.glow.one { width: 340px; height: 340px; background: var(--glow-1); filter: blur(110px); top: -120px; right: -140px; }
.glow.two { width: 300px; height: 300px; background: var(--glow-2); filter: blur(110px); top: 50vh; left: -160px; }

/* Layout */
#app {
  position: relative;
  z-index: 1;
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px 120px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
#app.no-nav { padding-bottom: 32px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

h1, h2, h3 { margin: 0; }
.title { font-size: 30px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
.h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.h3 { font-size: 17px; font-weight: 600; }

/* Surfaces */
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}
.panel { border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
}
.chip {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-2); border: 1px solid var(--border);
}
.chip.outline { background: transparent; border: 1px solid var(--border-strong); }
.chip.brand { background: transparent; color: var(--accent-text); border-color: var(--accent); }

/* Buttons: pills, like the website */
.btn {
  appearance: none; border: 0; cursor: pointer;
  height: 52px; padding: 0 22px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 16px; font-weight: 600; text-decoration: none;
  transition: transform 0.08s, opacity 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--btn-bg); color: var(--btn-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn.block { width: 100%; }
.btn.small { height: 40px; padding: 0 16px; font-size: 14px; gap: 8px; }
.avatar {
  width: 52px; height: 52px; flex: none; border-radius: 50%; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink);
  font-family: "Montserrat", "Inter", sans-serif; font-weight: 700; font-size: 18px;
}
.instructor { gap: 14px; }

/* On/off switch (a real checkbox) */
.switch-input {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer; margin: 2px 0 0;
  width: 50px; height: 30px; border-radius: 999px; position: relative;
  background: var(--track); border: 1px solid var(--border-strong); transition: background 0.2s;
}
.switch-input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
.switch-input:checked { background: var(--accent); border-color: var(--accent); }
.switch-input:checked::after { transform: translateX(20px); }
.switch-input:disabled { opacity: 0.6; }
.icon-btn {
  appearance: none; cursor: pointer;
  width: 44px; height: 44px; border-radius: 999px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--glass-strong); border: 1px solid var(--border-strong); color: var(--text);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Progress bars */
.bar { height: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.4s; }
.segs { display: flex; gap: 6px; }
.segs > span { flex: 1; height: 4px; border-radius: 2px; background: var(--track); }
.segs > span.on { background: var(--accent); }
.segs > span.miss { background: var(--text-2); opacity: 0.45; }

/* Topic tiles */
.tile {
  appearance: none; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px; border-radius: 20px;
  color: var(--text);
  transition: border-color 0.2s;
}
.tile:hover { border-color: var(--accent); }
.tile .name { font-family: "Montserrat", "Inter", sans-serif; font-size: 15px; font-weight: 600; line-height: 1.25; min-height: 38px; }
.tile .meta { font-size: 12px; color: var(--muted); }

/* Level tabs */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; }
.tabs button {
  flex: 1; appearance: none; border: 0; cursor: pointer;
  height: 40px; border-radius: 999px; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.tabs button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-ink); }

/* Flashcard */
.card-wrap { perspective: 1400px; flex: 1; min-height: 420px; display: flex; }
.card {
  position: relative; width: 100%; flex: 1;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(.2, .8, .2, 1);
  color: var(--text);
}
.card.flipped { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 28px; padding: 28px;
  display: flex; flex-direction: column; gap: 18px;
  background: var(--glass-strong); border: 1px solid var(--border);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
  overflow: auto;
  text-align: left; color: var(--text); font: inherit;
}
.face.front { cursor: pointer; }
.face.back { transform: rotateY(180deg); }
.face .q { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; margin: auto 0; }
.face .verdict { font-size: 42px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.face .verdict.myth, .face .verdict.false { color: var(--accent-text); }
.face .verdict.true { color: var(--true); }
.face .a { font-size: 18px; line-height: 1.55; color: var(--text-2); }
.face img { max-width: 100%; max-height: 180px; object-fit: contain; border-radius: 12px; }
.face .hint { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.watch {
  margin-top: auto; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border);
  font-size: 14px; font-weight: 500; color: var(--text); text-decoration: none;
}

/* Result */
.score { font-size: 64px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.blocks { display: flex; gap: 8px; }
.blocks > span { flex: 1; height: 40px; border-radius: 10px; background: var(--accent); }
.blocks > span.miss { background: var(--track); }
.stat .v { font-size: 22px; font-weight: 600; }
.stat .k { font-size: 12px; color: var(--muted); }
.amber { color: var(--amber); }

/* Calendar dots */
.dots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.dots > span { aspect-ratio: 1; border-radius: 8px; background: var(--track); }
.dots > span.on { background: var(--accent); }
.dots > span.today { outline: 2px solid var(--border-strong); }

/* Inputs */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 500; color: var(--text-2); }
.field input {
  height: 52px; padding: 0 20px; border-radius: 999px;
  background: var(--glass-strong); border: 1px solid var(--border-strong);
  font-size: 16px; outline: none;
}
.field input:focus { border-color: var(--accent); }
.code-input {
  height: 64px; width: 100%; padding: 0 16px; border-radius: 18px; text-align: center;
  font-family: "Montserrat", "Inter", sans-serif; font-size: 30px; font-weight: 600; letter-spacing: 0.35em;
  background: var(--glass-strong); border: 1px solid var(--border-strong); color: var(--text); outline: none;
  font-variant-numeric: tabular-nums;
}
.code-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.code-input::placeholder { color: var(--border-strong); letter-spacing: 0.35em; }
.linkish {
  appearance: none; background: none; border: 0; padding: 8px 0; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px;
}
.linkish:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.note { font-size: 13px; color: var(--muted); }
.error { font-size: 14px; color: var(--accent-text); }
.error:empty { display: none; }

/* Bottom nav */
nav.bottom {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(448px, calc(100% - 32px));
  display: flex; justify-content: space-around;
  padding: 8px; border-radius: 999px; z-index: 5;
  background: var(--nav-bg); border: 1px solid var(--border);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow);
}
nav.bottom[hidden] { display: none; }
nav.bottom button {
  appearance: none; border: 0; background: none; cursor: pointer;
  width: 72px; height: 48px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 500;
}
nav.bottom button[aria-current="page"] { color: var(--accent-text); }

.footer { display: flex; gap: 16px; justify-content: center; font-size: 13px; }
.footer a { color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  padding: 12px 18px; border-radius: 999px; z-index: 10;
  background: var(--btn-bg); color: var(--btn-ink);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow);
}

.center { text-align: center; }
.spacer { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .card, .bar > span { transition: none; }
}
