:root {
  --bg: #120f0a;
  --bg-deep: #0a0907;
  --bg-soft: #1b1610;
  --panel: rgba(30, 23, 15, 0.82);
  --panel-strong: rgba(38, 29, 20, 0.94);
  --panel-soft: rgba(255, 248, 234, 0.045);
  --line: rgba(234, 199, 133, 0.18);
  --line-strong: rgba(234, 199, 133, 0.36);
  --text: #f8f0e2;
  --text-strong: #fff8ec;
  --muted: #baa98d;
  --muted-strong: #d5c1a0;
  --sand: #e8c889;
  --amber: #d98f49;
  --copper: #bb6236;
  --teal: #79cad0;
  --teal-soft: #addfe2;
  --sage: #abc78f;
  --danger: #f26b5b;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --radius-xl: 36px;
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 16px;
  --font-display: "Bahnschrift SemiCondensed", "Aptos Display", "Franklin Gothic Medium", sans-serif;
  --font-body: "Aptos", "Candara", "Trebuchet MS", sans-serif;
  --font-mono: "Consolas", "Cascadia Mono", monospace;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  position: relative;
  overflow-x: hidden;
}

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

body::before {
  background:
    linear-gradient(130deg, rgba(255, 244, 220, 0.02), transparent 28%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 248, 235, 0.02) 0,
      rgba(255, 248, 235, 0.02) 1px,
      transparent 1px,
      transparent 52px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 248, 235, 0.015) 0,
      rgba(255, 248, 235, 0.015) 1px,
      transparent 1px,
      transparent 52px
    );
  mask-image: radial-gradient(circle at center, black 24%, transparent 86%);
  opacity: 0.55;
  z-index: -2;
}

body::after {
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.06), transparent 26%),
    linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
  z-index: -1;
}

.backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 12% 12%, rgba(232, 200, 137, 0.22), transparent 26%),
    radial-gradient(circle at 86% 10%, rgba(121, 202, 208, 0.18), transparent 26%),
    radial-gradient(circle at 55% 72%, rgba(171, 199, 143, 0.14), transparent 28%),
    linear-gradient(180deg, #2a2118 0%, #15110c 34%, #0a0907 100%);
  z-index: -3;
}

body[data-app-mode="gm"] .backdrop {
  background:
    radial-gradient(circle at 14% 10%, rgba(121, 202, 208, 0.18), transparent 24%),
    radial-gradient(circle at 84% 16%, rgba(171, 199, 143, 0.12), transparent 26%),
    radial-gradient(circle at 52% 76%, rgba(87, 141, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #161f24 0%, #0f1518 38%, #090b0d 100%);
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.shell {
  width: min(1380px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.masthead,
.hero-copy,
.hero-preview,
.hero-sidecard,
.play-stage,
.panel,
.rule-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(54, 40, 28, 0.82), rgba(20, 15, 10, 0.92)),
    linear-gradient(135deg, rgba(255, 250, 240, 0.03), transparent 40%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

body[data-app-mode="gm"] .masthead,
body[data-app-mode="gm"] .hero-copy,
body[data-app-mode="gm"] .hero-preview,
body[data-app-mode="gm"] .hero-sidecard,
body[data-app-mode="gm"] .play-stage,
body[data-app-mode="gm"] .panel,
body[data-app-mode="gm"] .rule-card {
  border-color: rgba(121, 202, 208, 0.18);
  background:
    linear-gradient(180deg, rgba(24, 34, 40, 0.9), rgba(11, 16, 20, 0.96)),
    linear-gradient(135deg, rgba(217, 251, 255, 0.035), transparent 44%);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(121, 202, 208, 0.03);
}

.masthead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  border-radius: 999px;
  margin-bottom: 24px;
  animation: rise-in 700ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

body[data-app-mode="gm"] .masthead {
  border-radius: 32px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: visible;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transform: scale(1.18);
  transform-origin: center;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.26));
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.masthead-maze {
  display: none;
  min-width: 0;
  align-content: center;
}

.maze-lockup {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  min-width: 0;
}

.masthead-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.035);
  color: var(--muted-strong);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.masthead-status.is-lobby,
.masthead-status.is-neutral {
  border-color: rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.035);
  color: var(--muted-strong);
}

.masthead-status.is-draft {
  border-color: rgba(232, 200, 137, 0.2);
  background: rgba(232, 200, 137, 0.08);
  color: #f7ddb0;
}

.masthead-status.is-live {
  border-color: rgba(121, 202, 208, 0.24);
  background: rgba(121, 202, 208, 0.1);
  color: #d9fbff;
}

.masthead-status.is-danger,
.masthead-status.is-finished {
  border-color: rgba(242, 107, 91, 0.22);
  background: rgba(242, 107, 91, 0.1);
  color: #ffd2cb;
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-strong);
}

.masthead-meta,
.masthead-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.page-link {
  white-space: nowrap;
}

body:not(.in-room) .masthead-maze,
body:not(.in-room) #leave-button,
body:not(.in-room) #start-button {
  display: none !important;
}

body.in-room .masthead-maze {
  display: grid;
}

body.in-room .portal-only {
  display: none !important;
}

.meta-pill {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.04);
  color: var(--muted-strong);
  font-size: 0.83rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-app-mode="gm"] .meta-pill {
  border-color: rgba(121, 202, 208, 0.16);
  background: rgba(121, 202, 208, 0.08);
  color: #d8fbff;
}

.portal {
  display: grid;
  gap: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(320px, 0.92fr);
  gap: 24px;
  align-items: stretch;
}

.hero.is-compact {
  grid-template-columns: minmax(0, 1.18fr) minmax(320px, 0.82fr);
  gap: 18px;
}

.hero-player-portal {
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.98fr);
  gap: 18px;
}

.hero-copy,
.hero-preview,
.hero-sidecard,
.play-stage,
.panel,
.rule-card {
  position: relative;
  overflow: hidden;
}

.hero-copy {
  padding: 40px;
  border-radius: var(--radius-xl);
  animation: rise-in 820ms cubic-bezier(0.2, 0.9, 0.2, 1) 70ms both;
}

.hero.is-compact .hero-copy,
.play-stage.is-compact {
  padding: 30px;
}

.hero-player-portal .hero-copy,
.hero-player-portal .hero-sidecard {
  min-height: 0;
}

.player-hero-copy {
  display: grid;
  gap: 24px;
  align-content: start;
}

.player-hero-copy::after {
  inset: auto -12% -22% 18%;
  height: 180px;
  background: radial-gradient(circle, rgba(121, 202, 208, 0.12), transparent 66%);
}

.hero-copy::before,
.play-stage::before,
.form-panel::before,
.room-bar::before,
.board-panel::before,
.side-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--sand), var(--teal), transparent 92%);
}

body[data-app-mode="gm"] .hero-copy::before,
body[data-app-mode="gm"] .play-stage::before,
body[data-app-mode="gm"] .form-panel::before,
body[data-app-mode="gm"] .room-bar::before,
body[data-app-mode="gm"] .board-panel::before,
body[data-app-mode="gm"] .side-panel::before {
  background: linear-gradient(90deg, #8fe4ef, #8dbdff, transparent 92%);
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -12% -18% 26%;
  height: 220px;
  background: radial-gradient(circle, rgba(121, 202, 208, 0.16), transparent 66%);
  filter: blur(12px);
}

.eyebrow,
.card-kicker {
  margin: 0 0 12px;
  font-size: 0.76rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--sand);
}

body[data-app-mode="gm"] .eyebrow,
body[data-app-mode="gm"] .card-kicker {
  color: #a9edf2;
}

.hero h1,
.hero-sidecard h2,
.section-heading h2,
.panel h2,
.panel h3,
.rule-card h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  color: var(--text-strong);
}

.hero h1 {
  max-width: 11ch;
  font-size: clamp(2.4rem, 4vw, 4.1rem);
  line-height: 0.98;
}

.hero.is-compact h1 {
  max-width: 13ch;
  font-size: clamp(2.1rem, 3.3vw, 3.35rem);
  line-height: 1;
}

.hero-player-portal h1 {
  max-width: 10.5ch;
  font-size: clamp(1.95rem, 3vw, 2.95rem);
  line-height: 0.96;
}

.portal-head {
  display: grid;
  gap: 12px;
  max-width: 40rem;
}

.player-hero-copy .hero-text {
  max-width: 42ch;
  margin-top: 0;
  font-size: 0.98rem;
}

.hero-mantra {
  margin: 2px 0 0;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-text,
.section-heading p,
.panel-copy,
.panel-footnote,
.hero-sidecard p,
.rule-card p,
.board-caption,
.rules-copy p,
.event-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.hero-text {
  max-width: 58ch;
  margin-top: 16px;
  font-size: 0.98rem;
}

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

.hero.is-compact .hero-actions {
  margin-top: 22px;
}

.hero-note {
  max-width: 30ch;
  font-size: 0.97rem;
  color: var(--muted-strong);
}

.hero-player-portal .hero-actions {
  margin-top: 0;
  align-items: flex-start;
}

.hero-player-portal .hero-note {
  max-width: 34ch;
}

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

.portal-step,
.banner-note {
  border-radius: 20px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 248, 235, 0.045), rgba(255, 248, 235, 0.02)),
    rgba(255, 248, 235, 0.025);
}

.portal-step {
  display: grid;
  gap: 8px;
  padding: 16px 16px 15px;
}

.portal-step span {
  color: var(--sand);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.portal-step strong {
  color: var(--text-strong);
  font-size: 1rem;
  line-height: 1.1;
}

.portal-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.hero-statline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-statline span {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 248, 235, 0.08), rgba(255, 248, 235, 0.03)),
    rgba(255, 248, 235, 0.035);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  font-size: 0.86rem;
  letter-spacing: 0.03em;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.stat-card {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 24px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 248, 235, 0.07), rgba(255, 248, 235, 0.025)),
    rgba(255, 248, 235, 0.025);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(232, 200, 137, 0.85), rgba(121, 202, 208, 0.7), transparent 92%);
}

.stat-card span,
.preview-step span,
.metric span,
.field span,
.runner-meta,
.event-item time,
.event-detail,
.editor-check span,
.editor-checkline {
  color: var(--muted);
}

.stat-card span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.16rem;
  color: var(--text-strong);
  line-height: 1.1;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-visual {
  display: grid;
  gap: 18px;
  animation: rise-in 860ms cubic-bezier(0.2, 0.9, 0.2, 1) 140ms both;
}

.hero-preview,
.hero-sidecard {
  border-radius: 32px;
  padding: 26px;
}

.hero-preview {
  position: relative;
}

.hero-preview::after {
  content: "";
  position: absolute;
  inset: auto 14% -32px 14%;
  height: 120px;
  background: radial-gradient(circle, rgba(121, 202, 208, 0.14), transparent 70%);
  filter: blur(12px);
  pointer-events: none;
}

.preview-header {
  display: grid;
  gap: 8px;
}

.preview-header .panel-copy {
  max-width: 34ch;
}

.preview-header strong {
  display: block;
  font-size: 1.18rem;
  color: var(--text-strong);
}

.preview-frame {
  position: relative;
  aspect-ratio: 1;
  margin: 22px 0 20px;
  border-radius: 30px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background:
    radial-gradient(circle at center, rgba(121, 202, 208, 0.08), transparent 45%),
    linear-gradient(180deg, rgba(17, 15, 11, 0.94), rgba(8, 8, 7, 0.94));
}

.preview-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.75;
}

.preview-ring,
.preview-route,
.preview-token,
.preview-diamond,
.preview-purge {
  position: absolute;
}

.preview-ring {
  border: 1px solid rgba(232, 200, 137, 0.34);
  border-radius: 22px;
}

.ring-one {
  inset: 9%;
}

.ring-two {
  inset: 21%;
  border-color: rgba(121, 202, 208, 0.3);
}

.ring-three {
  inset: 33%;
  border-color: rgba(171, 199, 143, 0.3);
}

.ring-four {
  inset: 45%;
  border-color: rgba(232, 200, 137, 0.36);
}

.preview-route {
  background: linear-gradient(180deg, rgba(121, 202, 208, 0.1), rgba(121, 202, 208, 0.64));
  box-shadow: 0 0 18px rgba(121, 202, 208, 0.22);
}

.route-one {
  top: 14%;
  bottom: 46%;
  left: calc(50% - 3px);
  width: 6px;
  border-radius: 999px;
}

.route-two {
  left: 24%;
  right: 50%;
  top: calc(50% - 3px);
  height: 6px;
  border-radius: 999px;
}

.preview-token {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  color: #1b140d;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.82);
}

.token-one {
  left: calc(50% - 21px);
  top: 16%;
  background: var(--sand);
}

.token-two {
  right: 18%;
  bottom: 24%;
  background: var(--teal);
}

.preview-diamond {
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  border-radius: 3px;
  box-shadow: 0 0 18px currentColor;
}

.diamond-one {
  top: 30%;
  right: 24%;
  color: var(--sand);
  background: currentColor;
}

.diamond-two {
  left: 26%;
  bottom: 21%;
  color: var(--sage);
  background: currentColor;
}

.preview-purge {
  inset: 6%;
  border: 10px solid rgba(242, 107, 91, 0.22);
  border-radius: 28px;
}

.preview-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compact-steps {
  grid-template-columns: 1fr;
}

.compact-steps .preview-step {
  padding: 12px 14px;
}

.preview-step {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.03);
}

.preview-step span {
  display: inline-block;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.preview-step p {
  margin: 0;
  color: var(--muted-strong);
  line-height: 1.5;
}

.hero-sidecard h2 {
  margin-bottom: 12px;
  font-size: 1.55rem;
  line-height: 1.08;
}

.banner-sidecard {
  display: grid;
  gap: 18px;
  align-content: start;
}

.banner-sidecard-copy {
  display: grid;
  gap: 10px;
}

.banner-sidecard-copy p:last-child {
  margin: 0;
}

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

.banner-item {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 13px;
  border-radius: 18px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 248, 235, 0.045), rgba(255, 248, 235, 0.02)),
    rgba(255, 248, 235, 0.02);
}

.banner-item.is-east {
  border-color: rgba(96, 214, 255, 0.2);
  background:
    linear-gradient(135deg, rgba(72, 195, 255, 0.12), transparent 62%),
    rgba(255, 248, 235, 0.02);
}

.banner-item.is-west {
  border-color: rgba(245, 238, 214, 0.18);
  background:
    linear-gradient(135deg, rgba(237, 233, 218, 0.1), transparent 62%),
    rgba(255, 248, 235, 0.02);
}

.banner-item.is-south {
  border-color: rgba(255, 119, 92, 0.2);
  background:
    linear-gradient(135deg, rgba(255, 103, 76, 0.12), transparent 62%),
    rgba(255, 248, 235, 0.02);
}

.banner-item.is-north {
  border-color: rgba(184, 255, 240, 0.18);
  background:
    linear-gradient(135deg, rgba(154, 255, 239, 0.1), transparent 62%),
    rgba(255, 248, 235, 0.02);
}

.banner-icon {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.06);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.18),
    0 0 0 1px rgba(255, 248, 235, 0.04);
}

.banner-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.banner-meta strong {
  color: var(--text-strong);
  font-size: 0.98rem;
}

.banner-meta span {
  color: var(--muted);
  font-size: 0.83rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.banner-sidecard-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.banner-note {
  padding: 14px;
  display: grid;
  gap: 6px;
}

.banner-note strong {
  color: var(--text-strong);
  font-size: 0.95rem;
}

.banner-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.status-banner {
  margin-bottom: 18px;
  padding: 15px 18px;
  border-radius: 18px;
  border: 1px solid rgba(242, 107, 91, 0.32);
  background: rgba(242, 107, 91, 0.12);
  color: #ffe2dd;
}

.announcement-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 7, 5, 0.62);
  backdrop-filter: blur(12px);
}

.announcement-card {
  width: min(520px, 100%);
  padding: 28px;
  border-radius: 28px;
  border: 1px solid rgba(234, 199, 133, 0.24);
  background:
    linear-gradient(180deg, rgba(54, 40, 28, 0.94), rgba(20, 15, 10, 0.97)),
    linear-gradient(135deg, rgba(255, 250, 240, 0.04), transparent 42%);
  box-shadow:
    0 36px 96px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 248, 235, 0.04);
  display: grid;
  gap: 14px;
  text-align: center;
  animation: rise-in 220ms ease both;
}

.announcement-card h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
}

.announcement-copy {
  margin: 0;
  color: var(--muted-strong);
  font-size: 1.02rem;
  line-height: 1.6;
}

.announcement-card .action-button {
  justify-self: center;
  min-width: 160px;
}

.play-stage {
  padding: 28px;
  border-radius: var(--radius-xl);
  scroll-margin-top: 24px;
  animation: rise-in 900ms cubic-bezier(0.2, 0.9, 0.2, 1) 200ms both;
}

.play-stage.is-compact .section-heading {
  margin-bottom: 18px;
}

.play-stage.is-compact .section-heading h2 {
  font-size: clamp(1.9rem, 3vw, 2.7rem);
}

.play-stage::after {
  content: "";
  position: absolute;
  inset: auto -10% -32% 40%;
  height: 220px;
  background: radial-gradient(circle, rgba(232, 200, 137, 0.15), transparent 68%);
  filter: blur(20px);
}

.section-heading {
  display: grid;
  gap: 8px;
  max-width: 52rem;
  margin-bottom: 24px;
}

.section-heading h2 {
  font-size: clamp(1.7rem, 2.8vw, 2.5rem);
  line-height: 1.02;
}

.play-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.05fr 0.9fr;
  gap: 18px;
}

.play-grid > *:nth-child(1) {
  animation: rise-in 820ms cubic-bezier(0.2, 0.9, 0.2, 1) 220ms both;
}

.play-grid > *:nth-child(2) {
  animation: rise-in 820ms cubic-bezier(0.2, 0.9, 0.2, 1) 300ms both;
}

.play-grid > *:nth-child(3) {
  animation: rise-in 820ms cubic-bezier(0.2, 0.9, 0.2, 1) 380ms both;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.form-panel {
  --stage-color: var(--sand);
  min-height: 100%;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.host-stage {
  --stage-color: var(--amber);
}

.join-stage {
  --stage-color: var(--teal);
}

.sim-stage {
  --stage-color: var(--sage);
}

.form-panel::before {
  background: linear-gradient(90deg, var(--stage-color), transparent 84%);
}

.stage-glow {
  position: absolute;
  top: -60px;
  right: -10px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  filter: blur(12px);
  opacity: 0.9;
  pointer-events: none;
}

.host-stage .stage-glow {
  background: radial-gradient(circle, rgba(217, 143, 73, 0.22), transparent 68%);
}

.join-stage .stage-glow {
  background: radial-gradient(circle, rgba(121, 202, 208, 0.22), transparent 68%);
}

.sim-stage .stage-glow {
  background: radial-gradient(circle, rgba(171, 199, 143, 0.22), transparent 68%);
}

.panel-heading {
  position: relative;
  z-index: 1;
  margin-bottom: 12px;
}

.panel-heading h2 {
  font-size: 1.7rem;
  line-height: 1.08;
}

.panel-copy {
  margin-bottom: 18px;
}

.panel-footnote {
  margin: auto 0 18px;
  color: var(--muted-strong);
  font-size: 0.95rem;
}

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

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.compact-field {
  margin-bottom: 0;
}

.field span {
  font-size: 0.95rem;
}

.field input,
.field select,
.editor-notes,
.action-button,
.ghost-button {
  border-radius: 16px;
  font: inherit;
}

.field input,
.field select,
.editor-notes {
  width: 100%;
  border: 1px solid rgba(255, 248, 235, 0.12);
  padding: 15px 16px;
  background: rgba(255, 248, 235, 0.04);
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field input::placeholder,
.editor-notes::placeholder {
  color: rgba(216, 198, 172, 0.65);
}

.field select,
.field select option,
.field select optgroup {
  background-color: #241b13;
  color: var(--text);
}

.field input:focus,
.field select:focus,
.editor-notes:focus {
  border-color: rgba(121, 202, 208, 0.62);
  box-shadow: 0 0 0 4px rgba(121, 202, 208, 0.12);
  background: rgba(255, 248, 235, 0.06);
}

.simulation-hint {
  margin: 0 0 18px;
  min-height: 5.1em;
  color: var(--muted);
  line-height: 1.6;
}

.action-button,
.ghost-button,
.hero-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.action-button {
  padding: 15px 18px;
  background: linear-gradient(135deg, var(--sand), #f2dbab 45%, var(--teal) 100%);
  color: #20160e;
  font-weight: 800;
  box-shadow: 0 18px 36px rgba(232, 200, 137, 0.2);
}

.action-button.secondary {
  background: linear-gradient(135deg, var(--teal), var(--teal-soft) 48%, var(--sage) 100%);
}

.action-button:disabled,
.ghost-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ghost-button {
  padding: 12px 16px;
  background: rgba(255, 248, 235, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 248, 235, 0.12);
}

body[data-app-mode="gm"] .ghost-button {
  background: rgba(217, 251, 255, 0.04);
  border-color: rgba(121, 202, 208, 0.16);
}

.action-button:hover:not(:disabled),
.ghost-button:hover:not(:disabled),
.hero-link:hover {
  transform: translateY(-1px);
}

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

.rule-card {
  padding: 24px;
  border-radius: 30px;
  animation: rise-in 940ms cubic-bezier(0.2, 0.9, 0.2, 1) 260ms both;
}

.rule-card h3 {
  margin-bottom: 10px;
  font-size: 1.5rem;
  line-height: 1.08;
}

.app {
  display: grid;
  gap: 22px;
}

.room-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  animation: rise-in 700ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.room-meta {
  min-width: 0;
}

.room-code-wrap {
  display: grid;
  gap: 6px;
}

#room-code {
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  letter-spacing: 0.11em;
  color: var(--text-strong);
}

#phase-copy {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.room-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.arena {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 380px);
  gap: 20px;
  align-items: start;
}

.board-panel {
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
  animation: rise-in 760ms cubic-bezier(0.2, 0.9, 0.2, 1) 60ms both;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-bottom: 12px;
}

.board-header h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

#purge-timer {
  color: var(--text-strong);
}

.board-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.metric {
  min-width: 130px;
  padding: 13px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.035);
}

.metric.emphasis {
  border-color: rgba(121, 202, 208, 0.24);
  background: rgba(121, 202, 208, 0.08);
  box-shadow: 0 10px 24px rgba(121, 202, 208, 0.08);
}

.metric span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric strong {
  font-size: 1.04rem;
  color: var(--text-strong);
}

#turn-status {
  font-size: 1.08rem;
}

.layer-strip {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.layer-chip {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  text-align: center;
  background: rgba(255, 248, 235, 0.04);
  overflow: hidden;
  isolation: isolate;
}

.layer-chip > * {
  position: relative;
  z-index: 1;
}

.layer-chip::before,
.layer-chip::after {
  content: "";
  position: absolute;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.layer-chip::before {
  left: 8px;
}

.layer-chip::after {
  right: 8px;
}

.layer-chip span {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(248, 240, 226, 0.78);
}

.layer-chip strong {
  font-size: 0.95rem;
  color: var(--text-strong);
}

.layer-chip em {
  font-style: normal;
  font-size: 0.75rem;
  color: rgba(248, 240, 226, 0.62);
}

.layer-chip.is-current {
  transform: translateY(-1px);
  border-color: rgba(232, 200, 137, 0.46);
  box-shadow: 0 12px 24px rgba(232, 200, 137, 0.16);
}

.layer-chip.is-warning {
  box-shadow:
    0 12px 24px rgba(232, 166, 76, 0.18),
    0 0 0 1px rgba(255, 195, 102, 0.14);
}

.layer-chip.is-warning::before,
.layer-chip.is-warning::after {
  opacity: 1;
  background: radial-gradient(circle, rgba(255, 247, 188, 0.96) 0 28%, rgba(255, 180, 74, 0.92) 42%, rgba(255, 120, 34, 0.22) 76%, transparent 78%);
  box-shadow:
    0 0 6px rgba(255, 199, 86, 0.76),
    0 0 16px rgba(255, 140, 60, 0.36);
  animation: purge-warning-blink 1.15s steps(2, end) infinite;
}

.layer-chip.is-critical {
  border-color: rgba(255, 119, 84, 0.56) !important;
  box-shadow:
    0 12px 28px rgba(226, 73, 73, 0.24),
    0 0 0 1px rgba(255, 119, 84, 0.18);
}

.layer-chip.is-critical::before,
.layer-chip.is-critical::after {
  opacity: 1;
  background: radial-gradient(circle, rgba(255, 234, 225, 0.98) 0 24%, rgba(255, 105, 92, 0.94) 42%, rgba(171, 22, 22, 0.28) 76%, transparent 78%);
  box-shadow:
    0 0 8px rgba(255, 122, 92, 0.88),
    0 0 18px rgba(203, 25, 25, 0.42);
  animation: purge-critical-blink 0.72s steps(2, end) infinite;
}

.layer-chip.is-purged {
  opacity: 0.34;
  filter: grayscale(0.25);
}

@keyframes purge-warning-blink {
  0%,
  100% {
    opacity: 0.28;
  }

  50% {
    opacity: 1;
  }
}

@keyframes purge-critical-blink {
  0%,
  100% {
    opacity: 0.2;
  }

  50% {
    opacity: 1;
  }
}

#maze-svg {
  width: 100%;
  height: auto;
  max-width: 100%;
  width: 100%;
  aspect-ratio: 1;
  display: block;
  touch-action: manipulation;
}

.board-canvas {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background:
    radial-gradient(circle at center, rgba(121, 202, 208, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(22, 18, 13, 0.98), rgba(8, 8, 7, 0.98));
  padding: 12px;
}

.board-caption {
  padding: 14px 6px 0;
  font-size: 0.96rem;
}

.board-caption.is-alert {
  color: #ff978b;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(242, 107, 91, 0.18);
  animation: alert-blink 1s steps(2, end) infinite;
}

.sidebar {
  display: grid;
  gap: 16px;
  min-height: 0;
}

.player-crest {
  display: none;
}

.player-crest-logo {
  width: 100%;
  height: auto;
  display: block;
}

.side-panel {
  display: grid;
  gap: 14px;
  min-height: 0;
  animation: rise-in 760ms cubic-bezier(0.2, 0.9, 0.2, 1) 120ms both;
}

.side-heading {
  display: grid;
  gap: 3px;
}

.scoreboard,
.event-log {
  display: grid;
  gap: 10px;
  min-height: 0;
}

.standings-panel,
.feed-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.score-row,
.event-item {
  border-radius: 18px;
  padding: 13px 14px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.04);
}

.score-row {
  position: relative;
  display: grid;
  gap: 7px;
  overflow: hidden;
}

.score-row > * {
  position: relative;
  z-index: 1;
}

.score-row.has-seal {
  min-height: 112px;
  padding-right: 126px;
}

.score-row.is-current-turn {
  border-color: rgba(121, 202, 208, 0.3);
  background: rgba(121, 202, 208, 0.08);
  box-shadow: 0 10px 24px rgba(121, 202, 208, 0.08);
}

.score-row.is-winner {
  border-color: rgba(175, 255, 245, 0.34);
  background:
    linear-gradient(180deg, rgba(10, 28, 30, 0.96), rgba(17, 24, 31, 0.98) 52%, rgba(39, 30, 15, 0.98) 100%),
    linear-gradient(135deg, rgba(224, 255, 255, 0.08), transparent 42%);
  box-shadow:
    0 18px 36px rgba(0, 32, 32, 0.26),
    0 0 0 1px rgba(224, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 248, 235, 0.08);
}

.score-row.is-winner::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 18%, rgba(192, 255, 255, 0.26) 0 26px, transparent 27px),
    radial-gradient(circle at 84% 18%, rgba(224, 255, 224, 0.18) 0 18px, transparent 19px),
    radial-gradient(circle at 54% -8%, rgba(255, 255, 160, 0.18) 0 34px, transparent 35px),
    linear-gradient(90deg, rgba(192, 255, 255, 0.1), rgba(255, 255, 192, 0.08) 48%, rgba(224, 255, 224, 0.08));
  pointer-events: none;
}

.score-row.is-winner::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, rgba(192, 255, 255, 0.9), rgba(255, 255, 160, 0.85), rgba(224, 255, 224, 0.9));
  box-shadow: 0 0 14px rgba(192, 255, 255, 0.22);
  pointer-events: none;
}

.score-row.is-out {
  border-color: rgba(166, 153, 153, 0.12);
  background:
    linear-gradient(180deg, rgba(60, 52, 49, 0.84), rgba(28, 24, 23, 0.96)),
    linear-gradient(135deg, rgba(255, 250, 240, 0.015), transparent 45%);
  box-shadow: inset 0 1px 0 rgba(255, 248, 235, 0.02);
  filter: grayscale(0.18) saturate(0.76);
}

.score-row.is-out::before,
.score-row.is-out::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.score-row.is-out::before {
  background:
    radial-gradient(circle at 1% 16%, rgba(177, 18, 18, 0.82) 0 13px, transparent 14px),
    radial-gradient(circle at 7% 11%, rgba(222, 48, 48, 0.56) 0 4px, transparent 5px),
    radial-gradient(circle at 10% 18%, rgba(165, 19, 19, 0.52) 0 6px, transparent 7px),
    radial-gradient(circle at 6% 28%, rgba(183, 29, 29, 0.36) 0 5px, transparent 6px),
    linear-gradient(102deg, rgba(136, 18, 18, 0.38) 0 8%, transparent 12%),
    linear-gradient(112deg, transparent 0 6%, rgba(78, 8, 8, 0.2) 10%, transparent 15%);
  opacity: 0.76;
}

.score-row.is-out::after {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.015), rgba(0, 0, 0, 0.14));
  opacity: 0.56;
}

.score-row.is-out .runner-chip,
.score-row.is-out strong {
  color: rgba(226, 218, 214, 0.86);
}

.score-row.is-winner .runner-chip,
.score-row.is-winner strong {
  color: #f7fff6;
  text-shadow: 0 0 12px rgba(192, 255, 255, 0.12);
}

.score-row.is-out .runner-meta,
.score-row.is-out .runner-intent {
  color: rgba(168, 158, 155, 0.92);
}

.score-row.is-winner .runner-meta,
.score-row.is-winner .runner-intent {
  color: rgba(223, 246, 233, 0.96);
}

.score-topline,
.event-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.runner-chip {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  color: var(--text-strong);
}

.runner-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 14px currentColor;
}

.runner-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid rgba(255, 248, 235, 0.28);
  box-shadow:
    0 0 0 1px rgba(255, 248, 235, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.22);
  background: rgba(255, 248, 235, 0.08);
}

.score-row.is-out .runner-avatar {
  filter: grayscale(1) saturate(0.18) brightness(0.86);
  border-color: rgba(201, 189, 186, 0.16);
  box-shadow:
    0 0 0 1px rgba(255, 248, 235, 0.03),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.score-row.is-winner .runner-avatar {
  border-color: rgba(192, 255, 255, 0.4);
  box-shadow:
    0 0 0 1px rgba(255, 248, 235, 0.08),
    0 0 12px rgba(192, 255, 255, 0.22),
    0 0 24px rgba(255, 255, 160, 0.18),
    0 10px 24px rgba(0, 0, 0, 0.24);
}

.runner-seal {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 102px;
  height: 102px;
  display: grid;
  place-items: center;
  pointer-events: none;
  transform: translateY(-50%);
  z-index: 2;
}

.runner-seal-banner {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 22%, rgba(255, 245, 183, 0.14), transparent 48%),
    linear-gradient(145deg, rgba(17, 24, 28, 0.84), rgba(12, 11, 17, 0.88));
  border: 1px solid rgba(255, 248, 235, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 28px rgba(0, 0, 0, 0.24);
}

.runner-seal-icon {
  width: 82%;
  height: 82%;
  object-fit: contain;
  display: block;
  opacity: 0.92;
  filter:
    saturate(1.04)
    brightness(1.02)
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.runner-seal-stamp {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: rotate(-12deg);
  backdrop-filter: blur(2px);
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 5px 12px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.runner-seal.is-victor .runner-seal-banner {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 238, 145, 0.34), transparent 44%),
    linear-gradient(140deg, rgba(39, 31, 10, 0.94), rgba(16, 47, 55, 0.9) 42%, rgba(64, 51, 14, 0.92));
  border-color: rgba(244, 212, 111, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(244, 212, 111, 0.1),
    0 0 20px rgba(255, 214, 102, 0.16),
    0 14px 30px rgba(0, 0, 0, 0.26);
}

.runner-seal.is-victor .runner-seal-icon {
  opacity: 1;
  filter:
    saturate(1.12)
    brightness(1.08)
    drop-shadow(0 0 10px rgba(187, 252, 255, 0.12))
    drop-shadow(0 0 18px rgba(255, 244, 169, 0.1));
}

.runner-seal.is-victor .runner-seal-stamp {
  color: #110d06;
  border: 1px solid rgba(255, 232, 156, 0.88);
  background:
    linear-gradient(
      160deg,
      rgba(255, 251, 226, 0.98) 0%,
      rgba(255, 234, 157, 0.96) 22%,
      rgba(241, 191, 72, 0.95) 46%,
      rgba(184, 126, 24, 0.96) 72%,
      rgba(118, 76, 10, 0.94) 100%
    );
  text-shadow: none;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.18),
    0 0 12px rgba(255, 214, 92, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    inset 0 -10px 16px rgba(92, 58, 7, 0.22),
    inset 0 0 0 1px rgba(255, 242, 188, 0.22);
}

.runner-seal.is-victor .runner-seal-stamp::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.08) 32%, transparent 42%),
    linear-gradient(105deg, transparent 0 18%, rgba(255, 249, 214, 0.48) 28%, transparent 42%);
  opacity: 0.92;
  z-index: -1;
}

.runner-seal.is-fallen .runner-seal-banner {
  background:
    linear-gradient(145deg, rgba(42, 34, 37, 0.88), rgba(20, 18, 22, 0.92));
  border-color: rgba(157, 60, 60, 0.2);
}

.runner-seal.is-fallen .runner-seal-icon {
  opacity: 0.56;
  filter:
    grayscale(1)
    saturate(0.22)
    brightness(0.84)
    drop-shadow(0 10px 18px rgba(0, 0, 0, 0.24));
}

.runner-seal.is-fallen .runner-seal-stamp {
  color: #ffd9d2;
  border: 1px solid rgba(178, 48, 48, 0.34);
  background:
    linear-gradient(135deg, rgba(179, 33, 33, 0.12), rgba(90, 13, 13, 0.14)),
    rgba(27, 8, 8, 0.36);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.32);
}

.runner-meta,
.event-item time {
  font-size: 0.88rem;
}

.runner-intent {
  margin-top: 4px;
  color: var(--muted-strong);
  font-size: 0.91rem;
  line-height: 1.5;
}

.event-item {
  display: grid;
  gap: 8px;
}

.event-item time {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.event-badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.05);
  color: rgba(248, 240, 226, 0.92);
}

.event-badge.is-diamond {
  border-color: rgba(232, 200, 137, 0.32);
  background: rgba(232, 200, 137, 0.1);
}

.event-badge.is-draft,
.event-badge.is-turn {
  border-color: rgba(121, 202, 208, 0.3);
  background: rgba(121, 202, 208, 0.1);
}

.event-badge.is-combat {
  border-color: rgba(242, 107, 91, 0.28);
  background: rgba(242, 107, 91, 0.12);
}

.event-badge.is-purge {
  border-color: rgba(217, 143, 73, 0.3);
  background: rgba(217, 143, 73, 0.12);
}

.event-badge.is-finish {
  border-color: rgba(121, 202, 208, 0.3);
  background: rgba(121, 202, 208, 0.12);
}

.event-detail {
  font-size: 0.86rem;
  line-height: 1.5;
}

.rules-copy {
  display: grid;
  gap: 10px;
}

.control-pad {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.control-pad.single-action {
  grid-template-columns: 1fr;
}

.control-key {
  min-height: 82px;
  border-radius: 18px;
  border: 1px solid rgba(255, 248, 235, 0.12);
  background: rgba(255, 248, 235, 0.04);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 4px;
  text-align: center;
  padding: 10px 8px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.control-key span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.control-key strong {
  font-size: 0.98rem;
}

.control-key:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(232, 200, 137, 0.38);
  background: rgba(232, 200, 137, 0.08);
}

.control-key:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.control-key.stop {
  border-color: rgba(242, 107, 91, 0.2);
  background: rgba(242, 107, 91, 0.08);
}

.editor-controls {
  display: grid;
  gap: 12px;
}

.editor-grid-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.editor-grid-stack {
  display: grid;
  gap: 12px;
}

.editor-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  color: var(--muted);
  font-size: 0.88rem;
}

.editor-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  width: 28px;
  height: 0;
  border-top: 4px solid rgba(217, 143, 73, 0.92);
  border-radius: 999px;
  display: inline-block;
}

.legend-swatch.open {
  border-top-color: rgba(8, 8, 7, 0.98);
  border-top-style: solid;
}

.legend-swatch.pillar {
  width: 12px;
  height: 12px;
  border: 0;
  background: rgba(255, 243, 216, 0.98);
  box-shadow: 0 0 0 2px rgba(232, 200, 137, 0.3);
}

.editor-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.editor-notes {
  min-height: 88px;
  resize: vertical;
}

.editor-visibility {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.editor-toggle {
  padding: 10px 14px;
  border-radius: 14px;
}

.editor-export {
  padding: 10px 16px;
  border-radius: 14px;
}

.editor-preview,
.editor-validation {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.035);
  display: grid;
  gap: 12px;
}

#editor-minimap {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  border-radius: 18px;
}

.minimap-bg {
  fill: rgba(17, 14, 10, 0.96);
  stroke: rgba(232, 200, 137, 0.16);
  stroke-width: 1.5;
}

.minimap-wall {
  stroke: rgba(217, 143, 73, 0.92);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.minimap-pillar {
  fill: rgba(255, 239, 204, 0.92);
}

.minimap-frame {
  fill: rgba(121, 202, 208, 0.08);
  stroke: rgba(121, 202, 208, 0.68);
  stroke-width: 2;
}

.editor-validation-list {
  display: grid;
  gap: 10px;
}

.editor-check {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 248, 235, 0.08);
  background: rgba(255, 248, 235, 0.03);
}

.editor-check strong {
  font-size: 0.95rem;
  color: var(--text-strong);
}

.editor-check span,
.editor-checkline {
  font-size: 0.87rem;
}

.editor-check.is-good {
  border-color: rgba(171, 199, 143, 0.28);
  background: rgba(171, 199, 143, 0.08);
}

.editor-check.is-warn {
  border-color: rgba(232, 200, 137, 0.24);
  background: rgba(232, 200, 137, 0.08);
}

.editor-checkstack {
  display: grid;
  gap: 6px;
}

.editor-toggle.is-active {
  border-color: rgba(232, 200, 137, 0.36);
  background: rgba(217, 143, 73, 0.1);
  color: #ffe7cb;
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

.layer-band {
  fill: none;
  opacity: 0.24;
}

.layer-band.is-purged {
  opacity: 0.08;
}

.maze-cell {
  stroke: rgba(255, 255, 255, 0.03);
  stroke-width: 1.2;
}

.maze-cell.is-hidden {
  opacity: 1;
}

.maze-cell.is-memory {
  opacity: 0.9;
}

.maze-cell.is-purged {
  opacity: 0.95;
}

.segment-divider {
  stroke: rgba(255, 248, 235, 0.14);
  stroke-width: 2.4;
  stroke-dasharray: 12 10;
}

.layer-boundary {
  fill: none;
  stroke: rgba(255, 248, 235, 0.05);
  stroke-width: 1.2;
}

.maze-wall {
  fill: none;
  stroke: rgba(255, 244, 218, 0.98);
  stroke-width: 9.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  filter:
    drop-shadow(0 0 3px rgba(255, 235, 184, 0.6))
    drop-shadow(0 0 12px rgba(232, 200, 137, 0.18));
}

.maze-wall.outer-wall {
  stroke-width: 10.5;
}

.maze-wall.is-purged {
  stroke: rgba(242, 107, 91, 0.38);
  filter: drop-shadow(0 0 10px rgba(242, 107, 91, 0.14));
}

.maze-wall.is-known {
  stroke-opacity: 0.84;
}

.purged-ring {
  fill: rgba(62, 10, 12, 0.34);
  stroke: rgba(242, 107, 91, 0.42);
  stroke-width: 18;
  filter:
    drop-shadow(0 0 18px rgba(242, 107, 91, 0.12))
    drop-shadow(0 0 34px rgba(132, 26, 18, 0.18));
}

.purged-ring-hatch {
  opacity: 0.72;
  pointer-events: none;
}

.current-node-ring {
  fill: rgba(121, 202, 208, 0.08);
  stroke: rgba(121, 202, 208, 0.5);
  stroke-width: 3;
  pointer-events: none;
}

.node-hit {
  fill: transparent;
  cursor: pointer;
}

.node-hit.is-legal {
  fill: rgba(121, 202, 208, 0.08);
}

.node-hit:hover {
  fill: rgba(255, 255, 255, 0.04);
}

.node-hit.is-legal:hover {
  fill: rgba(121, 202, 208, 0.14);
}

.editor-wall-hitbox {
  fill: rgba(255, 255, 255, 0.001);
  stroke: none;
  pointer-events: all;
  cursor: pointer;
}

.editor-wall-bar {
  pointer-events: none;
  transition: fill 120ms ease, opacity 120ms ease, filter 120ms ease;
}

.editor-wall-bar.is-closed {
  fill: rgba(217, 143, 73, 0.92);
  filter:
    drop-shadow(0 0 8px rgba(217, 143, 73, 0.24))
    drop-shadow(0 0 16px rgba(217, 143, 73, 0.14));
}

.editor-wall-bar.is-open {
  fill: rgba(10, 9, 7, 0.96);
  opacity: 0.98;
}

.editor-wall-hitbox:hover + .editor-wall-bar.is-closed {
  fill: rgba(255, 204, 155, 0.98);
}

.editor-wall-hitbox:hover + .editor-wall-bar.is-open {
  fill: rgba(121, 202, 208, 0.28);
}

.editor-pillar {
  fill: rgba(255, 243, 216, 0.98);
  stroke: rgba(232, 200, 137, 0.46);
  stroke-width: 2;
  filter:
    drop-shadow(0 0 6px rgba(255, 226, 154, 0.2))
    drop-shadow(0 0 12px rgba(232, 200, 137, 0.1));
}

.diamond {
  stroke: rgba(255, 255, 255, 0.42);
  stroke-width: 1.4;
  filter: drop-shadow(0 0 10px currentColor);
}

.diamond.is-memory {
  opacity: 0.45;
  filter: none;
}

.entry-marker circle {
  fill: rgba(232, 200, 137, 0.15);
  stroke: rgba(232, 200, 137, 0.6);
  stroke-width: 2.5;
}

.entry-marker.is-open circle {
  fill: rgba(232, 200, 137, 0.1);
}

.entry-marker.is-claimed circle {
  fill: rgba(121, 202, 208, 0.18);
  stroke: rgba(121, 202, 208, 0.62);
}

.entry-marker.is-selectable {
  cursor: pointer;
}

.entry-marker.is-selectable circle {
  fill: rgba(121, 202, 208, 0.18);
  stroke: rgba(121, 202, 208, 0.88);
}

.entry-marker.is-selectable:hover circle {
  fill: rgba(121, 202, 208, 0.28);
}

.entry-marker text {
  fill: rgba(255, 234, 194, 0.92);
  font-size: 22px;
  font-weight: 700;
  text-anchor: middle;
}

.entry-icon {
  pointer-events: none;
  filter:
    drop-shadow(0 0 6px rgba(255, 236, 189, 0.18))
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.16));
}

.entry-caption {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: rgba(255, 240, 214, 0.75);
}

.runner-shell {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 3.5;
}

.runner-halo {
  opacity: 0.18;
  filter: drop-shadow(0 0 14px rgba(255, 236, 189, 0.18));
  pointer-events: none;
}

.runner-portrait,
.runner-shell-fill {
  pointer-events: none;
}

.runner-token {
  cursor: pointer;
}

.runner-token.is-outside {
  cursor: default;
}

.runner-shell.is-outside {
  stroke-dasharray: 5 4;
}

.runner-shell.is-dead {
  opacity: 0.28;
}

.runner-label {
  fill: #1d130b;
  text-anchor: middle;
  dominant-baseline: middle;
  font-size: 16px;
  font-weight: 800;
}

.runner-name {
  fill: rgba(248, 240, 226, 0.88);
  text-anchor: middle;
  font-size: 14px;
  font-weight: 700;
}

@media (min-width: 1101px) {
  body.in-room {
    overflow: hidden;
  }

  body.in-room .shell {
    width: min(1740px, calc(100vw - 18px));
    height: calc(100dvh - 20px);
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
    padding: 10px 0;
  }

  body.in-room .masthead {
    margin-bottom: 0;
    padding: 10px 20px;
    border-radius: 28px;
    gap: 24px;
  }

  body[data-app-mode="player"].in-room .masthead {
    grid-template-columns: minmax(220px, 0.92fr) auto minmax(0, 1fr) auto;
  }

  body[data-app-mode="player"].in-room .brand-mark {
    display: none;
  }

  body[data-app-mode="player"].in-room .brand-lockup {
    display: grid;
    align-content: center;
    gap: 4px;
    min-height: 0;
    padding: 0 18px 0 0;
    border-right: 1px solid rgba(255, 248, 235, 0.08);
  }

  body.in-room .brand-logo {
    transform: scale(1.22);
  }

  body[data-app-mode="player"].in-room .brand-title {
    font-size: 1.34rem;
    letter-spacing: 0.09em;
  }

  body[data-app-mode="player"].in-room .meta-pill,
  body[data-app-mode="player"].in-room .page-link {
    padding-block: 10px;
  }

  body[data-app-mode="player"].in-room .app {
    height: 100%;
    grid-template-rows: minmax(0, 1fr);
    gap: 0;
    min-height: 0;
  }

  body[data-app-mode="player"].in-room #room-code {
    font-size: clamp(1.45rem, 2.1vw, 2rem);
    letter-spacing: 0.12em;
  }

  body[data-app-mode="player"].in-room .masthead-status {
    font-size: 0.68rem;
  }

  body[data-app-mode="player"].in-room .masthead-maze {
    padding-left: 2px;
  }

  body[data-app-mode="player"].in-room .maze-lockup {
    gap: 8px 16px;
  }

  body[data-app-mode="player"].in-room .masthead-actions {
    margin-left: auto;
  }

  body[data-app-mode="player"].in-room .arena {
    min-height: 0;
    height: 100%;
    grid-template-columns: clamp(236px, 16.1vw, 292px) minmax(0, 1fr) clamp(252px, 17.4vw, 312px);
    gap: 14px;
    align-items: stretch;
  }

  body[data-app-mode="player"].in-room .board-panel,
  body[data-app-mode="player"].in-room .sidebar {
    height: 100%;
  }

  body[data-app-mode="player"].in-room .sidebar-left {
    order: 0;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    gap: 8px;
  }

  body[data-app-mode="player"].in-room .player-crest {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1;
    justify-self: stretch;
    min-height: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border-radius: 28px;
    border: 1px solid rgba(234, 199, 133, 0.12);
    background:
      linear-gradient(180deg, rgba(39, 30, 20, 0.58), rgba(12, 11, 9, 0.78)),
      linear-gradient(135deg, rgba(255, 250, 240, 0.025), transparent 42%);
    box-shadow:
      0 14px 30px rgba(0, 0, 0, 0.16),
      inset 0 1px 0 rgba(255, 248, 235, 0.05);
  }

  body[data-app-mode="player"].in-room .player-crest::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
      radial-gradient(circle at 50% 48%, rgba(121, 202, 208, 0.18), transparent 34%),
      radial-gradient(circle at 50% 24%, rgba(255, 229, 128, 0.12), transparent 22%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 34%);
    pointer-events: none;
    z-index: 0;
  }

  body[data-app-mode="player"].in-room .player-crest::after {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg, rgba(232, 200, 137, 0.86), rgba(121, 202, 208, 0.82), transparent 90%);
    box-shadow: 0 0 12px rgba(121, 202, 208, 0.14);
  }

  body[data-app-mode="player"].in-room .player-crest-logo {
    position: relative;
    z-index: 1;
    width: calc(100% - 2px);
    aspect-ratio: 1;
    object-fit: contain;
    max-height: none;
    transform: translateY(18px) scale(1.34);
    transform-origin: center;
    clip-path: inset(0 0 8% 0);
    filter:
      drop-shadow(0 18px 28px rgba(0, 0, 0, 0.3))
      drop-shadow(0 0 18px rgba(121, 202, 208, 0.12));
  }

  body[data-app-mode="player"].in-room .board-panel {
    order: 1;
  }

  body[data-app-mode="player"].in-room .sidebar-right {
    order: 2;
  }

  body[data-app-mode="player"].in-room .board-panel {
    padding: 16px;
    gap: 10px;
  }

  body[data-app-mode="player"].in-room .standings-panel {
    padding-top: 10px;
  }

  body[data-app-mode="player"].in-room .board-header {
    margin-bottom: 0;
    gap: 14px;
  }

  body[data-app-mode="player"].in-room .board-header h2 {
    font-size: clamp(1.55rem, 2.2vw, 1.95rem);
  }

  body[data-app-mode="player"].in-room .board-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: min(100%, 420px);
  }

  body[data-app-mode="player"].in-room .metric {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 14px;
  }

  body[data-app-mode="player"].in-room .metric span {
    margin-bottom: 5px;
    font-size: 0.68rem;
  }

  body[data-app-mode="player"].in-room .metric strong,
  body[data-app-mode="player"].in-room #turn-status {
    font-size: 0.98rem;
  }

  body[data-app-mode="player"].in-room .layer-strip {
    gap: 6px;
    margin-bottom: 0;
  }

  body[data-app-mode="player"].in-room .layer-chip {
    gap: 2px;
    padding: 8px 6px;
    border-radius: 12px;
  }

  body[data-app-mode="player"].in-room .layer-chip span {
    font-size: 0.62rem;
  }

  body[data-app-mode="player"].in-room .layer-chip strong {
    font-size: 0.83rem;
  }

  body[data-app-mode="player"].in-room .layer-chip em {
    font-size: 0.68rem;
  }

  body[data-app-mode="player"].in-room .board-canvas {
    padding: 10px;
  }

  body[data-app-mode="player"].in-room #maze-svg {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
  }

  body[data-app-mode="player"].in-room .board-caption {
    padding: 0 4px;
    font-size: 0.88rem;
    line-height: 1.45;
    max-height: 3.1em;
    overflow: auto;
  }

  body[data-app-mode="player"].in-room .sidebar {
    gap: 0;
  }

  body[data-app-mode="player"].in-room .side-panel {
    padding: 12px;
    gap: 8px;
    height: 100%;
  }

  body[data-app-mode="player"].in-room .scoreboard,
  body[data-app-mode="player"].in-room .event-log {
    overflow: auto;
    padding-right: 2px;
    gap: 8px;
    align-content: start;
  }

  body[data-app-mode="player"].in-room .score-row,
  body[data-app-mode="player"].in-room .event-item {
    padding: 8px 10px;
    border-radius: 14px;
  }

  body[data-app-mode="player"].in-room .score-row.has-seal {
    min-height: 94px;
    padding-right: 108px;
  }

  body[data-app-mode="player"].in-room .runner-seal {
    right: 10px;
    width: 86px;
    height: 86px;
  }

  body[data-app-mode="player"].in-room .runner-seal-stamp {
    min-width: 66px;
    padding: 3px 9px;
    font-size: 0.72rem;
  }

  body[data-app-mode="player"].in-room .runner-avatar {
    width: 26px;
    height: 26px;
  }

  body[data-app-mode="player"].in-room .runner-meta,
  body[data-app-mode="player"].in-room .runner-intent,
  body[data-app-mode="player"].in-room .event-item time,
  body[data-app-mode="player"].in-room .event-detail {
    font-size: 0.8rem;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

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

@keyframes alert-blink {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.38;
  }
}

@media (max-width: 1260px) {
  .hero {
    grid-template-columns: 1fr;
  }

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

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

  .simulation-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .arena {
    grid-template-columns: 1fr;
  }

  .room-bar {
    grid-template-columns: 1fr;
  }

  .board-header {
    flex-direction: column;
    align-items: stretch;
  }

  .room-actions {
    justify-content: flex-start;
  }

  .board-metrics {
    justify-content: flex-start;
  }

  body[data-app-mode="player"].in-room .board-panel {
    order: 0;
  }

  body[data-app-mode="player"].in-room .sidebar-left {
    order: 1;
  }

  body[data-app-mode="player"].in-room .sidebar-right {
    order: 2;
  }
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 24px, 100%);
    padding: 18px 0 28px;
  }

  .masthead {
    border-radius: 28px;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .masthead-meta,
  .masthead-actions {
    justify-content: flex-start;
  }

  .hero-copy,
  .hero-preview,
  .hero-sidecard,
  .play-stage,
  .panel,
  .rule-card {
    border-radius: 24px;
  }

  .hero-copy,
  .hero-preview,
  .hero-sidecard,
  .play-stage,
  .form-panel,
  .panel {
    padding: 20px;
  }

  .hero-stats,
  .play-grid,
  .rules-band,
  .preview-steps {
    grid-template-columns: 1fr;
  }

  .portal-steps,
  .banner-sidecard-notes {
    grid-template-columns: 1fr;
  }

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

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

  .metric {
    min-width: 0;
  }

  .layer-strip {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .hero h1 {
    max-width: none;
    font-size: clamp(2.6rem, 14vw, 4rem);
  }

  .hero-player-portal h1 {
    font-size: clamp(2rem, 11vw, 3rem);
  }

  .section-heading h2,
  .hero-sidecard h2,
  .panel-heading h2 {
    font-size: 1.85rem;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .brand-title {
    font-size: 1.18rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

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

  .hero-link,
  .action-button,
  .ghost-button {
    width: 100%;
  }

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

  .room-actions {
    width: 100%;
  }

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

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

@media (max-width: 480px) {
  .board-metrics {
    grid-template-columns: 1fr;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
