:root {
  color-scheme: dark;
  --ink: #f7eee7;
  --muted: #ba9b91;
  --blood: #8d1c24;
  --blood-dark: #3a090f;
  --ember: #ff5a1f;
  --gold: #ffbd55;
  --poison: #b66dff;
  --poison-acid: #8ed54f;
  --ash: #817574;
  --coal: #100507;
  --panel: rgba(31, 9, 13, 0.88);
  --line: rgba(255, 127, 69, 0.22);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

.tier-1 {
  --tier-color: #ff453a;
  --tier-rgb: 255, 69, 58;
}

.tier-2 {
  --tier-color: #ffd84d;
  --tier-rgb: 255, 216, 77;
}

.tier-3 {
  --tier-color: #ff8a2b;
  --tier-rgb: 255, 138, 43;
}

.tier-4 {
  --tier-color: #fff8e8;
  --tier-rgb: 255, 248, 232;
}

.tier-5 {
  --tier-color: #55a7ff;
  --tier-rgb: 85, 167, 255;
}

html {
  min-height: 100%;
  background: var(--coal);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 110%, rgba(255, 58, 17, 0.3), transparent 42%),
    radial-gradient(circle at 10% 20%, rgba(111, 17, 28, 0.22), transparent 30%),
    linear-gradient(150deg, #090304, #170609 52%, #080203);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

#embers {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.smoke {
  position: fixed;
  z-index: -2;
  width: 44rem;
  height: 44rem;
  border-radius: 50%;
  opacity: 0.16;
  filter: blur(80px);
  background: #8b1724;
  animation: drift 18s ease-in-out infinite alternate;
}

.smoke-one {
  left: -22rem;
  top: 8vh;
}

.smoke-two {
  right: -25rem;
  bottom: -10rem;
  animation-delay: -7s;
}

.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1220px, calc(100% - 40px));
  min-height: 84px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 26px;
  height: 35px;
  border-radius: 55% 45% 58% 42% / 66% 58% 42% 34%;
  background: linear-gradient(160deg, var(--gold), var(--ember) 52%, #a30d1e);
  box-shadow: 0 0 20px rgba(255, 72, 25, 0.66);
  transform: rotate(4deg);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 13px 7px 2px;
  border-radius: 50% 50% 42% 42%;
  background: #fff3b0;
  opacity: 0.9;
}

.brand-word {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.header-actions {
  display: flex;
  gap: 20px;
  align-items: center;
}

.sound-control {
  position: relative;
}

.sound-button {
  min-width: 118px;
  color: var(--gold);
}

.sound-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 14px);
  right: 0;
  width: 230px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 5px 16px 5px 16px;
  background: rgba(22, 5, 8, 0.98);
  box-shadow: var(--shadow);
}

.sound-panel[hidden] {
  display: none;
}

.sound-panel label,
.sound-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.sound-panel input {
  min-height: 30px;
  margin: 8px 0;
  padding: 0;
  accent-color: var(--ember);
}

.sound-panel .secondary-button {
  width: 100%;
  min-height: 38px;
  margin-bottom: 8px;
}

.connection-status {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.connection-status::before {
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: #d88d29;
  box-shadow: 0 0 10px currentColor;
}

.connection-status.online::before {
  background: #ff682e;
}

.connection-status.offline::before {
  background: #87696b;
}

.text-button,
.icon-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.text-button {
  color: var(--ink);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

#app {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100% - 40px));
  min-height: calc(100vh - 84px);
  margin: 0 auto;
  padding: 44px 0 64px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--ember);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

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

h1,
h2,
.display-type {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  max-width: 780px;
  margin-bottom: 20px;
  font-size: clamp(3.7rem, 9vw, 7.7rem);
  line-height: 0.82;
  letter-spacing: -0.065em;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4.2vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.lede {
  max-width: 630px;
  color: #d1b4aa;
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.65;
}

.landing {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 210px);
}

.title-accent {
  display: block;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 179, 92, 0.9);
  text-shadow: 0 0 36px rgba(255, 55, 15, 0.22);
}

.ritual-panel,
.panel,
.team-panel,
.game-board,
.countdown-panel,
.victory-card {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(61, 15, 20, 0.36), transparent 52%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.ritual-panel {
  position: relative;
  width: min(100%, 460px);
  padding: 32px;
  border-radius: 4px 32px 4px 32px;
}

.ritual-panel::before,
.team-panel::before {
  position: absolute;
  inset: -1px 18% auto;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--ember), transparent);
  box-shadow: 0 0 16px var(--ember);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 28px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.32);
}

.tab {
  padding: 11px 16px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tab.active {
  color: var(--ink);
  background: linear-gradient(180deg, #73131e, #481018);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.3);
}

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

.room-invitation {
  margin: -6px 0 20px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 164, 114, 0.18);
  border-radius: 8px;
  color: #e2c5ba;
  background: rgba(94, 19, 24, 0.2);
  line-height: 1.45;
}

.field label {
  color: #d8bab1;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

input,
select {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid rgba(255, 164, 114, 0.2);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(6, 2, 3, 0.68);
}

input::placeholder {
  color: #806b68;
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.24em;
}

.primary-button,
.secondary-button,
.danger-button,
.team-join {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  width: 100%;
  color: #210304;
  background: linear-gradient(135deg, #ffc068, #ff5a1f 58%, #d51f27);
  box-shadow: 0 14px 30px rgba(221, 43, 28, 0.24);
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.team-join:hover {
  transform: translateY(-2px);
}

.primary-button:disabled,
.secondary-button:disabled,
.team-join:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.secondary-button,
.team-join {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.danger-button {
  border-color: rgba(255, 85, 54, 0.45);
  background: rgba(121, 20, 28, 0.42);
}

.microcopy {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.room-heading {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.room-code {
  display: grid;
  grid-template-columns: auto auto;
  gap: 2px 14px;
  align-items: center;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.28);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.room-code strong {
  grid-row: 1 / 3;
  font-size: 1.2rem;
  letter-spacing: 0.2em;
}

.room-code-label,
.copy-symbol {
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.room-code.copied {
  border-color: var(--gold);
  background: rgba(255, 179, 76, 0.08);
}

.room-code.copied .copy-symbol {
  color: var(--gold);
}

.lobby-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
}

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

.team-panel {
  position: relative;
  min-height: 220px;
  padding: 24px;
  overflow: hidden;
  border-radius: 5px 24px 5px 24px;
}

.team-panel.your-team {
  border-color: rgba(255, 180, 83, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 180, 83, 0.12), var(--shadow);
}

.team-title-row,
.panel-title-row,
.score-topline,
.turn-topline {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.team-count {
  color: var(--muted);
  font-size: 0.8rem;
}

.player-list {
  display: grid;
  gap: 8px;
  min-height: 74px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.player-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border-radius: 7px;
  color: #dfcbc5;
  background: rgba(0, 0, 0, 0.2);
}

.player-chip.offline {
  opacity: 0.5;
}

.host-mark {
  color: var(--ember);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.lobby-controls {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 24px;
  border-radius: 22px 5px 22px 5px;
}

.validation-list {
  display: grid;
  gap: 9px;
  margin: 20px 0;
  padding: 0;
  color: var(--muted);
  font-size: 0.8rem;
  list-style: none;
}

.validation-list li::before {
  margin-right: 8px;
  content: "○";
  color: var(--ash);
}

.validation-list li.ready::before {
  content: "◆";
  color: var(--gold);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(var(--team-count, 2), minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.score-team {
  position: relative;
  isolation: isolate;
  min-height: 126px;
  padding: 15px 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 111, 58, 0.16);
  border-radius: 12px;
  background: rgba(25, 7, 10, 0.8);
  transition: border-color 220ms ease, box-shadow 220ms ease, background 220ms ease;
}

.score-topline,
.score-team > .microcopy,
.score-team > .victory-meter {
  position: relative;
  z-index: 2;
}

.score-team .microcopy {
  max-width: calc(100% - 72px);
  margin: 7px 0 0;
}

.score-team.near-victory {
  border-color: rgba(255, 183, 67, 0.48);
  background:
    radial-gradient(circle at 88% 110%, rgba(255, 119, 30, 0.14), transparent 45%),
    rgba(30, 8, 10, 0.9);
}

.score-team.victory-threshold-crossed {
  border-color: var(--gold);
  box-shadow: 0 0 28px rgba(255, 124, 33, 0.24);
}

.score-team.active {
  border-color: rgba(255, 150, 74, 0.62);
  background:
    radial-gradient(circle at 82% 115%, rgba(255, 91, 31, calc(0.07 + var(--stage-level) * 0.045)), transparent 48%),
    rgba(25, 7, 10, 0.88);
  box-shadow:
    0 0 calc(22px + var(--stage-level) * 9px)
      rgba(255, 68, 25, calc(0.13 + var(--stage-level) * 0.045)),
    inset 0 -1px 18px rgba(255, 101, 34, calc(var(--stage-level) * 0.035));
}

.score-team.active::after {
  position: absolute;
  right: 7px;
  bottom: 2px;
  width: calc(38px + var(--stage-level) * 8px);
  height: calc(20px + var(--stage-level) * 8px);
  content: "";
  z-index: 0;
  pointer-events: none;
  opacity: calc(var(--stage-level) * 0.18);
  background:
    radial-gradient(circle at 15% 75%, var(--gold) 0 1px, transparent 2px),
    radial-gradient(circle at 55% 30%, var(--ember) 0 1px, transparent 2px),
    radial-gradient(circle at 85% 65%, var(--gold) 0 1px, transparent 2px);
  filter: drop-shadow(0 0 4px var(--ember));
  animation: ember-turbulence calc(1.2s - var(--stage-level) * 0.13s) ease-in-out infinite alternate;
}

.score-name {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.score-number {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.2rem;
  line-height: 1;
}

.victory-meter {
  display: grid;
  width: calc(100% - 72px);
  gap: 4px;
  margin-top: 11px;
}

.victory-track {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.victory-fill {
  width: calc(var(--victory-progress) * 100%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8f1822, var(--ember) 65%, var(--gold));
  box-shadow: 0 0 calc(4px + var(--victory-progress) * 12px) rgba(255, 83, 28, 0.52);
  transition: width 320ms ease-out;
}

.victory-mark {
  position: absolute;
  right: -3px;
  top: 50%;
  font-size: 0.72rem;
  filter: grayscale(calc(1 - var(--victory-progress)));
  opacity: calc(0.35 + var(--victory-progress) * 0.65);
  transform: translate(50%, -50%) scale(calc(0.72 + var(--victory-progress) * 0.45));
}

.victory-status {
  overflow: hidden;
  color: #907b75;
  font-size: 0.56rem;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.near-victory .victory-status,
.victory-threshold-crossed .victory-status {
  color: var(--gold);
}

.victory-threshold-crossed .victory-mark {
  animation: victory-threshold-pulse 700ms ease-in-out infinite alternate;
}

.team-flame {
  --streak: 0;
  position: absolute;
  right: 13px;
  bottom: 3px;
  z-index: 1;
  width: calc(24px + var(--stage-level) * 3px + var(--victory-progress) * 17px);
  height: calc(28px + var(--stage-level) * 8px + var(--victory-progress) * 48px);
  max-width: 50px;
  max-height: 78px;
  pointer-events: none;
  border-radius: 58% 42% 56% 44% / 68% 58% 42% 32%;
  opacity: calc(0.32 + var(--stage-level) * 0.1 + var(--victory-progress) * 0.48);
  background: linear-gradient(160deg, #fff0a3, #ff8a31 45%, #bf1721 76%);
  box-shadow:
    0 0 calc(12px + var(--stage-level) * 9px) rgba(255, 71, 25, 0.72),
    0 0 calc(var(--stage-level) * 13px + var(--victory-progress) * 22px)
      rgba(255, 183, 71, 0.36);
  transform: rotate(4deg)
    scale(calc(0.84 + var(--stage-level) * 0.06 + var(--victory-progress) * 0.2));
  transform-origin: 50% 100%;
  animation: flame-waver calc(900ms - var(--stage-level) * 105ms) ease-in-out infinite alternate;
  transition: width 320ms ease, height 320ms ease, transform 320ms ease, opacity 260ms ease;
}

.team-flame::after {
  position: absolute;
  inset: 45% 26% 4%;
  content: "";
  border-radius: 55% 45% 50% 50%;
  background: #fff5bf;
}

.game-board {
  position: relative;
  min-height: 520px;
  padding: clamp(20px, 4vw, 40px);
  border-radius: 5px 34px 5px 34px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 88, 27, calc(var(--stage-level) * 0.035)), transparent 42%),
    linear-gradient(145deg, rgba(61, 15, 20, 0.36), transparent 52%),
    var(--panel);
  transition: border-color 240ms ease, box-shadow 240ms ease, background 240ms ease;
}

.game-board.streak-inferno,
.game-board.streak-cataclysm {
  border-color: rgba(255, 137, 61, calc(0.46 + var(--stage-level) * 0.08));
  box-shadow:
    var(--shadow),
    inset 0 0 calc(30px + var(--stage-level) * 10px) rgba(255, 61, 21, 0.08);
}

.game-board.streak-cataclysm::before {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 20%, rgba(255, 190, 84, 0.07), transparent 38%);
  animation: board-breathe 700ms ease-in-out infinite alternate;
}

.game-board.urgent {
  border-color: rgba(180, 24, 35, 0.9);
  box-shadow: var(--shadow), inset 0 0 34px rgba(137, 12, 24, 0.16);
}

.turn-topline {
  margin-bottom: 24px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(255, 157, 87, 0.3);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.timer {
  position: relative;
  display: grid;
  min-width: 120px;
  justify-items: end;
}

.timer-impact {
  position: absolute;
  right: 0;
  bottom: -24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  font-weight: 900;
  animation: timer-impact-rise 1.8s ease-out forwards;
}

.timer-impact.gained {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 170, 51, 0.7);
}

.timer-impact.lost {
  color: #b9a7a1;
}

.timer-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
}

.timer-value.low-time {
  color: #ff7250;
  text-shadow: 0 0 18px rgba(160, 10, 22, 0.65);
}

.timer-value.critical-time::before {
  margin-right: 6px;
  content: "!";
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72em;
}

.timer-track {
  width: 100%;
}

.rope-timer {
  display: grid;
  gap: 7px;
  margin: -14px 0 25px;
}

.burning-rope {
  position: relative;
  height: 10px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(29, 18, 16, 0.82);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.72),
    0 3px 8px rgba(0, 0, 0, 0.32);
}

.rope-live {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--rope-end-progress, 0.3333) * 100%);
  min-width: 1px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(
      112deg,
      rgba(58, 34, 24, 0.12) 0 4px,
      rgba(255, 221, 151, 0.18) 4px 8px
    ),
    linear-gradient(180deg, #d9ae68, #80603c 52%, #3a281d);
  box-shadow:
    inset 0 1px rgba(255, 239, 191, 0.35),
    inset 0 -2px 2px rgba(30, 12, 8, 0.62),
    0 0 7px rgba(255, 154, 49, 0.12);
  transition: width 180ms ease-out;
}

.rope-burned {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--burn-progress, 0) * 100%);
  height: 100%;
  min-width: 1px;
  border-radius: 999px 0 0 999px;
  background:
    repeating-linear-gradient(110deg, #171111 0 3px, #41302b 3px 6px),
    #1a1110;
  box-shadow: inset -8px 0 8px rgba(255, 63, 18, 0.18);
}

@keyframes timer-impact-rise {
  0% {
    opacity: 0;
    transform: translateY(7px) scale(0.88);
  }
  18% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-12px) scale(1);
  }
}

.rope-burned::after {
  position: absolute;
  right: -9px;
  top: 50%;
  width: 18px;
  height: 24px;
  content: "";
  border-radius: 58% 42% 54% 46% / 68% 58% 42% 32%;
  background: radial-gradient(circle at 50% 65%, #fff2a3 0 16%, #ff9b32 24%, #f0391d 55%, transparent 58%);
  filter: drop-shadow(0 0 7px #ff4d1f);
  transform: translateY(-52%) rotate(4deg);
  animation: rope-flame-flicker 320ms ease-in-out infinite alternate;
}

.rope-status {
  justify-self: end;
  color: #8f7871;
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.game-board.urgent .burning-rope {
  box-shadow:
    inset 0 1px rgba(255, 239, 191, 0.35),
    0 0 15px rgba(174, 18, 30, 0.38);
}

.game-board.urgent .rope-status {
  color: #ff7250;
}

.streak-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.streak-banner.hot {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 88, 31, 0.5);
}

.streak-banner.stage-kindled {
  color: #ffcc73;
  background: rgba(255, 92, 30, 0.035);
}

.streak-banner.stage-inferno {
  color: #ffd98e;
  border-color: rgba(255, 106, 38, 0.18);
  background: rgba(255, 70, 21, 0.06);
  box-shadow: inset 0 0 20px rgba(255, 73, 22, 0.04);
  transform: scale(1.015);
}

.streak-banner.stage-cataclysm {
  color: #fff0ad;
  border-color: rgba(255, 183, 72, 0.34);
  background: linear-gradient(90deg, rgba(120, 12, 24, 0.12), rgba(255, 84, 24, 0.1), rgba(120, 12, 24, 0.12));
  box-shadow: 0 0 26px rgba(255, 68, 19, 0.12);
  transform: scale(1.035);
}

.streak-banner.ash-feedback {
  color: #b7a9a5;
  border-color: rgba(150, 139, 135, 0.22);
}

.waiting-header,
.active-row-label {
  display: flex;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
}

.waiting-header {
  margin: 34px 0 12px;
}

.waiting-header .eyebrow,
.active-row-label .eyebrow {
  margin-bottom: 5px;
}

.waiting-area {
  display: grid;
  gap: 6px;
  margin: 0 -8px 30px;
  padding: 10px 8px 14px;
  overflow-x: auto;
  border-top: 1px solid rgba(255, 115, 62, 0.12);
  border-bottom: 1px solid rgba(255, 115, 62, 0.18);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(20% - 1px),
      rgba(255, 117, 62, 0.035) 20%
    );
  scrollbar-color: var(--blood) rgba(0, 0, 0, 0.25);
}

.waiting-row {
  display: grid;
  grid-template-columns: 48px minmax(650px, 1fr);
  gap: 8px;
  align-items: stretch;
  min-width: 706px;
  content-visibility: auto;
  contain-intrinsic-size: auto 96px;
}

.waiting-row-label {
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  color: #806764;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.waiting-row:last-child .waiting-row-label {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 91, 31, 0.5);
}

.waiting-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.waiting-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  min-height: 88px;
  align-items: center;
  padding: 8px 9px;
  overflow: hidden;
  border: 1px solid rgba(var(--tier-rgb), 0.24);
  border-radius: 3px 10px 3px 10px;
  background:
    linear-gradient(145deg, rgba(var(--tier-rgb), 0.1), transparent 60%),
    rgba(9, 3, 4, 0.62);
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.waiting-card.queue-advanced,
.word-card.queue-advanced {
  animation: queue-slide 300ms ease-out both;
}

.waiting-card.actionable {
  cursor: pointer;
}

.waiting-card.actionable:hover {
  z-index: 2;
  border-color: rgba(var(--tier-rgb), 0.72);
  box-shadow: 0 0 16px rgba(var(--tier-rgb), 0.12);
  transform: translateY(-1px);
}

.waiting-card.poison-selected {
  box-shadow: inset 0 0 0 1px rgba(165, 77, 255, 0.55), 0 0 15px rgba(111, 42, 186, 0.17);
}

.poison-allowance {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px;
  padding: 4px 8px;
  border: 1px solid rgba(175, 90, 255, 0.3);
  border-radius: 999px;
  color: #d8adff;
  background: rgba(64, 24, 91, 0.34);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.poison-allowance.spent {
  border-color: rgba(154, 135, 148, 0.2);
  color: #8f7c89;
  background: rgba(39, 31, 37, 0.4);
}

.waiting-tier {
  color: var(--tier-color);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6rem;
  font-weight: 900;
}

.waiting-word {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.86rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr;
  gap: 5px;
}

.queue-action {
  min-width: 64px;
  min-height: 32px;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  color: #bfa7a1;
  background: rgba(0, 0, 0, 0.34);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
}

.queue-action:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.poison-selected .poison-action {
  color: #f4ddff;
  border-color: rgba(185, 95, 255, 0.72);
  background: rgba(74, 26, 112, 0.72);
}

.poison-action::before {
  margin-right: 3px;
  content: "☣";
}

.active-row-label {
  margin-bottom: 11px;
}

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

.word-card {
  position: relative;
  display: flex;
  min-height: 190px;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(var(--tier-rgb), 0.34);
  border-radius: 4px 18px 4px 18px;
  background:
    linear-gradient(160deg, rgba(var(--tier-rgb), 0.13), transparent 55%),
    rgba(8, 2, 4, 0.54);
  transition: transform 180ms ease, border-color 180ms ease;
}

.word-card.tier-3 {
  box-shadow: inset 0 -8px 22px rgba(var(--tier-rgb), 0.07);
}

.word-card.tier-4 {
  box-shadow: inset 0 -10px 26px rgba(var(--tier-rgb), 0.08);
}

.word-card.tier-5 {
  border-color: rgba(var(--tier-rgb), 0.5);
  box-shadow: inset 0 -12px 30px rgba(var(--tier-rgb), 0.11);
}

.word-card:hover {
  border-color: rgba(var(--tier-rgb), 0.72);
  box-shadow: 0 0 22px rgba(var(--tier-rgb), 0.12);
  transform: translateY(-3px);
}

.word-card.team-poisoned-card {
  box-shadow:
    inset 0 0 0 1px rgba(169, 80, 255, 0.45),
    inset 0 -14px 28px rgba(116, 205, 59, 0.06),
    0 0 24px rgba(100, 31, 163, 0.12);
}

.poison-mark {
  position: absolute;
  right: 8px;
  top: 8px;
  color: #ca8dff;
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.corruption-hit {
  animation: corruption-hit 520ms ease-out both;
}

.solved-card-reveal {
  --burn-delay: 0ms;
  position: fixed;
  z-index: 55;
  display: flex;
  min-width: 150px;
  min-height: 120px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(var(--tier-rgb), 0.8);
  border-radius: 4px 18px 4px 18px;
  color: var(--ink);
  pointer-events: none;
  background:
    linear-gradient(160deg, rgba(var(--tier-rgb), 0.28), transparent 58%),
    #170609;
  box-shadow:
    0 0 0 1px rgba(255, 191, 93, 0.18),
    0 0 34px rgba(var(--tier-rgb), 0.4),
    0 18px 44px rgba(0, 0, 0, 0.56);
  animation: solved-card-burn 1.8s var(--burn-delay) cubic-bezier(0.2, 0.72, 0.3, 1) both;
}

.solved-card-reveal::before {
  position: absolute;
  inset: auto -12% -50%;
  height: 92%;
  content: "";
  background:
    radial-gradient(ellipse at 18% 100%, #fff4a6 0 8%, #ff9b22 9% 22%, transparent 42%),
    radial-gradient(ellipse at 52% 100%, #fff4a6 0 9%, #ff4b16 10% 28%, transparent 48%),
    radial-gradient(ellipse at 84% 100%, #ffd25e 0 7%, #c91e25 8% 24%, transparent 44%);
  filter: blur(2px);
  mix-blend-mode: screen;
  animation: solved-card-flames 1.4s calc(var(--burn-delay) + 220ms) ease-in both;
}

.solved-card-reveal::after {
  position: absolute;
  inset: auto 0 0;
  height: 0;
  content: "";
  background:
    radial-gradient(circle at 18% 12%, transparent 0 5px, #130e0e 6px),
    radial-gradient(circle at 62% 8%, transparent 0 7px, #130e0e 8px),
    linear-gradient(#241719, #070505);
  opacity: 0.94;
  animation: solved-card-char 1.05s calc(var(--burn-delay) + 600ms) ease-in both;
}

.solved-card-reveal.poisoned-solve {
  border-color: rgba(182, 109, 255, 0.88);
  box-shadow:
    0 0 0 1px rgba(142, 213, 79, 0.24),
    0 0 36px rgba(158, 72, 221, 0.5),
    0 18px 44px rgba(0, 0, 0, 0.56);
}

.solved-card-label,
.solved-card-answer,
.solved-card-tier {
  position: relative;
  z-index: 2;
}

.solved-card-label {
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.solved-card-answer {
  max-width: 100%;
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 2vw, 1.75rem);
  line-height: 1.05;
  text-align: center;
}

.solved-card-tier {
  margin-top: 12px;
  color: var(--tier-color);
  font-size: 0.58rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.tier-label {
  color: var(--tier-color);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.card-word {
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.15rem, 2vw, 1.75rem);
  line-height: 1.05;
  text-align: center;
}

.hidden-word {
  color: #68484a;
  letter-spacing: 0.18em;
}

.card-value {
  color: var(--muted);
  font-size: 0.67rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.turn-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.live-guess-feed {
  display: grid;
  gap: 8px;
  max-width: 760px;
  margin: 20px auto 0;
  padding: 11px 13px;
  border: 1px solid rgba(255, 148, 72, 0.2);
  border-radius: 12px;
  background: rgba(20, 6, 9, 0.72);
}

.live-guess-heading {
  display: flex;
  gap: 14px;
  align-items: baseline;
  justify-content: space-between;
}

.live-guess-heading .eyebrow {
  margin: 0;
}

.live-guess-empty {
  margin: 0;
  color: #806d68;
  font-size: 0.68rem;
}

.live-guess-list {
  display: grid;
  gap: 6px;
}

.live-guess-row {
  display: grid;
  grid-template-columns: minmax(64px, auto) minmax(0, 1fr) auto;
  gap: 9px;
  align-items: baseline;
}

.live-guess-name {
  overflow: hidden;
  color: var(--gold);
  font-size: 0.65rem;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.live-guess-text {
  overflow-wrap: anywhere;
  color: #f6e9dc;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
}

.live-guess-caret {
  color: var(--ember);
  animation: live-guess-blink 760ms steps(1, end) infinite;
}

.guess-attempt-history {
  display: grid;
  gap: 5px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.guess-attempt-label {
  color: #806d68;
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.guess-attempt-list {
  display: grid;
  gap: 4px;
}

.guess-attempt-row {
  display: grid;
  grid-template-columns: minmax(64px, auto) minmax(0, 1fr) auto;
  gap: 9px;
  align-items: baseline;
  opacity: 0.76;
}

.guess-attempt-result {
  color: var(--muted);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.guess-attempt-row.correct .guess-attempt-result {
  color: var(--gold);
}

.guess-attempt-row.incorrect .guess-attempt-result {
  color: #a28e88;
}

@keyframes live-guess-blink {
  50% {
    opacity: 0;
  }
}

.guess-dock {
  position: sticky;
  z-index: 10;
  bottom: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  max-width: 620px;
  margin: 30px auto 0;
  padding: 10px;
  border: 1px solid rgba(255, 143, 74, 0.35);
  border-radius: 14px;
  background: rgba(16, 4, 7, 0.92);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(20px);
}

.guess-dock input {
  border: 0;
  background: transparent;
}

.guess-dock .primary-button {
  width: auto;
}

.countdown-panel {
  display: grid;
  min-height: 520px;
  place-items: center;
  padding: 40px;
  border-radius: 5px 34px 5px 34px;
  text-align: center;
}

.countdown-number {
  margin: 12px 0;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(6rem, 20vw, 13rem);
  line-height: 0.8;
  text-shadow: 0 0 50px rgba(255, 64, 20, 0.48);
}

.countdown-copy {
  color: var(--muted);
}

.victory-card {
  position: relative;
  display: grid;
  min-height: 560px;
  place-items: center;
  align-content: center;
  gap: 30px;
  padding: 50px;
  overflow: hidden;
  border-radius: 5px 34px 5px 34px;
  text-align: center;
}

.victory-card::before {
  position: absolute;
  inset: auto 5% -60% 5%;
  height: 100%;
  content: "";
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 183, 67, 0.8), rgba(255, 49, 20, 0.35) 30%, transparent 68%);
  filter: blur(10px);
  animation: victory-rise 1.5s ease-out both;
}

.victory-content {
  position: relative;
  z-index: 1;
  width: min(680px, 100%);
}

.final-score {
  margin: 18px 0 30px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 4.8rem;
}

.victory-statistics {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  text-align: left;
}

.victory-statistics h3 {
  margin-bottom: 6px;
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
}

.victory-statistics-copy {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.victory-team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
}

.victory-team-stat {
  padding: 18px;
  border: 1px solid rgba(255, 127, 69, 0.16);
  border-radius: 4px 18px 4px 18px;
  background: rgba(5, 2, 3, 0.52);
  animation: victory-stat-rise 700ms ease-out both;
}

.victory-team-stat:nth-child(2) {
  animation-delay: 90ms;
}

.victory-team-stat:nth-child(3) {
  animation-delay: 180ms;
}

.victory-team-stat:nth-child(4) {
  animation-delay: 270ms;
}

.victory-team-stat.winner {
  border-color: rgba(255, 189, 85, 0.52);
  background:
    linear-gradient(145deg, rgba(255, 91, 31, 0.14), transparent 58%),
    rgba(25, 7, 8, 0.82);
  box-shadow: 0 0 26px rgba(255, 82, 23, 0.14);
}

.victory-team-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.victory-team-heading h4 {
  margin: 0;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.victory-team-heading strong {
  color: var(--gold);
  white-space: nowrap;
}

.player-stat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}

.player-stat-table th,
.player-stat-table td {
  padding: 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.player-stat-table thead th {
  color: var(--muted);
  font-size: 0.6rem;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: bottom;
}

.player-stat-table .stat-group-row th {
  color: #d8b29b;
  text-align: center;
}

.player-stat-table .stat-group-row th:first-child {
  width: 20%;
  padding-left: 0;
  text-align: left;
}

.player-stat-table .stat-group-row th:last-child {
  width: 14%;
  text-align: right;
}

.player-stat-table .stat-detail-row th {
  text-align: right;
}

.player-stat-table tbody th {
  padding-left: 0;
  overflow-wrap: anywhere;
  text-align: left;
}

.player-stat-table td {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.victory-actions {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
}

.loading-screen {
  display: grid;
  min-height: 60vh;
  place-items: center;
  align-content: center;
  color: var(--muted);
}

.sigil-loader {
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 143, 74, 0.28);
  border-top-color: var(--ember);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(255, 66, 24, 0.2);
  animation: spin 1.2s linear infinite;
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  max-width: min(390px, calc(100% - 40px));
}

.toast {
  padding: 14px 17px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ember);
  border-radius: 4px 12px 4px 12px;
  color: #f5ded6;
  background: rgba(27, 6, 10, 0.96);
  box-shadow: var(--shadow);
  animation: toast-in 240ms ease-out both;
}

.toast.success {
  border-left-color: var(--gold);
}

.toast.poison {
  border-color: rgba(174, 92, 244, 0.44);
  border-left-color: var(--poison);
  box-shadow: 0 14px 50px rgba(101, 29, 139, 0.26);
}

.toast.ash {
  color: #c2b7b2;
  border-left-color: var(--ash);
  filter: saturate(0.45);
}

.toast.urgent {
  border-left-color: #bb202d;
}

.score-impact {
  position: absolute;
  z-index: 4;
  right: 10px;
  top: 42px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 181, 78, 0.28);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(18, 4, 6, 0.92);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  white-space: nowrap;
  animation: score-impact 850ms ease-out both;
}

.score-impact.tier-4,
.score-impact.tier-5 {
  box-shadow: 0 0 20px rgba(255, 74, 20, 0.28);
}

.ash-collapse {
  animation: ash-collapse 500ms ease-in both !important;
}

.poison-reward {
  animation: poison-reward 620ms ease-out both;
}

.rules-dialog {
  width: min(900px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: clamp(24px, 5vw, 46px);
  overflow: auto;
  border: 1px solid rgba(255, 139, 71, 0.36);
  border-radius: 5px 32px 5px 32px;
  color: var(--ink);
  background: #19070b;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.75);
}

.rules-dialog::backdrop {
  background: rgba(4, 1, 2, 0.82);
  backdrop-filter: blur(8px);
}

.dialog-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 1.7rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin: 28px 0;
  background: var(--line);
}

.rules-grid article {
  padding: 24px;
  background: #19070b;
}

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

.rule-number {
  color: var(--ember);
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
}

.notice-copy {
  margin: 22px 0 0;
  color: #8d7370;
  font-size: 0.75rem;
}

.victory-layer {
  position: fixed;
  z-index: 60;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 100%, rgba(255, 190, 77, 0.9), rgba(237, 47, 19, 0.45) 28%, transparent 68%);
}

.victory-layer.active {
  animation: eclipse 1.8s ease-out both;
}

@keyframes drift {
  to { transform: translate3d(12vw, -5vh, 0) scale(1.18); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes flame-waver {
  from {
    border-radius: 58% 42% 56% 44% / 68% 58% 42% 32%;
    transform: rotate(-4deg)
      scale(calc(0.84 + var(--stage-level) * 0.06 + var(--victory-progress) * 0.2));
  }
  to {
    border-radius: 42% 58% 46% 54% / 58% 68% 32% 42%;
    transform: rotate(6deg)
      scale(calc(0.89 + var(--stage-level) * 0.06 + var(--victory-progress) * 0.2));
  }
}

@keyframes victory-threshold-pulse {
  to { filter: drop-shadow(0 0 8px var(--gold)); transform: translate(50%, -50%) scale(1.35); }
}

@keyframes rope-flame-flicker {
  from { transform: translateY(-52%) rotate(-5deg) scale(0.9, 1.08); }
  to { transform: translateY(-58%) rotate(7deg) scale(1.08, 0.92); }
}

@keyframes ember-turbulence {
  to { transform: translate3d(-5px, -8px, 0) scale(1.15); opacity: calc(var(--stage-level) * 0.25); }
}

@keyframes board-breathe {
  to { opacity: 0.55; transform: scale(1.004); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
}

@keyframes eclipse {
  0% { opacity: 0; transform: scale(0.4); }
  42% { opacity: 0.9; }
  100% { opacity: 0; transform: scale(1.5); }
}

@keyframes victory-rise {
  from { transform: translateY(35%); opacity: 0; }
}

@keyframes victory-stat-rise {
  from { transform: translateY(18px); opacity: 0; }
}

@keyframes queue-slide {
  from { opacity: 0.35; transform: translateY(-12px) scale(0.98); filter: brightness(1.6); }
}

@keyframes score-impact {
  from { opacity: 0; transform: translateY(12px) scale(0.85); }
  35% { opacity: 1; transform: translateY(0) scale(1.06); }
}

@keyframes ash-collapse {
  55% { filter: grayscale(0.8); opacity: 0.7; transform: scaleY(0.72); }
  to { filter: grayscale(1); opacity: 0; transform: scaleY(0.08) translateY(16px); }
}

@keyframes solved-card-burn {
  0% { opacity: 1; transform: scale(1); filter: brightness(1); }
  18% {
    opacity: 1;
    transform: scale(1.035);
    filter: brightness(1.25) saturate(1.15);
  }
  58% { opacity: 1; transform: scale(1.01) translateY(-2px); }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(-18px);
    filter: grayscale(1) brightness(0.34) blur(2px);
  }
}

@keyframes solved-card-flames {
  0% { opacity: 0; transform: translateY(24%) scaleX(0.9); }
  35% { opacity: 0.95; }
  100% { opacity: 0; transform: translateY(-96%) scaleX(1.1); }
}

@keyframes solved-card-char {
  from { height: 0; }
  to { height: 112%; }
}

@keyframes corruption-hit {
  35% {
    border-color: var(--poison-acid);
    filter: hue-rotate(55deg) contrast(1.2);
    transform: translateX(-3px);
  }
  65% { border-color: var(--poison); transform: translateX(3px); }
}

@keyframes poison-reward {
  40% {
    border-color: var(--poison);
    box-shadow: 0 0 30px rgba(153, 72, 220, 0.4), inset 0 -10px 24px rgba(129, 207, 63, 0.08);
  }
}

@media (max-width: 960px) {
  .landing,
  .lobby-layout {
    grid-template-columns: 1fr;
  }

  .landing {
    padding-top: 24px;
  }

  .lobby-controls {
    position: static;
    order: -1;
  }

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

  .waiting-header,
  .active-row-label {
    align-items: start;
    flex-direction: column;
    gap: 3px;
  }

  .word-card {
    min-height: 155px;
  }
}

@media (max-width: 640px) {
  .site-header,
  #app {
    width: min(100% - 24px, 1220px);
  }

  .site-header {
    min-height: 68px;
  }

  #app {
    min-height: calc(100vh - 68px);
    padding-top: 24px;
  }

  .brand-word {
    display: none;
  }

  .header-actions {
    gap: 10px;
  }

  .header-actions .text-button {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
  }

  .sound-button {
    min-width: 0;
  }

  .connection-status {
    display: none;
  }

  h1 {
    font-size: clamp(3.4rem, 19vw, 5.2rem);
  }

  .ritual-panel {
    padding: 22px;
  }

  .victory-card {
    gap: 24px;
    padding: 32px 18px;
  }

  .victory-content h2 {
    font-size: clamp(1.8rem, 10vw, 2.4rem);
  }

  .final-score {
    margin: 12px 0 22px;
    font-size: 4rem;
  }

  .victory-statistics-copy {
    line-height: 1.5;
  }

  .player-stat-table thead th {
    font-size: 0.52rem;
    letter-spacing: 0.01em;
  }

  .room-heading {
    align-items: start;
    flex-direction: column;
  }

  .team-grid,
  .rules-grid {
    grid-template-columns: 1fr;
  }

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

  .game-board {
    padding: 18px 12px 24px;
  }

  .turn-topline {
    align-items: start;
  }

  .timer {
    min-width: 88px;
  }

  .timer-track {
    width: 100%;
  }

  .rope-timer {
    margin-top: -8px;
  }

  .victory-meter {
    width: calc(100% - 54px);
  }

  .score-team {
    padding: 13px;
  }

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

  .word-card {
    min-height: 145px;
    padding: 14px;
  }

  .word-card:last-child {
    grid-column: 1 / -1;
    min-height: 125px;
  }

  .guess-dock {
    grid-template-columns: 1fr;
  }

  .guess-dock .primary-button {
    width: 100%;
  }
}

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

  .team-flame,
  .streak-banner,
  .word-card,
  .waiting-card {
    transform: none !important;
  }

  .score-impact {
    animation-name: toast-in !important;
  }

  .solved-card-reveal {
    animation-name: solved-card-reveal-reduced !important;
    animation-duration: 1.2s !important;
  }

  .solved-card-reveal::before,
  .solved-card-reveal::after {
    display: none;
  }
}

@keyframes solved-card-reveal-reduced {
  0%, 72% { opacity: 1; }
  100% { opacity: 0; }
}
