:root {
  --bg: #140700;
  --bg-soft: #051225;
  --panel: rgba(14, 16, 21, 0.82);
  --panel-alt: rgba(19, 22, 29, 0.76);
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-border-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f7fb;
  --muted: #a7adbb;
  --warm: #ff9d1e;
  --warm-strong: #ff7f00;
  --cool: #348dff;
  --cool-strong: #1167ff;
  --white-seat: #ffb13a;
  --dark-seat: #4c97ff;
  --danger: #ff647f;
  --success: #ffb13a;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  --radius: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  color: var(--text);
  background:
    linear-gradient(128deg, #ffb15a 0%, #f3a45f 26%, #9a6670 54%, #4b6fa8 78%, #2d78ef 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 20%, rgba(255, 177, 90, 0.22), transparent 36%),
    radial-gradient(circle at 84% 16%, rgba(77, 136, 236, 0.2), transparent 34%),
    radial-gradient(circle at 50% 100%, rgba(17, 28, 52, 0.2), transparent 40%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.1));
}

.ambient {
  display: none;
}

.ambient-left {
  top: -12rem;
  left: -8rem;
  background: var(--warm-strong);
}

.ambient-right {
  right: -12rem;
  bottom: -9rem;
  background: var(--cool-strong);
}

a {
  color: var(--cool);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.eyebrow,
.micro-label {
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--cool);
  font-size: 0.78rem;
  font-family: "Consolas", "Lucida Console", monospace;
}

.micro-label {
  color: var(--warm);
}

h1,
h2,
h3,
strong {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.lead,
.section-copy,
.preview-banner p,
.rule-card p,
.phase-subtitle,
.zone-foot,
.resume-card,
.setup-summary,
.modal-card p {
  color: var(--muted);
}

.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 0.95rem 1.15rem;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    transform 160ms ease,
    filter 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
  color: var(--text);
  text-decoration: none;
}

.button:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  background: var(--cool-strong);
  border-color: rgba(52, 141, 255, 0.55);
  box-shadow: none;
}

.button.secondary {
  background: var(--warm-strong);
  border-color: rgba(255, 157, 30, 0.4);
  box-shadow: none;
}

.button.ghost {
  background: #131313;
  border-color: var(--panel-border);
  box-shadow: none;
}

.button.danger {
  color: #ffd8d8;
  border-color: rgba(255, 114, 114, 0.3);
}

.button.small {
  padding: 0.7rem 0.9rem;
}

.setup-shell {
  position: relative;
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
}

.hero,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero::before,
.panel::before {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 1.2rem;
  padding: 1.3rem;
}

.hero-copy,
.hero-preview {
  padding: 1rem;
}

.hero-preview {
  display: grid;
  gap: 1rem;
}

.logo-lockup {
  display: inline-flex;
  align-items: center;
  gap: 1.15rem;
  max-width: 100%;
  margin-bottom: 1rem;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.logo-lockup:hover {
  text-decoration: none;
}

.hero-logo-icon {
  display: block;
  flex: 0 0 auto;
  width: clamp(104px, 12vw, 164px);
  height: auto;
}

.hero-logo {
  display: block;
  max-width: 100%;
  width: clamp(200px, 24vw, 340px);
  height: auto;
}

.hero-setup h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5.2vw, 4rem);
  line-height: 0.98;
  letter-spacing: 0.03em;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.hero-pills span,
.mini-chip,
.seat-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: var(--panel-alt);
  box-shadow: none;
}

.preview-card,
.preview-banner,
.rule-card,
.resume-card,
.setup-summary,
.status-card,
.spine-card,
.modal-card,
.zone-inner {
  border-radius: 24px;
  border: 1px solid var(--panel-border);
  background: var(--panel-alt);
  box-shadow: none;
}

.preview-card,
.preview-banner,
.rule-card,
.resume-card,
.setup-summary,
.status-card,
.spine-card,
.modal-card {
  padding: 1rem;
}

.phase-list {
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.phase-list li + li {
  margin-top: 0.45rem;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.82fr);
  gap: 1.2rem;
  margin-top: 1.2rem;
}

.panel {
  padding: 1.35rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.1rem;
}

.setup-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.timing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.span-2 {
  grid-column: 1 / -1;
}

.field > span,
legend {
  font-weight: 700;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

input,
textarea {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: #0c0c0c;
  box-shadow: none;
  color: var(--text);
  font: inherit;
}

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

input:focus,
textarea:focus {
  outline: 2px solid rgba(52, 141, 255, 0.45);
  outline-offset: 1px;
}

.option-grid {
  display: grid;
  gap: 0.85rem;
}

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

.preset-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.option-card {
  position: relative;
  display: grid;
  gap: 0.45rem;
  min-height: 8.7rem;
  padding: 1rem 1rem 1rem 3rem;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  background: #121212;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.option-card:hover {
  transform: translateY(-3px);
  border-color: rgba(52, 141, 255, 0.34);
  box-shadow: none;
}

.option-card input {
  position: absolute;
  top: 1.1rem;
  left: 1rem;
  width: 1.1rem;
  height: 1.1rem;
}

.option-card:has(input:checked) {
  border-color: rgba(52, 141, 255, 0.52);
  background: rgba(17, 103, 255, 0.14);
  box-shadow: none;
}

.setup-summary {
  display: grid;
  gap: 0.38rem;
}

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.side-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.resume-card.empty {
  text-align: center;
}

.resume-card strong {
  display: block;
  margin-bottom: 0.35rem;
}

.resume-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.rules-stack {
  display: grid;
  gap: 0.95rem;
}

.phase-body {
  min-height: 100dvh;
  overflow: hidden;
}

.phase-shell {
  position: relative;
  width: min(1400px, calc(100% - 1.2rem));
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.9rem;
  padding: 0.8rem 0 0.9rem;
}

.phase-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  background:
    linear-gradient(135deg, rgba(10, 12, 17, 0.9), rgba(22, 26, 35, 0.78));
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  justify-self: start;
  padding: 0.75rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.brand-link:hover {
  text-decoration: none;
}

.brand-link-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.brand-link-icon {
  display: block;
  flex: 0 0 auto;
  width: 3.7rem;
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.brand-link-mark {
  display: block;
  max-width: 100%;
  width: 7.4rem;
  height: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.28));
}

.phase-title {
  text-align: center;
  padding-inline: 0.6rem;
}

.phase-title h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  color: #ffffff;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.26);
}

.phase-subtitle {
  margin: 0.25rem 0 0;
  color: rgba(245, 247, 251, 0.88);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.phase-header .eyebrow {
  margin-bottom: 0.35rem;
  color: #7aa8ff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
}

.phase-header .button.ghost {
  background: rgba(10, 12, 17, 0.65);
  border-color: rgba(255, 255, 255, 0.14);
}

.utility-button {
  justify-self: end;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.status-card {
  min-height: 6.4rem;
  display: grid;
  align-content: center;
  gap: 0.28rem;
  text-align: center;
}

.status-card span {
  color: var(--muted);
}

.status-card strong {
  font-size: clamp(1.6rem, 3.8vw, 2.7rem);
  line-height: 0.94;
}

.status-card.wide {
  background: #151515;
  border-color: var(--panel-border-strong);
}

.faceoff-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px) minmax(0, 1fr);
  gap: 0.8rem;
  min-height: 0;
}

.player-zone {
  min-height: 0;
}

.zone-inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.9rem;
  height: 100%;
  padding: 1rem;
}

.zone-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
}

.zone-head h2 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.45rem, 3vw, 2.4rem);
}

.zone-stats {
  text-align: right;
  display: grid;
  gap: 0.2rem;
  color: var(--muted);
}

.zone-stats strong {
  font-size: 1.4rem;
  color: var(--text);
}

.seat-tag {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.light-seat {
  background: rgba(255, 122, 0, 0.14);
  color: var(--white-seat);
  box-shadow: none;
}

.dark-seat {
  background: rgba(23, 98, 255, 0.14);
  color: var(--dark-seat);
  box-shadow: none;
}

.zone-button {
  width: 100%;
  min-height: clamp(220px, 44vh, 560px);
  padding: 1rem;
  border-radius: 28px;
  border: 1px solid currentColor;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.02;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  cursor: pointer;
  color: var(--text);
  transition:
    transform 150ms ease,
    filter 150ms ease,
    opacity 150ms ease,
    box-shadow 150ms ease;
  touch-action: manipulation;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.05);
}

.zone-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

.zone-button:disabled {
  cursor: not-allowed;
  transform: none;
  opacity: 0.52;
}

.light-button {
  background: rgba(255, 127, 0, 0.12);
  color: var(--white-seat);
  box-shadow: none;
}

.dark-button {
  background: rgba(17, 103, 255, 0.12);
  color: var(--dark-seat);
  box-shadow: none;
}

.zone-button.active-turn {
  box-shadow: inset 0 0 0 2px currentColor;
  animation: none;
}

.active-zone .zone-inner {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.zone-foot {
  min-height: 3.4rem;
  margin: 0;
}

.phase-spine {
  display: grid;
  align-content: center;
  gap: 0.8rem;
}

.spine-card {
  display: grid;
  gap: 0.35rem;
}

.spine-card strong {
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.spine-card p {
  margin-bottom: 0;
}

.spine-button {
  min-height: 4.4rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  background: #111111;
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.8rem;
}

.modal-head h2 {
  margin-bottom: 0;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.rules-shell {
  position: relative;
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
}

.hero-rules h1 {
  margin: 0;
  font-size: clamp(2.25rem, 4.8vw, 3.8rem);
  line-height: 0.98;
}

.hero-home h1 {
  margin: 0;
  font-size: clamp(2.15rem, 4.8vw, 3.9rem);
  line-height: 0.98;
}

.lead {
  font-size: clamp(1rem, 1.9vw, 1.18rem);
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.2rem;
}

.rule-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric-chip,
.stage-card,
.format-card,
.split-card,
.source-card {
  position: relative;
  border-radius: 24px;
  border: 1px solid var(--panel-border);
  background: var(--panel-alt);
  box-shadow: none;
}

.metric-chip,
.stage-card,
.format-card,
.split-card,
.source-card {
  padding: 1rem;
}

.metric-chip {
  display: grid;
  gap: 0.3rem;
}

.metric-chip span,
.stage-card p,
.format-head p,
.source-card p,
.split-card p {
  color: var(--muted);
}

.metric-chip strong {
  font-size: 1.2rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.2rem;
  margin-top: 1.2rem;
}

.panel-wide {
  grid-column: span 12;
}

.panel-half {
  grid-column: span 6;
}

.panel-third {
  grid-column: span 4;
}

.rules-stage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.home-story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.stage-card {
  display: grid;
  gap: 0.45rem;
}

.rules-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.format-card {
  display: grid;
  gap: 1rem;
  padding-top: 1.15rem;
}

.format-card::before {
  display: none;
}

.mini-panel {
  position: relative;
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  background: var(--panel-alt);
  box-shadow: none;
}

.mini-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.home-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.home-mini-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cta-panel {
  border-color: rgba(255, 122, 0, 0.26);
}

.twice-card {
  border-color: rgba(255, 122, 0, 0.28);
}

.time-card {
  border-color: rgba(23, 98, 255, 0.28);
}

.format-head h3,
.format-section h4,
.source-card strong {
  margin: 0;
}

.format-head {
  display: grid;
  gap: 0.45rem;
}

.format-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.format-badges span {
  display: inline-flex;
  align-items: center;
  padding: 0.48rem 0.78rem;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: #151515;
  color: var(--text);
}

.format-section {
  display: grid;
  gap: 0.6rem;
}

.rule-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
}

.rule-list li + li {
  margin-top: 0.55rem;
}

.rule-list.compact li + li {
  margin-top: 0.42rem;
}

.callout {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  background: #151515;
}

.callout p {
  margin-bottom: 0;
  color: var(--muted);
}

.split-callouts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.split-card {
  display: grid;
  gap: 0.4rem;
}

.minus-card {
  border-color: rgba(255, 122, 0, 0.24);
}

.plus-card {
  border-color: rgba(23, 98, 255, 0.24);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
}

.source-card {
  display: grid;
  gap: 0.4rem;
  color: var(--text);
  text-decoration: none;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.source-card:hover {
  transform: translateY(-3px);
  text-decoration: none;
  border-color: var(--panel-border-strong);
  box-shadow: none;
}

@media (max-width: 1100px) {
  .hero,
  .setup-grid,
  .mode-grid,
  .preset-grid,
  .timing-grid,
  .faceoff-board,
  .rules-compare,
  .rules-stage-grid,
  .home-story-grid,
  .split-callouts,
  .source-grid,
  .home-mini-grid,
  .home-mini-grid.two-columns {
    grid-template-columns: 1fr;
  }

  .panel-half,
  .panel-third {
    grid-column: span 12;
  }

  .phase-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .brand-link,
  .utility-button {
    justify-self: center;
  }
}

@media (max-width: 900px) {
  .phase-body {
    overflow-y: auto;
  }

  body[data-page="chrono"].phase-body {
    overflow: hidden;
    overscroll-behavior: none;
  }

  .setup-shell,
  .phase-shell,
  .rules-shell {
    width: min(100% - 1rem, 100%);
  }

  .panel,
  .hero {
    padding: 1rem;
  }

  .setup-form {
    grid-template-columns: 1fr;
  }

  .setup-actions,
  .resume-actions,
  .modal-actions {
    display: grid;
  }

  .phase-shell {
    gap: 0.55rem;
    padding: 0.55rem 0 0.55rem;
  }

  .phase-header {
    grid-template-columns: auto 1fr auto;
    gap: 0.45rem;
    text-align: center;
  }

  .phase-title h1 {
    font-size: clamp(1.55rem, 5.8vw, 2.1rem);
  }

  .phase-subtitle {
    font-size: 0.92rem;
  }

  .status-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .status-card {
    min-height: 4.5rem;
    padding: 0.65rem 0.45rem;
  }

  .status-card strong {
    font-size: clamp(1.25rem, 4vw, 1.7rem);
  }

  .faceoff-board {
    grid-template-rows: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 0.45rem;
  }

  .rules-grid {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .opponent-zone .mirrored-mobile {
    transform: rotate(180deg);
  }

  .zone-inner {
    padding: 0.7rem;
    gap: 0.55rem;
  }

  .zone-head {
    align-items: center;
  }

  .zone-head h2 {
    font-size: 1.25rem;
  }

  .zone-stats strong {
    font-size: 1.05rem;
  }

  .zone-button {
    min-height: clamp(118px, 18vh, 180px);
    font-size: clamp(1.7rem, 6.6vw, 2.7rem);
  }

  .zone-foot {
    min-height: 1.3rem;
    font-size: 0.88rem;
  }

  .phase-spine {
    gap: 0.45rem;
  }

  .spine-card {
    padding: 0.75rem;
  }

  .spine-card strong {
    font-size: 1.15rem;
  }

  .spine-card p {
    font-size: 0.92rem;
  }

  .spine-button {
    min-height: 3.4rem;
  }

  .brand-link {
    justify-self: start;
  }

  .utility-button {
    justify-self: end;
    width: auto;
  }

  .hero-actions {
    display: grid;
  }
}

@media (max-width: 640px) {
  body[data-page="setup"] .setup-shell {
    width: min(100% - 0.5rem, 100%);
    padding: 0.35rem 0 0.5rem;
  }

  body[data-page="setup"] .hero {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    padding: 0.75rem;
  }

  body[data-page="setup"] .hero-copy,
  body[data-page="setup"] .panel {
    padding: 0.75rem;
  }

  body[data-page="setup"] .hero-preview,
  body[data-page="setup"] .side-panel,
  body[data-page="setup"] #setupSummary {
    display: none;
  }

  body[data-page="setup"] .logo-lockup {
    gap: 0.7rem;
    margin-bottom: 0.55rem;
  }

  body[data-page="setup"] .hero-logo-icon {
    width: 4rem;
  }

  body[data-page="setup"] .hero-logo {
    width: min(11.5rem, 46vw);
  }

  body[data-page="setup"] .hero .eyebrow {
    margin-bottom: 0.25rem;
    font-size: 0.68rem;
  }

  body[data-page="setup"] .hero-setup h1 {
    font-size: clamp(1.8rem, 8vw, 2.5rem);
  }

  body[data-page="setup"] .hero-actions {
    margin-top: 0.75rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  body[data-page="setup"] .hero-actions .button {
    min-height: 3rem;
    padding: 0.75rem 0.7rem;
    border-radius: 14px;
    font-size: 0.92rem;
  }

  body[data-page="setup"] .setup-grid {
    grid-template-columns: 1fr;
    gap: 0.45rem;
    margin-top: 0.45rem;
  }

  body[data-page="setup"] .panel {
    border-radius: 24px;
  }

  body[data-page="setup"] .section-heading {
    margin-bottom: 0.7rem;
    gap: 0.45rem;
  }

  body[data-page="setup"] .section-copy {
    display: none;
  }

  body[data-page="setup"] .setup-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  body[data-page="setup"] .field {
    gap: 0.25rem;
  }

  body[data-page="setup"] .field > span,
  body[data-page="setup"] legend {
    font-size: 0.9rem;
  }

  body[data-page="setup"] input,
  body[data-page="setup"] textarea {
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
  }

  body[data-page="setup"] textarea {
    min-height: 4.2rem;
  }

  body[data-page="setup"] .option-grid,
  body[data-page="setup"] .timing-grid {
    gap: 0.45rem;
  }

  body[data-page="setup"] .mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="setup"] .preset-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-page="setup"] .option-card {
    min-height: 0;
    padding: 0.75rem 0.75rem 0.75rem 2rem;
    border-radius: 18px;
    gap: 0.2rem;
  }

  body[data-page="setup"] .option-card input {
    top: 0.82rem;
    left: 0.75rem;
    width: 0.95rem;
    height: 0.95rem;
  }

  body[data-page="setup"] .option-card span {
    font-size: 0.8rem;
    line-height: 1.25;
  }

  body[data-page="setup"] .mode-grid .option-card {
    min-height: 4.45rem;
    padding: 0.7rem 0.45rem;
    text-align: center;
    align-content: center;
  }

  body[data-page="setup"] .mode-grid .option-card input,
  body[data-page="setup"] .mode-grid .option-card span {
    position: static;
    margin: 0 auto;
  }

  body[data-page="setup"] .mode-grid .option-card span {
    display: none;
  }

  body[data-page="setup"] .preset-grid .option-card {
    padding: 0.7rem 0.45rem;
    text-align: center;
  }

  body[data-page="setup"] .preset-grid .option-card input {
    position: static;
    margin: 0 auto 0.2rem;
  }

  body[data-page="setup"] .setup-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  body[data-page="setup"] .setup-actions .button {
    min-height: 3rem;
    padding: 0.75rem 0.7rem;
  }

  body[data-page="setup"] .setup-actions .button.ghost {
    display: none;
  }

  .phase-body .phase-shell {
    width: min(100% - 0.45rem, 100%);
    gap: 0.35rem;
    padding: 0.35rem 0 0.35rem;
  }

  .phase-body .phase-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.35rem;
    padding: 0.55rem 0.65rem;
    border-radius: 20px;
  }

  .phase-body .brand-link {
    padding: 0;
    gap: 0.5rem;
  }

  .phase-body .brand-link-mark {
    display: none;
  }

  .phase-body .brand-link-icon {
    width: 2.45rem;
  }

  .phase-body .phase-title {
    padding-inline: 0;
  }

  .phase-body .phase-header .eyebrow,
  .phase-body .phase-subtitle,
  .phase-body .zone-foot,
  .phase-body .spine-card p {
    display: none;
  }

  .phase-body .phase-title h1 {
    font-size: clamp(1.05rem, 5.4vw, 1.35rem);
  }

  .phase-body .status-strip {
    gap: 0.3rem;
  }

  .phase-body .status-card {
    min-height: 3.35rem;
    padding: 0.35rem 0.25rem;
    border-radius: 18px;
  }

  .phase-body .status-card span {
    font-size: 0.66rem;
    line-height: 1.1;
  }

  .phase-body .status-card strong {
    font-size: 0.98rem;
  }

  .phase-body .faceoff-board {
    gap: 0.35rem;
  }

  .phase-body .zone-inner {
    padding: 0.5rem;
    gap: 0.4rem;
    border-radius: 20px;
  }

  .phase-body .zone-head {
    gap: 0.45rem;
  }

  .phase-body .zone-head h2 {
    margin-top: 0.1rem;
    font-size: 1rem;
  }

  .phase-body .zone-stats {
    gap: 0.08rem;
  }

  .phase-body .zone-stats strong {
    font-size: 0.95rem;
  }

  .phase-body .zone-stats span {
    font-size: 0.78rem;
  }

  .phase-body .seat-tag {
    padding: 0.22rem 0.55rem;
    font-size: 0.62rem;
  }

  .phase-body .zone-button {
    min-height: clamp(92px, 12.5vh, 132px);
    padding: 0.75rem;
    border-radius: 22px;
    font-size: clamp(1.35rem, 6.2vw, 2.05rem);
  }

  .phase-body .phase-spine {
    gap: 0.3rem;
  }

  .phase-body .spine-card {
    padding: 0.55rem 0.65rem;
    border-radius: 20px;
  }

  .phase-body .spine-card strong {
    font-size: 1rem;
  }

  .phase-body .spine-button {
    min-height: 2.9rem;
    padding: 0.7rem;
    border-radius: 18px;
    font-size: 0.96rem;
  }

  .phase-body .utility-button {
    min-height: auto;
    padding: 0.55rem 0.8rem;
    font-size: 0.9rem;
  }

  body[data-page="cube"] .phase-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem;
  }

  body[data-page="cube"] .phase-title,
  body[data-page="cube"] .phase-spine .spine-card {
    display: none;
  }

  body[data-page="cube"] .phase-spine {
    gap: 0;
  }

  body[data-page="cube"] .zone-inner {
    grid-template-rows: auto minmax(0, 1fr);
  }

  body[data-page="chrono"] .phase-shell {
    gap: 0.22rem;
    padding: 0.22rem 0 0.22rem;
  }

  body[data-page="chrono"] .phase-header {
    padding: 0.42rem 0.5rem;
  }

  body[data-page="chrono"] .phase-title h1 {
    font-size: 0.94rem;
  }

  body[data-page="chrono"] .status-strip {
    gap: 0.22rem;
  }

  body[data-page="chrono"] .status-card {
    min-height: 2.55rem;
    padding: 0.22rem 0.18rem;
  }

  body[data-page="chrono"] .status-card span {
    font-size: 0.58rem;
  }

  body[data-page="chrono"] .status-card strong {
    font-size: 0.82rem;
  }

  body[data-page="chrono"] .faceoff-board {
    gap: 0.22rem;
  }

  body[data-page="chrono"] .zone-inner {
    padding: 0.36rem;
    gap: 0.26rem;
    border-radius: 18px;
  }

  body[data-page="chrono"] .zone-head h2 {
    font-size: 0.84rem;
  }

  body[data-page="chrono"] .zone-stats strong {
    font-size: 0.8rem;
  }

  body[data-page="chrono"] .zone-stats span {
    font-size: 0.66rem;
  }

  body[data-page="chrono"] .seat-tag {
    padding: 0.16rem 0.42rem;
    font-size: 0.56rem;
  }

  body[data-page="chrono"] .zone-button {
    min-height: clamp(68px, 9vh, 92px);
    padding: 0.55rem;
    font-size: clamp(1rem, 5.5vw, 1.35rem);
  }

  body[data-page="chrono"] .phase-spine {
    gap: 0;
  }

  body[data-page="chrono"] .phase-spine .spine-card {
    display: none;
  }

  body[data-page="chrono"] .spine-button {
    min-height: 2.3rem;
    padding: 0.48rem;
    border-radius: 16px;
    font-size: 0.82rem;
  }

  .hero-setup h1 {
    font-size: 2.1rem;
  }

  .hero-home h1,
  .hero-rules h1 {
    font-size: 2rem;
  }

  .status-card {
    min-height: 4rem;
    padding: 0.55rem 0.35rem;
  }

  .status-card span {
    font-size: 0.76rem;
  }

  .status-card strong {
    font-size: 1.18rem;
  }

  .modal-head,
  .section-heading {
    flex-direction: column;
  }

  .zone-head {
    flex-direction: row;
    align-items: center;
  }

  .button,
  .spine-button {
    width: 100%;
  }

  .utility-button {
    width: auto;
  }
}

@media (max-width: 480px) {
  body[data-page="setup"] .hero-copy,
  body[data-page="setup"] .panel {
    padding: 0.65rem;
  }

  body[data-page="setup"] .logo-lockup {
    gap: 0.55rem;
    margin-bottom: 0.4rem;
  }

  body[data-page="setup"] .hero-logo-icon {
    width: 3.2rem;
  }

  body[data-page="setup"] .hero-logo {
    width: min(9.6rem, 42vw);
  }

  body[data-page="setup"] .hero-setup h1 {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  body[data-page="setup"] .hero-actions .button {
    min-height: 2.75rem;
    padding: 0.65rem 0.55rem;
    font-size: 0.84rem;
  }

  body[data-page="setup"] .setup-form {
    gap: 0.45rem;
  }

  body[data-page="setup"] .field > span,
  body[data-page="setup"] legend {
    font-size: 0.84rem;
  }

  body[data-page="setup"] input,
  body[data-page="setup"] textarea {
    padding: 0.68rem 0.75rem;
  }

  body[data-page="setup"] textarea {
    min-height: 3.6rem;
  }

  body[data-page="setup"] .option-card {
    padding: 0.68rem 0.6rem 0.68rem 1.8rem;
  }

  body[data-page="setup"] .option-card strong {
    font-size: 0.92rem;
  }

  body[data-page="setup"] .mode-grid .option-card strong {
    font-size: 0.86rem;
  }

  body[data-page="setup"] .option-card span {
    font-size: 0.75rem;
  }

  body[data-page="setup"] .preset-grid .option-card span {
    line-height: 1.15;
  }

  body[data-page="setup"] .setup-actions .button {
    min-height: 2.75rem;
    font-size: 0.88rem;
  }

  body[data-page="chrono"] .phase-header {
    padding: 0.36rem 0.42rem;
  }

  body[data-page="chrono"] .brand-link-icon {
    width: 1.9rem;
  }

  body[data-page="chrono"] .phase-title h1 {
    font-size: 0.88rem;
  }

  body[data-page="chrono"] .status-card {
    min-height: 2.3rem;
  }

  body[data-page="chrono"] .status-card span {
    font-size: 0.54rem;
  }

  body[data-page="chrono"] .status-card strong {
    font-size: 0.76rem;
  }

  body[data-page="chrono"] .zone-head h2 {
    font-size: 0.78rem;
  }

  body[data-page="chrono"] .zone-stats strong {
    font-size: 0.74rem;
  }

  body[data-page="chrono"] .zone-stats span {
    font-size: 0.62rem;
  }

  body[data-page="chrono"] .zone-button {
    min-height: clamp(60px, 8.4vh, 82px);
    font-size: clamp(0.94rem, 5.8vw, 1.2rem);
  }

  body[data-page="chrono"] .spine-button {
    min-height: 2.1rem;
    font-size: 0.78rem;
  }

  .phase-body .phase-header {
    padding: 0.5rem 0.55rem;
  }

  .phase-body .brand-link-icon {
    width: 2.15rem;
  }

  .phase-body .phase-title h1 {
    font-size: 0.98rem;
  }

  .phase-body .status-card {
    min-height: 3rem;
    padding: 0.3rem 0.2rem;
  }

  .phase-body .status-card span {
    font-size: 0.62rem;
  }

  .phase-body .status-card strong {
    font-size: 0.9rem;
  }

  .phase-body .zone-head h2 {
    font-size: 0.92rem;
  }

  .phase-body .zone-stats strong {
    font-size: 0.86rem;
  }

  .phase-body .zone-stats span {
    font-size: 0.72rem;
  }

  .phase-body .zone-button {
    min-height: clamp(84px, 11.5vh, 112px);
    font-size: clamp(1.22rem, 7vw, 1.75rem);
  }

  .phase-body .spine-button {
    min-height: 2.7rem;
    padding: 0.6rem;
    font-size: 0.9rem;
  }
}

/* Keep phase pages inside the visible mobile viewport, including safe areas. */
.phase-body {
  padding: 0;
}

.phase-body .phase-shell {
  box-sizing: border-box;
  width: min(1400px, 100%);
  min-height: 100dvh;
  height: 100dvh;
  max-height: 100dvh;
  padding:
    calc(var(--safe-top) + 0.8rem)
    calc(var(--safe-right) + 0.6rem)
    calc(var(--safe-bottom) + 0.9rem)
    calc(var(--safe-left) + 0.6rem);
  overflow: hidden;
}

@media (max-width: 900px) {
  .phase-body .phase-shell {
    width: 100%;
    padding:
      calc(var(--safe-top) + 0.55rem)
      calc(var(--safe-right) + 0.5rem)
      calc(var(--safe-bottom) + 0.55rem)
      calc(var(--safe-left) + 0.5rem);
  }
}

@media (max-height: 540px) {
  .phase-body .phase-shell {
    gap: 0.2rem;
    padding:
      calc(var(--safe-top) + 0.2rem)
      calc(var(--safe-right) + 0.35rem)
      calc(var(--safe-bottom) + 0.2rem)
      calc(var(--safe-left) + 0.35rem);
  }

  .phase-body .phase-header {
    padding: 0.32rem 0.4rem;
    border-radius: 16px;
  }

  .phase-body .brand-link-icon {
    width: 1.8rem;
  }

  .phase-body .phase-title h1 {
    font-size: 0.86rem;
  }

  .phase-body .status-strip,
  .phase-body .faceoff-board {
    gap: 0.2rem;
  }

  .phase-body .status-card {
    min-height: 2.05rem;
    padding: 0.18rem 0.14rem;
    border-radius: 14px;
  }

  .phase-body .status-card span {
    font-size: 0.5rem;
  }

  .phase-body .status-card strong {
    font-size: 0.72rem;
  }

  .phase-body .zone-inner {
    padding: 0.28rem;
    gap: 0.18rem;
    border-radius: 14px;
  }

  .phase-body .zone-head h2 {
    font-size: 0.72rem;
  }

  .phase-body .zone-stats strong {
    font-size: 0.7rem;
  }

  .phase-body .zone-stats span {
    font-size: 0.58rem;
  }

  .phase-body .seat-tag {
    padding: 0.12rem 0.32rem;
    font-size: 0.48rem;
  }

  .phase-body .zone-button {
    min-height: clamp(48px, 7vh, 72px);
    padding: 0.4rem;
    border-radius: 16px;
    font-size: clamp(0.88rem, 4.4vw, 1.05rem);
  }

  .phase-body .spine-card {
    padding: 0.35rem 0.45rem;
    border-radius: 14px;
  }

  .phase-body .spine-card strong {
    font-size: 0.8rem;
  }

  .phase-body .spine-button {
    min-height: 1.9rem;
    padding: 0.32rem;
    border-radius: 14px;
    font-size: 0.72rem;
  }

  .phase-body .utility-button {
    padding: 0.38rem 0.6rem;
    font-size: 0.72rem;
  }
}
