:root {
  --sky: #78dbff;
  --sun: #ffd246;
  --grass: #1ed75f;
  --grass-deep: #0d8a31;
  --heart: #ff3848;
  --alert: #ffe34f;
  --ink: #0d2034;
  --panel: rgba(9, 25, 39, 0.84);
  --panel-edge: rgba(255, 255, 255, 0.16);
  --shadow: rgba(7, 19, 35, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 210, 70, 0.42), transparent 22%),
    linear-gradient(180deg, #8ce6ff 0%, #6fddff 48%, #5ed46a 100%);
  color: #f7fbff;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 85%);
}

body::after {
  background:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.2), transparent 9%),
    radial-gradient(circle at 82% 14%, rgba(255, 255, 255, 0.14), transparent 10%),
    radial-gradient(circle at 68% 34%, rgba(255, 255, 255, 0.1), transparent 9%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.site-nav-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(9, 25, 39, 0.72);
  color: #f7fbff;
  font-weight: 900;
  text-decoration: none;
}

.site-nav-link.active,
.secondary-link:hover,
.site-nav-link:hover {
  border-color: rgba(255, 216, 79, 0.48);
  background: rgba(255, 216, 79, 0.16);
  color: #fff6b9;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 360px);
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.hero-copy {
  background: linear-gradient(180deg, rgba(12, 32, 55, 0.88), rgba(7, 21, 36, 0.92));
  border: 4px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 60px var(--shadow);
  padding: 24px 26px;
  border-radius: 28px;
  animation: lift-in 620ms ease-out both;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--alert);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 12px;
  color: #fffde8;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.2rem, 5vw, 4.25rem);
  line-height: 0.92;
  text-transform: uppercase;
  text-shadow: 0 5px 0 rgba(7, 22, 36, 0.36);
}

.hero-text {
  margin: 0;
  /* No 60ch cap. It held paragraphs to about half the width of a panel that had
     the room, so cards looked half-empty with their own copy wrapped early —
     most visibly on My Badges. Text now fills whatever its container gives it,
     and the container is what limits the line length. */
  font-size: 1.06rem;
  line-height: 1.6;
  color: rgba(244, 252, 255, 0.9);
}

.hero-logo {
  width: 100%;
  max-width: 320px;
  justify-self: center;
  filter: drop-shadow(0 24px 32px rgba(12, 28, 42, 0.3));
  animation: bob 4.8s ease-in-out infinite;
}

.page-header {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px;
  border: 4px solid rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(12, 32, 55, 0.9), rgba(7, 21, 36, 0.94));
  box-shadow: 0 24px 60px var(--shadow);
}

.page-header h1 {
  margin: 0 0 10px;
  color: #fffde8;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 3rem;
  line-height: 0.98;
  text-transform: uppercase;
  text-shadow: 0 5px 0 rgba(7, 22, 36, 0.36);
}

.page-logo {
  width: 100%;
  max-width: 160px;
  justify-self: center;
  filter: drop-shadow(0 18px 24px rgba(12, 28, 42, 0.28));
}

.content-shell {
  display: grid;
  gap: 16px;
}

.game-shell {
  display: grid;
  gap: 16px;
}

.hud-panel {
  display: grid;
  /* One dense row: Life | Beat (the wide one) | AEDs · Monsters · Score ·
     Level as narrow readouts. It used to be 5 equal columns wrapping onto a
     second row (~140px tall) — twice the height for no extra information. */
  grid-template-columns: minmax(130px, 170px) minmax(200px, 1fr) repeat(3, minmax(56px, max-content));
  align-items: center;
  gap: 8px 18px;
  padding: 8px 18px;
  background: var(--panel);
  border: 4px solid var(--panel-edge);
  border-radius: 24px;
  box-shadow: 0 18px 42px var(--shadow);
  backdrop-filter: blur(10px);
}

/* Just the Facts shows a fourth readout (CPR checks); campaign runs don't
   show a level number at all, so the base row has three. Width-scoped so it
   never outranks the phone layouts further down. */
@media (min-width: 1181px) {
  .hud-panel.facts-hud {
    grid-template-columns: minmax(130px, 170px) minmax(200px, 1fr) repeat(4, minmax(56px, max-content));
  }
}

.stat-group {
  display: grid;
  gap: 3px;
  min-width: 0;
  align-content: center;
}

.stat-label {
  color: rgba(247, 251, 255, 0.75);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  color: #fff7bf;
  font-size: clamp(1rem, 1.2vw, 1.15rem);
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.life-group {
  min-width: 150px;
}

.beat-group {
  gap: 4px;
}

.beat-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}

.beat-bar {
  position: relative;
  overflow: hidden;
  height: 22px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.18);
}

.beat-fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background:
    repeating-linear-gradient(
      90deg,
      #ff4056 0,
      #ff4056 18px,
      #ff9e30 18px,
      #ff9e30 36px
    );
  box-shadow: 0 0 22px rgba(255, 72, 72, 0.52);
  transition: transform 140ms linear;
}

.beat-fill.low {
  animation: beat-critical 0.55s ease-in-out infinite;
}

@keyframes beat-critical {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.7) saturate(1.4);
  }
}

.condition-group {
  grid-column: span 2;
}

.objective-group {
  grid-column: span 2;
}

.life-hearts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 34px;
}

.life-hearts img {
  width: 34px;
  height: auto;
  image-rendering: pixelated;
}

.canvas-wrap {
  position: relative;
  isolation: isolate;
  z-index: 3;
  background: linear-gradient(180deg, rgba(14, 39, 65, 0.82), rgba(9, 20, 33, 0.94));
  border: 5px solid rgba(9, 25, 39, 0.45);
  border-radius: 32px;
  padding: 14px;
  box-shadow: 0 24px 60px var(--shadow);
}

.level-progress-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.level-progress-chip {
  min-width: 0;
  padding: 8px 6px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(247, 251, 255, 0.68);
  font-size: 0.76rem;
  font-weight: 900;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.level-progress-chip.cleared {
  border-color: rgba(123, 255, 175, 0.42);
  background: rgba(123, 255, 175, 0.14);
  color: #9dffbc;
}

.level-progress-chip.active {
  border-color: rgba(255, 229, 107, 0.62);
  background: rgba(255, 216, 79, 0.18);
  color: #fff6b9;
  box-shadow: 0 0 0 3px rgba(255, 216, 79, 0.1);
}

#game-canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  background: var(--sky);
  image-rendering: pixelated;
}

.game-toast {
  position: absolute;
  left: 28px;
  /* Bottom-anchored: it used to sit at top:68px, exactly over the in-canvas
     run status line ("AEDs 0/11 · Gate open"), hiding it for the toast's whole
     lifetime. The bottom-left corner has nothing persistent. */
  bottom: 24px;
  top: auto;
  z-index: 4;
  max-width: min(420px, calc(100% - 56px));
  padding: 11px 14px;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(9, 25, 39, 0.86);
  color: #fff6b9;
  font-weight: 900;
  line-height: 1.35;
  box-shadow: 0 16px 32px rgba(5, 17, 30, 0.34);
  pointer-events: none;
  transition: opacity 120ms ease-out, transform 120ms ease-out;
}

.game-toast.hidden {
  opacity: 0;
  transform: translateY(-8px);
}

.game-toast.success {
  color: #9dffbc;
}

.game-toast.danger {
  color: #ffb4a4;
}

.overlay {
  position: absolute;
  inset: 14px;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 15, 24, 0.5);
  border-radius: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}

.overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.overlay-card {
  /*
   * 640, not 560: the saved-character strip holds up to six looks at 88px with
   * an 8px gap, which needs 568px of content — at 560 the sixth wrapped onto a
   * row of its own. `min(100%, …)` still hands the whole width back on a phone.
   */
  width: min(100%, 640px);
  position: relative;
  z-index: 6;
  padding: 24px;
  background: linear-gradient(180deg, rgba(11, 29, 48, 0.95), rgba(6, 16, 27, 0.96));
  border: 4px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  text-align: center;
  box-shadow: 0 24px 48px rgba(5, 17, 30, 0.48);
}

.overlay-logo {
  width: min(100%, 300px);
  max-height: 110px;
  object-fit: contain;
  margin-bottom: 8px;
}

.overlay-card h2 {
  margin: 0 0 12px;
  color: #fff5b6;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.overlay-card p {
  margin: 0;
  color: rgba(245, 251, 255, 0.9);
  line-height: 1.55;
}

.overlay-meta {
  margin-top: 14px;
  color: #ffe56b;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.profile-status {
  margin-top: 12px;
  color: #9dffbc;
  font-size: 0.9rem;
  font-weight: 800;
}

.mode-select-wrap {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.mode-select-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.mode-list {
  display: grid;
  /* 2x2, not a 4-wide row: the picker now leads the welcome card, where four
     narrow columns would squeeze each mode's description down to a sliver. */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-card {
  appearance: none;
  min-width: 0;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: #f7fbff;
  cursor: pointer;
  display: grid;
  gap: 6px;
  padding: 12px;
  text-align: left;
  transition:
    transform 120ms ease-out,
    border-color 120ms ease-out,
    background 120ms ease-out,
    box-shadow 120ms ease-out;
}

.mode-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 229, 107, 0.42);
  background: rgba(255, 255, 255, 0.1);
}

.mode-card.active {
  border-color: rgba(123, 255, 175, 0.82);
  background: rgba(123, 255, 175, 0.12);
  box-shadow: 0 0 0 3px rgba(123, 255, 175, 0.14);
}

.mode-card strong {
  color: #fff6b9;
  font-size: 0.98rem;
  line-height: 1.15;
}

.mode-card span {
  color: rgba(247, 251, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.level-preview {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 3px solid rgba(255, 216, 79, 0.18);
  border-radius: 18px;
  background: rgba(255, 216, 79, 0.08);
  text-align: left;
}

.level-preview h3 {
  margin: 0;
  color: #fff6b9;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.45rem;
  line-height: 1;
  text-transform: uppercase;
}

.level-preview p {
  color: rgba(247, 251, 255, 0.82);
  font-size: 0.92rem;
}

.level-preview-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.level-preview-list span {
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.character-select-wrap {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.character-select-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.character-current {
  color: #9dffbc;
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.character-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.character-card {
  appearance: none;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: #f7fbff;
  padding: 12px 10px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  justify-items: center;
  transition:
    transform 120ms ease-out,
    border-color 120ms ease-out,
    background 120ms ease-out,
    box-shadow 120ms ease-out;
}

.character-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 229, 107, 0.42);
  background: rgba(255, 255, 255, 0.1);
}

.character-card.active {
  border-color: rgba(123, 255, 175, 0.82);
  background: rgba(123, 255, 175, 0.12);
  box-shadow: 0 0 0 3px rgba(123, 255, 175, 0.14);
}

.character-preview {
  width: auto;
  height: 86px;
  object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(7, 18, 31, 0.3));
}

.character-card.active .character-preview {
  transform: scale(1.04);
}

.character-label {
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 20px;
}

.controls-grid span {
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  font-size: 0.92rem;
  font-weight: 700;
}

.save-score-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr) auto;
  gap: 10px;
  margin: 18px 0 8px;
}

.hidden {
  display: none !important;
}

.challenge-wrap {
  margin-top: 18px;
  display: grid;
  gap: 14px;
  text-align: left;
}

/* Deliberately quiet and off to the side: it is the exit, not the goal. */
.challenge-close {
  justify-self: end;
  min-width: 0;
  padding: 8px 16px;
  font-size: 0.85rem;
  opacity: 0.75;
}

.challenge-close:hover {
  opacity: 1;
}

.challenge-body {
  display: grid;
  gap: 12px;
}

.challenge-feedback {
  min-height: 22px;
  margin: 0;
  color: rgba(247, 251, 255, 0.82);
  font-size: 0.92rem;
  font-weight: 800;
}

.challenge-feedback.error {
  color: #ffb4a4;
}

.challenge-feedback.success {
  color: #9dffbc;
}

.challenge-panel,
.challenge-question {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 3px solid rgba(255, 255, 255, 0.1);
}

.challenge-question.correct {
  border-color: rgba(123, 255, 175, 0.68);
  background: rgba(123, 255, 175, 0.1);
}

.challenge-question.wrong {
  border-color: rgba(255, 122, 103, 0.62);
  background: rgba(255, 122, 103, 0.1);
}

.challenge-question-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.challenge-number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255, 216, 79, 0.18);
  color: #fff5b6;
  font-weight: 900;
}

.challenge-prompt {
  color: #ffffff;
  font-weight: 800;
  line-height: 1.55;
}

.challenge-choices,
.challenge-submit-row,
.order-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.challenge-choice,
.challenge-inline-button {
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #f7fbff;
  font: inherit;
  font-weight: 800;
  padding: 11px 16px;
  cursor: pointer;
  transition:
    transform 120ms ease-out,
    border-color 120ms ease-out,
    background 120ms ease-out;
}

.challenge-choice:hover,
.challenge-inline-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 229, 107, 0.48);
  background: rgba(255, 255, 255, 0.12);
}

.challenge-choice.active {
  border-color: rgba(123, 255, 175, 0.82);
  background: rgba(123, 255, 175, 0.14);
  color: #fffde8;
}

.challenge-choice:disabled,
.challenge-inline-button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.order-sequence {
  display: grid;
  gap: 10px;
}

.order-slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 54px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 2px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
}

.order-slot.filled {
  border-style: solid;
  border-color: rgba(255, 216, 79, 0.38);
  background: rgba(255, 216, 79, 0.08);
}

.order-slot-index {
  color: #ffe56b;
  font-weight: 900;
}

.order-slot-text {
  flex: 1;
  color: #ffffff;
  font-weight: 800;
}

.timing-panel {
  display: grid;
  gap: 14px;
}

.timing-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.timing-bpm {
  color: #fff3af;
}

.timing-note {
  color: rgba(247, 251, 255, 0.72);
}

.timing-track {
  position: relative;
  height: 20px;
  border-radius: 999px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(90deg, #2e75df 0 40%, #1ed75f 40% 60%, #ff922f 60% 100%);
}

.timing-zone {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 40%;
  width: 20%;
  border: 3px solid rgba(255, 245, 182, 0.82);
  border-radius: 999px;
}

.timing-pointer {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff5b6;
  border: 3px solid #0d2034;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.16);
}

.timing-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: rgba(247, 251, 255, 0.72);
  font-size: 0.83rem;
  font-weight: 800;
  text-transform: uppercase;
}

.timing-steps {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 104px;
}

.timing-step {
  border-radius: 12px 12px 4px 4px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
  transition:
    transform 120ms ease-out,
    background 120ms ease-out,
    border-color 120ms ease-out;
}

.timing-step.active {
  background: linear-gradient(180deg, #ffe56b, #ff9f2d);
  border-color: rgba(255, 245, 182, 0.82);
  transform: translateY(-4px);
}

.timing-step.current {
  box-shadow: 0 0 0 3px rgba(123, 255, 175, 0.24);
}

.name-input {
  width: 100%;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  padding: 12px 14px;
}

.name-input::placeholder {
  color: rgba(255, 255, 255, 0.46);
}

/* A <select>/<textarea> wearing .name-input: browsers don't inherit font or
   sizing into form controls, and a select keeps its own OS chrome unless the
   appearance is reset. */
select.name-input {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

select.name-input option {
  background: #10263c;
  color: #ffffff;
}

textarea.name-input {
  resize: vertical;
  font-weight: 500;
  line-height: 1.45;
}

/* A sub-heading inside a wizard step (the nominee's contact block sits under
   "who are you nominating?", not on its own numbered step). */
.wizard-page h3 {
  margin: 22px 0 8px;
  color: #fffde8;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Short fields that belong on one line (suburb / state / postcode). Collapses
   to a single column on a phone, where three boxes across is unusable. */
.field-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

@media (max-width: 560px) {
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* .secondary-button is styled with .primary-button further down — same button,
   different paint. See "THE TWO BUTTONS". */

/*
 * Status / error lines (aria-live). These sit right after a button row, and
 * .primary-button paints a 12px hard shadow OUTSIDE its box — a box-shadow
 * takes no layout space, so a status line with no top margin was rendered
 * underneath it and became unreadable. Clear the shadow with real space, and
 * lift the text above any remaining overlap.
 */
.save-status {
  min-height: 22px;
  margin: 16px 0 12px;
  position: relative;
  z-index: 1;
  color: rgba(247, 251, 255, 0.86);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
}

/* An actual message earns a panel so it can't be mistaken for body copy. */
.save-status:not(:empty) {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(10, 24, 40, 0.72);
  border-left: 4px solid #ffd84f;
}

.score-breakdown {
  display: grid;
  gap: 10px;
  margin: 18px 0 12px;
  padding: 14px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
}

.score-breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  color: rgba(247, 251, 255, 0.82);
  font-weight: 800;
}

.score-breakdown-row strong {
  color: #fff6b9;
}

.score-breakdown-total {
  padding-top: 10px;
  border-top: 2px solid rgba(255, 255, 255, 0.12);
  color: #9dffbc;
}

.completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 12px;
}

/* ---------------------------------------------------------------------------
 * THE TWO BUTTONS
 *
 * One button, two paints. The green one used to be a flat rounded rectangle in
 * sentence case, which read as a different (and lesser) kind of control next to
 * the orange one — so "Take it off" looked like a link while "SAVE MY CHARACTER"
 * looked like a button. They are now the same object: same pill, same weight,
 * same capitals, same press. Only the colour says which is the main action.
 *
 * Geometry and behaviour live in ONE rule so the two can never drift apart.
 * ------------------------------------------------------------------------ */
.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 28px;
  min-width: 200px;
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  /* The class is worn by <a> as often as <button> (About, the wizards). A raw
     anchor arrives underlined and left-aligned inside the pill, so centre it and
     drop the underline HERE rather than patching each page. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  /*
   * The 12px drop shadow is painted OUTSIDE the layout box, so a stacked or
   * wrapped row of these had the next button sitting ON the previous one's
   * shadow. Reserve the depth here, once, rather than hand-tuning the gap in
   * every container that happens to hold one. 12px of lip plus 4px of air, so
   * two stacked buttons are clearly separate rather than merely not touching.
   * The press animation travels 4px into this margin, which is exactly what
   * makes it look like a real key.
   */
  margin-bottom: 16px;
  transition: transform 120ms ease-out, box-shadow 120ms ease-out;
}

.primary-button {
  background: linear-gradient(180deg, #ffd84f, #ffab27);
  color: #0f2030;
  box-shadow: 0 12px 0 #d98518;
}

.secondary-button {
  background: linear-gradient(180deg, #4ff08a, #1ec95a);
  color: #0d2034;
  box-shadow: 0 12px 0 #14913c;
}

.primary-button:hover { transform: translateY(2px); box-shadow: 0 10px 0 #d98518; }
.primary-button:active { transform: translateY(4px); box-shadow: 0 8px 0 #d98518; }

.secondary-button:hover { transform: translateY(2px); box-shadow: 0 10px 0 #14913c; }
.secondary-button:active { transform: translateY(4px); box-shadow: 0 8px 0 #14913c; }

/* Shown while the artwork is still downloading — the button is disabled until
   the render loop is up, so make the wait look deliberate rather than broken. */
.primary-button.is-loading {
  background: linear-gradient(180deg, #cfd8e2, #a9b6c4);
  box-shadow: 0 12px 0 #7d8b99;
  animation: ktbg-loading-pulse 1.4s ease-in-out infinite;
}

@keyframes ktbg-loading-pulse {
  0%,
  100% {
    opacity: 0.58;
  }
  50% {
    opacity: 0.82;
  }
}

@media (prefers-reduced-motion: reduce) {
  .primary-button.is-loading {
    animation: none;
  }
}

.compact-button {
  justify-self: start;
  min-width: 180px;
}

.danger-button {
  border: 0;
  border-radius: 16px;
  background: #ff6b57;
  color: #102033;
  font: inherit;
  font-weight: 900;
  padding: 12px 18px;
  cursor: pointer;
}

.lower-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr);
  gap: 14px;
  align-items: start;
}

.game-info-grid {
  grid-template-columns: 1fr;
}

.legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.legend-card {
  min-height: 180px;
  overflow: hidden;
  padding: 18px;
  background: rgba(10, 28, 45, 0.84);
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 18px 36px rgba(8, 20, 34, 0.24);
}

.legend-card h3 {
  margin: 14px 0 10px;
  color: #fff6b9;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.legend-card p {
  margin: 0;
  color: rgba(247, 251, 255, 0.82);
  line-height: 1.55;
}

.leaderboard-panel {
  padding: 20px;
  background: rgba(10, 28, 45, 0.84);
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  box-shadow: 0 18px 36px rgba(8, 20, 34, 0.24);
}

.standalone-panel {
  min-height: 320px;
}

.panel-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}

.eyebrow.small {
  margin-bottom: 8px;
  font-size: 0.72rem;
}

.leaderboard-panel h2 {
  margin: 0 0 8px;
  color: #fff6b9;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 2rem;
  line-height: 0.96;
  text-transform: uppercase;
}

.leaderboard-copy,
.leaderboard-empty {
  margin: 0;
  color: rgba(247, 251, 255, 0.76);
  line-height: 1.55;
}

.leaderboard-list {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.leaderboard-list-large {
  gap: 12px;
}

.process-strip,
.records-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.process-strip article,
.portal-panel {
  padding: 20px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(10, 28, 45, 0.84);
  box-shadow: 0 18px 36px rgba(8, 20, 34, 0.24);
}

.process-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 216, 79, 0.18);
  color: #fff3af;
  font-weight: 900;
}

.process-strip h2,
.portal-panel h2 {
  margin: 12px 0 8px;
  color: #fff6b9;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.55rem;
  line-height: 1;
  text-transform: uppercase;
}

.process-strip p,
.portal-panel p {
  color: rgba(247, 251, 255, 0.8);
  line-height: 1.55;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.field-label {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: rgba(247, 251, 255, 0.78);
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.consent-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 14px 0;
  color: rgba(247, 251, 255, 0.86);
  line-height: 1.45;
}

.consent-line input {
  margin-top: 4px;
}

.record-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.record-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.record-card strong {
  color: #fff6b9;
  overflow-wrap: anywhere;
}

.record-card span,
.record-card small {
  color: rgba(247, 251, 255, 0.72);
}

/* ----------------------- who's playing (identity chip) ---------------------- */
/* "Playing as … · Sign out" in the site nav — the site's only session UI.
   Pushed to the row's far end so it reads as status, not another page link. */
.identity-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-left: auto;
  padding: 6px 12px;
  border: 3px solid rgba(123, 255, 175, 0.28);
  border-radius: 12px;
  background: rgba(9, 25, 39, 0.72);
}

.identity-chip:empty {
  display: none;
}

.identity-chip .identity-name {
  color: #c2ffd6;
  font-weight: 800;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34vw;
}

.identity-chip .identity-signout,
.identity-chip .identity-code,
.identity-chip .identity-join {
  border: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #f7fbff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.identity-chip .identity-signout:hover,
.identity-chip .identity-code:hover,
.identity-chip .identity-join:hover {
  background: rgba(255, 216, 79, 0.22);
  color: #fff6b9;
}

/* ------------------------ student join: two doors in ----------------------- */
/*
 * The 2/3 – 1/3 split on the student step: new players (school code) keep the
 * big left column, returning players get their own labelled door on the right
 * ("Been here before?"). Stacks on phones, returning box below the main form.
 */
.join-split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.join-secondary {
  padding: 16px 18px;
  border-radius: 18px;
  border: 3px dashed rgba(120, 219, 255, 0.4);
  background: rgba(120, 219, 255, 0.08);
}

.join-secondary h3 {
  margin: 0 0 8px;
  color: #bdeaff;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.join-secondary .wizard-copy.small {
  font-size: 0.92rem;
  margin-bottom: 10px;
}

.join-secondary .code-input {
  letter-spacing: 0.14em;
  font-weight: 800;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  .join-split {
    grid-template-columns: minmax(0, 1fr);
  }
}

/*
 * The round leader's banner. Dark like every other panel — the old gold-tinted
 * translucent wash disappeared into the page's light-blue background — with the
 * celebration carried by the GOLD around it: a glowing border, a slow shimmer
 * sweeping the panel, and trophy confetti in the corners.
 */
.winner-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(12, 32, 55, 0.94), rgba(7, 21, 36, 0.96));
  border: 3px solid rgba(255, 216, 79, 0.75);
  box-shadow:
    0 0 0 3px rgba(255, 216, 79, 0.18),
    0 0 26px rgba(255, 216, 79, 0.32),
    0 14px 36px var(--shadow);
}

/* A soft golden shimmer sweeping across every few seconds. */
.winner-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 216, 79, 0.16) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: winner-shimmer 4.5s ease-in-out infinite;
  pointer-events: none;
}

/* Trophy + sparkles in the corners — celebration, not clutter. */
.winner-panel::after {
  content: "🏆";
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1.7rem;
  filter: drop-shadow(0 0 10px rgba(255, 216, 79, 0.55));
  pointer-events: none;
}

@keyframes winner-shimmer {
  0%, 100% { background-position: 120% 0; }
  50% { background-position: -30% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .winner-panel::before {
    animation: none;
  }
}

.winner-panel .eyebrow.small {
  margin: 0;
  color: #ffd84f;
}

.winner-name {
  margin: 0;
  color: #fff3b0;
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 0 14px rgba(255, 216, 79, 0.35);
}

.winner-summary,
/* Same story as .save-status — it follows a button row. */
.leaderboard-status {
  margin: 14px 0 0;
  position: relative;
  z-index: 1;
  color: rgba(247, 251, 255, 0.86);
  line-height: 1.5;
}

.leaderboard-status:not(:empty) {
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(10, 24, 40, 0.72);
  border-left: 4px solid #ffd84f;
}

.leaderboard-summary-grid {
  display: flex;
  /* The class board now carries EIGHT stat strips (rank + runs + the fun-stat
     tallies); wrapping at ~25% per card lands them four to a row — two tidy
     rows — instead of eight squeezed cards with truncated labels. */
  flex-wrap: wrap;
  gap: 10px;
}

/* Four to a row when there are more than four, an equal share of one row
   otherwise (the public board still fills one line with its three). */
.leaderboard-summary-grid > .summary-card {
  flex: 1 1 calc(25% - 10px);
  min-width: 160px;
}

/* Compact stat strips: the label and its number share one line, so the three
   of them read as a single row rather than three tall cards. */
.summary-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(10, 28, 45, 0.78);
  box-shadow: 0 8px 18px rgba(8, 20, 34, 0.18);
}

.summary-card .stat-label {
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-card strong {
  color: #9dffbc;
  font-size: clamp(1.1rem, 1.8vw, 1.45rem);
  line-height: 1;
  white-space: nowrap;
}

.leaderboard-actions {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 10px;
  margin-top: 14px;
}

.leaderboard-button {
  justify-self: start;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

/* Class board: clicking a player's row drops down their full run list. */
.leaderboard-item.expandable {
  grid-template-columns: 38px minmax(0, 1fr) auto 16px;
  cursor: pointer;
}

.leaderboard-item.expandable:hover {
  background: rgba(255, 255, 255, 0.1);
}

.leaderboard-item.expandable:focus-visible {
  outline: 2px solid rgba(255, 209, 102, 0.85);
  outline-offset: 2px;
}

.run-history-caret {
  color: rgba(247, 251, 255, 0.55);
  font-size: 0.8rem;
  transition: transform 0.15s ease;
}

.leaderboard-item.expanded .run-history-caret {
  transform: rotate(180deg);
}

.run-history {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
  padding-top: 9px;
  border-top: 1px dashed rgba(247, 251, 255, 0.18);
}

.run-history-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.84rem;
  color: rgba(247, 251, 255, 0.72);
}

.run-history-rank {
  flex: 0 0 26px;
  font-weight: 800;
  color: rgba(247, 251, 255, 0.5);
}

.run-history-row.best .run-history-rank {
  color: #ffd166;
}

.run-history-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.run-history-score {
  color: #9dffbc;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.leaderboard-detail {
  display: grid;
  gap: 2px;
  min-width: 0;
}

/* On a desktop-width screen the whole entry reads as one line: rank, school
   name, the run detail and the score. It only stacks when there genuinely
   isn't room. */
@media (min-width: 900px) {
  .leaderboard-detail {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: nowrap;
  }

  .leaderboard-detail .leaderboard-name {
    flex: 0 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .leaderboard-detail .leaderboard-meta {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 216, 79, 0.16);
  color: #fff3af;
  font-weight: 900;
}

.leaderboard-name {
  display: block;
  color: #ffffff;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.leaderboard-meta {
  display: block;
  margin-top: 3px;
  color: rgba(247, 251, 255, 0.68);
  font-size: 0.82rem;
}

.leaderboard-score {
  color: #9dffbc;
  font-size: 1.05rem;
  font-weight: 900;
}

.touch-controls {
  display: none;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.touch-move,
.touch-actions {
  display: flex;
  gap: 8px;
}

.touch-actions {
  justify-content: end;
}

.touch-button {
  appearance: none;
  flex: 1;
  min-height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(9, 25, 39, 0.72);
  color: #f7fbff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-button.accent {
  background: linear-gradient(180deg, #ffd84f, #ffab27);
  color: #0f2030;
}

.touch-button:active,
.touch-button.active {
  border-color: rgba(123, 255, 175, 0.72);
  transform: translateY(1px);
}

.legend-icon,
.legend-heart {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
}

/* The game's own sprites (rendered from game.js art into Graphics/guide/). */
.legend-sprite {
  display: block;
  width: auto;
  height: 56px;
  image-rendering: pixelated;
}

.legend-sprite-big {
  height: 76px;
}

.aed-icon {
  position: relative;
  width: 72px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0 55%, #d5dde4 100%);
  border: 4px solid #25313d;
  border-top-color: #f07f1a;
  border-top-width: 6px;
  box-shadow: 6px 6px 0 rgba(7, 20, 34, 0.2), inset 4px 0 0 #f07f1a, inset -4px 0 0 #f07f1a;
}

.aed-icon::before,
.aed-icon::after {
  content: "";
  position: absolute;
}

.aed-icon::before {
  inset: 8px 14px 24px;
  border-radius: 6px;
  background: #0c1a24;
  box-shadow: inset 0 -6px 0 rgba(62, 242, 154, 0.35);
}

.aed-icon::after {
  left: 50%;
  bottom: 6px;
  width: 16px;
  height: 16px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #f07f1a;
  box-shadow: inset 0 0 0 2px rgba(138, 68, 9, 0.6);
}

.wire-icon {
  position: relative;
  width: 72px;
}

.wire-icon::before,
.wire-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
}

.wire-icon::before {
  bottom: 10px;
  height: 10px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #4b5968 0 12px, transparent 12px 16px, #4b5968 16px 28px, transparent 28px 32px, #4b5968 32px 44px, transparent 44px 48px, #4b5968 48px 100%);
}

.wire-icon::after {
  top: 8px;
  height: 38px;
  background:
    linear-gradient(135deg, transparent 0 24%, #ffe149 24% 30%, transparent 30% 52%, #ffe149 52% 58%, transparent 58% 100%);
}

.orb-icon {
  position: relative;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffffff, #9fe4ff 30%, #2f8cff 68%, #1b3fae 100%);
  box-shadow:
    0 0 0 8px rgba(90, 190, 255, 0.2),
    0 0 28px rgba(90, 190, 255, 0.55);
}

.orb-icon::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, 0.55);
}

.pit-icon {
  position: relative;
  width: 72px;
  border-radius: 14px;
  background: linear-gradient(180deg, #1dd45d 0 18%, #0d2034 18% 100%);
  overflow: hidden;
}

.pit-icon::before,
.pit-icon::after {
  content: "";
  position: absolute;
}

.pit-icon::before {
  inset: 12px 16px 0;
  background: linear-gradient(180deg, rgba(255, 91, 91, 0.8), rgba(255, 173, 61, 0.2));
  clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%);
}

.pit-icon::after {
  left: 14px;
  right: 14px;
  bottom: 12px;
  height: 8px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #ffe149 0 8px, #2d3d4d 8px 14px);
}

.junk-icon {
  position: relative;
  width: 72px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f0c562 0 26%, #7a4227 26% 40%, #f7d65a 40% 48%, #69bb55 48% 58%, #f0c562 58% 86%, transparent 86% 100%);
}

.junk-icon::before,
.junk-icon::after {
  content: "";
  position: absolute;
}

.junk-icon::before {
  left: 11px;
  top: -8px;
  width: 10px;
  height: 24px;
  background: #d85c2b;
  box-shadow:
    12px 2px 0 #d85c2b,
    24px -2px 0 #d85c2b,
    36px 3px 0 #d85c2b,
    48px -1px 0 #d85c2b;
}

.junk-icon::after {
  left: 20px;
  top: 18px;
  width: 32px;
  height: 16px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 25% 35%, #102033 0 3px, transparent 3px),
    radial-gradient(circle at 75% 35%, #102033 0 3px, transparent 3px),
    linear-gradient(180deg, transparent 0 34%, #ffffff 34% 100%);
}

.sick-heart {
  filter: brightness(0.22) contrast(1.2);
}

/* ------------------------- onboarding wizard ------------------------- */

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.hero-cta {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.howitworks-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  padding: 16px 18px;
  border: 4px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(12, 32, 55, 0.88), rgba(7, 21, 36, 0.92));
  box-shadow: 0 18px 44px var(--shadow);
}

.howitworks-strip article {
  display: flex;
  gap: 12px;
  align-items: center;
}

.howitworks-strip h3 {
  margin: 0 0 2px;
  color: #fffde8;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.howitworks-strip p {
  margin: 0;
  color: rgba(244, 252, 255, 0.78);
  font-size: 0.9rem;
  line-height: 1.4;
}

.howitworks-strip .process-number {
  flex-shrink: 0;
}

.connection-banner {
  margin: 0 0 18px;
  padding: 12px 16px;
  border: 3px dashed rgba(255, 216, 79, 0.55);
  border-radius: 14px;
  background: rgba(255, 216, 79, 0.12);
  color: #fff3b0;
  font-weight: 700;
}

.path-chooser {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.path-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 22px 18px;
  border: 4px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(12, 32, 55, 0.9), rgba(7, 21, 36, 0.94));
  color: #f7fbff;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 14px 36px var(--shadow);
  transition: transform 140ms ease, border-color 140ms ease;
}

.path-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 216, 79, 0.5);
}

.path-card.active {
  border-color: var(--sun);
  background: linear-gradient(180deg, rgba(38, 52, 24, 0.92), rgba(16, 30, 16, 0.94));
}

.path-emoji {
  font-size: 2.4rem;
  line-height: 1;
}

.path-title {
  font-size: 1.35rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.path-copy {
  color: rgba(244, 252, 255, 0.78);
  font-size: 0.98rem;
  text-align: center;
}

.wizard-panel {
  margin-bottom: 22px;
  padding: 22px;
  border: 4px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(12, 32, 55, 0.9), rgba(7, 21, 36, 0.94));
  box-shadow: 0 24px 60px var(--shadow);
  animation: lift-in 420ms ease-out both;
}

.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.wizard-step {
  padding: 7px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  background: rgba(9, 25, 39, 0.6);
  color: rgba(244, 252, 255, 0.62);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.wizard-step.active {
  border-color: var(--sun);
  color: #fff3b0;
  background: rgba(255, 216, 79, 0.14);
}

.wizard-step.done {
  border-color: rgba(30, 215, 95, 0.55);
  color: #c2ffd6;
}

.wizard-page h2 {
  margin: 0 0 12px;
  color: #fffde8;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 1.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.wizard-copy {
  margin: 0 0 14px;
  color: rgba(244, 252, 255, 0.85);
  line-height: 1.55;
}

.wizard-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  /* Reserve the 12px hard shadow .primary-button paints below itself, so
     whatever follows a button row isn't drawn underneath it. */
  margin-bottom: 14px;
}

.field-hint {
  color: rgba(244, 252, 255, 0.55);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
}

.big-input {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.school-match {
  min-height: 1.3em;
  margin: 8px 0 0;
  font-weight: 800;
  color: rgba(244, 252, 255, 0.5);
}

.school-match.matched {
  color: #8effb4;
}

/* --- national school directory picker (restricted registration) --- */

.school-picker {
  margin-top: 14px;
}

.school-board-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: baseline;
  margin-top: 18px;
}

.school-board-head h3 {
  margin: 0;
  color: #fff6b9;
  overflow-wrap: anywhere;
}

.school-board-head .link-button {
  margin-top: 0;
}

/* School code + its "new code" generator, mirroring .nickname-row. */
.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

@media (max-width: 520px) {
  .code-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.combobox {
  position: relative;
}

.combo-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 292px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border-radius: 16px;
  border: 3px solid rgba(255, 255, 255, 0.16);
  background: #10263c;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.combo-results li {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
}

.combo-results li strong {
  color: #fff6b9;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

.combo-results li span {
  color: rgba(247, 251, 255, 0.68);
  font-size: 0.82rem;
  font-weight: 600;
}

.combo-results li:hover,
.combo-results li.active {
  background: rgba(30, 215, 95, 0.18);
}

.school-chosen {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(30, 215, 95, 0.12);
  border: 3px solid rgba(30, 215, 95, 0.3);
}

.school-chosen strong {
  color: #8effb4;
  overflow-wrap: anywhere;
}

.school-chosen span {
  color: rgba(247, 251, 255, 0.72);
  font-size: 0.86rem;
}

.link-button {
  display: block;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(247, 251, 255, 0.72);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.link-button:hover {
  color: #fff6b9;
}

.school-manual {
  margin-top: 6px;
  padding: 4px 14px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.approval-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 216, 79, 0.12);
  border: 3px solid rgba(255, 216, 79, 0.26);
  color: rgba(247, 251, 255, 0.88);
  font-size: 0.9rem;
  line-height: 1.5;
}

.approval-note strong {
  color: #ffd84f;
}

.nickname-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  margin-bottom: 12px;
}

.dice-button {
  font-size: 1.5rem;
  padding: 8px 16px;
}

/* ----------------------- nickname slot machine ----------------------- */

.slot-machine {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.slot-reel-group {
  display: grid;
  gap: 6px;
}

.slot-window {
  position: relative;
  height: 156px; /* 3 × 52px items — keep in sync with REEL_ITEM_HEIGHT in signup.js */
  overflow: hidden;
  border: 3px solid var(--panel-edge);
  border-radius: 14px;
  /* payline band behind the middle row, over the reel base colour */
  background:
    linear-gradient(rgba(255, 210, 70, 0.16), rgba(255, 210, 70, 0.16)) 0 52px / 100% 52px no-repeat,
    rgba(4, 14, 24, 0.85);
  box-shadow: inset 0 12px 22px rgba(0, 0, 0, 0.5);
}

.slot-window::before,
.slot-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 50px;
  pointer-events: none;
  z-index: 2;
}

.slot-window::before {
  top: 0;
  background: linear-gradient(rgba(4, 14, 24, 0.92), rgba(4, 14, 24, 0));
}

.slot-window::after {
  bottom: 0;
  background: linear-gradient(rgba(4, 14, 24, 0), rgba(4, 14, 24, 0.92));
}

.slot-strip {
  list-style: none;
  margin: 0;
  padding: 0;
  will-change: transform;
}

.slot-strip li {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: clamp(0.85rem, 2.6vw, 1.1rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.slot-nudge {
  border: 2px solid var(--panel-edge);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 0.8rem;
  padding: 4px 0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.slot-nudge:hover,
.slot-nudge:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

.slot-spin-button {
  font-size: 1.05rem;
  padding: 14px 18px;
  white-space: nowrap;
}

.slot-spin-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.slot-spin-emoji {
  font-size: 1.4rem;
  margin-right: 4px;
}

.slot-result {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.slot-result strong {
  color: var(--sun);
  letter-spacing: 0.04em;
}

@media (max-width: 620px) {
  .slot-machine {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .slot-spin-button {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slot-strip {
    transition: none !important;
  }
}

.code-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 0 0 20px;
  padding: 18px 20px;
  border: 4px dashed rgba(255, 216, 79, 0.6);
  border-radius: 18px;
  background: rgba(255, 216, 79, 0.1);
}

.code-text {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  color: #fff3b0;
}

.share-kit h3 {
  margin: 0 0 10px;
  color: #fffde8;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.share-steps {
  margin: 0;
  padding-left: 22px;
  line-height: 1.7;
  color: rgba(244, 252, 255, 0.88);
}

.share-steps li {
  margin-bottom: 6px;
}

.play-now-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.round-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.connection-badge {
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(9, 25, 39, 0.6);
  color: rgba(244, 252, 255, 0.6);
  font-size: 0.85rem;
  font-weight: 800;
}

.connection-badge.live {
  border-color: rgba(30, 215, 95, 0.6);
  color: #8effb4;
}

.round-label {
  font-weight: 800;
  color: #fff3b0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.92rem;
}

.round-select {
  /* Sized by its longest option ("August 2026 (current)"), not by a guess — a
     clipped round name is the one thing on this row that has to be readable. */
  max-width: none;
  width: auto;
  padding: 8px 10px;
}

/* The round and mode pickers belong together, so they share one line rather
   than the mode picker dropping below when the row runs out of width. */
.round-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  /* Wraps rather than squeezing: two full-width pickers on one line beat two
     truncated ones. */
  flex-wrap: wrap;
}

.round-controls .round-select {
  max-width: none;
  width: auto;
  min-width: 0;
}

.leaderboard-item.leading {
  border-color: rgba(255, 216, 79, 0.55);
  background: rgba(255, 216, 79, 0.1);
}

.inline-cta {
  margin-left: 10px;
  vertical-align: middle;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes lift-in {
  from {
    opacity: 0;
    transform: translateY(22px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  /* Same single dense row as desktop, just tighter — the old 3-equal-column
     fallback stacked the HUD four rows tall on an iPad. */
  .hud-panel {
    grid-template-columns: minmax(110px, 140px) minmax(150px, 1fr) repeat(3, minmax(44px, max-content));
    gap: 8px 12px;
  }


  /* Four hearts must fit the narrower Life column on one line, or the whole
     row grows to fit their wrap. */
  .life-hearts {
    gap: 5px;
    min-height: 26px;
  }

  .life-hearts img {
    width: 24px;
    height: 24px;
  }
}

@media (min-width: 961px) and (max-width: 1180px) {
  .hud-panel.facts-hud {
    grid-template-columns: minmax(110px, 140px) minmax(150px, 1fr) repeat(4, minmax(44px, max-content));
  }
}

@media (max-width: 960px) {
  .hero,
  .page-header,
  .legend,
  .lower-grid,
  .onboarding-grid,
  .process-strip,
  .path-chooser,
  .howitworks-strip,
  .records-grid {
    grid-template-columns: 1fr;
  }

  /* The row is flex now and sizes itself to its card count; forcing three
     columns here would push the class board's fourth stat onto a second line
     again. Kept only to allow wrapping when there really isn't room. */
  .leaderboard-summary-grid {
    flex-wrap: wrap;
  }

  .leaderboard-summary-grid > .summary-card {
    flex: 1 1 140px;
  }

  .howitworks-cta {
    justify-self: start;
  }

  .page-header h1 {
    font-size: 2.35rem;
  }

  .page-logo {
    max-width: 140px;
  }

  .panel-heading-row {
    display: grid;
  }

  /* Compact HUD: keep the game above the fold. Life + Beat + AEDs + Score
     stay visible; secondary stats live in the in-game overlay instead. */
  .hud-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px 12px;
  }

  .beat-group,
  .condition-group,
  .objective-group {
    grid-column: auto;
  }

  .beat-group {
    grid-column: span 2;
  }

  .monster-group,
  .level-group,
  .hero-group,
  .condition-group,
  .objective-group {
    display: none;
  }

  .stat-value {
    font-size: 1.05rem;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  .save-score-row {
    grid-template-columns: 1fr;
  }

  .character-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mode-list,
  .level-preview-list {
    grid-template-columns: 1fr;
  }

  .level-progress-strip {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .level-progress-chip {
    font-size: 0;
    min-height: 10px;
    padding: 4px 0;
  }

  .touch-controls {
    display: grid;
  }
}

/* Touch devices get on-screen controls regardless of width. */
@media (pointer: coarse) {
  .touch-controls {
    display: grid;
  }

  .touch-button {
    min-height: 58px;
    font-size: 1.05rem;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 14px, 1180px);
    padding-top: 12px;
  }

  .hero-copy {
    padding: 18px;
  }

  .canvas-wrap {
    border-radius: 22px;
    padding: 8px;
  }

  .overlay {
    inset: 6px;
    padding: 6px;
  }

  .overlay-card {
    max-height: calc(100dvh - 90px);
    overflow-y: auto;
    padding: 16px;
  }

  .overlay-logo {
    max-width: 130px;
  }

  .game-toast {
    left: 14px;
    top: 48px;
    max-width: calc(100% - 28px);
    font-size: 0.9rem;
  }

  .touch-controls {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 8px;
  }

  .touch-actions {
    justify-content: stretch;
  }

  .code-display {
    justify-content: center;
  }

  .wizard-panel {
    padding: 16px;
  }
}

/* ---------------------------------------------------------------------------
 * Focused home page: compact hero, slimmer HUD, collapsible game guide.
 * ------------------------------------------------------------------------ */
html {
  scroll-behavior: smooth;
}

.hero-compact {
  grid-template-columns: minmax(90px, 150px) minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 16px;
  align-items: center;
}

.hero-logo-compact {
  max-width: 150px;
  animation: none;
}

.hero-copy-compact {
  padding: 18px 22px;
}

.hero-copy-compact h1 {
  font-size: clamp(1.5rem, 3.2vw, 2.6rem);
  margin-bottom: 14px;
}

.hero-cta-alt {
  filter: hue-rotate(120deg) saturate(0.85);
}

/* Keep the HUD to the stats players actually watch mid-run. The hidden
 * groups stay in the DOM because game.js updates them by id. */
.hud-panel .hero-group,
.hud-panel .condition-group,
.hud-panel .objective-group {
  display: none;
}

.legend-details {
  border: 4px solid var(--panel-edge);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 18px 42px var(--shadow);
  overflow: hidden;
}

.legend-details summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 22px;
  color: #fff7bf;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  user-select: none;
}

.legend-details summary::-webkit-details-marker {
  display: none;
}

.legend-details summary::before {
  content: "▸ ";
  color: var(--alert, #ffd84f);
}

.legend-details[open] summary::before {
  content: "▾ ";
}

.legend-details summary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.legend-details .lower-grid {
  padding: 0 16px 16px;
}

/* ---------------------------------------------------------------------------
 * New high score celebration.
 * ------------------------------------------------------------------------ */
.highscore-popup {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 12, 22, 0.82);
}

.highscore-popup.hidden {
  display: none;
}

#fireworks-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.highscore-card {
  position: relative;
  text-align: center;
  padding: 42px 56px;
  border-radius: 30px;
  border: 5px solid #ffd84f;
  background: linear-gradient(180deg, rgba(16, 38, 62, 0.96), rgba(8, 22, 38, 0.98));
  box-shadow: 0 0 60px rgba(255, 216, 79, 0.35), 0 30px 80px rgba(0, 0, 0, 0.5);
  animation: highscore-pop 520ms cubic-bezier(0.18, 1.4, 0.4, 1) both;
}

.highscore-eyebrow {
  margin: 0 0 6px;
  color: #9dffbc;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.highscore-card h2 {
  margin: 0 0 10px;
  color: #ffd84f;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  letter-spacing: 0.03em;
  text-shadow: 0 6px 0 rgba(7, 22, 36, 0.6), 0 0 26px rgba(255, 216, 79, 0.55);
}

.highscore-value {
  margin: 0 0 26px;
  color: #ffffff;
  font-size: clamp(1.8rem, 4.4vw, 3rem);
  font-weight: 900;
}

@keyframes highscore-pop {
  0% { transform: scale(0.4) rotate(-4deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* ---------------------------------------------------------------------------
 * Mobile-friendly pass: rotate hint, compact HUD, landscape game mode.
 * ------------------------------------------------------------------------ */
.rotate-hint {
  display: none;
  margin: 10px 2px 0;
  padding: 10px 14px;
  border-radius: 14px;
  border: 3px solid rgba(255, 216, 79, 0.4);
  background: rgba(255, 216, 79, 0.14);
  color: #fff6b9;
  font-weight: 800;
  font-size: 0.92rem;
  text-align: center;
}

/* Don't let swipes over the game scroll or zoom the page. */
#game-canvas {
  touch-action: none;
}

.touch-controls {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.touch-pause {
  flex: 0 0 52px;
}

@media (pointer: coarse) and (orientation: portrait) and (max-width: 700px) {
  .rotate-hint {
    display: block;
  }
}

/* Compact HUD on narrow phones: three columns, essentials only. */
@media (max-width: 640px) {
  .hud-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 8px 10px;
  }

  .beat-group {
    grid-column: span 2;
  }

  .stat-label {
    font-size: 0.68rem;
  }

  .life-hearts img {
    width: 26px;
  }

  .life-group {
    min-width: 0;
  }
}

/* Landscape phones: strip the page chrome and give everything to the game. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  .site-nav,
  .hero,
  .howitworks-strip,
  .legend-details,
  .rotate-hint {
    display: none;
  }

  .page-shell {
    width: min(100% - 8px, 1180px);
    padding: 4px 0 6px;
  }

  .game-shell {
    gap: 6px;
  }

  .hud-panel {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 5px 10px;
    border-width: 2px;
    border-radius: 14px;
  }

  .hud-panel.facts-hud {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .beat-group {
    grid-column: span 2;
  }

  .stat-label {
    font-size: 0.6rem;
  }

  .stat-value {
    font-size: 0.85rem;
  }

  .life-hearts {
    min-height: 22px;
  }

  .life-hearts img {
    width: 20px;
  }

  .canvas-wrap {
    padding: 6px;
    border-radius: 14px;
    border-width: 3px;
  }

  .level-progress-strip {
    display: none;
  }

  /* Controls float over the lower corners of the canvas — thumb zones. */
  .touch-controls {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 12px;
    margin-top: 0;
    pointer-events: none;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    gap: 40px;
  }

  .touch-controls .touch-button {
    pointer-events: auto;
    min-height: 52px;
    opacity: 0.72;
    background: rgba(9, 25, 39, 0.55);
    backdrop-filter: blur(2px);
  }

  .touch-controls .touch-button.accent {
    background: linear-gradient(180deg, rgba(255, 216, 79, 0.85), rgba(255, 171, 39, 0.85));
  }
}

/* ---------------- locked run modes + the join route (guests) ---------------- */
.mode-card.locked {
  opacity: 0.45;
  filter: saturate(0.35);
  cursor: not-allowed;
}

.mode-card.locked:hover {
  transform: none;
}

.mode-join-hint {
  display: block;
  margin-top: 10px;
  text-align: center;
  text-decoration: none;
}

/* How-to-play block inside the game guide (the controls moved here from the
   game overlays, which they were crowding off-screen). */
.howtoplay {
  grid-column: 1 / -1;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.howtoplay h3 {
  margin: 0 0 10px;
  color: #fffde8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ------------------- compact overlay (mission-setup screen) ------------------ */
/* Everything a notch tighter so the whole card usually fits the play area on a
   laptop. Deliberately NO max-height/scroll cage: if a state truly needs more
   room it spills past the canvas, which is the lesser evil. */
.overlay-card.compact {
  padding: 16px 18px 18px;
}

.overlay-card.compact .overlay-logo {
  display: none; /* the welcome screen already showed it */
}

.overlay-card.compact h2 {
  font-size: 1.45rem;
  margin-bottom: 4px;
}

.overlay-card.compact p {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

/* The nav chip already says who is playing, and the join button below the
   locked modes carries the join message — this line is dead weight here. */
.overlay-card.compact .profile-status {
  display: none;
}

.overlay-card.compact .mode-select-wrap,
.overlay-card.compact .character-select-wrap {
  margin-top: 8px;
}

.overlay-card.compact .mode-card {
  padding: 10px 10px;
  gap: 4px;
}

.overlay-card.compact .mode-card span {
  font-size: 0.78rem;
  line-height: 1.35;
}

.overlay-card.compact .mode-join-hint {
  margin-top: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.overlay-card.compact .level-preview {
  padding: 8px 12px;
  margin: 8px 0;
}

.overlay-card.compact .level-preview h3 {
  margin-bottom: 2px;
  font-size: 1.05rem;
}

/* The stat chips carry the numbers; the flavour line is welcome-screen fluff. */
.overlay-card.compact .level-preview p {
  display: none;
}

.overlay-card.compact .character-card {
  padding: 8px 6px;
  gap: 6px;
}

.overlay-card.compact .character-card img,
.overlay-card.compact .character-card canvas {
  max-height: 52px;
  width: auto;
}

.overlay-card.compact .character-card strong {
  font-size: 0.85rem;
}

.overlay-card.compact .primary-button {
  margin-top: 8px;
}

/* ---- narrow phones: the four action buttons were wider than their half of
   the grid (the Bolt button pushed 23px past the viewport → the whole game
   page scrolled sideways). Let each row breathe on its own line and shrink
   the padding so everything stays inside the screen. ---- */
@media (max-width: 480px) {
  .touch-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .touch-move,
  .touch-actions {
    justify-content: stretch;
    min-width: 0;
  }

  .touch-button {
    padding: 6px 4px;
    font-size: 0.95rem;
    min-width: 0;
  }
}

/* The nav identity chip is a first-class control for kids on tablets — give
   its pieces real tap height on touch screens (they were 24px tall). */
@media (pointer: coarse) {
  .identity-chip .identity-signout,
  .identity-chip .identity-code,
  .identity-chip .identity-join {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
  }
}

/* -------------------- audit fixes (2026-08-12, kid usability) -------------------- */

/* Desktop: keep LIFE / BEAT METER / SCORE on screen while playing — the HUD is
   a page block above the canvas and used to scroll away entirely. */
@media (min-width: 900px) {
  .hud-panel {
    position: sticky;
    top: 8px;
    z-index: 20;
  }
}

/* Scrolling to the game (Start Mission, the hero's "Play now" -> #game) lands
   the HUD at the top of the window with the play area right under it, not the
   canvas at the very top with the pinned HUD over it. --game-scroll-offset =
   8px + the HUD's height + the grid gap, kept current by syncGameScrollOffset
   in game.js; the fallback fits the usual one-row desktop HUD. */
#game {
  scroll-margin-top: var(--game-scroll-offset, 102px);
}

/* Phone portrait: the overlay stays ANCHORED TO THE GAME AREA — deliberately
   NOT a full-screen modal (it was one for a day): a modal hid the rest of the
   page, so a first-time visitor couldn't scroll down to the how-it-works strip
   or the game guide to learn what the site even is. The card simply overlays
   the page flow like on desktop; you scroll the PAGE to its button, and the
   near-opaque card background keeps the text under it from ghosting through. */
@media (max-width: 640px) {
  .overlay {
    inset: 6px;
    padding: 6px;
    place-items: start center;
    overflow: visible;
  }

  .overlay:not(.visible) {
    display: none; /* never intercept taps while hidden */
  }

  .overlay-card {
    margin: 0 0 12px;
    /* No inner scrollbar either (the pre-modal design capped the card at
       100dvh-90px with an invisible scroll affordance — heroes looked cut
       off). The page is the one scroll surface. */
    max-height: none;
    overflow-y: visible;
    background: linear-gradient(180deg, rgba(11, 29, 48, 0.985), rgba(6, 16, 27, 0.99));
  }

  /* The legacy phone block re-pins the toast to the top, where it covers the
     in-canvas status line — keep it bottom-anchored here too. */
  .game-toast {
    top: auto;
    bottom: 18px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
    gap: 12px;
  }
}

/* Clicking a locked mode card pulses the join route so the answer to "why
   won't it click?" is impossible to miss. */
@keyframes join-hint-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(30, 215, 95, 0.0); }
  35% { transform: scale(1.03); box-shadow: 0 0 0 8px rgba(30, 215, 95, 0.25); }
}

.mode-join-hint.pulse {
  animation: join-hint-pulse 700ms ease-out 2;
}

@media (prefers-reduced-motion: reduce) {
  .mode-join-hint.pulse {
    animation: none;
    outline: 3px solid rgba(30, 215, 95, 0.7);
  }
}

/* The one line kids must absorb on the player-code screen. */
.keep-secret-note {
  color: #ffe9a8 !important;
  font-weight: 700;
}

/* --------------- mobile toast dock (below the touch controls) --------------- */
/* Base: the slot doesn't exist visually; the toast floats over the canvas as
   ever on mouse devices. */
.mobile-toast-slot {
  display: none;
}

@media (pointer: coarse) {
  /* game.js moves #game-toast INTO this slot on touch layouts. The reserved
     min-height means the layout under it never jumps when a notice appears,
     and being below .touch-controls it can never cover a button mid-run. */
  .mobile-toast-slot {
    display: grid;
    place-items: center;
    min-height: 58px;
    margin-top: 10px;
  }

  .mobile-toast-slot .game-toast {
    position: static;
    max-width: 100%;
    margin: 0;
  }
}

/* ------------------------------ mobile nav burger --------------------------- */
.nav-burger {
  display: none;
}

@media (max-width: 640px) {
  .nav-burger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 14px;
    border: 3px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: rgba(9, 25, 39, 0.72);
    color: #f7fbff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
  }

  .site-nav .site-nav-link {
    display: none; /* folded into the burger */
  }

  .site-nav.open .site-nav-link {
    display: flex;
    width: 100%; /* one destination per row — thumb-sized targets */
  }

  .site-nav.open .identity-chip {
    width: 100%;
    justify-content: space-between;
  }
}

/* The retry screen's escape link: the primary button above it paints a 12px
   hard shadow below its own box, so a 10px margin let the link sit almost on
   the shadow. Clear the shadow plus real breathing room, and centre it under
   the button. */
#quit-run-link {
  margin: 26px auto 2px;
  text-align: center;
}

/* ---------------- wide two-column CPR checks (desktop) ---------------- */
/* A five-question quiz stacked in a 560px card ran well past the canvas —
   answering meant scrolling blind. On wide screens the card grows and the
   questions sit two-up, so the whole check is visible at once. The tap-rhythm
   and put-in-order challenges keep a single column (they're sequential). */
@media (min-width: 900px) {
  .overlay-card.challenge-open {
    width: min(100%, 960px);
  }

  .overlay-card.challenge-open .challenge-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: stretch;
    text-align: left;
  }

  .overlay-card.challenge-open .challenge-body .challenge-panel,
  .overlay-card.challenge-open .challenge-body .challenge-submit-row {
    grid-column: 1 / -1;
  }

  /* Trim the chrome while a check is up: the point is every question visible
     at once, and the logo/intro copy are already known by level 2. */
  .overlay-card.challenge-open {
    padding: 14px 20px 16px;
  }

  .overlay-card.challenge-open .overlay-logo,
  .overlay-card.challenge-open .profile-status {
    display: none;
  }

  .overlay-card.challenge-open .challenge-question {
    gap: 6px;
  }

  .overlay-card.challenge-open .challenge-wrap {
    margin-top: 4px;
  }

  .overlay-card.challenge-open h2 {
    margin-bottom: 4px;
    font-size: 1.45rem;
  }

  .overlay-card.challenge-open p {
    margin-bottom: 8px;
    font-size: 0.9rem;
  }

  .overlay-card.challenge-open .challenge-question {
    padding: 10px 12px;
  }

  .overlay-card.challenge-open .challenge-question-head {
    margin-bottom: 6px;
  }

  .overlay-card.challenge-open .challenge-prompt {
    font-size: 0.95rem;
    line-height: 1.35;
  }

  .overlay-card.challenge-open .challenge-choice {
    padding: 7px 11px;
    font-size: 0.88rem;
    line-height: 1.3;
  }

  .overlay-card.challenge-open .challenge-choices {
    gap: 6px;
  }

  .overlay-card.challenge-open .challenge-number {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }

  .overlay-card.challenge-open .challenge-submit-row {
    margin-top: 4px;
  }
}

/* ------------- public summary: 2×3 grid with big icons ------------- */
/* Opt-in modifier: the class board's four-tile strip keeps the compact
   one-line layout this does NOT touch. */
.summary-grid-icons {
  display: grid;
  /* 12 tracks: the top row's three cards span 4 each, the fun row's four
     cards span 3 each — both rows exactly fill the width. */
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.summary-grid-icons > .summary-card {
  grid-column: span 4;
}

.summary-grid-icons > .summary-card:nth-child(n + 4) {
  grid-column: span 3;
}

.summary-grid-icons > .summary-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  padding: 12px 16px;
}

.summary-grid-icons .summary-icon {
  grid-row: 1 / 3;
  font-size: 2.3rem;
  line-height: 1;
  filter: drop-shadow(0 3px 8px rgba(5, 17, 30, 0.35));
}

.summary-grid-icons .stat-label {
  grid-column: 2;
  font-size: 0.72rem;
}

.summary-grid-icons > .summary-card > strong {
  grid-column: 2;
  font-size: 1.35rem;
  line-height: 1.1;
}

@media (max-width: 640px) {
  .summary-grid-icons {
    gap: 8px;
  }

  /* Phones: simple 2-up — every card takes half the 12-track row. */
  .summary-grid-icons > .summary-card,
  .summary-grid-icons > .summary-card:nth-child(n + 4) {
    grid-column: span 6;
  }

  .summary-grid-icons .summary-icon {
    font-size: 1.8rem;
  }
}

/* ---------------------------------------------------------------------------
 * My Badges (badges.html) — a player's own stats and downloadable badges.
 * ------------------------------------------------------------------------- */

/*
 * The nine personal stat cards, as 4 then 5 — not the leaderboard's 3-then-4.
 * A 20-track row divides cleanly both ways (4 x 5 and 5 x 4), so both rows fill
 * the panel edge to edge with no ragged tail. Overrides the 12-track spans that
 * .summary-grid-icons sets, which is why it needs the same specificity.
 */
.summary-grid-icons.badge-stats-grid {
  grid-template-columns: repeat(20, minmax(0, 1fr));
}

.summary-grid-icons.badge-stats-grid > .summary-card {
  grid-column: span 5;
}

.summary-grid-icons.badge-stats-grid > .summary-card:nth-child(n + 5) {
  grid-column: span 4;
}

@media (max-width: 640px) {
  /* Phones: 2-up, matching the leaderboard's own narrow layout. */
  .summary-grid-icons.badge-stats-grid > .summary-card,
  .summary-grid-icons.badge-stats-grid > .summary-card:nth-child(n + 5) {
    grid-column: span 10;
  }
}

.badge-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.badge-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.badge-stat-value {
  font-size: 1.9rem;
  line-height: 1.1;
  color: #ffd84f;
}

.badge-stat-label {
  font-weight: 700;
  font-size: 0.92rem;
}

.badge-stat-hint {
  font-size: 0.78rem;
  opacity: 0.7;
}

/* The eight CPR checks, ticked off. Shown whether or not they are all done —
   seeing the gaps is what tells a child there is more to learn. */
.badge-topic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.badge-topic {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  opacity: 0.72;
}

.badge-topic.done {
  background: rgba(61, 220, 132, 0.16);
  border-color: rgba(61, 220, 132, 0.5);
  opacity: 1;
}

.badge-topic-tick {
  font-weight: 900;
  color: #7bffaf;
}

.badge-topic-name {
  font-weight: 700;
}

.badge-board-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.badge-board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.badge-board-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.badge-board-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.badge-board-tag {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 216, 79, 0.18);
  border: 1px solid rgba(255, 216, 79, 0.5);
  color: #ffd84f;
}

.badge-board-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.badge-board-fact {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.badge-board-fact strong {
  font-size: 1.1rem;
  color: #ffd84f;
}

.badge-board-fact span {
  font-size: 0.75rem;
  opacity: 0.72;
}

.badge-board-rank {
  margin: 0;
  font-weight: 800;
  color: #9dffbc;
}

/* ---------------------------------------------------------------------------
 * Player character editor (index.html #costume-wrap)
 * The costume is cosmetic; this panel appears only when the server says the
 * school has the editor. Laid out to sit inside the same end-of-run column the
 * hero picker uses, so it inherits that card's width on every breakpoint.
 * ------------------------------------------------------------------------- */
.costume-note { margin: 2px 0 8px; font-size: 0.82rem; opacity: 0.8; line-height: 1.45; }
#costume-open { width: 100%; min-width: 0; padding: 10px 18px; font-size: .86rem; margin-bottom: 12px; }
#costume-open { box-shadow: 0 8px 0 #14913c; }
#costume-open:hover { box-shadow: 0 6px 0 #14913c; }
#costume-open:active { box-shadow: 0 4px 0 #14913c; }

/* ---------------------------------------------------------------------------
 * Level ratings (community end screens): 5 stars + a difficulty slider.
 * ------------------------------------------------------------------------ */
.level-rating {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(247, 251, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.level-rating-title {
  margin: 0;
  font-weight: 800;
  font-size: 0.95rem;
}

.rating-stars {
  display: flex;
  gap: 4px;
}

.rating-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.9rem;
  line-height: 1;
  padding: 2px 4px;
  color: rgba(247, 251, 255, 0.28);
  transition: transform 0.12s ease, color 0.12s ease;
}

.rating-star:hover {
  transform: scale(1.18);
}

.rating-star.on {
  color: #ffd84f;
  text-shadow: 0 0 12px rgba(255, 216, 79, 0.55);
}

.rating-star:focus-visible {
  outline: 2px solid rgba(255, 209, 102, 0.85);
  outline-offset: 2px;
  border-radius: 8px;
}

.rating-difficulty {
  display: grid;
  gap: 4px;
  width: min(100%, 300px);
  font-size: 0.85rem;
}

.rating-difficulty-title {
  text-align: center;
}

.rating-difficulty input[type="range"] {
  width: 100%;
  accent-color: #ff5f8a;
}

.rating-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(247, 251, 255, 0.55);
}

/* --- Saved characters: thumbnails only, no names. ------------------------ */
/* A child picks their character by LOOKING at it. Names would mean typing,
   spelling, and a moderation surface for something nobody needs to read. */
.costume-saved-wrap { display: grid; gap: 6px; margin: 4px 0 10px; }
.costume-saved { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ===========================================================================
 * Hands-on CPR checks — the interactive quiz cards (game.src.js, "Hands-on
 * CPR checks"): Push Hard Push Fast, Pads On!, Call Triple Zero, Spot The
 * Dangers, Find The AED, Are They OK?
 *
 * Pixel-art scenes are inline SVG in "pixel" units (crisp edges). Every
 * tappable thing in a scene is a transparent .cc-hot button positioned in
 * percent over the art, and every hotspot looks IDENTICAL until it is tapped —
 * a hover or focus ring never hints which one is right. Colours borrow the
 * flyer tokens with fallbacks, so the cards still work without flyer-theme.css.
 * ------------------------------------------------------------------------ */

.cc-panel {
  --cc-ink: var(--fl-ink, #16192b);
  --cc-navy: var(--fl-navy, #10244a);
  --cc-lip: var(--fl-lip, rgba(16, 36, 74, 0.55));
  --cc-yellow: var(--fl-yellow, #ffd200);
  --cc-green: var(--fl-green, #1fa64a);
  --cc-red: var(--fl-red, #e52629);
  --cc-head: var(--fl-font-heading, Impact, "Arial Black", sans-serif);
  --cc-sub: var(--fl-font-sub, "Trebuchet MS", sans-serif);
  gap: 12px;
  padding: 12px;
  border: 4px solid var(--cc-navy);
  border-radius: 0;
  background: rgba(16, 36, 74, 0.32);
  box-shadow: 4px 4px 0 0 var(--cc-lip);
  text-align: left;
}

.cc-panel [hidden] {
  display: none !important;
}

.overlay-card .challenge-body .cc-panel p {
  margin: 0;
}

.cc-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
}

.cc-ask {
  font-size: 1.05rem;
}

.overlay-card .challenge-body .cc-panel .cc-tip {
  color: #fff3af;
  font-family: var(--cc-sub);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.4;
}

.challenge-feedback.tip {
  color: #fff3af;
}

.cc-stage {
  position: relative;
  width: 100%;
  justify-self: center;
  border: 4px solid var(--cc-ink);
  background: #8fd0f7;
  box-shadow: 4px 4px 0 0 var(--cc-lip);
}

/* A hotspot: invisible until hovered (pointer) or focused (keyboard) — and
   then exactly like every other hotspot in the scene. */
.cc-hot {
  position: absolute;
  min-width: 34px;
  min-height: 34px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transform: translate(-50%, -50%);
  font-family: var(--cc-head);
  font-size: 1rem;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .cc-hot:not(:disabled):hover {
    outline: 3px dashed rgba(255, 255, 255, 0.9);
    outline-offset: -3px;
  }
}

.cc-hot:focus-visible {
  outline: 4px solid var(--cc-yellow);
  outline-offset: -2px;
  box-shadow: 0 0 0 3px var(--cc-ink);
}

.cc-hot:disabled {
  cursor: default;
}

/* Judged only once tapped: a wrong pick shakes and tints red… */
.cc-hot.is-wrong {
  background: rgba(229, 38, 41, 0.3);
  outline: 3px solid #ff6265;
  outline-offset: -3px;
  animation: cc-shake 0.4s steps(4);
}

/* …a right one keeps a green frame and a badge. */
.cc-hot.is-found {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  background: rgba(31, 166, 74, 0.22);
  outline: 3px solid #6ad98a;
  outline-offset: -3px;
}

.cc-badge {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin: -10px -10px 0 0;
  padding: 0 4px;
  background: var(--cc-green);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  box-shadow: 0 -3px 0 0 var(--cc-ink), 0 3px 0 0 var(--cc-ink), -3px 0 0 0 var(--cc-ink), 3px 0 0 0 var(--cc-ink);
}

.cc-badge.is-danger {
  background: var(--cc-yellow);
  color: var(--cc-navy);
}

.cc-bubble {
  position: absolute;
  z-index: 2;
  max-width: 70%;
  padding: 6px 10px;
  background: #fff;
  color: var(--cc-navy);
  font-family: var(--cc-sub);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  pointer-events: none;
  box-shadow: 0 -3px 0 0 var(--cc-ink), 0 3px 0 0 var(--cc-ink), -3px 0 0 0 var(--cc-ink), 3px 0 0 0 var(--cc-ink), 4px 6px 0 0 var(--cc-lip);
}

.overlay-card .cc-panel .cc-bubble {
  color: var(--cc-navy);
}

.cc-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--cc-navy);
  color: #fff;
  font-family: var(--cc-head);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  box-shadow: 3px 3px 0 0 var(--cc-lip);
}

.cc-callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 12px 14px 18px;
  background: var(--cc-green);
  box-shadow: 0 -4px 0 0 var(--cc-ink), 0 4px 0 0 var(--cc-ink), -4px 0 0 0 var(--cc-ink), 4px 0 0 0 var(--cc-ink), inset 0 0 0 3px #6ad98a;
}

.overlay-card .challenge-body .cc-callout p {
  flex: 1 1 260px;
  color: #fff;
  font-family: var(--cc-sub);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.4;
  text-shadow: 1px 1px 0 rgba(16, 36, 74, 0.6);
}

.cc-callout .primary-button {
  margin-bottom: 8px;
}

/* Picked, checked and wrong (in a reply list): red, crossed, and spent. */
.challenge-choice.is-wrong,
.challenge-choice.is-wrong:disabled {
  background: #ffd6d1;
  color: #8a1014;
  text-decoration: line-through;
  opacity: 1;
}

.challenge-choice.is-wrong::before {
  content: "\2717\00a0";
  text-decoration: none;
  display: inline-block;
}

.cc-replies {
  flex-direction: column;
  align-items: stretch;
}

.cc-replies .challenge-choice {
  text-align: left;
}

/* ------------------------------ Push hard, push fast ----------------------------- */

.cpr-hud {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
}

.cpr-count {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 6px 12px;
  background: var(--cc-yellow);
  color: var(--cc-navy);
  box-shadow: 0 -3px 0 0 var(--cc-ink), 0 3px 0 0 var(--cc-ink), -3px 0 0 0 var(--cc-ink), 3px 0 0 0 var(--cc-ink), 4px 6px 0 0 var(--cc-lip);
}

.cpr-count-value {
  min-width: 2ch;
  font-family: var(--cc-head);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1;
  text-align: right;
}

.cpr-count-goal {
  font-family: var(--cc-head);
  font-size: 1rem;
}

.cpr-count-label {
  margin-left: 2px;
  font-family: var(--cc-sub);
  font-size: 0.85rem;
  font-weight: 700;
}

.cpr-meter {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.cpr-meter-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  color: #fff;
  font-family: var(--cc-sub);
  font-size: 0.95rem;
  font-weight: 700;
}

.cpr-meter-target {
  color: #fff3af;
}

.cpr-rate[data-zone="good"] {
  color: #9dffbc;
}

.cpr-rate[data-zone="slow"] {
  color: #b9dcff;
}

.cpr-rate[data-zone="fast"] {
  color: #ffc58a;
}

.cpr-track {
  position: relative;
  height: 18px;
  border: 3px solid var(--cc-ink);
  background: linear-gradient(90deg, #4f8fd8 0 40%, #1fa64a 40% 60%, #ff8a1f 60% 100%);
}

.cpr-zone {
  position: absolute;
  top: -7px;
  bottom: -7px;
  border: 3px solid #fff07a;
}

.cpr-needle {
  position: absolute;
  top: -9px;
  bottom: -9px;
  width: 6px;
  margin-left: -3px;
  background: #fff;
  box-shadow: 0 0 0 2px var(--cc-ink);
  transition: left 120ms steps(3);
}

.cpr-scale {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--cc-head);
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.cpr-scale-zone {
  color: #9dffbc;
}

.cpr-beat-toggle.is-on {
  background: var(--cc-yellow);
  color: var(--cc-navy);
}

.cpr-chest {
  position: relative;
  display: block;
  width: 100%;
  max-width: 520px;
  justify-self: center;
  margin: 0;
  padding: 0;
  border: 4px solid var(--cc-ink);
  border-radius: 0;
  background: #8fd0f7;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 4px 4px 0 0 var(--cc-lip);
}

.cpr-chest:focus-visible {
  outline: 4px solid var(--cc-yellow);
  outline-offset: 3px;
}

.cpr-scene .cc-rescuer,
.cpr-scene .cc-hands {
  transition: transform 60ms steps(2);
}

.cc-chest {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 60ms steps(2);
}

.cpr-chest.is-down .cc-rescuer,
.cpr-chest.is-down .cc-hands {
  transform: translateY(5px);
}

.cpr-chest.is-down .cc-chest {
  transform: scaleY(0.67);
}

.cpr-tap-hint {
  position: absolute;
  bottom: 6px;
  left: 50%;
  padding: 4px 10px;
  background: var(--cc-navy);
  color: #fff;
  font-family: var(--cc-head);
  font-size: 0.78rem;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 3px 3px 0 0 var(--cc-lip);
  animation: cc-bob 1s steps(2) infinite;
}

.cpr-tap-hint.is-hidden {
  display: none;
}

.cpr-beat-light {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 16px;
  height: 16px;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 3px var(--cc-ink);
}

.cpr-beat-light.is-on {
  background: var(--cc-yellow);
}

.cpr-review-head {
  display: grid;
  gap: 2px;
}

.cpr-review-title {
  color: #fff07a;
  font-family: var(--cc-head);
  font-size: 1.2rem;
  font-weight: 400;
}

.cpr-review-sub {
  color: #fff;
  font-family: var(--cc-sub);
  font-weight: 700;
}

.cpr-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 90px;
  padding: 6px;
  border: 3px solid var(--cc-ink);
  background: rgba(16, 36, 74, 0.55);
}

.cpr-bar {
  flex: 1 1 0;
  min-width: 3px;
  box-shadow: inset 0 2px 0 0 rgba(255, 255, 255, 0.45);
}

.cpr-bar.is-good {
  background: #1fa64a;
}

.cpr-bar.is-fast {
  background: #ff8a1f;
}

.cpr-bar.is-slow {
  background: #4f8fd8;
}

.cpr-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-family: var(--cc-sub);
  font-size: 0.85rem;
  font-weight: 700;
}

.cpr-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  background: currentColor;
}

.cpr-legend .is-good {
  color: #6ad98a;
}

.cpr-legend .is-fast {
  color: #ffb066;
}

.cpr-legend .is-slow {
  color: #9fc6f0;
}

/* ----------------------------------- Pads on! ----------------------------------- */

.pads-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.aed-device {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--cc-green);
  box-shadow:
    0 -4px 0 0 var(--cc-ink),
    0 4px 0 0 var(--cc-ink),
    -4px 0 0 0 var(--cc-ink),
    4px 0 0 0 var(--cc-ink),
    inset 0 0 0 3px #6ad98a,
    inset -6px -6px 0 0 #11702f,
    6px 8px 0 0 var(--cc-lip);
}

.aed-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.aed-head .aed-logo {
  width: 30px;
  box-shadow: 0 0 0 2px #fff;
}

.aed-name {
  color: #fff;
  font-family: var(--cc-head);
  font-size: 1.3rem;
  font-weight: 400;
  text-shadow: 2px 2px 0 var(--cc-ink);
}

.aed-led {
  width: 12px;
  height: 12px;
  margin-left: auto;
  background: #6ad98a;
  box-shadow: 0 0 0 3px var(--cc-ink);
}

.aed-led.is-busy {
  background: var(--cc-yellow);
  animation: cc-blink 0.5s steps(1) infinite;
}

.aed-screen {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 78px;
  padding: 8px 10px;
  background: #0b1a33;
  box-shadow: inset 0 0 0 3px var(--cc-ink), inset 0 0 0 6px #2a4a7a;
}

.overlay-card .challenge-body .cc-panel .aed-voice {
  color: #c9ffd9;
  font-family: var(--cc-sub);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.aed-screen .aed-ecg {
  display: none;
  height: 26px;
}

.aed-screen .aed-ecg.is-on {
  display: block;
}

.aed-ecg-line {
  stroke-dasharray: 300;
  animation: cc-ecg 1.6s linear infinite;
}

.aed-tray {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.aed-tray.is-empty {
  display: none;
}

.aed-tray-label {
  color: #fff;
  font-family: var(--cc-head);
  font-size: 0.75rem;
  text-shadow: 1px 1px 0 var(--cc-ink);
}

.aed-pad {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 86px;
  margin: 4px 0 8px;
  padding: 8px 6px 6px;
  border: 0;
  border-radius: 0;
  background: #f4f8ff;
  color: var(--cc-navy);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: var(--cc-sub);
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 -3px 0 0 var(--cc-ink), 0 3px 0 0 var(--cc-ink), -3px 0 0 0 var(--cc-ink), 3px 0 0 0 var(--cc-ink), 0 7px 0 0 var(--cc-lip);
}

.aed-pad:focus-visible {
  outline: 4px solid var(--cc-yellow);
  outline-offset: 4px;
}

.aed-pad.is-held {
  background: var(--cc-yellow);
  transform: translateY(-4px);
}

.aed-pad.is-lifted {
  opacity: 0.35;
}

.aed-pad.is-bounce {
  animation: cc-shake 0.45s steps(4);
}

.aed-pad-art {
  width: 44px;
}

.aed-pad .aed-pad-guide {
  display: none;
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
}

.aed-pad.show-guide .aed-pad-guide {
  display: block;
}

.aed-pad-ghost {
  position: fixed;
  z-index: 1000;
  width: 66px;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-6deg);
  filter: drop-shadow(4px 6px 0 rgba(16, 36, 74, 0.55));
}

.aed-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.aed-controls .aed-clear {
  flex: 1 1 auto;
}

.aed-shock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  margin: 4px 0 8px;
  padding: 8px 18px;
  border: 0;
  border-radius: 0;
  background: #ff8a1f;
  color: var(--cc-navy);
  cursor: pointer;
  font-family: var(--cc-head);
  font-size: 1rem;
  box-shadow: 0 -4px 0 0 var(--cc-ink), 0 4px 0 0 var(--cc-ink), -4px 0 0 0 var(--cc-ink), 4px 0 0 0 var(--cc-ink), inset -4px -4px 0 0 #c45a00, 0 9px 0 0 var(--cc-lip);
}

.aed-shock-bolt {
  font-size: 1.3rem;
}

.aed-shock:disabled {
  background: #9aa5b8;
  color: #e4e9f0;
  cursor: not-allowed;
  box-shadow: 0 -4px 0 0 var(--cc-ink), 0 4px 0 0 var(--cc-ink), -4px 0 0 0 var(--cc-ink), 4px 0 0 0 var(--cc-ink), inset -4px -4px 0 0 #7d889c, 0 9px 0 0 var(--cc-lip);
}

/* "Press the flashing shock button" — two flashes a second (well under the
   three-a-second photosensitivity limit); a steady ring under reduced motion. */
.aed-shock.is-ready {
  animation: cc-shock-flash 0.5s steps(1) infinite;
}

.aed-shock:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 5px;
}

.pads-stage-wrap {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.pads-sides {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 340px;
  color: #fff07a;
  font-family: var(--cc-head);
  font-size: 0.72rem;
  text-shadow: 1px 1px 0 var(--cc-ink);
}

.pads-stage {
  max-width: 340px;
  background: #dca46a;
  touch-action: manipulation;
}

.pads-svg .pads-shirt-l,
.pads-svg .pads-shirt-r {
  transition: transform 360ms steps(5);
}

.pads-svg.is-shirt-open .pads-shirt-l {
  transform: translateX(-24px);
}

.pads-svg.is-shirt-open .pads-shirt-r {
  transform: translateX(24px);
}

.pads-svg .pads-sam {
  transform: translateX(32px);
  transition: transform 400ms steps(4);
}

.pads-svg.is-sam-in .pads-sam {
  transform: none;
}

.pads-svg .pads-flash {
  opacity: 0;
  pointer-events: none;
}

.pads-svg.is-zap .pads-flash {
  animation: cc-zap-flash 0.5s steps(3);
}

.pads-svg.is-zap {
  animation: cc-jolt 0.4s steps(4);
}

.pads-spot-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pads-spot {
  pointer-events: auto;
  display: grid;
  place-items: center;
  background: rgba(16, 36, 74, 0.45);
  outline: 3px dashed #fff;
  outline-offset: -3px;
  font-size: 0.8rem;
  text-shadow: 1px 1px 0 var(--cc-ink);
}

.pads-shirt-hot.is-nudge {
  outline: 3px solid var(--cc-yellow);
  outline-offset: -3px;
  animation: cc-shake 0.45s steps(4);
}

/* Top corner, well clear of Sam's hand on the patient — the thing to spot. */
.cc-panel .pads-sam-bubble {
  top: 3%;
  right: 3%;
  max-width: 58%;
}

.overlay-card .challenge-body .cc-panel .pads-caption {
  text-align: center;
  font-size: 0.85rem;
}

.aed-clear.is-nudge {
  animation: cc-shake 0.45s steps(4);
}

.pads-question {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #0b1a33;
  box-shadow: inset 0 0 0 3px var(--cc-ink);
}

.overlay-card .challenge-body .cc-panel .pads-question .cc-ask {
  color: #c9ffd9;
}

.pads-question .cc-choices {
  flex-direction: column;
  align-items: stretch;
}

.pads-question .challenge-choice {
  text-align: left;
}

.pads-question:empty {
  display: none;
}

@media (min-width: 760px) {
  .pads-layout {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    align-items: start;
  }

  .pads-layout .aed-device {
    order: 2;
  }
}

/* ------------------------------- Call Triple Zero ------------------------------- */

.phone-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 14px;
}

.phone-side {
  display: grid;
  align-content: start;
  gap: 10px;
  width: 100%;
}

.cc-phone {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 250px;
  padding: 10px 12px 14px;
  background: #1b2238;
  box-shadow: 0 -4px 0 0 var(--cc-ink), 0 4px 0 0 var(--cc-ink), -4px 0 0 0 var(--cc-ink), 4px 0 0 0 var(--cc-ink), inset 0 0 0 3px #3b4766, 6px 8px 0 0 var(--cc-lip);
}

.cc-phone-speaker {
  justify-self: center;
  width: 44px;
  height: 5px;
  background: #3b4766;
}

.cc-phone-screen {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-height: 82px;
  padding: 8px;
  background: #0b1a33;
  color: #fff;
  box-shadow: inset 0 0 0 3px #3b4766;
}

.cc-phone-status {
  color: #9fd0ff;
  font-family: var(--cc-sub);
  font-size: 0.82rem;
  font-weight: 700;
}

.cc-phone-number {
  min-height: 1.1em;
  color: #fff;
  font-family: var(--cc-head);
  font-size: 1.9rem;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.14em;
}

.cc-phone-sub {
  color: #9dffbc;
  font-family: var(--cc-sub);
  font-size: 0.82rem;
  font-weight: 700;
}

.cc-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.cc-key {
  display: grid;
  place-items: center;
  min-height: 50px;
  margin: 0;
  padding: 4px;
  border: 0;
  border-radius: 0;
  background: #f4f8ff;
  color: var(--cc-navy);
  cursor: pointer;
  font-family: var(--cc-head);
  font-size: 1.25rem;
  line-height: 1;
  box-shadow: 0 -3px 0 0 var(--cc-ink), 0 3px 0 0 var(--cc-ink), -3px 0 0 0 var(--cc-ink), 3px 0 0 0 var(--cc-ink), inset -3px -3px 0 0 #c4d6ee, 0 6px 0 0 rgba(0, 0, 0, 0.4);
  transition: transform 60ms steps(2);
}

.cc-key small {
  color: #5d6b82;
  font-family: var(--cc-sub);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.cc-key:active {
  transform: translateY(3px);
}

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

.cc-phone-actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 9px;
}

.cc-key-del {
  font-size: 1.3rem;
}

.cc-key-call {
  grid-auto-flow: column;
  gap: 6px;
  background: var(--cc-green);
  color: #fff;
  box-shadow: 0 -3px 0 0 var(--cc-ink), 0 3px 0 0 var(--cc-ink), -3px 0 0 0 var(--cc-ink), 3px 0 0 0 var(--cc-ink), inset -3px -3px 0 0 #11702f, 0 6px 0 0 rgba(0, 0, 0, 0.4);
}

.cc-key-call small {
  color: #fff;
  font-family: var(--cc-head);
  font-size: 0.9rem;
}

.cc-chat {
  display: grid;
  gap: 8px;
}

.overlay-card .challenge-body .cc-panel .cc-line {
  max-width: 94%;
  padding: 8px 12px;
  color: var(--cc-navy);
  font-family: var(--cc-sub);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 -3px 0 0 var(--cc-ink), 0 3px 0 0 var(--cc-ink), -3px 0 0 0 var(--cc-ink), 3px 0 0 0 var(--cc-ink);
}

.cc-line.is-them {
  justify-self: start;
  background: #fff;
}

.cc-line.is-you {
  justify-self: end;
  background: var(--cc-yellow);
}

.overlay-card .challenge-body .cc-panel .cc-line.is-asking {
  font-size: 1.08rem;
}

.cc-line-who {
  display: block;
  margin-bottom: 2px;
  color: #2f6fbe;
  font-family: var(--cc-head);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.cc-line.is-you .cc-line-who {
  color: #8a5a00;
}

@media (min-width: 760px) {
  .phone-layout {
    grid-template-columns: 250px minmax(0, 1fr);
    align-items: start;
    justify-items: stretch;
  }
}

/* --------------------------- Spot the dangers / Find the AED --------------------------- */

.hunt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}

.hunt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.hunt-stage {
  max-width: 600px;
}

.hunt-svg .hunt-sparks {
  animation: cc-blink 0.24s steps(1) infinite;
}

.hunt-svg .hunt-hazards {
  animation: cc-blink 0.6s steps(1) infinite;
}

/* ---------------------------------- Are they OK? ---------------------------------- */

.response-stage {
  max-width: 540px;
}

.response-svg .cc-rescuer,
.response-svg .cc-hands {
  transition: transform 260ms steps(3);
}

.cc-svg .cc-arms-reach,
.cc-svg .cc-airway-hands,
.cc-svg .cc-mouth-open {
  display: none;
}

.response-svg.pose-ready .cc-rescuer {
  transform: translate(-14px, 0);
}

.response-svg.pose-ready .cc-hands {
  transform: translate(-14px, -5px);
}

.response-svg.pose-shoulders .cc-rescuer,
.response-svg.pose-shoulders .cc-hands {
  transform: translate(-14px, 0);
}

.response-svg.pose-airway .cc-rescuer {
  transform: translate(-18px, 0);
}

.response-svg.pose-airway .cc-hands,
.response-svg.pose-airway .cc-arms {
  display: none;
}

.response-svg.pose-airway .cc-arms-reach,
.response-svg.pose-airway .cc-airway-hands {
  display: inline;
}

.cc-svg .cc-head {
  transform-box: view-box;
  transform-origin: 24px 60px;
  transition: transform 420ms steps(4);
}

.cc-svg.is-tilted .cc-head {
  transform: rotate(-10deg);
}

.cc-svg.is-gasp .cc-chest {
  animation: cc-gasp 0.9s steps(4);
}

.cc-svg.is-gasp .cc-mouth-open {
  display: inline;
}

.cc-svg.is-gasp .cc-mouth-shut {
  display: none;
}

.cc-panel .response-bubble {
  top: 6%;
  left: 3%;
  max-width: 64%;
}

.cc-panel .response-bubble.is-shout {
  background: var(--cc-yellow);
}

.response-below {
  display: grid;
  gap: 10px;
}

@media (min-width: 760px) {
  .response-below .cc-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .response-below .challenge-choice {
    text-align: left;
  }
}

.response-look {
  display: grid;
  gap: 6px;
}

.response-look-text {
  color: #fff;
  font-family: var(--cc-sub);
  font-size: 1rem;
  font-weight: 700;
}

.response-look-bar {
  height: 16px;
  border: 3px solid var(--cc-ink);
  background: rgba(255, 255, 255, 0.2);
}

.response-look-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--cc-yellow);
}

/* --------------------------------- shared motion --------------------------------- */

@keyframes cc-shake {
  0%,
  100% {
    translate: 0 0;
  }
  25% {
    translate: -4px 0;
  }
  50% {
    translate: 4px 0;
  }
  75% {
    translate: -2px 0;
  }
}

@keyframes cc-blink {
  50% {
    opacity: 0;
  }
}

@keyframes cc-bob {
  50% {
    translate: 0 -3px;
  }
}

@keyframes cc-ecg {
  from {
    stroke-dashoffset: 300;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes cc-shock-flash {
  50% {
    background: #fff07a;
  }
}

@keyframes cc-zap-flash {
  0% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

@keyframes cc-jolt {
  25% {
    translate: 0 -3px;
  }
  50% {
    translate: 0 2px;
  }
  75% {
    translate: 0 -1px;
  }
}

@keyframes cc-gasp {
  40% {
    transform: scaleY(1.14);
  }
}

/* Below the two-column desktop card the logo goes for a hands-on check (as it
   already does for every check on desktop): the scene needs the room. */
@media (max-width: 899px) {
  .overlay-card.cc-open .overlay-logo {
    display: none;
  }
}

/* Phones: the card is narrow, so the scenes get every pixel of it. */
@media (max-width: 520px) {
  .cc-panel {
    padding: 8px;
    gap: 10px;
  }

  .cpr-hud {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "count beat" "meter meter";
  }

  .cpr-hud .cpr-count {
    grid-area: count;
  }

  .cpr-hud .cpr-meter {
    grid-area: meter;
  }

  .cpr-hud .cpr-beat-toggle {
    grid-area: beat;
    justify-self: end;
    padding: 8px 10px;
    font-size: 0.85rem;
  }

  .phone-panel.is-dial .phone-side {
    order: -1;
  }

  .cc-key {
    min-height: 44px;
  }

  .cpr-count-value {
    font-size: 1.6rem;
  }

  .cc-bubble {
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cc-panel *:not(.response-look-fill),
  .cc-panel *::before,
  .cc-panel *::after,
  .aed-pad-ghost {
    animation: none !important;
    transition: none !important;
  }

  .aed-shock.is-ready {
    background: #fff07a;
    outline: 4px solid #fff;
    outline-offset: 3px;
  }

  .pads-svg .pads-flash {
    display: none;
  }
}

/* On a phone the music toggle sits over the card's top-right corner. Keep the
   card title clear of it, on both sides so it stays centred. */
@media (max-width: 640px) {
  .overlay-card h2 {
    padding-inline: 36px;
  }
}
