:root {
  --bg: #140700;
  --bg-soft: #051225;
  --site-gradient: linear-gradient(128deg, #ffb15a 0%, #f3a45f 26%, #9a6670 54%, #4b6fa8 78%, #2d78ef 100%);
  --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;
  --site-menu-offset: calc(6.9rem + var(--safe-top));
  --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;
  background: var(--site-gradient);
}

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: var(--site-gradient);
  background-attachment: scroll;
}

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%),
    var(--site-gradient);
}

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;
}

/* FocusOnNavigate met le focus sur le titre apres navigation. */
h1[tabindex="-1"]:focus {
  outline: none;
}

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;
}

.setup-refresh-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.9rem;
  padding-bottom: 0.35rem;
}

.refresh-link-button {
  appearance: none;
  border: 0;
  padding: 0.3rem 0.45rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.86;
}

.refresh-link-button:hover {
  color: var(--text);
  text-decoration: underline;
}

.refresh-link-button:disabled {
  opacity: 0.56;
  cursor: wait;
}

.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;
}

[hidden] {
  display: none !important;
}

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

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

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

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

input:not([type="radio"]):not([type="checkbox"]),
select,
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:not([type="radio"]):not([type="checkbox"]):focus,
select: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;
  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;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.option-card.is-focused,
.option-card:has(input:focus-visible) {
  outline: 2px solid rgba(52, 141, 255, 0.45);
  outline-offset: 2px;
}

.option-card.is-selected,
.option-card:has(input:checked) {
  border-color: rgba(52, 141, 255, 0.58);
  background: linear-gradient(180deg, rgba(17, 103, 255, 0.16), rgba(17, 103, 255, 0.1));
  box-shadow: none;
}

.option-card.is-selected strong,
.option-card:has(input:checked) strong {
  color: #f7fbff;
}

.option-card.is-selected span,
.option-card:has(input:checked) span {
  color: #d6e5ff;
}

.competition-option.is-selected,
.competition-option:has(input:checked) {
  border-color: rgba(255, 157, 30, 0.48);
  background: linear-gradient(180deg, rgba(255, 127, 0, 0.14), rgba(255, 157, 30, 0.08));
}

.competition-option.is-selected span,
.competition-option:has(input:checked) span {
  color: #ffe6c4;
}

.competition-option {
  min-height: 0;
  gap: 0.25rem;
  padding-top: 0.95rem;
  padding-bottom: 0.95rem;
}

.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 {
  --app-page-height: calc(
    var(--app-visible-height, 100dvh) + max(var(--app-viewport-top, 0px), var(--phase-top-offset, 0px)) + 1px
  );
  min-height: var(--app-page-height);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: auto;
  -webkit-overflow-scrolling: touch;
}

.phase-shell {
  position: relative;
  width: min(1400px, calc(100% - 1.2rem));
  min-height: var(--app-page-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);
}

body[data-page="cube"] .zone-button {
  position: relative;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  --cube-hold-progress: 0;
}

body[data-page="cube"] .zone-button::before,
body[data-page="cube"] .zone-button::after {
  content: "";
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.9rem;
  height: 0.38rem;
  border-radius: 999px;
  pointer-events: none;
}

body[data-page="cube"] .zone-button::before {
  background: rgba(255, 255, 255, 0.12);
  opacity: 0;
  transition: opacity 120ms ease;
}

body[data-page="cube"] .zone-button::after {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.4), currentColor);
  transform: scaleX(var(--cube-hold-progress));
  transform-origin: left center;
  opacity: 0;
  transition: opacity 120ms ease;
}

body[data-page="cube"] .zone-button.cube-hold-arming {
  transform: none;
  filter: brightness(0.98);
  box-shadow: inset 0 0 0 1px currentColor;
}

body[data-page="cube"] .zone-button.cube-hold-arming::before,
body[data-page="cube"] .zone-button.cube-hold-arming::after,
body[data-page="cube"] .zone-button.cube-hold-ready::before,
body[data-page="cube"] .zone-button.cube-hold-ready::after {
  opacity: 1;
}

body[data-page="cube"] .zone-button.cube-hold-ready {
  transform: none;
  filter: brightness(1.08);
  box-shadow:
    inset 0 0 0 2px currentColor,
    0 0 24px rgba(255, 255, 255, 0.08);
}

body[data-page="cube"] .zone-button.cube-hold-ready::after {
  transform: scaleX(1);
}

.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:
    calc(1rem + var(--safe-top))
    calc(1rem + var(--safe-right))
    calc(1rem + var(--safe-bottom))
    calc(1rem + var(--safe-left));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.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%);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 2rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  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;
}

.result-modal-card {
  width: min(880px, 100%);
}

.cube-result-overview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.result-pill-card,
.cube-result-player-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  background: var(--panel-alt);
}

.result-pill-card span,
.cube-result-player-card span {
  color: var(--muted);
}

.result-pill-card strong {
  font-size: clamp(1.3rem, 3vw, 2rem);
}

.cube-result-player-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.cube-result-player-card strong {
  font-size: clamp(1.15rem, 2.8vw, 1.8rem);
}

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

.site-layout-body {
  padding-top: var(--site-menu-offset);
}

.site-menu-shell {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  width: 100%;
  margin: 0;
  padding: var(--safe-top) 0 0;
  transition:
    transform 220ms ease,
    opacity 220ms ease;
  will-change: transform, opacity;
}

.site-menu-bar {
  border-bottom: 1px solid var(--panel-border);
  background: rgba(14, 16, 21, 0.9);
  box-shadow: none;
  backdrop-filter: blur(18px);
}

body.site-menu-hidden .site-menu-shell {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

.site-menu-main {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.site-menu-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text);
  min-width: 0;
}

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

.site-menu-brand-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.site-menu-brand-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.site-menu-brand-copy .micro-label {
  margin-bottom: 0;
}

.site-menu-brand-copy strong {
  font-size: 1.08rem;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.site-menu-desktop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.site-menu-mobile-toggle,
.site-menu-mobile-panel {
  display: none;
}

.site-menu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.site-menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.02);
  font-weight: 800;
  letter-spacing: 0.04em;
  transition:
    color 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.site-menu-link:hover {
  color: var(--text);
  border-color: var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.site-menu-link.is-active {
  color: var(--text);
  border-color: rgba(52, 141, 255, 0.32);
  background: rgba(17, 103, 255, 0.18);
}

.site-menu-account {
  display: grid;
  gap: 0.45rem;
  justify-items: end;
}

.site-menu-account .micro-label {
  margin-bottom: 0;
}

.site-menu-account-actions,
.site-menu-account-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.site-menu-user {
  display: grid;
  gap: 0.15rem;
  text-align: right;
}

.site-menu-user strong {
  font-size: 0.98rem;
}

.site-menu-user span {
  color: var(--muted);
  font-size: 0.9rem;
}

.site-menu-mobile-links,
.site-menu-mobile-account-actions,
.site-menu-mobile-account-panel,
.site-menu-mobile-user {
  display: grid;
}

.site-menu-mobile-user {
  gap: 0.15rem;
}

.site-menu-mobile-user span {
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-modal-card {
  width: min(980px, 100%);
  padding: 1.1rem;
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  background: rgba(14, 16, 21, 0.96);
}

.auth-modal-copy {
  margin-bottom: 1rem;
  color: var(--muted);
}

.auth-modal-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.auth-form-grid {
  display: grid;
  gap: 0.85rem;
}

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

.auth-form-error {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 100, 127, 0.28);
  border-radius: 18px;
  color: #ffd8de;
  background: rgba(255, 100, 127, 0.12);
}

.validation-message {
  color: #ffb3c0;
  font-size: 0.88rem;
  line-height: 1.35;
}

.auth-modal-card .field {
  margin: 0;
}

.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;
}

.user-hero {
  align-items: stretch;
}

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

.profile-meta-card {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  background: var(--panel-alt);
}

.profile-meta-card strong {
  font-size: 1rem;
}

.profile-highlights {
  margin-bottom: 0.9rem;
}

.profile-callout {
  min-height: 100%;
}

.profile-callout p {
  margin-bottom: 0;
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.profile-actions .section-copy {
  margin-bottom: 0;
}

.profile-feedback {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 18px;
}

.profile-feedback.success {
  border: 1px solid rgba(69, 185, 127, 0.3);
  background: rgba(69, 185, 127, 0.12);
  color: #dff7ea;
}

.profile-feedback.error {
  border: 1px solid rgba(255, 100, 127, 0.28);
  background: rgba(255, 100, 127, 0.12);
  color: #ffd8de;
}

@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;
  }

  .profile-meta-grid,
  .profile-form-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 900px) {
  :root {
    --site-menu-offset: calc(6.8rem + var(--safe-top));
  }

  .site-menu-shell {
    padding: calc(var(--safe-top) + 0.45rem) 0.75rem 0;
  }

  .site-menu-bar {
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .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;
  }

  .site-menu-main {
    grid-template-columns: minmax(0, 1fr) auto;
    width: min(100%, 30rem);
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 28px;
    background:
      linear-gradient(135deg, rgba(255, 157, 30, 0.16), rgba(52, 141, 255, 0.12)),
      rgba(14, 16, 21, 0.92);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(18px);
  }

  .site-menu-brand {
    justify-content: flex-start;
    gap: 0.75rem;
  }

  .site-menu-brand-icon {
    width: 60px;
    height: 60px;
  }

  .site-menu-brand-copy .micro-label {
    display: none;
  }

  .site-menu-brand-copy strong {
    font-size: clamp(1.55rem, 6vw, 2rem);
    background: linear-gradient(90deg, #ff8a2b 0%, #f0a14f 38%, #4f96ff 73%, #2d78ef 100%);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
  }

  .site-menu-desktop {
    display: none;
  }

  .site-menu-mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.4rem;
    height: 3.4rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    transition:
      transform 160ms ease,
      background 160ms ease,
      border-color 160ms ease;
  }

  .site-menu-mobile-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
  }

  .site-menu-mobile-toggle-icon {
    display: grid;
    gap: 0.34rem;
    width: 1.6rem;
  }

  .site-menu-mobile-toggle-icon span {
    display: block;
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    transform-origin: center;
    transition:
      transform 180ms ease,
      opacity 180ms ease;
  }

  .site-menu-main.is-mobile-open .site-menu-mobile-toggle {
    border-color: rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
  }

  .site-menu-main.is-mobile-open .site-menu-mobile-toggle-icon span:nth-child(1) {
    transform: translateY(0.46rem) rotate(45deg);
  }

  .site-menu-main.is-mobile-open .site-menu-mobile-toggle-icon span:nth-child(2) {
    opacity: 0;
  }

  .site-menu-main.is-mobile-open .site-menu-mobile-toggle-icon span:nth-child(3) {
    transform: translateY(-0.46rem) rotate(-45deg);
  }

  .site-menu-mobile-panel {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    right: 0;
    z-index: 3;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 26px;
    background:
      linear-gradient(135deg, rgba(255, 157, 30, 0.12), rgba(52, 141, 255, 0.1)),
      rgba(14, 16, 21, 0.96);
    box-shadow: var(--shadow);
  }

  .site-menu-main.is-mobile-open .site-menu-mobile-panel {
    display: grid;
    gap: 1rem;
  }

  .site-menu-mobile-links {
    gap: 0.55rem;
  }

  .site-menu-mobile-links .site-menu-link {
    width: 100%;
    justify-content: flex-start;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
  }

  .site-menu-mobile-account {
    display: grid;
    gap: 0.8rem;
    padding-top: 0.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .site-menu-mobile-account .micro-label {
    margin-bottom: 0;
  }

  .site-menu-mobile-account-actions,
  .site-menu-mobile-account-panel {
    gap: 0.75rem;
  }

  .site-menu-mobile-account .button {
    width: 100%;
  }

  .site-menu-mobile-user {
    text-align: left;
  }

  .auth-modal-card {
    padding: 1rem;
  }

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

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

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

  .cube-result-overview,
  .cube-result-player-grid {
    grid-template-columns: 1fr;
  }

  .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;
    border-radius: 18px;
    gap: 0.2rem;
  }

  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 span {
    display: none;
  }

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

  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-top-offset: var(--safe-top);
  background: var(--site-gradient);
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  .phase-body {
    --phase-top-offset: max(var(--safe-top), 1.15rem);
  }
}

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

@media (max-width: 900px) {
  .phase-body .phase-shell {
    width: 100%;
    padding:
      calc(var(--phase-top-offset) + 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(--phase-top-offset) + 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;
  }
}

@media (max-width: 900px) {
  body[data-page="chrono"].phase-body {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
  }

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

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

  body[data-page="chrono"] .brand-link-logo {
    justify-self: start;
  }

  body[data-page="chrono"] .utility-button {
    justify-self: end;
  }

  body[data-page="chrono"] .phase-shell {
    min-height: var(--app-page-height, 100svh);
    height: auto;
    max-height: none;
    gap: 0.35rem;
    padding:
      calc(var(--phase-top-offset) + 0.55rem)
      calc(var(--safe-right) + 0.5rem)
      calc(var(--safe-bottom) + 0.55rem)
      calc(var(--safe-left) + 0.5rem);
  }

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

  body[data-page="chrono"] .status-card {
    min-height: 3.35rem;
    padding: 0.35rem 0.25rem;
    border-radius: 18px;
  }

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

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

  body[data-page="chrono"] .faceoff-board {
    height: auto;
    min-height: 0;
    align-self: stretch;
    gap: 0.35rem;
  }

  body[data-page="chrono"] .player-zone {
    display: flex;
    min-height: 0;
  }

  body[data-page="chrono"] .zone-inner {
    flex: 1 1 auto;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    height: auto;
    padding: 0.5rem;
    gap: 0.4rem;
    border-radius: 20px;
  }

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

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

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

  body[data-page="chrono"] .seat-tag {
    padding: 0.22rem 0.55rem;
    font-size: 0.62rem;
  }

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

  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.9rem;
    padding: 0.7rem;
    border-radius: 18px;
    font-size: 0.96rem;
  }
}

@supports (-webkit-touch-callout: none) {
  @media (max-width: 900px) {
    body[data-page="chrono"] .phase-shell {
      min-height: var(--app-page-height, -webkit-fill-available);
      height: auto;
      max-height: none;
    }
  }
}

@media (max-width: 420px) {
  body[data-page="chrono"] .phase-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body[data-page="chrono"] .brand-link-logo {
    justify-self: start;
  }

  body[data-page="chrono"] .utility-button {
    justify-self: end;
  }
}

/* Let chrono and cube scroll naturally on iPhone while still filling the viewport. */
body[data-page="chrono"].phase-body,
body[data-page="cube"].phase-body {
  position: static;
  inset: auto;
  width: auto;
  min-height: var(--app-page-height, 100dvh);
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
}

body[data-page="chrono"] .chrono-stage,
body[data-page="cube"] .cube-shell {
  position: relative;
  inset: auto;
  width: min(1400px, 100%);
  min-width: 0;
  margin: 0 auto;
  min-height: var(--app-page-height, 100dvh);
  height: auto;
  max-height: none;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0.55rem;
  padding:
    calc(var(--phase-top-offset) + 0.55rem)
    calc(var(--safe-right) + 0.5rem)
    calc(var(--safe-bottom) + 0.55rem)
    calc(var(--safe-left) + 0.5rem);
  overflow: visible;
}

body[data-page="chrono"] .faceoff-board,
body[data-page="cube"] .faceoff-board {
  min-height: 0;
  height: auto;
  align-self: stretch;
}

body[data-page="chrono"] .status-strip {
  flex: 0 0 auto;
}

body[data-page="chrono"] .player-zone,
body[data-page="chrono"] .phase-spine {
  min-height: 0;
  display: flex;
}

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

body[data-page="chrono"] .zone-button {
  min-height: 0;
  height: auto;
  flex: 1 1 auto;
}

body[data-page="chrono"] .phase-spine {
  align-items: stretch;
}

body[data-page="chrono"] .spine-button {
  width: 100%;
}

@media (max-width: 900px) {
  body[data-page="chrono"] .chrono-stage,
  body[data-page="cube"] .cube-shell {
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 0.35rem;
    padding:
      calc(var(--phase-top-offset) + 0.45rem)
      calc(var(--safe-right) + 0.45rem)
      calc(var(--safe-bottom) + 0.45rem)
      calc(var(--safe-left) + 0.45rem);
  }

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

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

  body[data-page="chrono"] .brand-link-logo,
  body[data-page="cube"] .brand-link-logo {
    justify-self: start;
  }

  body[data-page="chrono"] .utility-button,
  body[data-page="cube"] .utility-button {
    justify-self: end;
  }

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

  body[data-page="chrono"] .status-card,
  body[data-page="cube"] .status-card {
    min-height: 3rem;
    padding: 0.3rem 0.2rem;
    border-radius: 18px;
  }

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

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

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

  body[data-page="chrono"] .phase-spine,
  body[data-page="cube"] .phase-spine {
    display: block;
  }

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

  body[data-page="chrono"] .zone-inner,
  body[data-page="cube"] .zone-inner {
    padding: 0.5rem;
    gap: 0.4rem;
    border-radius: 20px;
  }

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

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

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

  body[data-page="chrono"] .seat-tag,
  body[data-page="cube"] .seat-tag {
    padding: 0.22rem 0.55rem;
    font-size: 0.62rem;
  }

  body[data-page="chrono"] .zone-button,
  body[data-page="cube"] .zone-button {
    padding: 0.75rem;
    border-radius: 22px;
    font-size: clamp(1.22rem, 7vw, 1.75rem);
  }

  body[data-page="chrono"] .spine-button,
  body[data-page="cube"] .spine-button {
    min-height: 2.7rem;
    padding: 0.6rem;
    border-radius: 18px;
    font-size: 0.9rem;
  }
}

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

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

body[data-page="chrono"] .has-player-clock .zone-stats {
  gap: 0.45rem;
}

body[data-page="chrono"] .has-player-clock .zone-stats strong {
  color: var(--muted);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
}

body[data-page="chrono"] .player-clock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  min-width: min(100%, 10ch);
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--panel-border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: clamp(1.3rem, 3.6vw, 2.35rem);
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

body[data-page="chrono"] #whiteClockChrono.player-clock {
  color: var(--white-seat);
  background: rgba(255, 177, 58, 0.12);
  border-color: rgba(255, 177, 58, 0.28);
}

body[data-page="chrono"] #blackClockChrono.player-clock {
  color: var(--dark-seat);
  background: rgba(23, 98, 255, 0.12);
  border-color: rgba(23, 98, 255, 0.28);
}

body[data-page="chrono"] .player-clock.active-clock {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 24px rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

body[data-page="chrono"] .player-clock.negative-clock {
  color: #ffd6dc;
  background: rgba(255, 100, 127, 0.16);
  border-color: rgba(255, 100, 127, 0.34);
}

@media (max-width: 900px) {
  body[data-page="chrono"] .player-clock {
    min-width: 7.7ch;
    padding: 0.45rem 0.68rem;
    font-size: clamp(1.05rem, 5.8vw, 1.7rem);
  }
}
