/* Phone-first training app: black gym floor, one strong red, hexagon badges. */

/* Fonts live inside the app, so kids' devices don't have to contact Google. */
@font-face { font-family: "Anton"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/anton-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("assets/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("assets/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Permanent Marker"; font-style: normal; font-weight: 400; font-display: swap; src: url("assets/fonts/permanent-marker-latin-400-normal.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --ink: #0b0a0a;
  --panel: #1b1818;
  --line: #4c4646;
  --white: #ffffff;
  --soft: #d9d4d4;
  --red: #d80f10;
  --red-dark: #920809;
  --display: "Anton", Impact, "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --marker: "Permanent Marker", "Comic Sans MS", cursive;
  --gutter-left: max(16px, env(safe-area-inset-left, 0px));
  --gutter-right: max(16px, env(safe-area-inset-right, 0px));
  --tabs-height: 68px;
  --app-width: 480px;
}

/* Parents' tablets get a bigger game and screens. */
@media (min-width: 700px) {
  :root { --app-width: 720px; }
}

* { box-sizing: border-box; }

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

body {
  background: var(--ink);
  color: var(--white);
  font-family: var(--body);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.45;
}

button { font: inherit; color: inherit; cursor: pointer; }

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

h1, h2, h3, p, ol { margin: 0; }

.app {
  width: 100%;
  max-width: var(--app-width);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--ink);
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-block: calc(10px + env(safe-area-inset-top, 0px)) 8px;
  padding-left: var(--gutter-left);
  padding-right: var(--gutter-right);
  background: var(--ink);
  border-bottom: 3px solid var(--red);
}

.top-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top img { display: block; width: auto; height: 34px; }

.who {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 3px 10px 3px 4px;
  background: var(--panel);
  border: 2px solid var(--line);
  text-align: left;
}

.who[hidden] { display: none; }

.who canvas { display: block; width: 38px; height: 38px; }

.who-name {
  overflow: hidden;
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who-action {
  color: var(--soft);
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.needs-ninja .tabs { display: none; }

.top-name {
  font-family: var(--display);
  font-size: 20px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

main {
  padding-block: 22px calc(var(--tabs-height) + 32px + env(safe-area-inset-bottom, 0px));
  padding-left: var(--gutter-left);
  padding-right: var(--gutter-right);
  outline: none;
}

h1 {
  font-family: var(--display);
  font-size: clamp(38px, 11.5vw, 52px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}

/* Move of the week */
.week { display: flex; flex-direction: column; gap: 16px; }

.video {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--panel);
  border: 2px solid var(--line);
}

.video iframe { display: block; width: 100%; height: 100%; border: 0; }

.video-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  padding: 16px;
  text-align: center;
  color: var(--soft);
  background-image:
    linear-gradient(var(--ink) 2px, transparent 2px),
    linear-gradient(90deg, var(--ink) 2px, transparent 2px);
  background-size: 44px 44px;
}

.video-empty p { background: var(--panel); padding: 2px 8px; }

.tape {
  display: inline-block;
  padding: 3px 18px;
  background: var(--white);
  color: var(--ink);
  font-family: var(--marker);
  font-size: 22px;
  transform: rotate(-3deg);
}

.move-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.move-head h2 {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--white);
  text-transform: uppercase;
}

.level {
  display: inline-block;
  padding: 2px 10px;
  border: 2px solid var(--white);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.week h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--soft);
}

.cues {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  list-style: none;
  counter-reset: cue;
  margin-top: -6px;
}

.cues li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: baseline;
  counter-increment: cue;
}

.cues li::before {
  content: counter(cue);
  font-family: var(--display);
  font-size: 24px;
  color: var(--red);
  -webkit-text-stroke: 0.4px var(--white);
}

.action { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

.big {
  width: 100%;
  min-height: 64px;
  padding: 10px 16px;
  background: var(--red);
  border: 0;
  box-shadow: 0 5px 0 var(--red-dark);
  color: var(--white);
  font-family: var(--display);
  font-size: 26px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.big:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--red-dark); }

.hint { color: var(--soft); font-size: 15px; text-align: center; margin-top: 4px; }

.quiet {
  min-height: 44px;
  padding: 8px 12px;
  background: none;
  border: 0;
  color: var(--soft);
  font-size: 15px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.done {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--panel);
  border: 2px solid var(--red);
}

.done strong { display: block; font-size: 20px; }

/* Hexagon badges */
.hex { display: block; width: 100%; height: auto; }

.hex-shape { stroke-width: 4; stroke-linejoin: round; }

.hex-icon {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-earned .hex-shape { fill: var(--red); stroke: var(--white); }
.is-earned .hex-icon { stroke: var(--white); }
.is-earned .hex-icon .solid { fill: var(--white); }
.is-locked .hex-icon .solid { fill: #8f8888; }

.is-locked .hex-shape { fill: var(--panel); stroke: var(--line); stroke-dasharray: 7 6; }
.is-locked .hex-icon { stroke: #8f8888; }

/* Badge wall */
.wall { display: flex; flex-direction: column; gap: 20px; }

.wall-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.tally { color: var(--soft); font-variant-numeric: tabular-nums; }

.tally b {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 400;
  color: var(--white);
}

.comb { display: flex; flex-direction: column; gap: 12px; }

.comb-row { display: flex; justify-content: center; gap: 6px; }

.badge {
  display: flex;
  flex: 0 0 calc((100% - 12px) / 3);
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  background: none;
  border: 0;
  text-align: center;
}

.badge .hex { width: min(100%, 104px); }

.badge-name { font-size: 14px; font-weight: 700; line-height: 1.2; text-wrap: balance; }

.badge-state {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--soft);
}

.is-earned .badge-state { color: var(--white); }

/* Bottom tabs */
.tabs {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, var(--app-width));
  transform: translateX(-50%);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  background: var(--panel);
  border-top: 2px solid var(--line);
}

.tabs button {
  height: var(--tabs-height);
  background: none;
  border: 0;
  border-top: 4px solid transparent;
  padding: 0 4px;
  color: var(--soft);
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tabs button.is-active { color: var(--white); border-top-color: var(--red); }

.tabs span { font-family: var(--body); font-size: 13px; font-weight: 700; }

/* Ninja Run */
.is-running,
.is-running body {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.run { display: flex; flex-direction: column; gap: 14px; }

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

.run-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }

.game-controls {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 3;
  display: flex;
  gap: 6px;
}

.game-control {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  background: rgba(11, 10, 10, 0.78);
  border: 2px solid var(--line);
  color: var(--white);
}

.game-control svg { display: block; width: 23px; height: 23px; }

.game-control[aria-pressed="false"] { color: var(--soft); }

.game-pause, .game-exit, .jump-bar { display: none; }

.is-running .game-pause { display: grid; }

.game {
  position: relative;
  width: min(100%, max(280px, calc((100vh - 300px) * 1.09)));
  max-width: 100%;
  margin-inline: auto;
  aspect-ratio: 480 / 440;
  overflow: hidden;
  border: 2px solid var(--line);
  background: var(--panel);
}

.game canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  background: rgba(11, 10, 10, 0.78);
}

.game-overlay[hidden] { display: none; }

.over-title {
  max-width: 100%;
  font-family: var(--display);
  font-size: clamp(30px, 9vw, 40px);
  line-height: 1.1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.over-detail { font-size: 18px; }

.over-detail b { font-size: 22px; }

.game-overlay .big { min-height: 56px; max-width: 280px; font-size: 23px; }

.big:disabled { opacity: 0.55; cursor: default; }

/* End of a run */
.game-overlay.is-result { justify-content: flex-start; gap: 8px; padding: 10px; }

.result-card {
  width: 100%;
  padding: 8px 10px 10px;
  background: var(--ink);
  border: 2px solid var(--white);
}

.result-flag {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 10px;
  background: var(--red);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-name {
  font-family: var(--display);
  font-size: clamp(23px, 6.8vw, 34px);
  line-height: 1.1;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.result-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 6px; }

.result-stats div { display: flex; min-width: 0; flex-direction: column; }

.result-stats div + div { border-left: 2px solid var(--line); }

.result-stats span {
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-stats b {
  font-family: var(--display);
  font-size: clamp(25px, 7.4vw, 34px);
  font-weight: 400;
  line-height: 1.1;
}

.result-actions { display: flex; width: 100%; gap: 8px; }

.result-actions > * { min-width: 0; flex: 1 1 0; }

.game-overlay .result-actions .big { min-height: 50px; max-width: none; padding-inline: 6px; font-size: 19px; }

.result-board {
  min-height: 50px;
  padding: 6px;
  background: var(--ink);
  border: 2px solid var(--white);
  color: var(--white);
  font-family: var(--display);
  font-size: 19px;
  text-transform: uppercase;
}

/* Phones and tablets: a run fills the screen, with a big jump bar for thumbs. */
@media (any-pointer: coarse) {
  .in-game, .in-game body { overflow: hidden; overscroll-behavior: none; }

  .in-game .top, .in-game .tabs, .in-game .run-head, .in-game .hint { display: none; }

  .in-game .run {
    position: fixed;
    inset: 0;
    z-index: 20;
    gap: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
    background: var(--ink);
  }

  .in-game .game {
    --game-width: min(100vw, calc((100vh - 130px - env(safe-area-inset-top, 0px)) * 1.09));
    --game-most: calc(100vh - 130px - env(safe-area-inset-top, 0px));
    --game-tall: 68vh;
    flex: 0 0 auto;
    width: var(--game-width);
    height: min(var(--game-most), max(calc(var(--game-width) * 0.9167), var(--game-tall)));
    aspect-ratio: auto;
    border-width: 0;
  }

  @supports (height: 100dvh) {
    .in-game .game {
      --game-width: min(100vw, calc((100dvh - 130px - env(safe-area-inset-top, 0px)) * 1.09));
      --game-most: calc(100dvh - 130px - env(safe-area-inset-top, 0px));
      --game-tall: 68dvh;
    }
  }

  .in-game:not(.is-running) .game-exit { display: grid; }

  .in-game .game-overlay.is-result { padding-top: 54px; }

  .in-game .jump-bar {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-width: 0;
    min-height: 130px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--red);
    border: 0;
    border-top: 4px solid var(--white);
    color: var(--white);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
  }

  .jump-bar span {
    font-family: var(--display);
    font-size: clamp(44px, 14vw, 76px);
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .jump-bar small { font-size: 16px; font-weight: 700; }

  .in-game .jump-bar.is-pressed { background: var(--red-dark); }

  .in-game:not(.is-running) .jump-bar { opacity: 0.3; }
}

@media (any-pointer: coarse) and (orientation: landscape) {
  .in-game .run { flex-direction: row; align-items: stretch; }

  .in-game .game {
    align-self: center;
    width: auto;
    max-width: calc(100% - 130px);
    height: calc(100vh - env(safe-area-inset-top, 0px));
    height: calc(100dvh - env(safe-area-inset-top, 0px));
    aspect-ratio: 480 / 440;
    margin: 0;
  }

  .in-game .jump-bar {
    min-width: 130px;
    min-height: 0;
    border-top: 0;
    border-left: 4px solid var(--white);
  }

  .jump-bar span { font-size: clamp(38px, 7vw, 76px); }
}

/* Who's playing */
#who-sheet, #board-sheet, #parent-sheet, #install-sheet {
  width: min(100%, 480px);
  max-width: 100%;
  max-height: 88%;
  margin: auto auto 0;
  background: var(--panel);
  border-top: 4px solid var(--red);
}

#who-sheet::backdrop, #board-sheet::backdrop, #parent-sheet::backdrop, #install-sheet::backdrop { background: rgba(0, 0, 0, 0.72); }

/* Add to home screen */
#install-slot:empty { display: none; }

.install-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 18px;
  padding: 10px 12px;
  background: var(--panel);
  border: 2px solid var(--line);
}

.install-card img { display: block; width: 52px; height: 52px; border-radius: 12px; }

.install-text { display: flex; min-width: 0; flex-direction: column; }

.install-text strong { font-size: 18px; line-height: 1.2; }

.install-text span { color: var(--soft); font-size: 15px; line-height: 1.3; }

.install-actions { display: flex; grid-column: 1 / -1; align-items: center; gap: 6px; }

.install-go {
  min-height: 44px;
  flex: 1 1 auto;
  padding: 6px 14px;
  background: var(--red);
  border: 0;
  color: var(--white);
  font-weight: 700;
}

.install-steps { display: flex; flex-direction: column; gap: 10px; padding-left: 24px; font-size: 18px; }

.install-share { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; }

/* Parent sign in and settings */
.account { display: flex; flex-direction: column; gap: 16px; }

.account form { display: flex; flex-direction: column; gap: 14px; }

.account-links { display: flex; flex-direction: column; align-items: center; }

.text-input {
  width: 100%;
  min-height: 52px;
  padding: 10px 12px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 0;
  color: var(--white);
  font: inherit;
  font-size: 18px;
}

.text-input:focus { border-color: var(--white); outline: none; }

.notice { padding: 10px 12px; background: var(--panel); border-left: 4px solid var(--red); }

.who-body .notice { background: var(--ink); }

.parent-list { display: flex; flex-direction: column; gap: 10px; }

.parent-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  background: var(--ink);
  border: 2px solid var(--line);
}

.parent-row strong { overflow-wrap: anywhere; }

/* Leaderboard */
.board-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }

.board-tabs button {
  min-height: 44px;
  padding: 6px;
  background: none;
  border: 2px solid var(--line);
  color: var(--soft);
  font-weight: 700;
}

.board-tabs button.is-active { background: var(--white); border-color: var(--white); color: var(--ink); }

.board-list { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }

.board-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 4px 10px;
  background: var(--ink);
  border: 2px solid var(--line);
}

.board-row.is-mine { background: var(--red-dark); border-color: var(--white); }

.board-place, .board-m { font-family: var(--display); font-size: 21px; }

.board-name { overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }

.board-gap { color: var(--soft); text-align: center; }

.who-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-block: 18px calc(10px + env(safe-area-inset-bottom, 0px));
  padding-left: var(--gutter-left);
  padding-right: var(--gutter-right);
}

.who-body h2 {
  font-family: var(--display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.1;
  text-transform: uppercase;
}

.who-list { display: flex; flex-direction: column; gap: 8px; }

.who-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 5px 10px 5px 5px;
  background: var(--ink);
  border: 2px solid var(--line);
  text-align: left;
}

.who-row.is-current { border-color: var(--white); }

.who-row canvas { display: block; width: 52px; height: 52px; }

.who-row-text { display: flex; min-width: 0; flex-direction: column; }

.who-row-text strong {
  overflow: hidden;
  font-size: 19px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who-row-text span { color: var(--soft); font-size: 14px; }

.who-now {
  padding: 2px 8px;
  background: var(--red);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

/* Build your ninja */
.portrait {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 176px;
  background: var(--panel);
  border: 2px solid var(--line);
}

#ninja-form { display: flex; flex-direction: column; gap: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label, legend {
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--soft);
}

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }

legend { margin-bottom: 8px; }

.name-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--soft);
}

.name-preview {
  font-family: var(--display);
  font-size: clamp(30px, 9vw, 40px);
  line-height: 1.15;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.name-pickers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.name-picker { display: flex; min-width: 0; flex-direction: column; gap: 4px; }

.name-picker:nth-child(3) { grid-column: 1 / -1; }

.field .name-picker label { font-size: 13px; }

.name-picker select {
  width: 100%;
  min-height: 52px;
  padding: 8px 10px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 0;
  color: var(--white);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
}

.name-picker select:focus { border-color: var(--white); outline: none; }

.shuffle {
  min-height: 48px;
  padding: 8px 12px;
  background: none;
  border: 2px solid var(--white);
  color: var(--white);
  font-weight: 700;
}

.shuffle:active { background: var(--white); color: var(--ink); }

.field-note { color: var(--soft); font-size: 15px; }

.field-error { color: var(--white); background: var(--red-dark); padding: 6px 10px; font-size: 15px; font-weight: 700; }

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

.swatch, .toggle label { position: relative; display: block; cursor: pointer; }

.swatch input, .toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.swatch-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 6px 6px;
  background: var(--panel);
  border: 2px solid var(--line);
  font-size: 15px;
  font-weight: 700;
}

.swatch-color {
  display: block;
  width: 100%;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.45);
}

.swatch input:checked + .swatch-box { border-color: var(--white); box-shadow: inset 0 0 0 2px var(--white); }

.swatch input:focus-visible + .swatch-box,
.toggle input:focus-visible + span { outline: 3px solid var(--white); outline-offset: 2px; }

.toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  background: var(--panel);
  border: 2px solid var(--line);
  font-weight: 700;
}

.toggle input:checked + span { background: var(--white); border-color: var(--white); color: var(--ink); }

/* Badge details */
dialog { color: var(--white); border: 0; padding: 0; }

#badge-sheet {
  width: min(100%, 480px);
  max-width: 100%;
  margin: auto auto 0;
  background: var(--panel);
  border-top: 4px solid var(--red);
}

#badge-sheet::backdrop { background: rgba(0, 0, 0, 0.72); }

.sheet-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-block: 22px calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: var(--gutter-left);
  padding-right: var(--gutter-right);
  text-align: center;
}

.sheet-body .hex { width: 112px; }

.sheet-body h2 {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.1;
  text-transform: uppercase;
}

/* The big moment */
#celebrate {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background: var(--red);
}

#celebrate::backdrop { background: var(--red); }

.party-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 480px;
  min-height: 100%;
  margin: 0 auto;
  padding-block: calc(24px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-bottom, 0px));
  padding-left: var(--gutter-left);
  padding-right: var(--gutter-right);
  text-align: center;
  font-size: 21px;
  font-weight: 600;
}

.stamp { width: 168px; animation: stamp 420ms cubic-bezier(0.2, 1.3, 0.4, 1) both; }

.party-body .hex-shape { fill: var(--ink); stroke: var(--white); }

.party-badge {
  font-family: var(--marker);
  font-size: 23px;
  line-height: 1.2;
}

.party-body h2 {
  font-family: var(--display);
  font-size: clamp(44px, 14vw, 62px);
  font-weight: 400;
  line-height: 1.05;
  text-transform: uppercase;
  text-wrap: balance;
}

.party-body .big {
  margin-top: 10px;
  background: var(--white);
  box-shadow: 0 5px 0 var(--red-dark);
  color: var(--ink);
}

@keyframes stamp {
  from { transform: scale(1.9) rotate(-10deg); }
  to { transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .stamp { animation: none; }
  .big:active { transform: none; }
}
