/* ===========================================================================
   Neft Teacher · Hero Novels · styles.css
   The STUDENT is the hero of an interactive Grade-6 math graphic novel.
   Comic-book feel: cream paper, thick near-black borders, hard offset shadows,
   gold uppercase tags, white speech bubbles. Platform palette.
   Accessibility: large readable text, 48px targets, focus rings, reduced-motion.
   Offline-only: no external fonts/images/APIs.
   =========================================================================== */
:root {
  --navy: #12355b;
  --teal: #1fa6a2;
  --amber: #f2c15b;
  --coral: #d9795d;
  --cream: #f7f4ec;
  --ink: #21313f;

  --line: #14202b; /* comic outline (near-black) */
  --paper: var(--cream);
  --bubble: #ffffff;
  --ok: #1fa6a2;
  --bad: #d9795d;
  --sh: 5px 5px 0 rgba(20, 32, 43, 0.22); /* hard comic shadow */
  --sh-sm: 3px 3px 0 var(--line);
  --font: Arial, Helvetica, "Segoe UI", system-ui, sans-serif;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
html,
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  font-size: 18px;
}
body {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(20, 32, 43, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(20, 32, 43, 0.04) 1px, transparent 1px), var(--paper);
  background-size: 30px 30px;
  padding-bottom: 40px;
}
img,
svg {
  max-width: 100%;
}
:focus-visible {
  outline: 4px solid var(--amber);
  outline-offset: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ---------------------------------------------------------------- Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--navy);
  color: #fff;
  border-bottom: 5px solid var(--line);
}
.topbar-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
}
.brand .pow {
  color: var(--amber);
}
.spacer {
  flex: 1;
}
.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1rem;
  border: 3px solid var(--line);
  border-radius: 10px;
  padding: 10px 18px;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--sh-sm);
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 0.08s ease,
    background 0.12s ease;
}
.btn:hover {
  background: var(--amber);
}
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--line);
}
.btn.primary {
  background: var(--teal);
  color: #fff;
}
.btn.primary:hover {
  background: #178b87;
}
.btn.ghost {
  background: transparent;
  color: #fff;
  border-color: #fff;
  box-shadow: none;
}
.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.15);
}
.btn.small {
  min-height: 40px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* ------------------------------------------------------------------ Shell */
.shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 22px 16px;
}
.tag {
  display: inline-block;
  background: var(--amber);
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  padding: 5px 12px;
  border: 3px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--sh-sm);
}

/* ----------------------------------------------------------- Onboarding */
.card {
  background: var(--bubble);
  border: 4px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--sh);
  padding: 22px;
  margin-top: 18px;
}
.card h1 {
  font-size: 1.9rem;
  line-height: 1.15;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 10px 0 6px;
}
.card h2 {
  font-size: 1.25rem;
  margin: 4px 0 10px;
}
.card p.lede {
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 6px;
}
.field {
  margin: 16px 0;
}
.field > label {
  display: block;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
input[type="text"] {
  width: 100%;
  font-size: 1.2rem;
  font-weight: 700;
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

/* avatar + interest pickers */
.picker {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
}
.pick {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
  text-align: center;
  box-shadow: var(--sh-sm);
  transition: transform 0.08s ease;
  min-height: 48px;
}
.pick:hover {
  background: var(--cream);
}
.pick[aria-pressed="true"] {
  background: var(--amber);
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--line);
}
.pick[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: -10px;
  right: -10px;
  width: 28px;
  height: 28px;
  background: var(--teal);
  color: #fff;
  border: 3px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-weight: 900;
}
.pick .av,
.pick .ic {
  width: 64px;
  height: 64px;
}
.pick .label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* difficulty toggle */
.levels {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.level-btn {
  flex: 1;
  min-width: 160px;
  text-align: left;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--sh-sm);
  min-height: 48px;
}
.level-btn[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}
.level-btn .lv {
  display: block;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.95rem;
}
.level-btn .lv-desc {
  font-size: 0.85rem;
  opacity: 0.9;
}

.cta-row {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.hint-line {
  font-size: 0.9rem;
  color: var(--navy);
  font-weight: 700;
}

/* ------------------------------------------------------------------ Comic */
.comic-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.comic-head h1 {
  font-size: 1.5rem;
  text-transform: uppercase;
  line-height: 1.1;
}
.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}
.progress {
  flex: 1;
  height: 16px;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--teal);
  transition: width 0.35s ease;
}
.progress-label {
  font-weight: 900;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* panel = framed comic scene with an SVG backdrop */
.panel {
  position: relative;
  border: 5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--sh);
  overflow: hidden;
  margin-top: 8px;
}
.panel .scene {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
}
.panel .scene svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.panel .caption {
  position: absolute;
  left: 14px;
  top: 14px;
  max-width: 70%;
  background: var(--amber);
  color: var(--ink);
  border: 3px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 0.92rem;
  box-shadow: var(--sh-sm);
}
.panel .sfx {
  position: absolute;
  right: 16px;
  top: 14px;
  font-weight: 900;
  font-size: 2rem;
  color: var(--coral);
  -webkit-text-stroke: 2px var(--line);
  transform: rotate(-8deg);
  text-transform: uppercase;
  pointer-events: none;
}

/* speech bubble inside / under the panel */
.bubble {
  background: var(--bubble);
  border: 3px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 16px 0 4px;
  position: relative;
  box-shadow: var(--sh-sm);
  font-size: 1.12rem;
  font-weight: 600;
}
.bubble::before {
  content: "";
  position: absolute;
  bottom: -16px;
  left: 36px;
  border: 9px solid transparent;
  border-top-color: var(--line);
}
.bubble::after {
  content: "";
  position: absolute;
  bottom: -11px;
  left: 39px;
  border: 7px solid transparent;
  border-top-color: var(--bubble);
}
.bubble .who {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 5px;
  margin-bottom: 6px;
}

/* the math prompt + choices */
.challenge {
  margin-top: 22px;
  border: 4px dashed var(--navy);
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}
.challenge .q {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 14px;
}
.choices {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.choice {
  min-height: 56px;
  border: 3px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  padding: 12px 14px;
  box-shadow: var(--sh-sm);
  transition: transform 0.08s ease;
}
.choice:hover {
  background: var(--amber);
}
.choice:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--line);
}
.choice.correct {
  background: var(--teal);
  color: #fff;
  border-color: var(--line);
}
.choice.wrong {
  background: var(--coral);
  color: #fff;
}
.choice:disabled {
  cursor: default;
  opacity: 0.95;
}

.feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border: 3px solid var(--line);
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.02rem;
  display: none;
}
.feedback.show {
  display: block;
}
.feedback.good {
  background: rgba(31, 166, 162, 0.16);
}
.feedback.bad {
  background: rgba(217, 121, 93, 0.18);
}
.feedback .next {
  margin-top: 12px;
}

/* ------------------------------------------------------------- Finale */
.finale {
  text-align: center;
}
.finale .burst {
  font-size: 1.6rem;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--coral);
  -webkit-text-stroke: 1.5px var(--line);
  letter-spacing: 0.04em;
}
.finale .star-row {
  font-size: 2.4rem;
  margin: 10px 0;
  letter-spacing: 6px;
}
.finale h1 {
  font-size: 1.8rem;
}

@media (max-width: 540px) {
  .card h1 {
    font-size: 1.5rem;
  }
  .panel .caption {
    max-width: 86%;
    font-size: 0.82rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
