:root {
  color-scheme: dark;
  --bg: #0d1110;
  --bg-2: #151c19;
  --panel: rgba(17, 21, 18, 0.9);
  --panel-strong: rgba(9, 12, 11, 0.92);
  --line: rgba(231, 186, 86, 0.3);
  --line-soft: rgba(235, 221, 183, 0.14);
  --text: #fff4d8;
  --muted: #c6b889;
  --faint: #857b63;
  --gold: #e8b84d;
  --gold-2: #b87c28;
  --jade: #3ed391;
  --teal: #31b9b7;
  --danger: #e85e3d;
  --ruby: #d84b43;
  --stone: #2b312c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --focus: 0 0 0 3px rgba(62, 211, 145, 0.35);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(5, 8, 7, 0.6), rgba(10, 12, 11, 0.92)),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.app {
  min-height: 100vh;
  background-image:
    linear-gradient(90deg, rgba(7, 9, 8, 0.76), rgba(7, 9, 8, 0.16), rgba(7, 9, 8, 0.78)),
    url("./assets/temple-table.png");
  background-position: center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  position: relative;
}

.app::before {
  content: "";
  position: fixed;
  inset: 0;
  border: 0 solid transparent;
  box-shadow: none;
  pointer-events: none;
  z-index: 95;
  transition: border-color 220ms ease, border-width 220ms ease, box-shadow 260ms ease;
}

.app--frame-mine::before {
  border-width: 5px;
  border-color: var(--jade);
  box-shadow: inset 0 0 28px rgba(62, 211, 145, 0.42);
  animation: frameMinePulse 2.4s ease-in-out infinite;
}

.app--frame-retreated::before {
  border-width: 5px;
  border-color: var(--gold);
  box-shadow: inset 0 0 28px rgba(232, 184, 77, 0.38);
}

.app--frame-end::before {
  border-width: 5px;
  border-color: var(--danger);
  box-shadow: inset 0 0 32px rgba(232, 94, 61, 0.42);
}

@keyframes frameMinePulse {
  0%, 100% { box-shadow: inset 0 0 22px rgba(62, 211, 145, 0.32); }
  50%      { box-shadow: inset 0 0 36px rgba(62, 211, 145, 0.55); }
}

@media (prefers-reduced-motion: reduce) {
  .app--frame-mine::before { animation: none; }
}

/* TREASURE BURST — full-screen gold jackpot moment */

.treasure-burst {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 240ms ease-out;
}

.treasure-burst.is-active { opacity: 1; }

.treasure-burst.is-leaving {
  opacity: 0;
  transition: opacity 480ms ease-in;
}

.treasure-burst__flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, #fff7c8 0%, rgba(255, 215, 107, 0.85) 35%, transparent 70%);
  opacity: 0;
  animation: treasureFlash 0.55s ease-out;
}

@keyframes treasureFlash {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  100% { opacity: 0; }
}

.treasure-burst__dim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 230, 130, 0.55) 0%, rgba(170, 100, 20, 0.6) 32%, rgba(50, 22, 0, 0.86) 78%, rgba(0, 0, 0, 0.92) 100%);
  backdrop-filter: blur(2.5px);
}

.treasure-burst__rays {
  position: absolute;
  inset: -25vmin;
  background:
    conic-gradient(from 0deg,
      transparent 0deg,
      rgba(255, 235, 150, 0.4) 5deg,
      transparent 11deg,
      transparent 22deg,
      rgba(255, 215, 107, 0.32) 27deg,
      transparent 33deg,
      transparent 50deg,
      rgba(255, 245, 200, 0.28) 55deg,
      transparent 60deg);
  animation: treasureRaysSpin 3s linear;
  filter: blur(1.6px);
  mix-blend-mode: screen;
}

.treasure-burst__rays--reverse {
  animation: treasureRaysSpinReverse 3.6s linear;
  opacity: 0.7;
}

@keyframes treasureRaysSpin {
  0%   { transform: rotate(0deg);   opacity: 0; }
  10%  { opacity: 1; }
  88%  { opacity: 1; }
  100% { transform: rotate(280deg); opacity: 0; }
}

@keyframes treasureRaysSpinReverse {
  0%   { transform: rotate(0deg);    opacity: 0; }
  10%  { opacity: 0.7; }
  88%  { opacity: 0.7; }
  100% { transform: rotate(-220deg); opacity: 0; }
}

.treasure-burst__coins {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.treasure-burst__coin {
  position: absolute;
  width: var(--size, 16px);
  height: var(--size, 16px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fffbe0 0%, #ffe580 32%, #ffd76b 55%, #c98a30 80%, #6b3e0d 100%);
  box-shadow:
    0 0 18px rgba(255, 235, 150, 0.95),
    0 0 32px rgba(255, 215, 107, 0.55),
    inset 0 0 5px rgba(255, 250, 220, 0.7);
  opacity: 0;
  transform: translate(0, 0) scale(0.4);
  animation: coinFly var(--dur, 1500ms) cubic-bezier(0.16, 0.72, 0.28, 1) var(--delay, 0ms) forwards;
}

@keyframes coinFly {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.25) rotate(0deg); }
  14%  { opacity: 1; transform: translate(calc(var(--dx) * 0.18), calc(var(--dy) * 0.18)) scale(1.15) rotate(80deg); }
  60%  { opacity: 1; transform: translate(calc(var(--dx) * 0.7), calc(var(--dy) * 0.7)) scale(1) rotate(360deg); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.55) rotate(720deg); }
}

.treasure-burst__stack {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center;
  padding: 0 12px;
}

.treasure-burst__big {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  font-size: clamp(160px, 44vmin, 420px);
  line-height: 0.92;
  background: linear-gradient(180deg, #ffffff 0%, #fff5b0 22%, #ffd76b 50%, #e8a73a 78%, #8a5c1a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow:
    0 0 60px rgba(255, 235, 150, 0.85),
    0 0 18px rgba(255, 215, 107, 1),
    0 0 6px rgba(255, 245, 200, 1);
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.6));
  letter-spacing: -0.02em;
  animation: treasureBigPop 2.6s cubic-bezier(0.22, 1.6, 0.32, 1);
}

@keyframes treasureBigPop {
  0%   { transform: scale(0.2) rotate(-14deg); opacity: 0; filter: blur(12px) drop-shadow(0 0 0 transparent); }
  14%  { transform: scale(1.32) rotate(4deg);  opacity: 1; filter: blur(0) drop-shadow(0 8px 28px rgba(0,0,0,0.6)); }
  24%  { transform: scale(0.94) rotate(-2deg); }
  36%  { transform: scale(1.06) rotate(1deg); }
  48%  { transform: scale(1) rotate(0deg); }
  60%  { transform: scale(1.04) rotate(0deg); }
  88%  { transform: scale(1) rotate(0deg);     opacity: 1; }
  100% { transform: scale(1.12) rotate(0deg);  opacity: 0; }
}

.treasure-burst__label {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 800;
  font-size: clamp(20px, 5vmin, 36px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff5b0;
  text-shadow:
    0 0 24px rgba(255, 235, 150, 0.9),
    0 0 6px rgba(232, 184, 77, 0.95);
  animation: treasureLabel 2.6s ease-out;
}

@keyframes treasureLabel {
  0%   { opacity: 0; transform: translateY(36px) scale(0.85); }
  18%  { opacity: 1; transform: translateY(0) scale(1); }
  88%  { opacity: 1; transform: translateY(-2px) scale(1); }
  100% { opacity: 0; transform: translateY(-16px) scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  .treasure-burst__rays,
  .treasure-burst__flash,
  .treasure-burst__coin { display: none; }
  .treasure-burst__big,
  .treasure-burst__label { animation: none; opacity: 1; }
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, auto) minmax(220px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(9, 12, 11, 0.9);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.topbar__left,
.topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar__right {
  justify-content: flex-end;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 2px;
  text-align: center;
}

.brand__mark {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(232, 184, 77, 0.65);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--gold);
  background:
    radial-gradient(circle at 50% 28%, rgba(232, 184, 77, 0.26), transparent 38%),
    #151611;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.38);
}

.brand h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  line-height: 1;
  color: #ffe6a3;
  text-shadow: 0 2px 0 #4a2d12, 0 10px 22px rgba(0, 0, 0, 0.42);
}

.brand p {
  margin: 0;
  max-width: 360px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
}

.stat {
  min-width: 86px;
  border-left: 1px solid var(--line-soft);
  padding-left: 14px;
}

.stat:first-child {
  border-left: 0;
  padding-left: 0;
}

.stat__label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
}

.stat__value {
  display: block;
  margin-top: 3px;
  color: var(--gold);
  font-weight: 900;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 12px rgba(232, 184, 77, 0.18);
}

.stat--risk .stat__value {
  color: var(--danger);
}

.stat--online .stat__value {
  color: var(--teal);
}

.icon-button,
.ghost-button,
.primary-button,
.danger-button,
.choice-button,
.mini-button {
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    color 150ms ease,
    opacity 150ms ease;
}

.icon-button,
.ghost-button,
.mini-button {
  border: 1px solid var(--line-soft);
  background: rgba(255, 244, 216, 0.06);
  color: var(--text);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
}

.ghost-button,
.primary-button,
.danger-button,
.mini-button {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.primary-button {
  background: linear-gradient(180deg, #f4ca68, #a46724);
  color: #1b1209;
  border: 1px solid rgba(255, 231, 164, 0.55);
}

.danger-button {
  background: linear-gradient(180deg, #f07c51, #92361f);
  color: #fff5e6;
  border: 1px solid rgba(255, 193, 152, 0.45);
}

.ghost-button--rules {
  background: rgba(232, 184, 77, 0.14);
  border-color: rgba(232, 184, 77, 0.5);
  color: var(--gold);
}

.ghost-button--rules:hover,
.ghost-button--rules:focus-visible {
  background: rgba(232, 184, 77, 0.22);
  color: #ffe5a2;
}

.ghost-button--rules .svg-icon {
  color: var(--gold);
}

.icon-button:hover,
.ghost-button:hover,
.mini-button:hover,
.primary-button:hover,
.danger-button:hover,
.choice-button:hover {
  transform: translateY(-1px);
}

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

.svg-icon {
  width: 1.1em;
  height: 1.1em;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  line-height: 1;
}

.svg-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-strip {
  padding: 16px 20px 0;
}

.action-strip .decision-panel {
  max-width: 880px;
  margin: 0 auto;
}

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 16px 20px 20px;
}

.board {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(260px, 1fr) auto;
  gap: 16px;
}

.temple-strip,
.player-table,
.decision-panel,
.log-panel,
.score-panel,
.setup-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.temple-strip {
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2,
.section-title h3 {
  margin: 0;
  color: #ffe5a2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.1;
}

.section-title span,
.section-title small {
  color: var(--muted);
  font-size: 12px;
}

.path {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 4px 2px 8px;
  max-height: min(64vh, 560px);
}

.path::-webkit-scrollbar {
  width: 8px;
}

.path::-webkit-scrollbar-thumb {
  background: rgba(232, 184, 77, 0.34);
  border-radius: 99px;
}

.empty-path {
  width: 100%;
  min-height: 110px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed rgba(232, 184, 77, 0.28);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
  text-align: center;
  padding: 18px;
  font-size: 13px;
}

.card {
  flex: 0 0 auto;
  width: 100%;
  height: 104px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 104px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 10px;
  border: 2px solid rgba(255, 229, 162, 0.55);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34), inset 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 229, 162, 0.22);
  border-radius: 6px;
  pointer-events: none;
}

.card__art {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 0;
}

.card__symbol {
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 52px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.card__footer {
  position: relative;
  z-index: 1;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.card__label {
  position: relative;
  z-index: 1;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 229, 162, 0.85);
  font-weight: 800;
}

.card__value {
  display: block;
  font-size: 38px;
  line-height: 1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #ffe5a2;
  text-shadow: 0 0 18px rgba(232, 184, 77, 0.25);
}

.card__note {
  display: block;
  margin-top: 4px;
  color: rgba(255, 244, 216, 0.7);
  font-size: 12px;
  line-height: 1.25;
}

.card__tag {
  position: relative;
  z-index: 1;
  align-self: center;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 244, 216, 0.85);
}

.card--danger .card__tag {
  background: rgba(232, 94, 61, 0.22);
  border-color: rgba(232, 94, 61, 0.6);
  color: #ffd9cf;
}

.card--treasure {
  background:
    radial-gradient(circle at 50% 42%, rgba(62, 211, 145, 0.28), transparent 42%),
    linear-gradient(160deg, #183625, #102019 55%, #07100d);
  border-color: rgba(62, 211, 145, 0.75);
}

.card--hazard {
  background:
    radial-gradient(circle at 50% 42%, rgba(232, 94, 61, 0.25), transparent 42%),
    linear-gradient(160deg, #3b1712, #1c1110 58%, #090807);
  border-color: rgba(232, 94, 61, 0.78);
}

.card--artifact {
  background:
    radial-gradient(circle at 50% 42%, rgba(49, 185, 183, 0.32), transparent 42%),
    linear-gradient(160deg, #0f3b3b, #102223 56%, #070d0d);
  border-color: rgba(49, 185, 183, 0.78);
}

.player-table {
  overflow: hidden;
  position: relative;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.player-row {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 244, 216, 0.08);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
}

.player-row.is-active {
  background: rgba(62, 211, 145, 0.1);
  border-color: rgba(62, 211, 145, 0.32);
}

.player-row.is-out {
  color: rgba(255, 244, 216, 0.55);
}

.player-row.is-me {
  outline: 1px solid rgba(232, 184, 77, 0.55);
  outline-offset: -1px;
}

.player-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.player-row__status {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

.player-row__status strong {
  color: var(--jade);
}

.player-row__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.player-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 244, 216, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  min-width: 0;
}

.player-stat__label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-stat__value {
  font-size: 20px;
  font-weight: 900;
  color: #fff5d7;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.player-stat__value.gem-stack {
  color: var(--jade);
}

.player-stat__value--banked {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(232, 184, 77, 0.2);
}

.player-stat__value--artifacts {
  font-size: 14px;
  color: rgba(255, 244, 216, 0.85);
  flex-wrap: wrap;
  gap: 4px 6px;
}

.player-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.26);
}

.player-label {
  min-width: 0;
}

.player-label strong {
  display: block;
  overflow: hidden;
  color: #fff3d6;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  border: 1px solid rgba(255, 244, 216, 0.14);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.number-cell {
  font-size: 20px;
  font-weight: 900;
  color: #fff5d7;
}

.gem-stack {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--jade);
  font-weight: 900;
}

.status-cell {
  color: var(--muted);
  font-size: 13px;
}

.status-cell strong {
  color: var(--jade);
}

.side {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(220px, 1fr);
  gap: 14px;
}

.decision-panel,
.log-panel,
.score-panel {
  padding: 14px;
}

.decision-panel {
  position: relative;
  overflow: hidden;
}

.decision-panel::after {
  content: "";
  position: absolute;
  inset: auto 14px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 184, 77, 0.65), transparent);
  pointer-events: none;
}

.decision-panel--handoff {
  background:
    radial-gradient(circle at 18% 0%, rgba(49, 185, 183, 0.18), transparent 36%),
    var(--panel-strong);
}

.choice-stage {
  display: grid;
  gap: 12px;
}

.voter-card {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  background: rgba(255, 244, 216, 0.06);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.privacy-card {
  min-height: 156px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 244, 216, 0.08), rgba(255, 244, 216, 0.03)),
    rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}

.privacy-card span,
.leave-preview span,
.intel-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.privacy-card strong {
  color: #fff5d7;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  line-height: 1;
}

.privacy-card p,
.leave-preview p {
  margin: 0;
  color: rgba(255, 244, 216, 0.76);
  font-size: 13px;
  line-height: 1.5;
}

.voter-card span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.voter-card strong {
  font-size: 24px;
  line-height: 1;
  color: #fff5d7;
}

.choice-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.intel-grid,
.leave-preview {
  display: grid;
  gap: 8px;
}

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

.intel-grid div,
.leave-preview div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 244, 216, 0.1);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.18);
}

.intel-grid strong,
.leave-preview strong {
  display: block;
  margin-top: 4px;
  color: #fff5d7;
  font-size: 23px;
  line-height: 1;
}

.leave-preview {
  grid-template-columns: 1fr 1fr;
}

.leave-preview p {
  grid-column: 1 / -1;
  padding: 0 2px;
}

.choice-button {
  min-height: 78px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  color: var(--text);
  border: 1px solid rgba(255, 244, 216, 0.16);
}

.choice-button strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  line-height: 1;
}

.choice-button span {
  color: rgba(255, 244, 216, 0.72);
  font-size: 12px;
}

.choice-button--stay {
  background:
    radial-gradient(circle at 22% 18%, rgba(62, 211, 145, 0.22), transparent 34%),
    linear-gradient(180deg, #1d754f, #0d3327);
}

.choice-button--leave {
  background:
    radial-gradient(circle at 22% 18%, rgba(232, 184, 77, 0.18), transparent 34%),
    linear-gradient(180deg, #9a3f24, #4b1c15);
}

.decision-meta {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.choice-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.choice-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 244, 216, 0.08);
  border-radius: var(--radius);
  font-size: 13px;
}

.choice-list b {
  color: #fff5d7;
}

.log-panel {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  padding: 6px;
}

.log-panel.is-closed {
  grid-template-rows: auto;
}

.log-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #ffe5a2;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.log-toggle:hover,
.log-toggle:focus-visible {
  background: rgba(232, 184, 77, 0.08);
  outline: none;
}

.log-toggle__main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.log-toggle__main .svg-icon {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.log-toggle__count {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 8px;
  border: 1px solid rgba(255, 244, 216, 0.16);
  border-radius: 99px;
}

.log-toggle__caret {
  display: inline-flex;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 180ms ease;
}

.log-toggle__caret.is-open {
  transform: rotate(180deg);
}

.log-list {
  margin: 8px 6px 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  max-height: 220px;
}

.log-list li {
  padding: 5px 0;
  border-bottom: 1px solid rgba(255, 244, 216, 0.06);
  color: rgba(255, 244, 216, 0.62);
  font-size: 12px;
  line-height: 1.3;
}

.log-list li:first-child {
  color: #fff5d7;
  font-weight: 600;
}

.log-more {
  margin: 6px 6px 4px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.06em;
}

.rules-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: rgba(255, 244, 216, 0.78);
  font-size: 13px;
  line-height: 1.35;
}

.score-panel {
  display: grid;
  gap: 10px;
}

.winner {
  padding: 12px;
  border: 1px solid rgba(62, 211, 145, 0.42);
  border-radius: var(--radius);
  background: rgba(62, 211, 145, 0.12);
}

.winner strong {
  color: #a8ffd4;
}

.setup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px);
}

.setup-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
}

.setup-copy {
  margin: -2px 0 14px;
  color: rgba(255, 244, 216, 0.74);
  font-size: 14px;
  line-height: 1.45;
}

.setup-grid {
  display: grid;
  gap: 12px;
}

.setup-control {
  display: grid;
  gap: 6px;
}

.setup-control label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-control input {
  width: 100%;
  min-height: 42px;
  color: var(--text);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.24);
  padding: 0 12px;
}

.setup-player {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 244, 216, 0.1);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.15);
}

.toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.setup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.hidden {
  display: none !important;
}

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

  .side {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .log-panel.is-open {
    min-height: 220px;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .topbar__left,
  .topbar__right {
    justify-content: center;
  }

  .brand {
    order: -1;
  }

  .action-strip {
    padding: 12px 12px 0;
  }

  .main-grid {
    padding: 8px 12px 12px;
  }

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

  .player-stat__value {
    font-size: 18px;
  }

  .player-stat__label {
    font-size: 9px;
  }

  .path {
    max-height: min(56vh, 480px);
  }

  .card {
    height: 92px;
    grid-template-columns: 84px 1fr auto;
    padding: 8px 12px 8px 8px;
  }

  .card__symbol {
    width: 76px;
    height: 76px;
    font-size: 44px;
  }

  .card__value {
    font-size: 32px;
  }

  .choice-stage {
    gap: 8px;
  }

  .voter-card {
    min-height: 56px;
    padding: 10px 14px;
  }

  .privacy-card {
    min-height: 96px;
    padding: 12px 14px;
    gap: 4px;
  }

  .privacy-card strong {
    font-size: 26px;
  }

  .privacy-card p,
  .leave-preview p {
    font-size: 12px;
    line-height: 1.35;
  }

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

  .choice-button strong {
    font-size: 22px;
  }

  .choice-button span {
    font-size: 11px;
  }

  .intel-grid div,
  .leave-preview div {
    padding: 6px 8px;
  }

  .intel-grid strong,
  .leave-preview strong {
    font-size: 18px;
  }
}

@media (max-width: 520px) {
  .brand h1 {
    font-size: 24px;
  }

  .topbar__left,
  .topbar__right {
    flex-wrap: wrap;
  }

  .stat {
    min-width: 74px;
  }

  .choice-button strong {
    font-size: 24px;
  }
}

/* Card flip animation */
@keyframes cardReveal {
  0% { transform: rotateY(90deg) scale(0.85); opacity: 0; }
  60% { transform: rotateY(-8deg) scale(1.04); opacity: 1; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}

.card--latest {
  animation: cardReveal 0.42s ease-out;
}

.card--lost {
  opacity: 0.4;
  filter: grayscale(1);
}

/* Hazard flash */
@keyframes hazardFlash {
  0%, 100% { box-shadow: none; }
  20% { box-shadow: inset 0 0 0 4px rgba(232, 94, 61, 0.72); }
  40% { box-shadow: none; }
  60% { box-shadow: inset 0 0 0 4px rgba(232, 94, 61, 0.72); }
  80% { box-shadow: none; }
}

.app--hazard-flash {
  animation: hazardFlash 0.7s ease-in-out;
}

/* Game-over full-screen overlay */
.gameover-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.gameover-panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 28px 24px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.gameover-title {
  margin: 0;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  color: #ffe5a2;
}

.gameover-winner {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 18px;
  border: 1px solid rgba(62, 211, 145, 0.42);
  border-radius: var(--radius);
  background: rgba(62, 211, 145, 0.1);
}

.gameover-winner__label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gameover-winner__name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  line-height: 1;
  color: #a8ffd4;
}

.gameover-winner__score {
  font-size: 22px;
  font-weight: 900;
  color: #fff5d7;
}

@keyframes pulse {
  0%, 100% { text-shadow: 0 0 8px rgba(168, 255, 212, 0.4); }
  50% { text-shadow: 0 0 24px rgba(168, 255, 212, 0.95), 0 0 40px rgba(62, 211, 145, 0.5); }
}

.gameover-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.gameover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Rules list (used in modal and onboarding) */
.rules-list {
  display: grid;
  gap: 10px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: rgba(255, 244, 216, 0.82);
  font-size: 14px;
  line-height: 1.45;
}

/* First-run onboarding */
.onboarding-rules {
  margin-bottom: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.18);
}

.onboarding-rules summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 900;
  font-size: 14px;
  user-select: none;
}

/* ==================================================
   Cinematic upgrade — ceremony + card spotlight +
   catastrophe overlay. Pure additions.
   ================================================== */

/* GAME-OVER CEREMONY */
.gameover-overlay { perspective: 1200px; }

.gameover-panel {
  position: relative;
  background:
    radial-gradient(circle at 50% 0%, rgba(232, 184, 77, 0.12), transparent 60%),
    linear-gradient(180deg, #2e2924 0%, #1c1814 50%, #110e0b 100%);
  border: 2px solid rgba(232, 184, 77, 0.45);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.6),
    inset 0 2px 0 rgba(232, 184, 77, 0.35),
    inset 0 -3px 0 rgba(0, 0, 0, 0.55),
    0 32px 80px rgba(0, 0, 0, 0.85);
  clip-path: polygon(
    14px 0, calc(100% - 14px) 0,
    100% 14px, 100% calc(100% - 14px),
    calc(100% - 14px) 100%, 14px 100%,
    0 calc(100% - 14px), 0 14px
  );
  animation: tabletRise 1300ms cubic-bezier(0.22, 1.04, 0.36, 1) 100ms backwards;
}
.gameover-panel::before, .gameover-panel::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--gold-2, #b87c28);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6);
}
.gameover-panel::before { top: 14px; left: 14px; }
.gameover-panel::after  { bottom: 14px; right: 14px; }

@keyframes tabletRise {
  0%   { transform: translateY(120%) rotateX(8deg); opacity: 0; }
  70%  { transform: translateY(-2%)  rotateX(0deg); opacity: 1; }
  85%  { transform: translateY(1.2%); }
  100% { transform: translateY(0); opacity: 1; }
}

.gameover-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  letter-spacing: 0.6em;
  text-transform: uppercase;
  color: var(--gold, #e8b84d);
  text-align: center;
  margin: 0 0 12px;
  animation: fadeUpCinematic 500ms ease-out 1500ms backwards;
}

.gameover-pulse,
.gameover-winner__name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  background: linear-gradient(180deg, #ffe6a3 0%, #e8b84d 50%, #b87c28 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 0 #4a2d12);
  animation: carveIn 700ms cubic-bezier(0.16, 1, 0.3, 1) 1700ms backwards;
}

@keyframes carveIn {
  0%   { opacity: 0; transform: translateY(8px); filter: blur(4px) drop-shadow(0 2px 0 #4a2d12); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0); filter: blur(0) drop-shadow(0 2px 0 #4a2d12); }
}
@keyframes fadeUpCinematic {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gameover-winner__score {
  font-family: Georgia, serif;
  font-size: 18px;
  letter-spacing: 0.2em;
  text-align: center;
  display: block;
  color: var(--gold-bright, #ffe6a3);
  animation: fadeUpCinematic 500ms ease-out 2100ms backwards;
}

.gameover-overlay .choice-list li {
  animation: rowSlide 500ms cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.gameover-overlay .choice-list li:nth-child(1) { animation-delay: 2300ms; }
.gameover-overlay .choice-list li:nth-child(2) { animation-delay: 2400ms; }
.gameover-overlay .choice-list li:nth-child(3) { animation-delay: 2500ms; }
.gameover-overlay .choice-list li:nth-child(4) { animation-delay: 2600ms; }
.gameover-overlay .choice-list li:nth-child(5) { animation-delay: 2700ms; }
.gameover-overlay .choice-list li:nth-child(6) { animation-delay: 2800ms; }
.gameover-overlay .choice-list li:nth-child(7) { animation-delay: 2900ms; }
.gameover-overlay .choice-list li:nth-child(8) { animation-delay: 3000ms; }

@keyframes rowSlide {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}

.gameover-actions { animation: fadeUpCinematic 500ms ease-out 3100ms backwards; }

.dust-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 61;
}

/* CARD SPOTLIGHT + ENHANCED REVEAL (override existing .card--latest) */
.card-spot {
  position: absolute;
  inset: -40px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 229, 162, 0.32) 0%, transparent 55%);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.card--latest {
  animation: cardRiseEnhanced 720ms cubic-bezier(0.22, 1, 0.36, 1);
}
.card--latest .card-spot {
  animation: spotFade 1100ms ease-out;
}

@keyframes cardRiseEnhanced {
  0%   { transform: translateY(48px) scale(0.78); opacity: 0; filter: blur(2px); }
  45%  { transform: translateY(-8px) scale(1.05); opacity: 1; filter: blur(0); }
  70%  { transform: translateY(2px)  scale(1); }
  100% { transform: translateY(0)    scale(1); }
}
@keyframes spotFade {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

/* CATASTROPHE OVERLAY — hazard 2x cinematic moment */
.catastrophe-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.catastrophe-overlay .flash-white {
  position: absolute;
  inset: 0;
  background: #ffffff;
  opacity: 0;
  z-index: 10;
  mix-blend-mode: screen;
}
.catastrophe-overlay.is-active .flash-white {
  animation: catFlash 420ms cubic-bezier(0.05, 0.7, 0.1, 1) forwards;
}
@keyframes catFlash {
  0%   { opacity: 0; }
  6%   { opacity: 1; }
  18%  { opacity: 0.85; }
  45%  { opacity: 0.18; }
  100% { opacity: 0; }
}

.catastrophe-zoom {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transform: scale(0.94);
  transform-origin: 50% 50%;
}
.catastrophe-overlay.is-active .catastrophe-zoom {
  animation: catZoom 1500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes catZoom {
  0%   { transform: scale(0.94); filter: blur(2px); }
  15%  { transform: scale(1.02); filter: blur(0.5px); }
  55%  { transform: scale(1.10); filter: blur(0); }
  100% { transform: scale(1.05); filter: blur(0); }
}

.catastrophe-overlay .crack-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.catastrophe-overlay .crack {
  stroke: rgba(255, 244, 216, 0.55);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(232, 94, 61, 0.6));
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
}
.catastrophe-overlay.is-active .crack { animation: crackDraw 900ms cubic-bezier(0.4, 0, 0.2, 1) 100ms forwards; }
.catastrophe-overlay.is-active .crack-2 { animation-delay: 180ms; }
.catastrophe-overlay.is-active .crack-3 { animation-delay: 240ms; }
.catastrophe-overlay.is-active .crack-4 { animation-delay: 320ms; }

@keyframes crackDraw {
  from { stroke-dashoffset: 800; opacity: 0; }
  20%  { opacity: 1; }
  to   { stroke-dashoffset: 0; opacity: 0.85; }
}

.catastrophe-overlay .vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 30%, rgba(232, 94, 61, 0.35) 70%, rgba(108, 28, 14, 0.7) 100%);
  opacity: 0;
}
.catastrophe-overlay.is-active .vignette {
  animation: catVignette 1400ms cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
@keyframes catVignette {
  0%   { opacity: 0; }
  25%  { opacity: 1; }
  70%  { opacity: 0.55; }
  100% { opacity: 0.18; }
}

.catastrophe-content {
  text-align: center;
  opacity: 0;
  transform: scale(0.7);
  z-index: 4;
}
.catastrophe-overlay.is-active .catastrophe-content {
  animation: catTextIn 500ms cubic-bezier(0.16, 1, 0.3, 1) 200ms forwards;
}
@keyframes catTextIn {
  0%   { opacity: 0; transform: scale(0.7); filter: blur(8px); }
  50%  { opacity: 1; transform: scale(1.08); filter: blur(0); }
  100% { opacity: 1; transform: scale(1); filter: blur(0); }
}
.catastrophe-eyebrow {
  font-family: Inter, sans-serif;
  font-size: 12px;
  letter-spacing: 0.6em;
  text-transform: uppercase;
  color: var(--ruby, #d84b43);
  margin-bottom: 16px;
}
.catastrophe-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(56px, 11vw, 120px);
  font-weight: 900;
  line-height: 1;
  margin: 0;
  background: linear-gradient(180deg, #ffd5b3 0%, #e85e3d 50%, #6b1a0e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(232, 94, 61, 0.4);
  letter-spacing: 0.05em;
}
.catastrophe-subtext {
  margin-top: 16px;
  font-family: Inter, sans-serif;
  font-size: 14px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 244, 216, 0.85);
}

.app--shaking { animation: appShake 700ms steps(14) 1; }
@keyframes appShake {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-4px, 2px); }
  20%  { transform: translate(3px, -2px); }
  30%  { transform: translate(-2px, 3px); }
  40%  { transform: translate(2px, 1px); }
  50%  { transform: translate(-1px, -2px); }
  60%  { transform: translate(1px, 2px); }
  70%  { transform: translate(-1px, 0); }
  85%  { transform: translate(0.5px, -0.5px); }
  100% { transform: translate(0, 0); }
}
