:root {
  --ink: #29324a;
  --cream: #fff8df;
  --sky: #8ed8ff;
  --leaf: #39b96e;
  --mint: #94efd0;
  --gold: #ffcf4a;
  --rose: #ff7aa8;
  --violet: #8d78ff;
  --lake: #3fc5d8;
  --danger: #ef4f64;
  --shadow: 0 18px 50px rgba(41, 50, 74, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 207, 74, 0.55), transparent 22rem),
    radial-gradient(circle at 85% 8%, rgba(255, 122, 168, 0.42), transparent 20rem),
    linear-gradient(155deg, #8ed8ff 0%, #94efd0 42%, #fff8df 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: #27314c;
  background: var(--gold);
  box-shadow: 0 5px 0 rgba(122, 86, 25, 0.25);
  cursor: pointer;
  font-weight: 900;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.04);
}

button:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(122, 86, 25, 0.25);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.5);
  opacity: 0.72;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 3px solid rgba(41, 50, 74, 0.14);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-weight: 800;
}

#app {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  padding: clamp(1rem, 3vw, 2rem);
}

.title-screen {
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: clamp(1.25rem, 5vw, 4rem);
  overflow: hidden;
}

.title-copy {
  max-width: 780px;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 0.8rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 248, 223, 0.74);
  color: #7a4f1f;
  font-weight: 900;
}

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

h1 {
  margin-bottom: 1rem;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: clamp(3rem, 9vw, 7.4rem);
  line-height: 0.86;
  letter-spacing: 0;
  color: #29324a;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.58);
}

.subtitle {
  max-width: 56ch;
  font-size: clamp(1.08rem, 2.2vw, 1.45rem);
  font-weight: 800;
}

.primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.35rem;
}

.primary-actions button,
.wide-button {
  padding: 0.7rem 1.2rem;
  font-size: 1.1rem;
}

.privacy-note {
  max-width: 62ch;
  margin: 1rem 0 0;
  padding: 0.7rem 0.85rem;
  border: 2px solid rgba(63, 197, 216, 0.34);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: rgba(41, 50, 74, 0.9);
  font-size: clamp(0.86rem, 1.45vw, 0.98rem);
  font-weight: 800;
  line-height: 1.35;
}

.privacy-note strong {
  color: #236a77;
}

.hero-art {
  min-height: min(68vh, 650px);
  position: relative;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), transparent 45%),
    linear-gradient(160deg, #59c879 0%, #3db5d9 52%, #7c69db 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-art::before {
  content: "";
  position: absolute;
  inset: 16% 8% auto;
  height: 34%;
  border-radius: 999px 999px 30% 30%;
  background: rgba(255, 248, 223, 0.72);
  clip-path: polygon(0 60%, 10% 44%, 21% 61%, 36% 28%, 49% 57%, 63% 20%, 76% 56%, 88% 38%, 100% 58%, 100% 100%, 0 100%);
}

.castle {
  position: absolute;
  right: 8%;
  bottom: 14%;
  width: 43%;
  height: 52%;
  background: linear-gradient(180deg, #fff1a8, #f8b75a);
  clip-path: polygon(12% 100%, 12% 35%, 24% 35%, 24% 18%, 38% 18%, 38% 35%, 52% 35%, 52% 9%, 68% 9%, 68% 35%, 83% 35%, 83% 100%);
  box-shadow: inset 0 -14px rgba(147, 88, 48, 0.14);
}

.crystal-horn {
  position: absolute;
  left: 13%;
  bottom: 17%;
  width: 34%;
  aspect-ratio: 1;
  background: conic-gradient(from 20deg, #fff, #8ef4ff, #ffcef0, #fff5a5, #fff);
  clip-path: polygon(50% 0, 62% 38%, 98% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 12px 14px rgba(41, 50, 74, 0.22));
}

.setup-screen,
.winner-screen {
  display: grid;
  align-content: center;
  gap: 1rem;
}

.panel {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 4px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 248, 223, 0.9);
  box-shadow: var(--shadow);
}

.panel h2 {
  margin-bottom: 0.2rem;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1;
}

.setup-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
}

.setup-message {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  font-weight: 900;
}

.setup-message.bad {
  border: 2px solid #f6a5b7;
  background: #ffe6ec;
  color: #8d2444;
}

.field {
  display: grid;
  gap: 0.25rem;
  font-weight: 900;
}

.player-forms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 0.85rem;
}

.player-card {
  padding: 0.9rem;
  border: 3px solid rgba(41, 50, 74, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.player-card h3 {
  margin-bottom: 0.6rem;
}

.selected-avatar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 54px;
  margin: 0.25rem 0 0.55rem;
  padding: 0.35rem 0.5rem;
  border: 3px solid;
  border-radius: 8px;
  background: #fff;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.42rem;
}

.avatar-choice {
  min-height: 72px;
  padding: 0.35rem;
  border: 3px solid transparent;
  background: #ffffff;
  box-shadow: none;
  font-size: 0.83rem;
}

.avatar-choice.selected {
  border-color: var(--rose);
  background: #fff0f6;
}

.avatar-choice:disabled,
.avatar-choice.unavailable {
  opacity: 0.48;
  cursor: not-allowed;
  filter: grayscale(0.28);
}

.avatar-choice:disabled:hover,
.avatar-choice.unavailable:hover {
  transform: none;
}

.selected-word {
  display: block;
  margin-top: 0.1rem;
  color: #a73462;
  font-size: 0.72rem;
  font-weight: 900;
}

.unavailable-word {
  color: #7d5962;
}

.avatar-emoji {
  display: block;
  font-size: 1.65rem;
  line-height: 1;
}

.critter-piece {
  --piece-color: #ff7aa8;
  --piece-accent: #ffe5f0;
  --player-ring: #ff4f8f;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 3px solid var(--player-ring);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 62%, var(--piece-accent) 0 24%, transparent 25%),
    linear-gradient(160deg, var(--piece-color), color-mix(in srgb, var(--piece-color), #29324a 18%));
  box-shadow: 0 5px 0 rgba(41, 50, 74, 0.18), 0 8px 14px rgba(41, 50, 74, 0.18);
  color: #29324a;
}

.critter-piece.board {
  width: 28px;
  height: 28px;
  border-width: 3px;
  box-shadow: 0 3px 0 rgba(41, 50, 74, 0.28), 0 7px 10px rgba(41, 50, 74, 0.22);
}

.critter-piece.medium {
  width: 44px;
  height: 44px;
}

.critter-piece.large {
  width: 58px;
  height: 58px;
}

.critter-piece.winner {
  width: 118px;
  height: 118px;
  border-width: 6px;
}

.piece-horn {
  position: absolute;
  top: -13%;
  left: 50%;
  width: 28%;
  height: 38%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #fffdf0 0 35%, #ffcf4a 36% 58%, #9eefff 59% 100%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 1px 1px rgba(41, 50, 74, 0.3));
  z-index: 4;
}

.piece-ear {
  position: absolute;
  top: 8%;
  width: 24%;
  height: 28%;
  border-radius: 50%;
  background: color-mix(in srgb, var(--piece-color), #ffffff 18%);
  z-index: 1;
}

.piece-ear.left {
  left: 10%;
  transform: rotate(-28deg);
}

.piece-ear.right {
  right: 10%;
  transform: rotate(28deg);
}

.piece-face {
  position: absolute;
  inset: 21% 16% 13%;
  border-radius: 48% 48% 44% 44%;
  background: color-mix(in srgb, var(--piece-accent), #ffffff 32%);
  z-index: 2;
}

.piece-eye {
  position: absolute;
  top: 36%;
  width: 12%;
  height: 12%;
  border-radius: 50%;
  background: #29324a;
}

.piece-eye.left {
  left: 27%;
}

.piece-eye.right {
  right: 27%;
}

.piece-cheek {
  position: absolute;
  top: 54%;
  width: 13%;
  height: 9%;
  border-radius: 50%;
  background: rgba(255, 122, 168, 0.28);
}

.piece-cheek.left {
  left: 14%;
}

.piece-cheek.right {
  right: 14%;
}

.piece-muzzle {
  position: absolute;
  left: 50%;
  bottom: 9%;
  width: 42%;
  height: 34%;
  transform: translateX(-50%);
  border-radius: 52% 52% 46% 46%;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 -2px 0 rgba(41, 50, 74, 0.08);
}

.piece-nose {
  position: absolute;
  left: 50%;
  top: 20%;
  width: 28%;
  height: 22%;
  transform: translateX(-50%);
  border-radius: 50% 50% 56% 56%;
  background: #29324a;
}

.piece-mouth {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 34%;
  height: 20%;
  transform: translateX(-50%);
  border-bottom: 2px solid rgba(41, 50, 74, 0.62);
  border-radius: 0 0 999px 999px;
}

.piece-detail {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.player-label {
  position: absolute;
  right: -9px;
  bottom: -8px;
  min-width: 20px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--player-ring);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 900;
  z-index: 6;
  box-shadow: 0 2px 4px rgba(41, 50, 74, 0.25);
}

.critter-piece.board .player-label {
  right: -11px;
  bottom: -8px;
  min-width: 18px;
  height: 16px;
  font-size: 0.52rem;
}

.critter-piece.active-piece {
  animation: tokenBounce 0.85s ease-in-out infinite;
  outline: 4px solid rgba(255, 255, 255, 0.95);
  outline-offset: 3px;
  filter: drop-shadow(0 0 11px rgba(255, 255, 255, 0.95));
}

.critter-piece.foxicorn .piece-ear {
  width: 30%;
  height: 32%;
  border-radius: 12% 80% 20% 80%;
  background: linear-gradient(145deg, #ff9c43 0 55%, #fff2df 56% 100%);
}

.critter-piece.foxicorn .piece-face {
  clip-path: polygon(50% 100%, 10% 25%, 50% 0, 90% 25%);
  background: linear-gradient(180deg, #fff3df 0 34%, #ffffff 35% 100%);
}

.critter-piece.foxicorn .piece-muzzle {
  width: 52%;
  height: 38%;
  bottom: 5%;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
}

.critter-piece.foxicorn .piece-detail {
  left: 50%;
  bottom: 12%;
  width: 18%;
  height: 18%;
  transform: translateX(-50%);
  border-radius: 0 0 50% 50%;
  background: #ffffff;
  box-shadow: -0.28em -0.08em 0 #ffffff, 0.28em -0.08em 0 #ffffff;
}

.critter-piece.turtlecorn {
  border-radius: 42%;
  background:
    radial-gradient(circle at 50% 52%, rgba(255, 255, 255, 0.18) 0 28%, transparent 29%),
    linear-gradient(160deg, #39b96e, #248b55);
}

.critter-piece.turtlecorn .piece-ear {
  top: 32%;
  width: 16%;
  height: 16%;
}

.critter-piece.turtlecorn .piece-face {
  inset: 25% 18% 18%;
  border-radius: 46%;
  background: #c8ffd8;
}

.critter-piece.turtlecorn .piece-detail {
  inset: 10% 9% 28%;
  border-radius: 44%;
  background:
    linear-gradient(90deg, transparent 47%, rgba(41, 50, 74, 0.18) 48% 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, rgba(41, 50, 74, 0.18) 48% 52%, transparent 53%),
    radial-gradient(circle, #8be08f 0 60%, #2f9b5e 61% 100%);
  box-shadow: inset 0 -3px 0 rgba(41, 50, 74, 0.16);
}

.critter-piece.turtlecorn .piece-muzzle {
  width: 34%;
  height: 25%;
  bottom: 10%;
}

.critter-piece.owlcorn .piece-ear {
  width: 28%;
  height: 28%;
  border-radius: 16%;
  background: #6c59d9;
}

.critter-piece.owlcorn .piece-face {
  inset: 20% 12% 13%;
  clip-path: polygon(50% 100%, 5% 20%, 24% 0, 50% 18%, 76% 0, 95% 20%);
  background:
    radial-gradient(circle at 32% 42%, #ffffff 0 17%, transparent 18%),
    radial-gradient(circle at 68% 42%, #ffffff 0 17%, transparent 18%),
    linear-gradient(180deg, #ded8ff, #f4f1ff);
}

.critter-piece.owlcorn .piece-eye {
  top: 38%;
  width: 10%;
  height: 10%;
}

.critter-piece.owlcorn .piece-muzzle {
  left: 50%;
  top: 55%;
  width: 18%;
  height: 18%;
  border-radius: 0;
  background: #ffcf4a;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  box-shadow: none;
}

.critter-piece.owlcorn .piece-nose,
.critter-piece.owlcorn .piece-mouth,
.critter-piece.owlcorn .piece-cheek {
  display: none;
}

.critter-piece.owlcorn .piece-detail {
  left: 22%;
  right: 22%;
  top: 31%;
  height: 14%;
  border-top: 2px solid rgba(41, 50, 74, 0.35);
  border-radius: 50%;
}

.critter-piece.lionicorn::after {
  content: "";
  position: absolute;
  inset: -9%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 10deg, #e68b2e 0 10deg, #ffcf4a 10deg 20deg);
  z-index: 0;
}

.critter-piece.lionicorn .piece-horn,
.critter-piece.lionicorn .piece-ear,
.critter-piece.lionicorn .piece-face,
.critter-piece.lionicorn .piece-detail,
.critter-piece.lionicorn .player-label {
  z-index: 3;
}

.critter-piece.lionicorn .piece-face {
  background: #fff1b6;
}

.critter-piece.lionicorn .piece-muzzle {
  width: 48%;
  height: 35%;
  background: #fff8d8;
}

.critter-piece.bearicorn .piece-ear {
  top: 12%;
  width: 25%;
  height: 25%;
  background: color-mix(in srgb, var(--piece-color), #29324a 8%);
}

.critter-piece.bunnycorn .piece-ear {
  top: -7%;
  width: 19%;
  height: 42%;
  border-radius: 999px 999px 55% 55%;
  background: linear-gradient(90deg, #ff7aa8, #ffe5f0 42% 58%, #ff7aa8);
}

.critter-piece.bunnycorn .piece-ear.left {
  left: 18%;
  transform: rotate(-12deg);
}

.critter-piece.bunnycorn .piece-ear.right {
  right: 18%;
  transform: rotate(12deg);
}

.critter-piece.bunnycorn .piece-muzzle {
  width: 46%;
  height: 31%;
}

.critter-piece.bunnycorn .piece-nose {
  background: #e64d83;
}

.critter-piece.bearicorn .piece-face {
  inset: 22% 15% 12%;
  border-radius: 50% 50% 44% 44%;
  background: #e6d0bd;
}

.critter-piece.bearicorn .piece-muzzle {
  width: 52%;
  height: 39%;
  bottom: 6%;
  background: #f3dfce;
}

.critter-piece.bearicorn .piece-nose {
  width: 32%;
  height: 24%;
  border-radius: 45% 45% 56% 56%;
}

.game-screen {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) minmax(340px, 390px);
  gap: 1rem;
  align-items: start;
}

.top-bar,
.board-wrap,
.turn-panel,
.score-row,
.shop-grid {
  border-radius: 8px;
}

.top-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 248, 223, 0.91);
  box-shadow: var(--shadow);
}

.top-bar h2 {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: clamp(1.25rem, 2.3vw, 2rem);
  line-height: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: #fff;
  font-weight: 900;
}

.board-wrap {
  min-height: min(72vh, 720px);
  position: relative;
  padding: 0;
  background: linear-gradient(145deg, #a3ebc7, #74d6e8 58%, #a18bef);
  box-shadow: var(--shadow);
  overflow: hidden;
  perspective: 950px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.board-wrap.dragging-map {
  cursor: grabbing;
}

.map-controls {
  position: absolute;
  z-index: 12;
  left: 0.75rem;
  top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: calc(100% - 1.5rem);
}

.map-controls button {
  min-height: 38px;
  padding: 0.35rem 0.6rem;
  border: 2px solid rgba(41, 50, 74, 0.12);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 0 rgba(41, 50, 74, 0.16);
  color: var(--ink);
  font-size: 0.86rem;
}

.map-controls button:first-child,
.map-controls button:nth-child(2) {
  width: 38px;
  padding: 0;
  font-size: 1.25rem;
}

.map-hint {
  position: absolute;
  z-index: 12;
  left: 0.75rem;
  bottom: 0.65rem;
  max-width: min(360px, calc(100% - 1.5rem));
  margin: 0;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(41, 50, 74, 0.84);
  font-size: 0.78rem;
  font-weight: 900;
  pointer-events: none;
}

.board-world {
  --camera-x: 0px;
  --camera-y: 0px;
  --camera-zoom: 0.72;
  position: absolute;
  left: 0;
  top: 0;
  width: 1540px;
  height: 980px;
  max-width: none;
  border-radius: 8px;
  background:
    radial-gradient(ellipse at 18% 80%, rgba(255, 241, 128, 0.3), transparent 24%),
    radial-gradient(ellipse at 21% 27%, rgba(23, 116, 69, 0.48), transparent 24%),
    radial-gradient(ellipse at 48% 57%, rgba(63, 197, 216, 0.5), transparent 19%),
    radial-gradient(ellipse at 80% 25%, rgba(139, 120, 255, 0.46), transparent 23%),
    radial-gradient(ellipse at 78% 76%, rgba(141, 174, 255, 0.34), transparent 26%),
    linear-gradient(145deg, #70d66c 0%, #8ee5aa 34%, #61cbdc 58%, #8f76dc 100%);
  transform: translate(var(--camera-x), var(--camera-y)) scale(var(--camera-zoom));
  transform-origin: 0 0;
  transition: transform 0.62s cubic-bezier(0.22, 0.82, 0.28, 1);
}

.board-world.camera-ready {
  will-change: transform;
}

.board-world::before {
  content: "";
  position: absolute;
  pointer-events: none;
}

.board-world::before {
  inset: 8% 5%;
  border-radius: 50%;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16), transparent 55%);
  transform: rotate(-8deg);
}

.map-layer {
  position: absolute;
  border-radius: 46% 54% 48% 52%;
  filter: blur(0.2px);
  opacity: 0.68;
  pointer-events: none;
  z-index: 0;
}

.map-layer.meadow {
  left: 4%;
  top: 64%;
  width: 42%;
  height: 25%;
  background:
    radial-gradient(circle at 19% 66%, #ffef7a 0 4%, transparent 5%),
    radial-gradient(circle at 34% 36%, #ff8bb6 0 4%, transparent 5%),
    radial-gradient(circle at 65% 58%, #ffffff 0 4%, transparent 5%),
    linear-gradient(145deg, #b8f27c, #71d76b);
  box-shadow: inset 0 -14px 22px rgba(42, 130, 64, 0.18);
}

.map-layer.forest {
  left: 3%;
  top: 14%;
  width: 40%;
  height: 41%;
  background:
    radial-gradient(circle at 18% 62%, rgba(6, 79, 49, 0.92) 0 15%, transparent 16%),
    radial-gradient(circle at 34% 35%, rgba(6, 94, 54, 0.92) 0 18%, transparent 19%),
    radial-gradient(circle at 55% 26%, rgba(11, 122, 68, 0.9) 0 22%, transparent 23%),
    radial-gradient(circle at 73% 55%, rgba(24, 144, 78, 0.86) 0 18%, transparent 19%),
    radial-gradient(circle at 47% 70%, rgba(8, 99, 58, 0.82) 0 17%, transparent 18%),
    linear-gradient(145deg, #1a8d54, #0e6b43);
  box-shadow: inset -18px -16px 24px rgba(4, 62, 39, 0.22);
}

.map-layer.lake {
  left: 34%;
  top: 41%;
  width: 32%;
  height: 27%;
  border-radius: 56% 44% 52% 48%;
  background:
    radial-gradient(ellipse at 57% 33%, rgba(255, 255, 255, 0.48) 0 13%, transparent 14%),
    linear-gradient(145deg, #92f5ff, #34bdd7 62%, #2297bd);
  box-shadow: inset 8px 10px 20px rgba(255, 255, 255, 0.34), inset -12px -16px 24px rgba(12, 90, 134, 0.24);
}

.map-layer.mountain {
  left: 57%;
  top: 8%;
  width: 39%;
  height: 35%;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 0 16%, rgba(255, 255, 255, 0.72) 17% 24%, transparent 25%),
    linear-gradient(225deg, transparent 0 20%, rgba(255, 255, 255, 0.68) 21% 29%, transparent 30%),
    linear-gradient(145deg, #c9b7ff 0%, #8fa5ef 58%, #667bd2 100%);
  clip-path: polygon(0 100%, 16% 44%, 27% 72%, 45% 16%, 57% 62%, 70% 30%, 100% 100%);
  box-shadow: inset -12px -14px 18px rgba(48, 64, 127, 0.22);
}

.map-layer.moon {
  left: 58%;
  top: 58%;
  width: 35%;
  height: 29%;
  border-radius: 44% 56% 36% 64%;
  background:
    radial-gradient(circle at 27% 38%, rgba(255, 255, 255, 0.64) 0 7%, transparent 8%),
    radial-gradient(circle at 66% 55%, rgba(89, 105, 176, 0.18) 0 9%, transparent 10%),
    radial-gradient(circle at 46% 72%, rgba(89, 105, 176, 0.14) 0 6%, transparent 7%),
    linear-gradient(160deg, transparent 0 24%, rgba(78, 93, 176, 0.18) 25% 32%, transparent 33% 48%, rgba(255, 255, 255, 0.22) 49% 55%, transparent 56%),
    linear-gradient(145deg, #dfe9ff, #9fb9ff 62%, #8495e6);
  box-shadow: inset 0 -14px 20px rgba(55, 71, 151, 0.18);
}

.map-landmark {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.meadow-flowers {
  left: 9%;
  top: 68%;
  width: 30%;
  height: 18%;
  background:
    radial-gradient(circle at 12% 72%, #ff8bb6 0 2.4%, transparent 2.8%),
    radial-gradient(circle at 18% 66%, #fff 0 2.2%, transparent 2.6%),
    radial-gradient(circle at 32% 35%, #ffef7a 0 2.5%, transparent 2.9%),
    radial-gradient(circle at 55% 68%, #ff8bb6 0 2.2%, transparent 2.6%),
    radial-gradient(circle at 71% 42%, #fff 0 2.2%, transparent 2.6%),
    radial-gradient(circle at 86% 70%, #ffef7a 0 2.4%, transparent 2.8%),
    repeating-linear-gradient(105deg, transparent 0 18px, rgba(44, 135, 66, 0.26) 19px 21px, transparent 22px 36px);
  opacity: 0.82;
}

.forest-trees {
  left: 6%;
  top: 17%;
  width: 34%;
  height: 33%;
  background:
    radial-gradient(circle at 8% 68%, #06492f 0 5%, transparent 5.5%),
    radial-gradient(circle at 14% 42%, #137c4d 0 6.2%, transparent 6.7%),
    radial-gradient(circle at 24% 74%, #0a5d3b 0 6%, transparent 6.5%),
    radial-gradient(circle at 33% 38%, #1b965b 0 7%, transparent 7.5%),
    radial-gradient(circle at 45% 58%, #0b653f 0 6%, transparent 6.5%),
    radial-gradient(circle at 56% 28%, #158652 0 7.5%, transparent 8%),
    radial-gradient(circle at 67% 68%, #06492f 0 5.8%, transparent 6.3%),
    radial-gradient(circle at 76% 43%, #178b55 0 6.8%, transparent 7.3%),
    radial-gradient(circle at 90% 62%, #0b653f 0 5.8%, transparent 6.3%),
    linear-gradient(90deg, transparent 0 7%, rgba(90, 61, 37, 0.42) 7.2% 8.2%, transparent 8.4% 13%, rgba(90, 61, 37, 0.4) 13.2% 14.2%, transparent 14.4% 23%, rgba(90, 61, 37, 0.36) 23.2% 24.2%, transparent 24.4%);
  filter: drop-shadow(0 7px 0 rgba(9, 75, 47, 0.22));
}

.forest-trail {
  left: 10%;
  top: 30%;
  width: 28%;
  height: 18%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 36% 58%, rgba(255, 229, 155, 0.5) 0 7%, transparent 8%),
    radial-gradient(ellipse at 58% 42%, rgba(255, 229, 155, 0.42) 0 6%, transparent 7%),
    linear-gradient(134deg, transparent 0 39%, rgba(255, 230, 160, 0.3) 40% 47%, transparent 48% 100%);
  transform: rotate(-10deg);
  opacity: 0.62;
}

.lake-ripples {
  left: 39%;
  top: 46%;
  width: 22%;
  height: 17%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 35% 38%, transparent 0 22%, rgba(255, 255, 255, 0.58) 23% 26%, transparent 27%),
    radial-gradient(ellipse at 66% 62%, transparent 0 18%, rgba(255, 255, 255, 0.45) 19% 22%, transparent 23%),
    radial-gradient(ellipse at 52% 48%, rgba(255, 255, 255, 0.48) 0 5%, transparent 6%);
  opacity: 0.9;
}

.lake-crystals {
  left: 38%;
  top: 43%;
  width: 27%;
  height: 23%;
  background:
    linear-gradient(135deg, transparent 0 44%, rgba(255, 255, 255, 0.86) 45% 54%, transparent 55%) 14% 16% / 12% 24% no-repeat,
    linear-gradient(135deg, transparent 0 44%, rgba(181, 250, 255, 0.9) 45% 54%, transparent 55%) 80% 66% / 11% 23% no-repeat,
    radial-gradient(circle at 20% 74%, rgba(38, 111, 141, 0.2) 0 5%, transparent 6%),
    radial-gradient(circle at 78% 26%, rgba(38, 111, 141, 0.2) 0 4%, transparent 5%);
  opacity: 0.9;
}

.mountain-peaks {
  left: 61%;
  top: 12%;
  width: 30%;
  height: 23%;
  background:
    linear-gradient(135deg, transparent 0 38%, rgba(255, 255, 255, 0.9) 39% 50%, transparent 51%),
    linear-gradient(225deg, transparent 0 38%, rgba(255, 255, 255, 0.75) 39% 50%, transparent 51%),
    linear-gradient(145deg, rgba(86, 102, 188, 0.78), rgba(121, 142, 224, 0.4));
  clip-path: polygon(0 100%, 20% 38%, 34% 76%, 54% 4%, 71% 68%, 84% 31%, 100% 100%);
  filter: drop-shadow(0 12px 0 rgba(41, 50, 74, 0.14));
}

.mountain-ridges {
  left: 58%;
  top: 22%;
  width: 37%;
  height: 21%;
  background:
    linear-gradient(145deg, transparent 0 33%, rgba(62, 72, 148, 0.34) 34% 38%, transparent 39%),
    linear-gradient(28deg, transparent 0 44%, rgba(255, 255, 255, 0.34) 45% 48%, transparent 49%),
    linear-gradient(170deg, transparent 0 55%, rgba(62, 72, 148, 0.24) 56% 61%, transparent 62%);
  clip-path: polygon(0 100%, 16% 42%, 30% 74%, 48% 12%, 61% 61%, 75% 30%, 100% 100%);
  opacity: 0.82;
}

.moon-valley {
  left: 64%;
  top: 63%;
  width: 27%;
  height: 22%;
  border-radius: 50% 50% 38% 62%;
  background:
    radial-gradient(circle at 25% 40%, rgba(255, 255, 255, 0.88) 0 9%, transparent 10%),
    radial-gradient(circle at 58% 33%, rgba(68, 84, 160, 0.2) 0 8%, transparent 9%),
    radial-gradient(circle at 72% 69%, rgba(68, 84, 160, 0.18) 0 7%, transparent 8%),
    linear-gradient(160deg, rgba(232, 238, 255, 0.8), rgba(143, 165, 255, 0.3));
}

.valley-ridges {
  left: 61%;
  top: 67%;
  width: 34%;
  height: 18%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 38% 55%, transparent 0 31%, rgba(255, 255, 255, 0.38) 32% 35%, transparent 36%),
    radial-gradient(ellipse at 64% 62%, transparent 0 24%, rgba(77, 93, 174, 0.22) 25% 28%, transparent 29%),
    linear-gradient(172deg, transparent 0 47%, rgba(75, 88, 170, 0.2) 48% 51%, transparent 52%);
}

.castle-landmark {
  left: 72%;
  top: 5%;
  width: 23%;
  height: 27%;
  border-radius: 10px 10px 42% 42%;
  background:
    radial-gradient(circle at 50% 9%, rgba(255, 255, 255, 0.88) 0 4%, transparent 4.8%),
    linear-gradient(90deg, transparent 0 12%, #ffe173 12.5% 22%, transparent 22.5% 38%, #fff0a7 38.5% 52%, transparent 52.5% 68%, #ffe173 68.5% 79%, transparent 79.5%),
    linear-gradient(180deg, #fff3b5 0%, #f9c75e 58%, #d98b35 100%);
  clip-path: polygon(0 100%, 0 48%, 8% 48%, 8% 31%, 18% 31%, 18% 48%, 30% 48%, 30% 19%, 43% 19%, 43% 41%, 51% 8%, 59% 41%, 59% 19%, 72% 19%, 72% 48%, 84% 48%, 84% 31%, 95% 31%, 95% 48%, 100% 48%, 100% 100%);
  filter: drop-shadow(0 23px 15px rgba(41, 50, 74, 0.3));
  opacity: 0.96;
}

.castle-landmark::before,
.castle-landmark::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.castle-landmark::before {
  left: 42%;
  top: 2%;
  width: 17%;
  height: 37%;
  background: linear-gradient(135deg, #fff 0 30%, #9eefff 31% 62%, #ffcf4a 63% 100%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 4px 3px rgba(41, 50, 74, 0.28));
}

.castle-landmark::after {
  left: 42%;
  bottom: 0;
  width: 16%;
  height: 27%;
  border-radius: 999px 999px 0 0;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.72) 0 13%, transparent 14%),
    linear-gradient(180deg, #6a4a32, #3f2b24);
  box-shadow:
    -4.6em -4.7em 0 -2.3em #ff6f9c,
    4.8em -4.5em 0 -2.3em #8d78ff,
    0 -2.5em 0 -2em rgba(255, 255, 255, 0.66);
}

.region-label {
  position: absolute;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  font-size: clamp(0.66rem, 1vw, 0.82rem);
  font-weight: 900;
  pointer-events: none;
  z-index: 3;
}

.board-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotateX(7deg) rotateZ(-1deg);
  transform-origin: center;
  transform-style: preserve-3d;
  z-index: 2;
}

.path-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.path-shadow,
.path-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.path-shadow {
  stroke: rgba(41, 50, 74, 0.2);
  stroke-width: 5.5;
  transform: translate(0.7px, 1.1px);
}

.path-line {
  stroke: #ffe8a4;
  stroke-width: 4.5;
  filter: drop-shadow(0 4px 0 rgba(118, 79, 36, 0.16));
}

.space {
  position: absolute;
  width: clamp(32px, 3.8vw, 46px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(41, 50, 74, 0.18);
  border-radius: 50%;
  background: var(--cream);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 0 rgba(41, 50, 74, 0.16), 0 16px 20px rgba(41, 50, 74, 0.14);
  transform-style: preserve-3d;
  transition: filter 0.2s ease, scale 0.2s ease;
}

.space::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

.space.active-space {
  filter: drop-shadow(0 0 13px rgba(255, 255, 255, 0.95));
  scale: 1.08;
  z-index: 5;
}

.space.normal {
  background: #fff8df;
}

.space.treasure {
  background: #ffdc58;
}

.space.shortcut {
  background: #ff91bd;
}

.space.mystery {
  background: #96f2ff;
}

.space.rescue {
  background: #b5ff9c;
}

.space.shop {
  background: #c0a4ff;
}

.space.trap {
  background: #ffb0a8;
}

.space.boss {
  background: #ffcf4a;
  border-radius: 8px;
}

.space.rest {
  background: #d8f4ff;
}

.space.castle {
  background: #fff0a7;
  border-radius: 8px;
}

.space-number {
  position: absolute;
  left: 4px;
  top: 2px;
  color: rgba(41, 50, 74, 0.62);
  font-size: 0.62rem;
  font-weight: 900;
}

.space-icon {
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.token-stack {
  position: absolute;
  inset: auto 4px 3px 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1px;
}

.token {
  position: relative;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(41, 50, 74, 0.28), 0 7px 10px rgba(41, 50, 74, 0.22);
}

.token-horn {
  position: absolute;
  top: -12px;
  color: #fff7a9;
  font-size: 0.68rem;
  text-shadow: 0 1px 2px rgba(41, 50, 74, 0.5);
}

.active-token {
  animation: tokenBounce 0.85s ease-in-out infinite;
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

.turn-panel {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  max-height: calc(100vh - 6.2rem);
  overflow-y: auto;
  padding: 0.65rem;
  background: rgba(255, 248, 223, 0.93);
  box-shadow: var(--shadow);
  position: sticky;
  top: 1rem;
}

.current-player {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.current-player h3 {
  margin-bottom: 0.25rem;
  font-size: 1.15rem;
}

.big-avatar {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: 2rem;
  box-shadow: inset 0 0 0 4px rgba(41, 50, 74, 0.08);
}

.panel-section {
  display: grid;
  gap: 0.45rem;
  padding: 0.6rem;
  border: 3px solid rgba(41, 50, 74, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.panel-section h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.player-summary {
  background: rgba(255, 255, 255, 0.86);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.stat-grid span {
  min-height: 36px;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  background: #fff8df;
  font-weight: 900;
}

.action-grid,
.drawer-grid,
.question-tools {
  display: grid;
  gap: 0.5rem;
}

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

.action-grid button,
.drawer-grid button,
.question-tools button {
  min-height: 48px;
}

.drawer-box {
  display: grid;
  gap: 0.5rem;
  padding: 0.65rem;
  border-radius: 8px;
  background: #fff8df;
  border: 3px solid rgba(255, 207, 74, 0.75);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.drawer-head button {
  min-height: 38px;
  padding: 0 0.7rem;
  background: #ffffff;
  box-shadow: 0 3px 0 rgba(41, 50, 74, 0.12);
}

.empty-note,
.active-note,
.question-owner {
  margin-bottom: 0;
  font-weight: 900;
}

.question-section .empty-note {
  padding: 0.65rem;
  border-radius: 8px;
  background: #ffffff;
}

.scoreboard {
  display: grid;
  gap: 0.5rem;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.75);
  font-weight: 900;
}

.score-row.active {
  outline: 3px solid var(--rose);
}

.question-box {
  padding: 0;
  border-radius: 8px;
  background: transparent;
  border: 0;
}

.inventory-box,
.preturn-box,
.encounter-box {
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  border: 3px solid rgba(41, 50, 74, 0.1);
}

.preturn-box {
  display: grid;
  gap: 0.55rem;
  background: #fff8df;
  border-color: rgba(255, 207, 74, 0.85);
}

.preturn-box h3,
.preturn-box p {
  margin-bottom: 0;
}

.preturn-shop {
  padding: 0;
  background: transparent;
}

.inventory-line {
  margin-top: 0.25rem;
  font-size: 0.92rem;
  font-weight: 900;
}

.encounter-box h3 {
  margin-bottom: 0.35rem;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.preview-note {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: #fff3b7;
  font-weight: 900;
}

.question-box h3 {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.question-text {
  margin-bottom: 0.6rem;
  padding: 0.65rem;
  border-radius: 8px;
  background: #fff;
  font-size: 1.3rem;
  font-weight: 900;
}

.ten-frame {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0 0 0.7rem;
  padding: 0.5rem;
  border: 3px solid rgba(63, 197, 216, 0.35);
  border-radius: 8px;
  background: linear-gradient(145deg, #f3fdff, #fff8df);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.ten-frame-cell {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 2px solid rgba(41, 50, 74, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 -3px 0 rgba(41, 50, 74, 0.07);
}

.ten-frame-cell.filled {
  background: linear-gradient(145deg, #ffffff, #d8f4ff);
  border-color: rgba(63, 197, 216, 0.5);
}

.ten-frame-gem {
  width: 25px;
  height: 25px;
  display: block;
  overflow: hidden;
  color: transparent;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0 20%, transparent 21%),
    linear-gradient(145deg, #9eefff 0 28%, #6f8cff 29% 62%, #8d78ff 63% 100%);
  clip-path: polygon(50% 0, 86% 24%, 72% 100%, 28% 100%, 14% 24%);
  filter: drop-shadow(0 2px 1px rgba(41, 50, 74, 0.22));
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.answer-grid button {
  min-height: 52px;
  background: #ffffff;
  box-shadow: 0 4px 0 rgba(41, 50, 74, 0.12);
  border: 3px solid rgba(41, 50, 74, 0.1);
}

.answer-grid button.correct {
  background: #91f39c;
}

.answer-grid button.wrong {
  background: #ff9aa8;
}

.message {
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.75);
  font-weight: 900;
}

.message.good {
  background: #d9ffd9;
}

.message.bad {
  background: #ffe1e7;
}

.controls,
.powerups {
  display: grid;
  gap: 0.55rem;
}

.controls {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.roll-button:not(:disabled) {
  background: #91f39c;
}

.dice-section {
  background: rgba(255, 255, 255, 0.9);
}

.dice-action {
  display: grid;
  gap: 0.5rem;
  align-items: center;
  justify-items: center;
  text-align: center;
}

.dice-action p {
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 900;
}

.dice-action.ready {
  background: #d9ffd9;
  border-radius: 8px;
  padding: 0.6rem;
}

.dice-action.rolling-panel {
  padding: 0.65rem;
  border-radius: 8px;
  background: linear-gradient(145deg, #fff7c7, #e8fbff);
  box-shadow: inset 0 0 0 2px rgba(41, 50, 74, 0.08);
}

.dice-action .roll-button {
  min-height: 58px;
  font-size: 1.12rem;
  width: 100%;
}

.dice.big {
  width: 86px;
  height: 86px;
  min-height: 86px;
  font-size: 3rem;
}

.footer-controls {
  grid-template-columns: 1fr;
}

.next-button {
  min-height: 58px;
  background: #91f39c;
  font-size: 1.12rem;
}

.secondary-button {
  min-height: 40px;
  background: #ffffff;
  box-shadow: 0 3px 0 rgba(41, 50, 74, 0.12);
  font-size: 0.92rem;
}

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

.powerups button {
  min-height: 58px;
  padding: 0.35rem;
  background: #fff;
  box-shadow: 0 4px 0 rgba(41, 50, 74, 0.12);
  font-size: 0.86rem;
}

.shop-grid {
  display: grid;
  gap: 0.5rem;
  padding: 0.7rem;
  background: rgba(141, 120, 255, 0.16);
}

.shop-grid button {
  background: #c0a4ff;
}

.dice {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 3px solid rgba(41, 50, 74, 0.16);
  border-radius: 16px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.95), transparent 23%),
    linear-gradient(145deg, #ffffff 0%, #fff4c7 58%, #e3f9ff 100%);
  font-size: 1.75rem;
  font-weight: 900;
  color: #29324a;
  transform: rotateX(10deg) rotateZ(-4deg);
  box-shadow:
    0 12px 0 #d7a94e,
    0 18px 26px rgba(41, 50, 74, 0.24),
    inset -8px -10px 0 rgba(255, 207, 74, 0.22),
    inset 5px 5px 0 rgba(255, 255, 255, 0.8);
  transform-style: preserve-3d;
}

.dice.rolling {
  animation: diceTumble 0.16s ease-in-out infinite;
  background:
    radial-gradient(circle at 26% 20%, rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(145deg, #fffdf1, #fff1a8 55%, #bff5ff);
}

.dice.landed {
  animation: diceLand 0.48s cubic-bezier(0.18, 0.9, 0.22, 1.25) both;
}

.countdown-note {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  background: #fff0f6;
  color: #8b2750;
  font-size: 0.9rem;
}

.board-effect {
  position: absolute;
  z-index: 8;
  transform: translate(-50%, -115%);
  display: grid;
  place-items: center;
  min-width: 92px;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-weight: 900;
  text-align: center;
  box-shadow: var(--shadow);
  animation: effectPop 1.4s ease both;
  pointer-events: none;
}

.board-effect span {
  font-size: 1.5rem;
}

.victory-board-overlay {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
}

.castle-gate-glow {
  position: absolute;
  left: 96%;
  top: 34%;
  width: 230px;
  height: 230px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 13%, rgba(255, 226, 106, 0.72) 14% 30%, rgba(158, 239, 255, 0.34) 31% 52%, transparent 53%);
  animation: castleGateOpen 2.7s ease both;
  animation-delay: 0.45s;
  filter: drop-shadow(0 0 24px rgba(255, 226, 106, 0.95));
}

.victory-token {
  position: absolute;
  left: 96%;
  top: 34%;
  transform: translate(-50%, -50%);
  animation: winnerTokenArrive 2.7s ease both;
  animation-delay: 0.45s;
  z-index: 10;
}

.victory-burst {
  position: absolute;
  left: 96%;
  top: 34%;
  width: 320px;
  height: 320px;
  transform: translate(-50%, -50%);
  z-index: 9;
}

.victory-burst span {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #fff6a6;
  font-size: 2.6rem;
  font-weight: 900;
  text-shadow: 0 3px 6px rgba(41, 50, 74, 0.28);
  animation: starBurst 2.25s ease-out both;
}

.victory-burst span:nth-child(1) { --burst-x: -130px; --burst-y: -92px; animation-delay: 0.58s; }
.victory-burst span:nth-child(2) { --burst-x: 104px; --burst-y: -112px; animation-delay: 0.66s; color: #9eefff; }
.victory-burst span:nth-child(3) { --burst-x: 138px; --burst-y: 76px; animation-delay: 0.74s; color: #ff91bd; }
.victory-burst span:nth-child(4) { --burst-x: -94px; --burst-y: 118px; animation-delay: 0.82s; }
.victory-burst span:nth-child(5) { --burst-x: 8px; --burst-y: -148px; animation-delay: 0.9s; color: #ffffff; }

.victory-callout {
  position: absolute;
  left: 83%;
  top: 12%;
  display: grid;
  gap: 0.18rem;
  min-width: 270px;
  padding: 0.65rem 0.85rem;
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  background: rgba(255, 248, 223, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: translate(-50%, -20%);
  animation: victoryCallout 2.7s ease both;
  animation-delay: 0.45s;
  text-align: center;
}

.victory-callout strong {
  font-size: 1rem;
}

.victory-callout span {
  font-weight: 900;
  font-size: 0.88rem;
}

.effect-treasure {
  animation: effectPop 1.4s ease both, sparklePulse 0.5s ease-in-out 2;
}

.effect-mystery,
.effect-trap {
  animation: effectPop 1.4s ease both, swirlGlow 0.7s ease-in-out 2;
}

.effect-trap.space {
  animation: gentleShake 0.48s ease-in-out;
}

.effect-boss,
.effect-castle {
  animation: effectPop 1.4s ease both, castleGlow 0.7s ease-in-out 2;
}

@keyframes tokenBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes diceWiggle {
  0% { transform: rotate(-3deg) scale(1); }
  50% { transform: rotate(3deg) scale(1.04); }
  100% { transform: rotate(-3deg) scale(1); }
}

@keyframes diceTumble {
  0% { transform: translateY(0) rotateX(10deg) rotateZ(-10deg) scale(1); }
  35% { transform: translateY(-8px) rotateX(22deg) rotateZ(8deg) scale(1.05); }
  70% { transform: translateY(2px) rotateX(4deg) rotateZ(-5deg) scale(0.98); }
  100% { transform: translateY(0) rotateX(10deg) rotateZ(-10deg) scale(1); }
}

@keyframes diceLand {
  0% { transform: translateY(-16px) rotateX(24deg) rotateZ(12deg) scale(1.08); }
  55% { transform: translateY(4px) rotateX(8deg) rotateZ(-5deg) scale(0.96); }
  80% { transform: translateY(-2px) rotateX(12deg) rotateZ(-2deg) scale(1.02); }
  100% { transform: translateY(0) rotateX(10deg) rotateZ(-4deg) scale(1); }
}

@keyframes effectPop {
  0% { opacity: 0; transform: translate(-50%, -90%) scale(0.75); }
  18% { opacity: 1; transform: translate(-50%, -125%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -155%) scale(1); }
}

@keyframes sparklePulse {
  50% { filter: drop-shadow(0 0 18px rgba(255, 207, 74, 0.95)); }
}

@keyframes swirlGlow {
  50% { filter: hue-rotate(60deg) drop-shadow(0 0 14px rgba(141, 120, 255, 0.95)); }
}

@keyframes castleGlow {
  50% { filter: drop-shadow(0 0 18px rgba(255, 240, 167, 0.95)); }
}

@keyframes gentleShake {
  0%, 100% { translate: 0 0; }
  25% { translate: -3px 0; }
  75% { translate: 3px 0; }
}

@keyframes castleGateOpen {
  0% { opacity: 0; scale: 0.35; filter: blur(2px) drop-shadow(0 0 0 rgba(255, 226, 106, 0)); }
  22% { opacity: 1; scale: 0.82; }
  55% { opacity: 1; scale: 1.08; filter: blur(0) drop-shadow(0 0 26px rgba(255, 226, 106, 0.95)); }
  100% { opacity: 0.82; scale: 1.2; filter: blur(0) drop-shadow(0 0 34px rgba(158, 239, 255, 0.95)); }
}

@keyframes winnerTokenArrive {
  0% { opacity: 0; transform: translate(-50%, -10%) scale(0.45) rotate(-10deg); }
  32% { opacity: 1; transform: translate(-50%, -62%) scale(1.05) rotate(6deg); }
  58% { transform: translate(-50%, -50%) scale(0.94) rotate(-3deg); }
  78% { transform: translate(-50%, -57%) scale(1.05) rotate(2deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
}

@keyframes starBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(0deg); }
  20% { opacity: 1; }
  74% { opacity: 1; transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) scale(1.08) rotate(180deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) scale(0.86) rotate(260deg); }
}

@keyframes victoryCallout {
  0% { opacity: 0; transform: translate(-50%, -4%) scale(0.88); }
  30%, 82% { opacity: 1; transform: translate(-50%, -20%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -26%) scale(0.98); }
}

.winner-panel {
  text-align: center;
}

.winner-avatar {
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  margin: 0.6rem auto 0.9rem;
  border-radius: 50%;
  background: #fff;
  font-size: 4rem;
  box-shadow: var(--shadow);
}

.confetti {
  font-size: clamp(2.4rem, 8vw, 5rem);
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .title-screen,
  .game-screen {
    grid-template-columns: 1fr;
  }

  .hero-art {
    min-height: 320px;
  }

  .board-wrap {
    min-height: 520px;
  }

  .board-grid {
    min-height: 480px;
  }

  .turn-panel {
    grid-row: 3;
    max-height: none;
    overflow: visible;
    position: static;
  }
}

@media (max-width: 560px) {
  .screen {
    padding: 0.7rem;
  }

  .setup-toolbar,
  .top-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .answer-grid,
  .controls,
  .powerups {
    grid-template-columns: 1fr;
  }

  .space {
    width: 34px;
  }

  .space-icon {
    font-size: 1.1rem;
  }

  .token {
    width: 17px;
    height: 17px;
    font-size: 0.62rem;
  }
}

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

  .board-grid {
    transform: none;
  }
}
