/* BigZ stage 1 styles.
   Built to be readable for a 10-year-old, iPad-first, and usable with a
   finger (no hover-only controls). British English lives in the HTML. */

:root {
  --bg: #0b1220;
  --bg-2: #121a2b;
  --panel: #172036;
  --panel-2: #1d2944;
  --ink: #f4f7fb;
  --muted: #b7c0d4;
  --green: #22e67a;
  --green-ink: #052010;
  --gold: #ffd21a;
  --pink: #ff5ec8;
  --cyan: #3ce0ff;
  --orange: #ff8a3d;
  --red: #ff3b4e;
  --yt: #ff0000;
  --yt-ink: #fff;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --tap: 48px;
  --font: "Trebuchet MS", "Avenir Next", "Segoe UI", ui-rounded, system-ui, sans-serif;
  --space: 1rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--green);
  text-decoration-thickness: 2px;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

/* ----- layout ----- */

.wrap {
  width: min(1100px, 100% - 1.5rem);
  margin-inline: auto;
}

.site-header, .site-footer {
  padding: 0.75rem 0;
  padding-top: max(0.75rem, env(safe-area-inset-top));
}

.site-header .wrap, .site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.site-nav {
  margin-left: auto;
  justify-content: flex-end;
}

.logo {
  display: inline-flex;
  align-items: baseline;
  min-height: var(--tap);
  padding: 0.25rem 0.2rem 0.25rem 0.15rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 1.45rem;
}

.logo span {
  color: var(--green);
  letter-spacing: 0.04em;
  margin-left: -0.12em;
  text-shadow: 0 0 16px rgba(34, 230, 122, 0.45);
}

.rainbow {
  height: 6px;
  background: linear-gradient(90deg,
    #ff3b4e, #ff8a3d, #ffd21a, #22e67a, #3ce0ff, #7a6cff, #ff5ec8);
}

.site-footer {
  color: var(--muted);
  font-size: 0.95rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  margin-top: 2rem;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.fine-print { margin: 0.6rem 0 0; }

/* ----- buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0.7rem 1.1rem;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--panel-2);
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--shadow);
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(34, 230, 122, 0.25);
}

.btn:focus-visible, .icon-btn:focus-visible, .level:focus-visible, .answer:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.btn-green { background: var(--green); color: var(--green-ink); }
.btn-gold { background: var(--gold); color: #2a1d00; }
.btn-cyan { background: var(--cyan); color: #042028; }
.btn-pink { background: var(--pink); color: #2a0520; }
.btn-yt { background: var(--yt); color: var(--yt-ink); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  box-shadow: none;
  color: var(--ink);
}

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-lg {
  min-height: 72px;
  font-size: 1.25rem;
  padding: 0.9rem 1.2rem;
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0.4rem 0.75rem;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  font-weight: 700;
  touch-action: manipulation;
}

/* ----- home ----- */

.hero {
  display: grid;
  gap: 1.25rem;
  margin: 1rem 0 1.5rem;
}

.banner-frame {
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid #1e2a44;
  box-shadow: var(--shadow), 0 0 0 2px rgba(34, 230, 122, 0.2);
  background: #071018;
}

.banner-frame img {
  width: 100%;
  height: auto;
  max-height: min(52vh, 520px);
  object-fit: contain;
  background: #071018;
}

.hero-copy h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
}

.hero-copy h1 strong { color: var(--green); }

.lede { margin: 0 0 1rem; color: var(--muted); font-size: 1.05rem; }

.cta-stack { display: grid; gap: 0.75rem; }

.quiz-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.quiz-card small { font-weight: 600; opacity: 0.85; }

.subscribe-block {
  margin-top: 0.5rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
}

.subscribe-block p { margin: 0 0 0.7rem; }

/* Landscape iPads and similar: banner and buttons share the screen
   so nobody has to scroll past a tall picture to play. */
@media (orientation: landscape) and (min-width: 900px) {
  .hero {
    grid-template-columns: 1.15fr 1fr;
    align-items: center;
  }
  .banner-frame img { max-height: min(70vh, 560px); }
}

@media (orientation: landscape) and (max-height: 500px) {
  .banner-frame img { max-height: 72vh; }
  .hero { margin-top: 0.4rem; }
}

/* ----- level map ----- */

.page-head { margin: 1rem 0; }

.page-head h1 { margin: 0 0 0.3rem; font-size: clamp(1.5rem, 3vw, 2.1rem); }

.legend, .status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 1rem 0 1.5rem;
}

@media (min-width: 768px) {
  .level-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .level-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}

.level {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: 56px;
  padding: 0.3rem 0.2rem;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  touch-action: manipulation;
}

.level .num { font-size: 1rem; }
.level .stars { font-size: 0.75rem; letter-spacing: 0.05em; color: var(--gold); min-height: 1em; }
.level .tag { font-size: 0.65rem; font-weight: 700; color: var(--muted); text-transform: uppercase; }

.level.open { background: var(--panel-2); border-color: var(--green); }
.level.done { background: #12331f; border-color: var(--green); }
.level.locked {
  background: #151c30;
  color: #c5cce0;
  cursor: pointer;
}
.level.soon, .level.zacks {
  background: #101628;
  color: #8b95ab;
  cursor: pointer;
}

.level.my-qs {
  grid-column: 1 / -1;
  flex-direction: row;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  min-height: var(--tap);
  border-color: var(--pink);
  background: #2a1230;
}

/* ----- quiz play ----- */

.quiz-shell { width: min(800px, 100%); margin: 0 auto 2rem; }

.progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  margin: 0.5rem 0 1rem;
  color: var(--muted);
}

.progress span { white-space: nowrap; }

@media (max-width: 820px) {
  .progress {
    flex-direction: column;
    align-items: flex-start;
  }
  .icon-btn { padding-inline: 0.45rem; }
}

.question {
  font-size: clamp(1.2rem, 2.8vw, 1.7rem);
  line-height: 1.25;
  margin: 0 0 1rem;
  font-weight: 800;
}

.answers {
  display: grid;
  gap: 0.7rem;
}

@media (min-width: 768px) {
  .answers { grid-template-columns: 1fr 1fr; }
}

.answer {
  appearance: none;
  width: 100%;
  min-height: 64px;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 3px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.answer.correct { background: #147a43; border-color: var(--green); }
.answer.wrong { background: #7a1824; border-color: var(--red); }
.answer.missed { border-color: var(--green); }
.answer[disabled] { cursor: default; }

.fact {
  margin: 1rem 0;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: var(--panel);
  border-left: 6px solid var(--gold);
}

.fact[hidden], [hidden] { display: none !important; }

/* ----- results ----- */

.results {
  text-align: center;
  padding: 0.5rem 0 1.5rem;
}

.score-big {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 800;
  margin: 0.2rem 0;
  color: var(--green);
}

.star-row { font-size: 2rem; color: var(--gold); letter-spacing: 0.15em; }

.results .cta-stack { margin-top: 1.1rem; }

/* ----- make a question ----- */

.form-grid { display: grid; gap: 0.85rem; margin: 1rem 0; }

label { display: grid; gap: 0.35rem; font-weight: 700; }

input[type="text"], textarea, select {
  width: 100%;
  min-height: var(--tap);
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg-2);
  padding: 0.7rem 0.8rem;
}

textarea { min-height: 6rem; resize: vertical; }

.choice-row {
  display: grid;
  grid-template-columns: var(--tap) 1fr;
  gap: 0.5rem;
  align-items: center;
}

.choice-row input[type="radio"] {
  width: 1.6rem;
  height: 1.6rem;
  accent-color: var(--green);
  justify-self: center;
}

.card-list { display: grid; gap: 0.7rem; margin: 1rem 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
}

.card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }

/* ----- modal / toast ----- */

.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 20;
}

.modal-card {
  width: min(26rem, 100%);
  background: var(--bg-2);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  z-index: 30;
  max-width: calc(100% - 2rem);
}

/* ----- helpers ----- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.center { text-align: center; }

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