:root {
  color-scheme: light;
  --ink: #1f1a14;
  --muted: #5c5448;
  --accent: #d97b3b;
  --accent-ink: #5a3416;
  --panel: #fff6e7;
  --panel-edge: #ead6be;
  --wash-1: #f0e6d6;
  --wash-2: #e4efe1;
  --shadow: rgba(65, 46, 21, 0.16);
  --chip: rgba(217, 123, 59, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Futura", "Gill Sans", sans-serif;
  color: var(--ink);
  background: radial-gradient(
      circle at 15% 20%,
      rgba(255, 255, 255, 0.7),
      rgba(255, 255, 255, 0)
    ),
    radial-gradient(
      circle at 85% 0%,
      rgba(255, 255, 255, 0.4),
      rgba(255, 255, 255, 0)
    ),
    linear-gradient(130deg, var(--wash-1), var(--wash-2));
}

body.play-mode {
  background: linear-gradient(
      120deg,
      rgba(255, 248, 236, 0.78),
      rgba(238, 226, 210, 0.65)
    ),
    url("./img/pagoda.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.page {
  min-height: 100vh;
  display: block;
  padding: 16px 16px 24px;
}

.shell {
  width: min(1500px, 96vw);
  margin: 0 auto;
  padding: 8px 4px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(640px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.board-panel {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.board {
  width: min(70vw, 560px);
  aspect-ratio: 1 / 1;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
}

#board canvas {
  top: 0;
  left: 0;
}

.board-control {
  position: absolute;
  z-index: 13;
}

.board-control.is-flashing {
  animation: boardControlFlash 0.45s ease;
}

@keyframes boardControlFlash {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(255, 196, 120, 0);
  }
  50% {
    transform: translateY(-1px) scale(1.06);
    box-shadow: 0 0 18px rgba(255, 196, 120, 0.6);
  }
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 rgba(255, 196, 120, 0);
  }
}

#mysteryTimerBtn {
  right: 10px;
  top: 10px;
  border: 1px solid rgba(150, 90, 50, 0.45);
  background: linear-gradient(
      135deg,
      rgba(255, 244, 228, 0.98),
      rgba(255, 226, 196, 0.92)
    );
  color: #4b2a12;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 12px 24px rgba(90, 60, 30, 0.28);
}

#mysteryTimerBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(90, 60, 30, 0.32);
}

#enigmaTimerBtn {
  right: 10px;
  top: 44px;
  border: 1px solid var(--panel-edge);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 8px 18px rgba(70, 50, 30, 0.2);
}

#enigmaTimerBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(70, 50, 30, 0.25);
}

#mysteryTimerCountdown {
  left: 10px;
  top: 10px;
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  color: #fff8ea;
  background: rgba(31, 26, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 14px rgba(30, 20, 10, 0.35);
  pointer-events: none;
}

#enigmaTimerCountdown {
  left: 10px;
  top: 44px;
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  color: #fff8ea;
  background: rgba(31, 26, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 14px rgba(30, 20, 10, 0.35);
  pointer-events: none;
}

#speedTimerCountdown {
  left: 10px;
  top: 78px;
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  color: #fff8ea;
  background: rgba(31, 26, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 14px rgba(30, 20, 10, 0.35);
  pointer-events: none;
}

#secondChanceCountdown {
  left: 10px;
  top: 112px;
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  color: #fff8ea;
  background: rgba(31, 26, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 14px rgba(30, 20, 10, 0.35);
  pointer-events: none;
}

#fadeOutCountdown {
  left: 10px;
  top: 146px;
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff6dd;
  background: rgba(20, 15, 10, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 12px rgba(30, 20, 10, 0.35);
  font-family: "Press Start 2P", "VT323", "Courier New", monospace;
  -webkit-font-smoothing: none;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

#multishotCounter {
  left: 0;
  top: 0;
  min-width: 32px;
  padding: 1px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
  text-align: center;
  color: #fff8ea;
  background: rgba(20, 15, 10, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 18px rgba(30, 20, 10, 0.35);
  transform: none;
  pointer-events: none;
}

#ghostban-board {
  z-index: 1;
}

#ghostban-canvas {
  z-index: 2;
}

#ghostban-gray {
  z-index: 3;
}

#ghostban-fadeout {
  z-index: 3;
}

#ghostban-enigma {
  z-index: 4;
}

#ghostban-ghost {
  z-index: 5;
}

#ghostban-fire {
  z-index: 6;
}

#ghostban-frost {
  z-index: 6;
}

#ghostban-flip {
  z-index: 6;
}

#ghostban-spotlight {
  z-index: 11;
}

#ghostban-spyglass {
  z-index: 11;
}

#ghostban-fx {
  z-index: 12;
}

#ghostban-ownership {
  z-index: 6;
}

#ghostban-markup {
  z-index: 7;
}

#ghostban-analysis {
  z-index: 8;
}

#ghostban-cursor {
  z-index: 9;
}

#ghostban-effect {
  z-index: 10;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.hud-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--panel-edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  font-size: 13px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.hud-card span {
  font-size: 18px;
  font-weight: 700;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-edge);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
}

.status--fixed {
  width: 260px;
  max-width: 100%;
}

.status.success {
  border-color: rgba(45, 135, 75, 0.4);
  background: rgba(62, 179, 104, 0.18);
  color: #1e4d30;
}

.status.error {
  border-color: rgba(188, 60, 60, 0.45);
  background: rgba(225, 79, 79, 0.18);
  color: #6a1f1f;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(40, 30, 20, 0.6);
  box-shadow: 0 0 4px rgba(40, 30, 20, 0.2);
}

.status-indicator--black {
  background: #1f1a14;
}

.status-indicator--white {
  background: #fffdf6;
}

.status-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.status-mark__icon {
  width: 12px;
  height: 12px;
  display: block;
}

.status-mark--success {
  color: #1e4d30;
  background: rgba(62, 179, 104, 0.18);
  border-color: rgba(45, 135, 75, 0.4);
}

.status-mark--speed-play {
  color: #24724b;
  background: rgba(62, 179, 104, 0.2);
  border-color: rgba(45, 135, 75, 0.45);
}

.status-mark--speed-solve {
  color: #1f4f92;
  background: rgba(70, 130, 225, 0.22);
  border-color: rgba(53, 100, 185, 0.5);
}

.lives-box {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--panel-edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.coins-box {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--panel-edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.admin-toggle {
  padding: 8px 12px;
  font-size: 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--panel-edge);
}

.admin-toggle.is-active {
  background: var(--chip);
  border-color: rgba(217, 123, 59, 0.5);
  color: var(--accent-ink);
}

.lives-label {
  color: var(--muted);
}

.lives-hearts {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 16px;
}

.heart {
  width: 14px;
  height: 14px;
  position: relative;
  background: #d74b4b;
  transform: rotate(-45deg);
  border-radius: 3px;
}

.heart::before,
.heart::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  background: #d74b4b;
  border-radius: 50%;
}

.heart::before {
  top: -7px;
  left: 0;
}

.heart::after {
  left: 7px;
  top: 0;
}

.coin-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(
      circle at 30% 30%,
      rgba(255, 246, 205, 0.9),
      rgba(255, 246, 205, 0) 60%
    ),
    radial-gradient(
      circle at 65% 65%,
      rgba(255, 196, 82, 0.9),
      rgba(255, 196, 82, 0)
    ),
    linear-gradient(135deg, #f2b349, #d78a1f);
  border: 1px solid rgba(120, 80, 25, 0.5);
  box-shadow: 0 2px 4px rgba(90, 60, 25, 0.25);
}

.bank-icon {
  width: 16px;
  height: 14px;
  border-radius: 3px;
  position: relative;
  background: linear-gradient(135deg, #f1e9dd, #cbbca7);
  border: 1px solid rgba(90, 70, 50, 0.55);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.6),
    0 2px 4px rgba(60, 50, 40, 0.22);
}

.bank-icon::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  left: 4px;
  top: 3px;
  border: 1px solid rgba(90, 70, 50, 0.6);
  background: radial-gradient(
      circle at 35% 35%,
      rgba(255, 255, 255, 0.85),
      rgba(255, 255, 255, 0)
    ),
    linear-gradient(135deg, #f5efe6, #cbbca7);
}

.bank-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 2px;
  left: 3px;
  bottom: 2px;
  border-radius: 2px;
  background: rgba(90, 70, 50, 0.55);
}

.coins-value {
  font-weight: 700;
  color: var(--accent-ink);
}

.lives-box.is-flashing {
  animation: livesFlash 0.45s ease;
}

@keyframes livesFlash {
  0% {
    background: rgba(225, 79, 79, 0.3);
    border-color: rgba(188, 60, 60, 0.5);
  }
  100% {
    background: #fff;
    border-color: var(--panel-edge);
  }
}

.panel {
  display: grid;
  gap: 12px;
  padding: 10px;
  border-radius: 16px;
  background: #fffdfa;
  border: 1px solid var(--panel-edge);
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 1fr));
  gap: 12px;
  align-items: start;
}

.panel-section {
  display: grid;
  gap: 8px;
  align-content: start;
}

label {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: #fff;
  font-size: 14px;
}

.controls {
  display: grid;
  gap: 8px;
}

.controls--challenges,
.controls--hints,
.controls--passives {
  padding: 8px;
  border-radius: 12px;
  border: 1px dashed rgba(90, 70, 50, 0.4);
  background: rgba(90, 70, 50, 0.05);
}

.controls--challenges {
  border-color: rgba(140, 85, 60, 0.4);
  background: rgba(170, 90, 70, 0.07);
}

.button {
  border: 1px solid var(--panel-edge);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.controls--passives .button {
  background: rgba(160, 200, 245, 0.18);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(90, 60, 30, 0.15);
}

.button.active {
  background: var(--chip);
  border-color: rgba(217, 123, 59, 0.5);
  color: var(--accent-ink);
}

.button--challenge {
  border-color: rgba(90, 70, 50, 0.55);
  background: #f7ece2;
  color: #4b3d2c;
}

.button--challenge.active {
  background: rgba(120, 70, 50, 0.22);
  border-color: rgba(90, 70, 50, 0.7);
  color: #3a2d1f;
}

.button--challenge:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.mystery-row,
.ghost-row,
.enigma-row,
.infection-row,
.speed-row,
.fadeout-row,
.fire-row,
.frost-row,
.flip-row,
.spotlight-row,
.spyglass-row,
.passive-row,
.hint-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 1fr);
  align-items: center;
  gap: 8px;
}

.passive-row--indicator {
  grid-template-columns: minmax(0, 1fr) auto;
}

.passive-label {
  border: 1px solid var(--panel-edge);
  background: rgba(160, 200, 245, 0.18);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  text-align: center;
}

.passive-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(90, 70, 50, 0.4);
  background: rgba(120, 110, 100, 0.2);
  box-shadow: inset 0 0 6px rgba(60, 45, 30, 0.25);
  transition: background 0.2s ease, box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.passive-indicator.is-active {
  background: rgba(255, 150, 50, 0.9);
  border-color: rgba(200, 105, 30, 0.85);
  box-shadow: 0 0 12px rgba(255, 140, 40, 0.65);
}

.hint-row {
  grid-template-columns: minmax(0, 1fr) minmax(130px, 1fr);
}

.hint-row .button {
  width: 100%;
  min-width: 0;
  white-space: normal;
  text-align: center;
}

.controls--challenges .button,
.controls--passives .button {
  width: 100%;
  min-width: 0;
  white-space: normal;
  text-align: center;
}

.mystery-level,
.ghost-level,
.enigma-level,
.infection-level,
.speed-level,
.fadeout-level,
.fire-level,
.frost-level,
.flip-level,
.spotlight-level,
.spyglass-level,
.passive-level,
.hint-level {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(90, 70, 50, 0.4);
  background: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  min-width: 0;
}

.mystery-level label,
.ghost-level label,
.enigma-level label,
.infection-level label,
.speed-level label,
.fadeout-level label,
.fire-level label,
.frost-level label,
.flip-level label,
.spotlight-level label,
.spyglass-level label,
.passive-level label,
.hint-level label {
  display: inline-flex;
  align-items: center;
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.mystery-level input[type="range"],
.ghost-level input[type="range"],
.enigma-level input[type="range"],
.infection-level input[type="range"],
.speed-level input[type="range"],
.fadeout-level input[type="range"],
.fire-level input[type="range"],
.frost-level input[type="range"],
.flip-level input[type="range"],
.spotlight-level input[type="range"],
.spyglass-level input[type="range"],
.passive-level input[type="range"],
.hint-level input[type="range"] {
  width: auto;
  min-width: 0;
  flex: 1 1 0;
}

.hint-level input[type="range"] {
  width: auto;
  min-width: 0;
  flex: 1 1 0;
}

.mystery-level__value,
.ghost-level__value,
.enigma-level__value,
.infection-level__value,
.speed-level__value,
.fadeout-level__value,
.fire-level__value,
.frost-level__value,
.flip-level__value,
.spotlight-level__value,
.spyglass-level__value,
.passive-level__value,
.hint-level__value {
  min-width: 16px;
  text-align: right;
  font-weight: 700;
  color: var(--accent-ink);
}

.log {
  max-height: 200px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed var(--panel-edge);
  background: #fff;
  font-size: 12px;
  color: var(--muted);
}

.log-item {
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(234, 214, 190, 0.6);
}

.log-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.row-hint {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(110, 200, 140, 0.14),
    rgba(110, 200, 140, 0.34),
    rgba(110, 200, 140, 0.14)
  );
  border: 1px solid rgba(78, 156, 102, 0.45);
  box-shadow: 0 8px 16px rgba(45, 90, 60, 0.18);
  transition: opacity 0.2s ease;
  z-index: 5;
}

.row-hint.is-active {
  opacity: 1;
}

.col-hint {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(98, 176, 206, 0.14),
    rgba(98, 176, 206, 0.34),
    rgba(98, 176, 206, 0.14)
  );
  border: 1px solid rgba(72, 138, 163, 0.45);
  box-shadow: 0 8px 16px rgba(36, 74, 92, 0.18);
  transition: opacity 0.2s ease;
  z-index: 5;
}

.col-hint.is-active {
  opacity: 1;
}

.diag-hint {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  border-radius: 999px;
  transform-origin: center;
  background: linear-gradient(
    90deg,
    rgba(110, 200, 140, 0.14),
    rgba(110, 200, 140, 0.34),
    rgba(110, 200, 140, 0.14)
  );
  border: 1px solid rgba(78, 156, 102, 0.45);
  box-shadow: 0 8px 16px rgba(45, 90, 60, 0.18);
  transition: opacity 0.2s ease;
  z-index: 5;
}

.diag-hint.is-active {
  opacity: 1;
}

.play-panel {
  align-self: start;
}

.difficulty-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--panel-edge);
  display: grid;
  gap: 4px;
}

.difficulty-card.is-hidden {
  display: none;
}

.difficulty-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-ink);
}

.play-section.is-hidden {
  display: none;
}

.play-list {
  display: grid;
  gap: 8px;
}

.play-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--panel-edge);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
}

.controls--passives .play-chip {
  background: rgba(160, 200, 245, 0.18);
}

.controls--challenges .play-chip {
  background: rgba(190, 120, 90, 0.12);
  border-color: rgba(140, 90, 60, 0.45);
}

.play-chip__level {
  font-weight: 700;
  color: var(--accent-ink);
  font-size: 12px;
}

.play-chip__indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(90, 70, 50, 0.4);
  background: rgba(120, 110, 100, 0.2);
  box-shadow: inset 0 0 4px rgba(60, 45, 30, 0.2);
}

.play-chip__indicator.is-active {
  background: rgba(255, 150, 50, 0.9);
  border-color: rgba(200, 105, 30, 0.85);
  box-shadow: 0 0 8px rgba(255, 140, 40, 0.6);
}

.play-hint {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.play-hint.is-used {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.play-chip.is-upgraded,
.play-hint.is-upgraded {
  animation: upgradeFlash 0.35s ease-out;
}

@keyframes upgradeFlash {
  0% {
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transform: scale(1);
  }
  45% {
    box-shadow: 0 0 14px rgba(255, 170, 80, 0.7);
    transform: scale(1.03);
  }
  100% {
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    transform: scale(1);
  }
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 248, 234, 0.86);
  backdrop-filter: blur(2px);
  z-index: 20;
  transition: opacity 0.2s ease;
}

.play-overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.play-overlay__panel {
  padding: 18px 20px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--panel-edge);
  box-shadow: 0 16px 30px rgba(65, 46, 21, 0.25);
  display: grid;
  gap: 12px;
  justify-items: center;
  min-width: 180px;
}

.play-overlay__title {
  font-size: 16px;
  font-weight: 600;
}

.play-overlay__cta {
  min-width: 160px;
}

.play-overlay--start .play-overlay__cta--start {
  position: relative;
  min-width: 200px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-color: rgba(190, 110, 40, 0.8);
  color: #2b1b12;
  background: linear-gradient(135deg, #ffb24d 0%, #ffd98b 52%, #ff9f3a 100%);
  box-shadow: 0 12px 24px rgba(255, 157, 60, 0.35),
    inset 0 0 0 1px rgba(255, 250, 240, 0.6);
  overflow: hidden;
  animation: startPulse 2.4s ease-in-out infinite;
}

.play-overlay--start .play-overlay__cta--start::before {
  content: "";
  position: absolute;
  top: -80%;
  left: -50%;
  width: 60%;
  height: 260%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.5),
    rgba(255, 255, 255, 0)
  );
  transform: rotate(20deg);
  animation: startShine 3.2s ease-in-out infinite;
  pointer-events: none;
}

.play-overlay--start .play-overlay__cta--start:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 16px 28px rgba(255, 157, 60, 0.45),
    inset 0 0 0 1px rgba(255, 250, 240, 0.7);
}

.play-overlay__cta--secondary {
  min-width: 160px;
  background: rgba(120, 110, 100, 0.12);
  border-color: rgba(90, 70, 50, 0.35);
  color: var(--muted);
}

.play-overlay__cta--secondary:hover {
  box-shadow: 0 6px 14px rgba(70, 50, 30, 0.12);
  transform: translateY(-1px);
}

.start-passives {
  width: min(320px, 80vw);
  display: grid;
  gap: 8px;
  text-align: left;
  justify-items: stretch;
}

.start-passives.is-hidden {
  display: none;
}

.start-passives__label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.start-passives__list {
  display: grid;
  gap: 6px;
}

.start-banked,
.start-best {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(244, 238, 231, 0.9);
  border: 1px solid rgba(190, 170, 150, 0.5);
  font-size: 12px;
  color: var(--muted);
}

.start-banked__value,
.start-best__value {
  font-weight: 700;
  color: #4a3829;
}

.start-best.is-hidden {
  display: none;
}

@keyframes startPulse {
  0%,
  100% {
    transform: translateY(0);
    box-shadow: 0 12px 24px rgba(255, 157, 60, 0.35),
      inset 0 0 0 1px rgba(255, 250, 240, 0.6);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(255, 157, 60, 0.45),
      inset 0 0 0 1px rgba(255, 250, 240, 0.7);
  }
}

@keyframes startShine {
  0%,
  60% {
    left: -60%;
    opacity: 0;
  }
  70% {
    opacity: 0.6;
  }
  100% {
    left: 140%;
    opacity: 0;
  }
}

.play-overlay--shop .play-overlay__panel {
  min-width: 420px;
  max-width: 520px;
  align-items: stretch;
  justify-items: stretch;
  text-align: left;
}

.play-overlay--admin .play-overlay__panel {
  min-width: 320px;
  max-width: 420px;
  align-items: stretch;
  justify-items: stretch;
  text-align: left;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-grid {
  display: grid;
  gap: 10px;
}

.admin-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) 70px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.admin-row--quad {
  grid-template-columns: 70px minmax(0, 1fr) 56px 70px;
}

.admin-label {
  font-size: 11px;
  color: var(--muted);
}

.admin-select,
.admin-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: #fff;
  font-size: 12px;
}

.admin-input[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.admin-action,
.admin-close {
  padding: 6px 10px;
  font-size: 12px;
  min-width: 0;
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shop-title-group {
  display: grid;
  gap: 2px;
}

.shop-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.shop-coins {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent-ink);
}

.shop-section {
  display: grid;
  gap: 6px;
}

.shop-section.is-hidden {
  display: none;
}

.shop-section__label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.shop-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  background: #fff;
  font-size: 13px;
}

.shop-item__info {
  display: grid;
  gap: 4px;
}

.shop-item__name {
  font-weight: 600;
}

.shop-item__price {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.shop-item__badge {
  font-size: 11px;
  color: var(--muted);
}

.shop-item.is-owned {
  opacity: 0.6;
}

.shop-item.is-warn {
  animation: shopWarn 0.35s ease;
}

.shop-buy {
  min-width: 74px;
}

.shop-buy.is-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.shop-empty {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
}

.coin-burst {
  position: absolute;
  top: 8px;
  left: 50%;
  width: calc(100% - 32px);
  max-width: 640px;
  display: none;
  align-items: flex-start;
  justify-content: center;
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 3;
  box-sizing: border-box;
}

.coin-burst.is-active {
  display: flex;
  animation: coinBurst 0.35s ease-out;
}

.coin-burst__grid {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px 18px;
  padding: 16px 16px 12px;
  border-radius: 16px;
  background: rgba(255, 250, 243, 0.92);
  border: 1px solid rgba(210, 180, 150, 0.6);
  box-shadow: 0 16px 28px rgba(70, 40, 25, 0.18);
  text-align: center;
}

.coin-burst__slot {
  display: grid;
  gap: 4px;
  justify-items: center;
  min-width: 0;
}

.coin-burst__slot.is-placeholder {
  visibility: hidden;
}

.coin-burst__slot--speed-solve {
  transform: translateX(18px);
}

.coin-burst__value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Comic Sans MS", "Comic Neue", "Marker Felt", "Trebuchet MS",
    sans-serif;
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  color: #f7d58c;
  -webkit-text-stroke: 1.4px #2b1d16;
  text-shadow: 1px 1px 0 #2b1d16, -1px 1px 0 #2b1d16,
    1px -1px 0 #2b1d16, -1px -1px 0 #2b1d16,
    0 4px 8px rgba(50, 30, 20, 0.35);
}

.coin-burst__value--total {
  font-size: 44px;
}

.coin-burst__icon {
  transform: scale(1.2);
}

.coin-burst__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
}

@keyframes coinBurst {
  0% {
    opacity: 0;
    transform: translateY(0) scale(0.98);
  }
  25% {
    opacity: 1;
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    opacity: 1;
    transform: translateY(-4px) scale(1);
  }
}

@keyframes shopWarn {
  0% {
    box-shadow: 0 0 0 rgba(200, 80, 60, 0);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(200, 80, 60, 0.25);
    background: rgba(255, 235, 228, 0.9);
  }
  100% {
    box-shadow: 0 0 0 rgba(200, 80, 60, 0);
  }
}

.play-overlay--retry .play-overlay__panel {
  min-width: 220px;
}

.play-overlay--retry .play-overlay__title {
  font-size: 18px;
}

.play-overlay--retry .play-overlay__cta {
  min-width: 200px;
  font-size: 16px;
  padding: 12px 18px;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .board {
    width: min(92vw, 560px);
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .play-overlay--shop .play-overlay__panel {
    min-width: 300px;
    max-width: 420px;
  }

  .shop-list {
    grid-template-columns: 1fr;
  }
}

.play-overlay--map {
  background: rgba(245, 237, 226, 0.92);
  backdrop-filter: blur(2px);
}

.play-map {
  width: min(92vw, 720px);
  margin: 0 auto;
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 252, 246, 0.95);
  border: 1px solid var(--panel-edge);
  box-shadow: 0 24px 40px rgba(60, 40, 20, 0.18);
  display: grid;
  gap: 12px;
  position: relative;
}

.play-map__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.play-map__title {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-ink);
}

.play-map__status {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(217, 123, 59, 0.15);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(217, 123, 59, 0.25);
}

.play-map__status--overlay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  pointer-events: none;
  box-shadow: 0 6px 12px rgba(60, 40, 20, 0.12);
}

.play-map__stage {
  position: relative;
  border-radius: 18px;
  padding: 12px;
  background: linear-gradient(180deg, #fdf7ef 0%, #f5eadc 100%);
  border: 1px solid rgba(228, 203, 180, 0.7);
  overflow: visible;
  min-height: 360px;
}

.play-map__level {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 248, 236, 0.9);
  border: 2px solid rgba(55, 40, 22, 0.4);
  font-family: "Comic Sans MS", "Comic Neue", "Marker Felt", "Trebuchet MS",
    sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #3c2a18;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.play-map__canvas {
  position: relative;
  width: 100%;
  height: 100%;
}

.play-map__info {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(228, 203, 180, 0.9);
  background: rgba(255, 248, 241, 0.92);
  display: grid;
  gap: 4px;
}

.play-map__info-title {
  font-weight: 700;
  font-size: 14px;
}

.play-map__info-desc {
  font-size: 12px;
  color: var(--muted);
}

.play-map__info-hint {
  font-size: 11px;
  color: var(--accent-ink);
  font-weight: 600;
}

.play-map__hex {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--map-hex-width);
  height: var(--map-hex-height);
  --hex-border-size: 2px;
  --hex-inner-scale: 0.92;
  --hex-shape: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  appearance: none;
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  transform: translate(-50%, -50%) scale(var(--hex-scale, 1));
  transition: transform 0.2s ease;
  cursor: pointer;
  clip-path: var(--hex-shape);
}

.play-map__shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.play-map__shape polygon {
  fill: #141414;
}

.play-map__shape polygon.play-map__shape-fill {
  fill: var(--hex-fill, #fef8ef);
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(var(--hex-inner-scale));
}

.play-map__hex > :not(.play-map__shape):not(.play-map__marker) {
  position: relative;
  z-index: 1;
}

.play-map__hex--animate {
  opacity: 0;
  animation: playMapHexIn 0.45s ease both;
}

@keyframes playMapHexIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.play-map__hex:hover {
  --hex-scale: 1.03;
}

.play-map__hex.is-current {
  --hex-border-size: 3px;
  --hex-inner-scale: 0.9;
}

.play-map__hex.is-selected {
  --hex-scale: 1.05;
  --hex-inner-scale: 0.88;
}

.play-map__hex.is-reachable {
  --hex-inner-scale: 0.9;
}

.play-map__hex.is-visited {
  opacity: 0.45;
  filter: grayscale(0.5);
}

.play-map__icon {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-map__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.play-map__marker {
  position: absolute;
  top: calc(var(--map-hex-height) * 0.14);
  left: 50%;
  width: calc(var(--map-hex-height) * 0.15);
  height: calc(var(--map-hex-height) * 0.15);
  border-radius: 50%;
  background: #0a0a0a;
  border: 1px solid #050505;
  transform: translateX(-50%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.play-map__tooltip {
  position: absolute;
  max-width: 200px;
  padding: 10px 12px;
  background: #fffdf9;
  border: 2px solid #141414;
  border-radius: 12px;
  box-shadow: 0 12px 18px rgba(32, 24, 16, 0.2);
  font-size: 12px;
  z-index: 5;
  pointer-events: auto;
  display: grid;
  gap: 6px;
}

.play-map__tooltip::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fffdf9;
  border-left: 2px solid #141414;
  border-bottom: 2px solid #141414;
  transform: rotate(45deg);
  top: 14px;
  left: -6px;
}

.play-map__tooltip[data-side="left"]::after {
  left: auto;
  right: -6px;
  transform: rotate(225deg);
}

.play-map__tooltip[data-side="top"]::after {
  left: 18px;
  top: auto;
  bottom: -6px;
  transform: rotate(135deg);
}

.play-map__tooltip[data-side="bottom"]::after {
  left: 18px;
  top: -6px;
  transform: rotate(-45deg);
}

.play-map__tooltip-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.play-map__tooltip-body {
  color: var(--muted);
  line-height: 1.4;
}

.play-map__tooltip-cta {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
}

.play-overlay--treasure {
  background: rgba(246, 240, 230, 0.86);
}

.play-overlay--congrats {
  background: rgba(246, 238, 226, 0.9);
  z-index: 22;
}

.play-overlay__panel--treasure {
  width: min(86vw, 420px);
  display: grid;
  gap: 12px;
}

.treasure-subtitle {
  font-size: 12px;
  color: var(--muted);
}

.treasure-list {
  display: grid;
  gap: 10px;
}

.treasure-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--panel-edge);
  background: rgba(255, 255, 255, 0.9);
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.treasure-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(60, 40, 20, 0.16);
}

.treasure-card__title {
  font-weight: 700;
  font-size: 14px;
}

.treasure-card__desc {
  font-size: 12px;
  color: var(--muted);
}
