:root {
  --bg: #17131f;
  --bg-2: #241d32;
  --paper: #fbf3df;
  --paper-2: #fffaf0;
  --ink: #2b2336;
  --muted: #6d6378;
  --line: #2b2336;
  --gold: #f3a712;
  --gold-light: #ffe5a0;
  --blue: #2f6fc7;
  --blue-dark: #204e90;
  --red: #d14c3d;
  --red-dark: #8c2f27;
  --green: #2f8f4e;
  --focus: #79d7ff;
  --shadow: 5px 5px 0 rgba(0, 0, 0, 0.38);
  font-family: "Trebuchet MS", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--paper);
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  font-size: 16px;
  line-height: 1.5;
}

button, output { font: inherit; }

button, a {
  min-height: 46px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button { cursor: pointer; }

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--line);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.teacher-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px max(12px, calc((100vw - 1180px) / 2));
  color: var(--ink);
  background: rgba(251, 243, 223, 0.98);
  border-bottom: 4px solid var(--line);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.28);
}

.teacher-bar__title p,
.teacher-bar__title strong {
  margin: 0;
}

.teacher-bar__title p {
  color: var(--blue-dark);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.teacher-bar__title strong { font-size: 0.95rem; }

.teacher-bar__controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.teacher-bar button,
.lesson-clock button,
.lens-tabs button,
.undo-button,
.reset-button {
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.28);
  font-weight: 900;
}

.teacher-bar button:active,
.lesson-clock button:active,
.lens-tabs button:active,
.vote-card button:active,
.timer-box button:active,
.case-cover button:active,
.minute-51 a:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.teacher-bar button:disabled,
.undo-button:disabled {
  color: #877f8e;
  background: #d7cebc;
  box-shadow: none;
  cursor: not-allowed;
}

.nav-button--next { background: var(--gold) !important; }
.reset-button { color: #fff !important; background: var(--red-dark) !important; }

#slide-count {
  min-width: 3.8em;
  color: var(--ink);
  text-align: center;
  font-weight: 900;
}

.lesson-clock {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  width: min(100% - 24px, 1180px);
  margin: 18px auto 0;
}

.lesson-clock button {
  min-width: 0;
  min-height: 58px;
  padding: 6px;
  color: #cfc6d8;
  background: var(--bg-2);
  border-color: #5d526c;
  font-size: 0.76rem;
}

.lesson-clock button span {
  display: block;
  color: var(--gold);
  font-size: 0.7rem;
}

.lesson-clock button[aria-current="step"] {
  color: var(--ink);
  background: var(--gold-light);
  border-color: var(--line);
}

.slides {
  width: min(100% - 24px, 1180px);
  margin: 12px auto 24px;
}

.slide {
  position: relative;
  min-height: min(680px, calc(100vh - 190px));
  padding: clamp(22px, 4vw, 52px);
  color: var(--ink);
  background: var(--paper);
  border: 5px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.slide::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -70px;
  bottom: -70px;
  border: 18px solid rgba(47, 111, 199, 0.12);
  transform: rotate(45deg);
}

.slide__stamp {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: clamp(18px, 4vw, 36px);
  padding-bottom: 10px;
  border-bottom: 3px solid var(--line);
}

.slide__stamp span {
  color: var(--blue-dark);
  font-weight: 900;
}

.slide__stamp strong {
  padding: 3px 9px;
  color: #fff;
  background: var(--blue-dark);
  border: 2px solid var(--line);
}

.slide__grid {
  display: grid;
  align-items: center;
  gap: clamp(20px, 4vw, 48px);
}

.kicker {
  margin: 0 0 8px;
  color: var(--red-dark);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

h1, h2, h3, p { overflow-wrap: anywhere; }

h1, h2 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.8rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

h2 { max-width: 980px; }

.lead {
  max-width: 900px;
  margin: 18px 0 26px;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  font-weight: 700;
}

.score-scene {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: clamp(12px, 2vw, 22px);
  color: #fff;
  background: #16121e;
  border: 7px solid var(--line);
  box-shadow: inset 0 0 35px rgba(255, 255, 255, 0.08);
}

.team-card {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 16px;
  border: 4px solid var(--line);
  text-align: center;
}

.team-card span { font-weight: 900; }
.team-card strong { font-size: clamp(2.6rem, 8vw, 5.8rem); line-height: 1; }
.team-card--red { background: var(--red); }
.team-card--blue { background: var(--blue); }
.versus { color: var(--gold); font-weight: 900; }

.class-cue {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: clamp(22px, 4vw, 38px);
}

.class-cue > div {
  display: grid;
  grid-template-columns: minmax(92px, 150px) 1fr;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper-2);
  border: 3px solid var(--line);
}

.class-cue span {
  color: var(--blue-dark);
  font-weight: 900;
}

.class-cue p { margin: 0; font-size: clamp(1rem, 1.8vw, 1.25rem); font-weight: 800; }

.timer-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.timer-box button,
.case-cover button,
.vote-card button {
  padding: 10px 16px;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--line);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.32);
  font-weight: 900;
}

#look-timer {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: #fff;
  background: var(--blue-dark);
  border: 3px solid var(--line);
  font-size: 1.6rem;
  font-weight: 900;
}

.vote-board {
  display: grid;
  gap: 14px;
}

.vote-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 14px;
  padding: clamp(16px, 3vw, 28px);
  color: #fff;
  border: 4px solid var(--line);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
}

.vote-card--red { background: var(--red-dark); }
.vote-card--blue { background: var(--blue-dark); }
.vote-card h3, .vote-card p { margin: 0; }
.vote-card h3 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
.vote-card p { color: rgba(255, 255, 255, 0.82); font-weight: 700; }
.vote-card output {
  grid-row: 1 / 3;
  grid-column: 2;
  align-self: center;
  font-size: clamp(3rem, 8vw, 5.4rem);
  font-weight: 900;
  line-height: 1;
}
.vote-card button { grid-column: 1 / -1; margin-top: 8px; }

.vote-result {
  margin-top: 16px;
  padding: 14px;
  background: var(--paper-2);
  border: 3px solid var(--line);
}

.bar {
  display: flex;
  width: 100%;
  height: 28px;
  overflow: hidden;
  background: #d9cfba;
  border: 3px solid var(--line);
}

.bar span { width: 0; transition: width 180ms ease; }
.bar span:first-child { background: var(--red); }
.bar span:last-child { background: var(--blue); }
.vote-result p { margin: 9px 0; font-weight: 900; }
.undo-button { min-height: 42px; }

.case-cover {
  display: grid;
  place-items: center;
  min-height: 300px;
  padding: 24px;
  color: #d6cedf;
  background: #15111d;
  border: 7px solid var(--line);
  text-align: center;
}

.case-cover p { font-size: clamp(1.15rem, 3vw, 1.8rem); font-weight: 800; }
.case-cover button { font-size: 1.12rem; }

.case-reveal {
  display: grid;
  gap: 14px;
}

.case-card {
  padding: clamp(18px, 3vw, 28px);
  background: #fff;
  border: 4px solid var(--line);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.26);
}

.case-card h3 { margin: 0 0 8px; font-size: clamp(1.4rem, 3vw, 2.2rem); }
.case-card p { margin: 0 0 14px; color: var(--muted); font-size: 1.05rem; font-weight: 700; }
.case-card strong { display: block; padding-top: 10px; border-top: 3px dashed #cfc4ae; }
.case-card--red h3 { color: var(--red-dark); }
.case-card--blue h3 { color: var(--blue-dark); }

.lens-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 22px 0 14px;
}

.lens-tabs button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--gold);
}

.compare-panel {
  padding: clamp(18px, 3vw, 30px);
  color: #fff;
  background: #1c263d;
  border: 5px solid var(--line);
}

.compare-panel__question {
  margin: 0 0 18px;
  color: var(--gold-light);
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 900;
}

.compare-panel__teams {
  display: grid;
  gap: 12px;
}

.compare-panel__teams article {
  padding: 14px;
  border: 3px solid rgba(255, 255, 255, 0.46);
}

.compare-panel__teams span { color: var(--gold); font-weight: 900; }
.compare-panel__teams p { margin: 6px 0 0; font-size: 1.08rem; font-weight: 800; }

.vote-compare {
  margin-top: 16px;
  padding: 16px;
  background: var(--gold-light);
  border: 3px solid var(--line);
}

.vote-compare h3 { margin: 0 0 10px; }
.vote-compare > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-top: 2px solid rgba(43, 35, 54, 0.24);
}

.board-notes {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.board-notes > div {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 4px solid var(--line);
}

.board-notes span {
  display: grid;
  place-items: center;
  min-height: 54px;
  color: #fff;
  background: var(--blue-dark);
  border: 2px solid var(--line);
  font-size: 1.15rem;
  font-weight: 900;
}

.board-notes p { margin: 0; font-size: clamp(1.05rem, 2vw, 1.35rem); font-weight: 800; }

blockquote {
  margin: 24px 0;
  padding: clamp(18px, 4vw, 34px);
  color: #211900;
  background: var(--gold-light);
  border: 5px solid var(--line);
  box-shadow: var(--shadow);
  font-size: clamp(1.45rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1.28;
}

.minute-51 {
  display: grid;
  align-items: center;
  gap: 18px;
  width: min(100% - 24px, 1180px);
  margin: 0 auto 24px;
  padding: clamp(20px, 3vw, 32px);
  color: #fff;
  background: var(--bg-2);
  border: 4px solid #625572;
}

.minute-51 p, .minute-51 h2 { margin: 0; }
.minute-51 p { color: var(--gold); font-weight: 900; letter-spacing: 0.08em; }
.minute-51 h2 { font-size: clamp(1.45rem, 3vw, 2.3rem); }
.minute-51 span { color: #d8d0e0; }
.minute-51 .game-url { display: block; margin-top: 8px; color: var(--gold); font-weight: 700; }
.minute-51 .game-qr { justify-self: center; width: 148px; height: 148px; background: #fff; padding: 6px; border: 3px solid #625572; }
.minute-51 a {
  display: grid;
  place-items: center;
  padding: 12px 18px;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--line);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.38);
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

footer {
  padding: 12px 16px 36px;
  color: #aca2b8;
  text-align: center;
  font-size: 0.82rem;
}

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

[hidden] { display: none !important; }

@media (min-width: 760px) {
  .slide__grid { grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr); }
  .vote-board, .case-reveal, .compare-panel__teams { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .minute-51 { grid-template-columns: 1fr auto minmax(240px, 0.38fr); }
}

@media (min-width: 1100px) {
  body { font-size: 18px; }
  .slide { min-height: min(730px, calc(100vh - 190px)); }
}

@media (max-width: 720px) {
  .teacher-bar { position: relative; }
  .teacher-bar__controls { width: 100%; display: grid; grid-template-columns: 1fr auto 1fr auto; }
  .teacher-bar button { padding-inline: 8px; }
  .lesson-clock {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .slide { min-height: 0; }
}

@media (max-width: 399px) {
  .slides, .lesson-clock, .minute-51 { width: min(100% - 16px, 1180px); }
  .slide { padding: 18px 14px; border-width: 3px; }
  .teacher-bar { padding: 8px; }
  .teacher-bar__title { width: 100%; }
  .teacher-bar__controls { grid-template-columns: 1fr auto 1fr; }
  .reset-button { grid-column: 1 / -1; }
  .lesson-clock button { min-height: 52px; }
  .score-scene { grid-template-columns: 1fr; }
  .versus { text-align: center; }
  .team-card { min-height: 110px; }
  .class-cue > div, .board-notes > div { grid-template-columns: 1fr; }
  .lens-tabs button { padding-inline: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .slide, button, a, .team-card, .vote-card, .case-card, .compare-panel, .board-notes > div {
    border-color: CanvasText;
  }
}
