:root {
  --bg: #07110c;
  --bg-deep: #030906;
  --table-wood: #2b1a12;
  --table-wood-dark: #170d08;
  --felt: #234a37;
  --felt-dark: #13291f;
  --felt-shadow: #0d1a14;
  --panel: rgba(15, 23, 19, 0.74);
  --panel-strong: rgba(11, 17, 14, 0.9);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-soft: rgba(255, 255, 255, 0.03);
  --line: rgba(233, 243, 230, 0.12);
  --line-strong: rgba(242, 234, 193, 0.24);
  --text: #f3f1e9;
  --muted: rgba(232, 231, 220, 0.72);
  --accent: #c6d7a6;
  --accent-bright: #9ef0be;
  --gold: #d4b26d;
  --danger: #ef9c8b;
  --warning: #e6c57a;
  --good: #97deb0;
  --shadow-deep: 0 34px 90px rgba(0, 0, 0, 0.48);
  --shadow-soft: 0 16px 40px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 28px 54px rgba(0, 0, 0, 0.36);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-ui: "Aptos", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Aptos Display", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mx: 0px;
  --my: 0px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(222, 255, 203, 0.14), transparent 18%),
    radial-gradient(circle at 20% 20%, rgba(126, 80, 41, 0.12), transparent 24%),
    linear-gradient(180deg, #09120d 0%, #040a07 100%);
}

body {
  position: relative;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.atmosphere,
.table-shell,
.overlay,
.toast-stack,
.fx-layer {
  position: relative;
  z-index: 1;
}

.atmosphere {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.lamp-glow,
.lamp-core,
.haze,
.grain,
.vignette {
  position: absolute;
  inset: 0;
}

.lamp-glow {
  background:
    radial-gradient(circle at calc(50% + var(--mx) * 0.03) calc(11% + var(--my) * 0.02), rgba(213, 255, 184, 0.18), transparent 18%),
    radial-gradient(circle at 50% 28%, rgba(122, 214, 162, 0.12), transparent 28%);
  filter: blur(26px);
}

.lamp-core {
  background: radial-gradient(circle at 50% 4%, rgba(247, 255, 213, 0.72), transparent 7%);
  filter: blur(30px);
  opacity: 0.88;
}

.haze {
  opacity: 0.2;
  mix-blend-mode: screen;
  background:
    radial-gradient(circle at 24% 34%, rgba(255, 255, 255, 0.09), transparent 18%),
    radial-gradient(circle at 68% 24%, rgba(181, 255, 212, 0.08), transparent 20%),
    radial-gradient(circle at 52% 68%, rgba(182, 206, 191, 0.07), transparent 26%);
  filter: blur(34px);
}

.haze-a {
  animation: driftA 22s ease-in-out infinite alternate;
}

.haze-b {
  animation: driftB 28s ease-in-out infinite alternate;
}

.grain {
  opacity: 0.07;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.44) 0 1px, transparent 1px),
    radial-gradient(circle at 70% 80%, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px);
  background-size: 190px 190px;
}

.vignette {
  background: radial-gradient(circle at center, transparent 38%, rgba(0, 0, 0, 0.5) 100%);
}

.embers {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ember {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(254, 241, 209, 0.68);
  box-shadow: 0 0 10px rgba(255, 220, 157, 0.38);
  animation: floatUp linear infinite;
}

.table-shell {
  height: 100svh;
  padding: 12px;
}

.table-layout,
.play-column {
  height: 100%;
}

.table-stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  padding: 16px;
  border-radius: 42px;
  background:
    linear-gradient(180deg, rgba(7, 11, 9, 0.34), rgba(5, 8, 7, 0.16)),
    linear-gradient(135deg, var(--table-wood-dark), var(--table-wood) 14%, #4a2c1b 50%, var(--table-wood) 86%, var(--table-wood-dark));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -38px 80px rgba(0, 0, 0, 0.34),
    var(--shadow-deep);
}

.table-stage::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 34px;
  background:
    radial-gradient(circle at 50% 10%, rgba(223, 255, 210, 0.18), transparent 16%),
    radial-gradient(circle at 50% 48%, rgba(62, 135, 97, 0.24), transparent 46%),
    linear-gradient(180deg, rgba(27, 57, 43, 0.98), rgba(17, 33, 26, 0.98));
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.24),
    inset 0 0 0 18px rgba(255, 255, 255, 0.015),
    inset 0 30px 60px rgba(255, 255, 255, 0.02),
    inset 0 -60px 100px rgba(0, 0, 0, 0.28);
  animation: feltShift 18s ease-in-out infinite alternate;
}

.table-stage::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 34px;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.012) 0 2px,
      rgba(255, 255, 255, 0) 2px 10px
    );
  opacity: 0.35;
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.stage-ring {
  position: absolute;
  inset: 94px 210px 170px;
  border-radius: 999px;
  border: 1px solid rgba(240, 233, 189, 0.14);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 0 80px rgba(195, 255, 212, 0.05);
  pointer-events: none;
}

.chrome-panel,
.overlay-card {
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  background:
    linear-gradient(180deg, rgba(22, 32, 26, 0.88), rgba(11, 17, 14, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 40%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.chrome-panel::after,
.event-card::after,
.overlay-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.table-plaque {
  position: absolute;
  left: 50%;
  top: 20px;
  z-index: 2;
  width: min(520px, calc(100% - 460px));
  padding: 14px 20px 16px;
  border-radius: 20px;
  transform: translateX(-50%);
  text-align: center;
  background:
    linear-gradient(180deg, rgba(35, 29, 18, 0.9), rgba(16, 13, 9, 0.92)),
    linear-gradient(180deg, rgba(255, 233, 175, 0.05), transparent 44%);
  border: 1px solid rgba(212, 183, 112, 0.18);
  transition: transform 300ms ease, width 300ms ease, top 300ms ease, opacity 220ms ease, padding 300ms ease;
}

.eyebrow,
.panel-label,
.meta-label,
.overlay-eyebrow,
.stage-chip-label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.68rem;
  color: var(--muted);
}

.table-plaque h1 {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 0.94;
}

body.in-run .table-plaque {
  top: 18px;
  width: 280px;
  padding: 10px 16px 11px;
  opacity: 0.92;
}

body.in-run .table-plaque h1 {
  margin: 4px 0;
  font-size: 1.05rem;
  letter-spacing: 0.16em;
}

body.in-run .table-plaque .eyebrow {
  font-size: 0.56rem;
}

body.in-run .table-plaque .tagline {
  font-size: 0.72rem;
}

.tagline {
  margin: 0;
  color: rgba(244, 235, 206, 0.76);
  font-size: 0.95rem;
}

.control-cluster {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 3;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions,
.overlay-actions,
.intro-actions,
.leaderboard-controls,
.intro-badges,
.modifier-list,
.achievement-strip,
.mode-strip,
.summary-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-rail {
  position: absolute;
  left: 28px;
  right: 28px;
  z-index: 2;
}

.top-rail {
  top: 26px;
  width: 320px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.bottom-rail {
  left: 28px;
  right: 28px;
  bottom: 18px;
}

.stage-chip,
.rail-block,
.decision-fan {
  border-radius: 18px;
}

.stage-chip,
.rail-block {
  position: relative;
  padding: 12px 14px;
  background:
    linear-gradient(180deg, rgba(14, 21, 18, 0.84), rgba(8, 13, 11, 0.88)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 40%);
  border: 1px solid rgba(245, 237, 200, 0.1);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.stage-chip {
  display: grid;
  gap: 3px;
}

.stage-chip strong {
  font-size: 0.92rem;
  line-height: 1.24;
}

.status-chip strong {
  color: var(--accent-bright);
}

.stage-chip.offline strong {
  color: var(--warning);
}

.battle-area {
  position: absolute;
  left: 198px;
  right: 198px;
  top: 112px;
  bottom: 178px;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr) 156px;
  align-items: center;
  gap: 18px;
  z-index: 1;
  perspective: 1400px;
}

.pile-stack {
  position: relative;
  min-height: 206px;
  padding: 18px 14px;
  display: grid;
  align-content: end;
  gap: 6px;
  text-align: center;
  border-radius: 22px;
  transform-style: preserve-3d;
  box-shadow: var(--shadow-card);
  animation: pileBob 6s ease-in-out infinite;
}

.deck-stack {
  transform: rotateX(48deg) rotateZ(-12deg);
  animation-delay: -1.2s;
}

.discard-stack {
  transform: rotateX(48deg) rotateZ(12deg);
  animation-delay: -3.1s;
}

.pile-title {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
}

.pile-count {
  font-size: 2.7rem;
  line-height: 0.95;
  font-weight: 800;
}

.pile-subtitle {
  color: var(--muted);
  font-size: 0.8rem;
}

.tray-panel {
  position: absolute;
  top: 124px;
  bottom: 118px;
  z-index: 2;
  width: 176px;
  padding: 14px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.left-tray {
  left: 24px;
}

.right-tray {
  right: 24px;
}

.meta-grid,
.stats-grid,
.derived-grid,
.help-grid,
.status-report,
.end-summary,
.player-line,
.stat-meta,
.card-topline {
  display: grid;
}

.compact-meta {
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.compact-meta .meta-value {
  font-size: 0.86rem;
  line-height: 1.3;
}

.modifier-chip,
.achievement-chip,
.mode-chip {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.76rem;
}

.achievement-chip.unlocked {
  color: #0b120e;
  background: linear-gradient(135deg, #e6e4c7, #9fd8b0);
  box-shadow: 0 12px 26px rgba(159, 216, 176, 0.22);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.compact-stats {
  gap: 7px;
  margin-top: 12px;
}

.stats-grid,
.derived-grid,
.help-grid,
.status-report {
  gap: 10px;
}

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

.stat-meta {
  gap: 6px;
}

.stat-name {
  display: inline-flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.84rem;
}

.stat-value {
  font-variant-numeric: tabular-nums;
}

.stat-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.stat-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 50%;
  border-radius: inherit;
  background: linear-gradient(90deg, #cde7b0, #7cdaab);
  transition: width 420ms cubic-bezier(.2, .9, .2, 1), background 420ms ease;
}

.stat-row.warning .stat-fill {
  background: linear-gradient(90deg, #e2c67b, #f0df9c);
}

.stat-row.danger .stat-fill {
  background: linear-gradient(90deg, #e58d85, #efb299);
}

.stat-row.pulse {
  animation: statPulse 500ms ease;
}

.compact-derived {
  margin-top: 10px;
  gap: 6px;
}

.compact-derived .derived-row {
  font-size: 0.77rem;
  color: var(--muted);
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tray-foot-label {
  margin-top: 12px;
}

.compact-achievements {
  margin-top: 10px;
  max-height: 122px;
  overflow: hidden;
}

.event-card {
  position: relative;
  align-self: stretch;
  justify-self: center;
  width: min(100%, 620px);
  padding: 20px 20px 18px;
  border-radius: 30px;
  transform-style: preserve-3d;
  transform:
    rotateX(calc(7deg - var(--my) * 0.015))
    rotateY(calc(var(--mx) * 0.02));
  background:
    linear-gradient(180deg, rgba(255, 245, 219, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(54, 59, 46, 0.95), rgba(19, 24, 20, 0.98));
  border: 1px solid var(--line-strong);
  box-shadow:
    0 30px 64px rgba(0, 0, 0, 0.36),
    0 10px 22px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
  animation: cardIdle 5.6s ease-in-out infinite;
}

.event-card.dealing {
  animation: dealCard 620ms cubic-bezier(.2, .95, .18, 1);
}

.event-card.reveal-pause {
  animation: revealHold 720ms ease;
}

.card-frame {
  position: absolute;
  inset: 12px;
  border-radius: 22px;
  border: 1px solid rgba(244, 229, 176, 0.1);
  pointer-events: none;
}

.frame-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: rgba(214, 183, 107, 0.54);
  border-style: solid;
}

.frame-corner.tl {
  top: -1px;
  left: -1px;
  border-width: 2px 0 0 2px;
  border-top-left-radius: 16px;
}

.frame-corner.tr {
  top: -1px;
  right: -1px;
  border-width: 2px 2px 0 0;
  border-top-right-radius: 16px;
}

.frame-corner.bl {
  bottom: -1px;
  left: -1px;
  border-width: 0 0 2px 2px;
  border-bottom-left-radius: 16px;
}

.frame-corner.br {
  bottom: -1px;
  right: -1px;
  border-width: 0 2px 2px 0;
  border-bottom-right-radius: 16px;
}

.card-sheen {
  position: absolute;
  inset: -40%;
  background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, 0.12) 50%, transparent 60%);
  transform: translateX(-20%) rotate(8deg);
  animation: sheen 10s ease-in-out infinite;
  pointer-events: none;
}

.card-topline {
  grid-template-columns: auto auto;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.card-type,
.card-tension {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.card-layout {
  min-height: calc(100% - 54px);
}

.card-copy {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 8px 22px 8px 18px;
  text-align: center;
}

.event-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 4vw, 4.2rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}

.event-card h2.long-title {
  font-size: clamp(2rem, 3.2vw, 3.2rem);
}

.event-card h2.very-long-title {
  font-size: clamp(1.55rem, 2.6vw, 2.5rem);
  line-height: 0.98;
}

.card-body,
.card-flavour,
.overlay-copy,
.leaderboard-empty,
.tiny-inline,
.log-item,
.field span,
.help-grid p,
.status-report p {
  color: var(--muted);
}

.card-body {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.5;
  max-width: 40ch;
  margin-inline: auto;
}

.card-flavour {
  max-width: 34ch;
  margin-inline: auto;
  font-size: 0.94rem;
  line-height: 1.5;
  font-style: italic;
}

.decision-fan {
  position: absolute;
  left: 214px;
  right: 214px;
  bottom: 18px;
  z-index: 3;
  padding: 12px 14px 14px;
  background:
    linear-gradient(180deg, rgba(14, 20, 17, 0.88), rgba(8, 13, 11, 0.94)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 40%);
  border: 1px solid rgba(244, 236, 203, 0.08);
  box-shadow: 0 20px 36px rgba(0, 0, 0, 0.28);
}

.decision-ribbon {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding-inline: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  min-height: 148px;
  align-items: end;
}

.choice-button,
.primary-button,
.ghost-button {
  position: relative;
  border: 0;
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease, background 220ms ease;
}

.choice-button {
  padding: 14px 14px 16px;
  min-height: 148px;
  text-align: left;
  border-radius: 20px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 246, 214, 0.12), transparent 20%),
    linear-gradient(180deg, rgba(64, 67, 53, 0.94), rgba(17, 22, 18, 0.98));
  border: 1px solid rgba(238, 228, 191, 0.12);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: handSettle 420ms ease both;
}

.choice-button::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.choice-button:hover,
.choice-button:focus-visible,
.primary-button:hover,
.primary-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible {
  transform: translateY(-4px);
  outline: none;
}

.choice-button:hover,
.choice-button:focus-visible {
  box-shadow:
    0 24px 38px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(194, 227, 186, 0.18) inset;
}

.choice-grid .choice-button:nth-child(1) {
  transform: rotate(-4deg) translateY(6px);
}

.choice-grid .choice-button:nth-child(2) {
  transform: translateY(0);
}

.choice-grid .choice-button:nth-child(3) {
  transform: rotate(4deg) translateY(6px);
}

.choice-grid .choice-button:nth-child(1):hover,
.choice-grid .choice-button:nth-child(1):focus-visible,
.choice-grid .choice-button:nth-child(2):hover,
.choice-grid .choice-button:nth-child(2):focus-visible,
.choice-grid .choice-button:nth-child(3):hover,
.choice-grid .choice-button:nth-child(3):focus-visible {
  transform: translateY(-8px) scale(1.01);
}

.choice-title {
  display: block;
  margin-bottom: 8px;
  font-size: 0.98rem;
  line-height: 1.28;
  font-weight: 700;
}

.choice-impact {
  display: block;
  margin-top: 10px;
  color: rgba(197, 229, 207, 0.9);
  font-size: 0.8rem;
  line-height: 1.35;
}

.choice-button[data-tone="risky"] .choice-impact {
  color: #f0d09d;
}

.choice-button[data-tone="dirty"] .choice-impact {
  color: #f0aea5;
}

.achievement-more {
  color: rgba(244, 234, 198, 0.82);
}

.ghost-button,
.primary-button {
  border-radius: 16px;
  padding: 12px 16px;
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.primary-button {
  color: #08110d;
  background: linear-gradient(135deg, #ebe2b8, #9cd7ab);
  box-shadow: 0 14px 26px rgba(156, 215, 171, 0.22);
}

.compact {
  padding: 10px 12px;
  border-radius: 14px;
}

.compact-field {
  min-width: 160px;
}

.rail-log {
  width: min(520px, 100%);
  margin-left: auto;
  padding: 12px 14px;
}

.log-list {
  display: grid;
  gap: 10px;
  max-height: 86px;
  overflow: auto;
  padding-right: 4px;
}

.log-item {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.04);
  line-height: 1.38;
  font-size: 0.88rem;
}

.log-item strong {
  color: var(--text);
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 5, 0.72);
  z-index: 5;
}

.overlay.active {
  display: flex;
}

.overlay-card {
  width: min(760px, 100%);
  max-height: min(90vh, 980px);
  overflow: auto;
  padding: 28px;
  border-radius: 32px;
}

.overlay-card.wide {
  width: min(1080px, 100%);
}

.overlay-card h2 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3.1rem);
  font-weight: 800;
  line-height: 0.95;
  text-transform: uppercase;
}

.intro-card {
  width: min(980px, 100%);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(22, 33, 27, 0.95), rgba(10, 16, 13, 0.98)),
    radial-gradient(circle at top, rgba(240, 227, 164, 0.06), transparent 28%);
}

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

.intro-copy-stack {
  display: grid;
  gap: 14px;
}

.intro-copy-stack h2 {
  max-width: 11ch;
}

.intro-badges span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.84rem;
}

.intro-visual {
  position: relative;
  min-height: 330px;
}

.hero-card {
  position: absolute;
  width: 220px;
  height: 300px;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(74, 74, 60, 0.94), rgba(19, 24, 20, 0.98)),
    radial-gradient(circle at top, rgba(255, 245, 213, 0.12), transparent 36%);
  border: 1px solid rgba(244, 230, 176, 0.14);
  box-shadow: var(--shadow-card);
}

.hero-card-back {
  right: 54px;
  top: 8px;
  transform: rotate(12deg);
}

.hero-card-mid {
  right: 84px;
  top: 24px;
  transform: rotate(-8deg);
}

.hero-card-front {
  right: 18px;
  top: 30px;
  transform: rotate(7deg);
}

.hero-card-header {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-size: 0.72rem;
}

.hero-card-title {
  margin-top: 14px;
  font-size: 1.45rem;
  line-height: 0.98;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-card-body {
  margin-top: 16px;
  color: var(--muted);
  line-height: 1.42;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.leaderboard-table-wrap {
  overflow: auto;
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.leaderboard-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.leaderboard-table th {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.leaderboard-empty {
  display: none;
  padding: 18px 4px 0;
}

.status-report,
.end-summary {
  gap: 12px;
}

.summary-score {
  font-size: clamp(2.2rem, 4vw, 4rem);
  font-weight: 800;
}

.summary-banner {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
}

.summary-inline span {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.spread {
  justify-content: space-between;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
  z-index: 6;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(10, 16, 13, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
  animation: toastIn 360ms ease, toastOut 360ms ease 3.4s forwards;
}

.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.score-pop,
.paper-shard {
  position: absolute;
  font-weight: 700;
  animation: popFloat 900ms ease forwards;
}

.paper-shard {
  width: 8px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, #f1edd7, #a9dac4);
  animation: shardFall 1500ms ease forwards;
}

.screen-shake {
  animation: screenShake 420ms linear;
}

.tiny-inline {
  font-size: 0.8rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1300px) {
  .table-plaque {
    width: min(440px, calc(100% - 390px));
  }

  .battle-area {
    left: 182px;
    right: 182px;
    grid-template-columns: 132px minmax(0, 1fr) 132px;
  }

  .tray-panel {
    width: 168px;
  }

  .decision-fan {
    left: 186px;
    right: 186px;
  }

  .choice-grid {
    gap: 12px;
  }

  .choice-button {
    min-height: 138px;
  }
}

@media (max-width: 1120px) {
  html,
  body {
    overflow: auto;
  }

  .table-shell {
    height: auto;
    min-height: 100svh;
  }

  .table-stage {
    height: auto;
    min-height: 100svh;
    overflow: visible;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "plaque"
      "controls"
      "hud"
      "battle"
      "left"
      "right"
      "hand"
      "log";
    gap: 14px;
  }

  .table-stage::before,
  .table-stage::after {
    inset: 10px;
  }

  .stage-ring {
    display: none;
  }

  .table-plaque,
  .control-cluster,
  .top-rail,
  .battle-area,
  .decision-fan,
  .left-tray,
  .right-tray,
  .bottom-rail {
    position: relative;
    inset: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    width: 100%;
    transform: none;
  }

  .table-plaque {
    grid-area: plaque;
  }

  .control-cluster {
    grid-area: controls;
    justify-content: stretch;
  }

  .control-cluster .ghost-button {
    flex: 1 1 150px;
  }

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

  .battle-area {
    grid-area: battle;
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 120px;
    gap: 12px;
    align-items: stretch;
  }

  .event-card {
    min-height: 360px;
  }

  body.in-run .table-plaque {
    width: 240px;
  }

  .left-tray {
    grid-area: left;
  }

  .right-tray {
    grid-area: right;
  }

  .decision-fan {
    grid-area: hand;
  }

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

  .bottom-rail {
    grid-area: log;
  }

  .rail-log {
    width: 100%;
  }
}

@media (max-width: 860px) {
  html,
  body {
    overflow: hidden;
  }

  .table-shell {
    padding: 10px;
  }

  .table-stage {
    border-radius: 28px;
    gap: 12px;
  }

  .table-stage::before,
  .table-stage::after {
    border-radius: 22px;
  }

  .table-plaque {
    padding: 14px 16px;
    border-radius: 18px;
  }

  .table-plaque h1 {
    font-size: clamp(1.7rem, 8vw, 2.4rem);
  }

  body.in-run .table-plaque {
    width: 180px;
    padding: 8px 12px 9px;
  }

  body.in-run .table-plaque h1 {
    font-size: 0.8rem;
    letter-spacing: 0.14em;
  }

  body.in-run .table-plaque .tagline {
    display: none;
  }

  body.in-run .table-shell,
  body.in-run .play-column {
    height: 100svh;
  }

  body.in-run .table-stage {
    height: calc(100svh - 20px);
    min-height: 0;
    overflow: hidden;
    grid-template-areas:
      "plaque"
      "controls"
      "hud"
      "battle"
      "hand";
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  }

  .top-rail {
    grid-template-columns: 1fr;
  }

  body.in-run .top-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .battle-area {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "deck discard"
      "card card";
  }

  body.in-run .battle-area {
    grid-template-columns: 78px minmax(0, 1fr) 78px;
    grid-template-areas: "deck card discard";
    gap: 8px;
    min-height: 0;
  }

  .deck-stack {
    grid-area: deck;
  }

  .discard-stack {
    grid-area: discard;
  }

  .pile-stack {
    min-height: 110px;
    transform: none;
    animation: none;
  }

  body.in-run .pile-stack {
    min-height: 126px;
    padding: 12px 8px;
    align-content: center;
  }

  body.in-run .pile-count {
    font-size: 1.9rem;
  }

  body.in-run .pile-subtitle {
    font-size: 0.68rem;
  }

  .event-card {
    grid-area: card;
    width: 100%;
    min-height: 0;
    padding: 18px;
    animation: none;
  }

  body.in-run .event-card {
    height: 100%;
    padding: 14px;
  }

  .event-card h2 {
    font-size: clamp(1.9rem, 9vw, 3rem);
  }

  body.in-run .event-card h2 {
    font-size: clamp(1.35rem, 7vw, 2rem);
    line-height: 0.96;
  }

  body.in-run .event-card h2.long-title {
    font-size: clamp(1.1rem, 5.4vw, 1.6rem);
  }

  body.in-run .event-card h2.very-long-title {
    font-size: clamp(0.92rem, 4.6vw, 1.24rem);
    line-height: 1;
  }

  .card-copy {
    padding: 4px 8px 6px;
    gap: 12px;
  }

  body.in-run .card-copy {
    justify-content: center;
    gap: 10px;
    padding: 2px 4px;
  }

  body.in-run .card-body {
    font-size: 0.88rem;
    line-height: 1.36;
    max-width: 26ch;
  }

  body.in-run .card-flavour {
    font-size: 0.78rem;
    line-height: 1.32;
    max-width: 24ch;
  }

  .decision-ribbon {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .choice-grid,
  .intro-grid,
  .help-grid {
    grid-template-columns: 1fr;
  }

  body.in-run .decision-fan {
    padding: 10px;
  }

  body.in-run .decision-ribbon {
    display: none;
  }

  body.in-run .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-height: 0;
  }

  .choice-button {
    min-height: 116px;
  }

  body.in-run .choice-button {
    min-height: 82px;
    padding: 10px;
  }

  body.in-run .choice-title {
    font-size: 0.82rem;
    margin-bottom: 6px;
  }

  body.in-run .choice-button > span {
    font-size: 0.72rem;
    line-height: 1.28;
  }

  body.in-run .choice-impact {
    margin-top: 6px;
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .choice-grid .choice-button:nth-child(1),
  .choice-grid .choice-button:nth-child(2),
  .choice-grid .choice-button:nth-child(3) {
    transform: none;
  }

  body.in-run .left-tray,
  body.in-run .right-tray,
  body.in-run .bottom-rail {
    display: none;
  }

  .intro-hero {
    grid-template-columns: 1fr;
  }

  .intro-visual {
    min-height: 240px;
  }

  .hero-card {
    width: 176px;
    height: 234px;
  }

  .hero-card-back {
    right: 42px;
  }

  .hero-card-mid {
    right: 70px;
  }

  .hero-card-front {
    right: 10px;
  }

  .overlay {
    padding: 12px;
  }

  .overlay-card {
    padding: 22px;
    border-radius: 24px;
  }
}

@media (max-width: 560px) {
  .control-cluster {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  body.in-run .control-cluster {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  body.in-run .table-plaque {
    display: none;
  }

  body.in-run .control-cluster .ghost-button {
    padding: 8px 6px;
    font-size: 0.7rem;
    line-height: 1.1;
  }

  .battle-area {
    grid-template-columns: 1fr;
    grid-template-areas:
      "deck"
      "discard"
      "card";
  }

  .pile-stack {
    min-height: 98px;
  }

  body.in-run .battle-area {
    grid-template-columns: 68px minmax(0, 1fr) 68px;
  }

  body.in-run .pile-stack {
    min-height: 112px;
  }

  .stage-chip strong {
    font-size: 0.88rem;
  }

  .card-type,
  .card-tension {
    font-size: 0.68rem;
    padding: 7px 10px;
  }

  .log-list {
    max-height: 180px;
  }

  body.in-run .top-rail {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  body.in-run .stage-chip {
    padding: 8px 10px;
  }

  body.in-run .stage-chip-label {
    font-size: 0.56rem;
    letter-spacing: 0.14em;
  }

  body.in-run .stage-chip strong {
    font-size: 0.74rem;
  }

  body.in-run .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.in-run .choice-button {
    min-height: 72px;
    padding: 9px;
  }

  body.in-run .event-card {
    padding: 10px;
  }

  body.in-run .card-topline {
    margin-bottom: 8px;
    gap: 6px;
  }

  body.in-run .card-type,
  body.in-run .card-tension {
    padding: 5px 8px;
    font-size: 0.54rem;
    letter-spacing: 0.1em;
  }

  body.in-run .event-card h2,
  body.in-run .event-card h2.long-title,
  body.in-run .event-card h2.very-long-title {
    font-size: clamp(0.88rem, 4.7vw, 1.15rem);
    line-height: 0.94;
  }

  body.in-run .card-body,
  body.in-run .card-flavour {
    display: none;
  }

  body.in-run .choice-grid .choice-button:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@keyframes driftA {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.06); }
}

@keyframes driftB {
  from { transform: translate3d(2%, 1%, 0) scale(1.02); }
  to { transform: translate3d(-2%, -1%, 0) scale(1); }
}

@keyframes floatUp {
  from { transform: translateY(0) scale(0.8); opacity: 0; }
  20% { opacity: 1; }
  to { transform: translateY(-120vh) scale(1.2); opacity: 0; }
}

@keyframes dealCard {
  0% { transform: translateY(32px) rotateX(60deg) rotateY(-16deg) scale(0.88); opacity: 0; }
  100% { transform: rotateX(calc(7deg - var(--my) * 0.015)) rotateY(calc(var(--mx) * 0.02)); opacity: 1; }
}

@keyframes revealHold {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@keyframes sheen {
  0%, 100% { transform: translateX(-30%) rotate(8deg); opacity: 0; }
  14%, 28% { opacity: 1; }
  40% { transform: translateX(32%) rotate(8deg); opacity: 0; }
}

@keyframes statPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toastOut {
  to { transform: translateY(20px); opacity: 0; }
}

@keyframes popFloat {
  from { transform: translateY(0) scale(0.8); opacity: 0; }
  18% { opacity: 1; }
  to { transform: translateY(-50px) scale(1.05); opacity: 0; }
}

@keyframes shardFall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to { transform: translateY(200px) rotate(220deg); opacity: 0; }
}

@keyframes screenShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-8px, 2px, 0); }
  40% { transform: translate3d(7px, -3px, 0); }
  60% { transform: translate3d(-6px, 3px, 0); }
  80% { transform: translate3d(5px, -2px, 0); }
}

@keyframes feltShift {
  from { transform: scale(1) translateY(0); filter: saturate(0.96); }
  to { transform: scale(1.01) translateY(-3px); filter: saturate(1.04); }
}

@keyframes pileBob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}

@keyframes cardIdle {
  0%, 100% {
    translate: 0 0;
    box-shadow: 0 30px 64px rgba(0, 0, 0, 0.36), 0 10px 22px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
  50% {
    translate: 0 -8px;
    box-shadow: 0 38px 74px rgba(0, 0, 0, 0.4), 0 12px 24px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  }
}

@keyframes handSettle {
  from { opacity: 0; translate: 0 18px; }
  to { opacity: 1; translate: 0 0; }
}
