@import url("https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,500;0,9..144,600;1,9..144,500&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap");

* {
  box-sizing: border-box;
}

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 30% 25%, rgba(124, 96, 152, 0.16), transparent 65%),
    radial-gradient(ellipse 60% 50% at 75% 80%, rgba(207, 156, 56, 0.08), transparent 60%),
    linear-gradient(165deg, #1b1826 0%, #111018 60%, #0b0a10 100%);
  color: #f6ecdb;
  font: 15px/1.45 "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 1010px;
  margin: auto;
  padding: 18px clamp(12px, 4vw, 42px) 36px;
}

header,
.title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header {
  border-bottom: 1px solid #494256;
  padding-bottom: 12px;
}

.brand,
#phase {
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 700;
  color: #eec578;
}

#phase {
  text-transform: uppercase;
  color: #c3becb;
}

h1,
h2 {
  font-family: "Fraunces", Georgia, serif;
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5.5vw, 56px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

h1 i {
  color: #f0c580;
  font-style: italic;
}

.title {
  padding: 12px 0 18px;
}

#prize {
  text-align: right;
  font-weight: 700;
  color: #ffdc93;
  font-variant-numeric: tabular-nums;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 29%);
  gap: 14px 24px;
  align-items: start;
}

/* Board & Walnut-Brass Casing */
#board {
  grid-column: 1;
  grid-row: 1;
  container-type: inline-size;
  position: relative;
  isolation: isolate;
  aspect-ratio: 1;
  width: 100%;
  background: radial-gradient(circle at 50% 45%, #47362b 0%, #2a1f18 78%, #1e1611 100%);
  border: 10px solid #211813;
  border-radius: 20px;
  box-shadow:
    inset 0 0 0 2.5px #c8a25d,
    inset 0 0 24px rgba(0, 0, 0, 0.55),
    0 22px 48px -10px rgba(0, 0, 0, 0.72),
    0 6px 16px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  --coral: #d65b5b;
  --mint: #37998b;
  --gold: #cf9c38;
  --sky: #5887c9;
}

#board:has(.burst),
#board:has(.floater),
#board:has(.sound-wave) {
  overflow: visible;
}

#board.shake {
  animation: board-shake 0.38s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes board-shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  18% { transform: translate3d(-4px, 2px, 0) rotate(-0.35deg); }
  36% { transform: translate3d(4px, -2px, 0) rotate(0.35deg); }
  54% { transform: translate3d(-3px, 1px, 0) rotate(-0.2deg); }
  72% { transform: translate3d(2px, -1px, 0) rotate(0.15deg); }
}

.tile,
.base,
.center,
.piece,
.burst,
.land-ripple {
  position: absolute;
}

/* Sculpted Track & Home Tiles */
.tile {
  width: 6.42%;
  height: 6.42%;
  margin: calc((100% / 15 - 6.42%) / 2);
  border: 0;
  border-radius: 20%;
  background: linear-gradient(160deg, #fffbf2 0%, #efe0c3 100%);
  color: #8a7044;
  display: grid;
  place-items: center;
  font-size: clamp(12px, 2.4vw, 20px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 0 rgba(164, 134, 86, 0.34),
    0 1px 2px rgba(0, 0, 0, 0.28);
}

.tile.start {
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--seat) 74%, #ffffff) 0%,
    var(--seat) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 0 rgba(0, 0, 0, 0.24),
    0 1px 2px rgba(0, 0, 0, 0.3);
}

.tile.start:after {
  content: "";
  width: 44%;
  height: 44%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.tile.safe {
  background: linear-gradient(155deg, #fff6dc 0%, #edd39a 100%);
  box-shadow:
    inset 0 0 0 1.5px #cfa651,
    inset 0 -2px 0 rgba(160, 118, 36, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.25);
}

.tile.safe:after {
  content: "★";
  color: #9c7224;
  font-size: clamp(11px, 2.2vw, 17px);
  line-height: 1;
}

.tile.home {
  background: linear-gradient(
    155deg,
    color-mix(in srgb, var(--seat) 76%, #ffffff) 0%,
    color-mix(in srgb, var(--seat) 92%, #000000) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 0 rgba(0, 0, 0, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.28);
}

.tile.home:after {
  content: "";
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
}

/* Corner Bases with Pure CSS Recessed Yard Sockets */
.base {
  width: 40%;
  height: 40%;
  display: grid;
  place-items: center;
  border-radius: 7.5%;
  background: linear-gradient(
    150deg,
    color-mix(in srgb, var(--seat) 76%, #ffffff) 0%,
    var(--seat) 55%,
    color-mix(in srgb, var(--seat) 74%, #000000) 100%
  );
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.38),
    inset 0 -4px 10px rgba(0, 0, 0, 0.3),
    0 2px 6px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.3s var(--ease-out-expo);
}

.base:before {
  content: "";
  inset: 10%;
  position: absolute;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  border-radius: 14%;
  background:
    radial-gradient(circle closest-side at 18.75% 18.75%, color-mix(in srgb, var(--seat) 22%, #ded2bc) 0 64%, color-mix(in srgb, var(--seat) 55%, #ffffff) 66% 74%, transparent 76%),
    radial-gradient(circle closest-side at 81.25% 18.75%, color-mix(in srgb, var(--seat) 22%, #ded2bc) 0 64%, color-mix(in srgb, var(--seat) 55%, #ffffff) 66% 74%, transparent 76%),
    radial-gradient(circle closest-side at 18.75% 81.25%, color-mix(in srgb, var(--seat) 22%, #ded2bc) 0 64%, color-mix(in srgb, var(--seat) 55%, #ffffff) 66% 74%, transparent 76%),
    radial-gradient(circle closest-side at 81.25% 81.25%, color-mix(in srgb, var(--seat) 22%, #ded2bc) 0 64%, color-mix(in srgb, var(--seat) 55%, #ffffff) 66% 74%, transparent 76%),
    linear-gradient(160deg, rgba(255, 250, 240, 0.95), rgba(242, 230, 206, 0.93));
  box-shadow:
    inset 0 3px 10px rgba(32, 20, 12, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.45);
}

.base > span {
  position: relative;
  z-index: 1;
  font: italic clamp(18px, 4vw, 30px) "Fraunces", Georgia, serif;
  color: color-mix(in srgb, var(--seat) 70%, #241914);
}

.base.current {
  z-index: 2;
  box-shadow:
    inset 0 0 0 2.5px #fff8e6,
    0 0 0 2.5px #eec578,
    0 0 24px color-mix(in srgb, var(--seat) 55%, transparent);
}

.base.current:after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 9%;
  border: 2px solid #eec578;
  opacity: 0;
  pointer-events: none;
  animation: base-turn-pulse 2s ease-in-out infinite;
}

@keyframes base-turn-pulse {
  0%, 100% {
    opacity: 0.2;
    transform: scale(0.995);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.015);
  }
}

.base .who {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.base .avatar,
.base .initial {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 17%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--seat);
  background: linear-gradient(150deg, #2d2638, #191521);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.base .avatar {
  object-fit: cover;
}

.base .initial {
  display: grid;
  place-items: center;
  color: #fff8ea;
  font: 700 clamp(10px, 2.4cqi, 16px)/1 "Plus Jakarta Sans", system-ui, sans-serif;
}

.base .resident {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translateX(-50%);
  max-width: 34%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: #2b211b;
  font: 700 clamp(8px, 1.85cqi, 12px)/1.15 "Plus Jakarta Sans", system-ui, sans-serif;
}

.base .status {
  position: absolute;
  left: 50%;
  top: 66%;
  transform: translateX(-50%);
  white-space: nowrap;
  color: #6b5a4b;
  font: 600 clamp(7px, 1.5cqi, 10px)/1 "Plus Jakarta Sans", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}

/* Center Sanctuary */
.center {
  z-index: 3;
  width: 20%;
  height: 20%;
  left: 40%;
  top: 40%;
  display: grid;
  place-items: center;
  color: #fff0ca;
  border-radius: 6%;
  background: conic-gradient(from 45deg, var(--gold) 25%, var(--sky) 0 50%, var(--coral) 0 75%, var(--mint) 0);
  box-shadow:
    inset 0 0 0 3px #30241c,
    0 0 0 2px #dfc182,
    0 6px 16px rgba(0, 0, 0, 0.45);
}

.center:before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(45deg, transparent calc(50% - 1.2px), #2c2119 calc(50% - 1.2px) calc(50% + 1.2px), transparent calc(50% + 1.2px)),
    linear-gradient(-45deg, transparent calc(50% - 1.2px), #2c2119 calc(50% - 1.2px) calc(50% + 1.2px), transparent calc(50% + 1.2px));
  pointer-events: none;
}

/* Tactile Sculpted Game Pieces */
.piece {
  transform: translate(-50%, -50%);
  width: 6.2%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 32% 28%,
    color-mix(in srgb, var(--seat) 55%, #ffffff) 0%,
    var(--seat) 52%,
    color-mix(in srgb, var(--seat) 62%, #000000) 100%
  );
  box-shadow:
    0 4px 7px rgba(0, 0, 0, 0.48),
    0 1px 2px rgba(0, 0, 0, 0.36),
    inset 0 2px 3px rgba(255, 255, 255, 0.52),
    inset 0 -3px 4px rgba(0, 0, 0, 0.36),
    0 0 0 2px #fffaf0;
  color: #ffffff;
  z-index: 4;
  transition:
    width 0.22s var(--ease-out-expo),
    filter 0.18s ease,
    box-shadow 0.2s ease;
}

.piece:after {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  background: radial-gradient(circle at 40% 32%, rgba(255, 255, 255, 0.24), transparent 68%);
  pointer-events: none;
}

.piece b {
  position: relative;
  z-index: 1;
  font: 800 clamp(9px, 2cqi, 15px)/1 "Plus Jakarta Sans", system-ui, sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.piece.stack {
  width: 4.5%;
}

.piece.stack b {
  font-size: clamp(7px, 1.55cqi, 12px);
}

.piece.arrived {
  z-index: 6;
  box-shadow:
    0 0 0 2.5px #fff5cf,
    0 0 14px rgba(255, 214, 110, 0.85),
    0 4px 8px rgba(0, 0, 0, 0.45);
}

.piece:enabled {
  cursor: pointer;
  z-index: 7;
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.52),
    inset 0 2px 3px rgba(255, 255, 255, 0.65),
    inset 0 -3px 4px rgba(0, 0, 0, 0.35),
    0 0 0 2.5px #ffffff;
}

.piece:enabled:before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid #fff7dc;
  opacity: 0.75;
  pointer-events: none;
  animation: piece-halo 1.25s ease-in-out infinite;
}

.piece:enabled:hover {
  filter: brightness(1.1);
}

.piece.talking {
  z-index: 8;
}

@keyframes piece-halo {
  0%, 100% {
    transform: scale(0.95);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.22);
    opacity: 0.18;
  }
}

.land-ripple {
  width: 7%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2.5px solid var(--seat, #ffe4a8);
  transform: translate(-50%, -50%) scale(0.4);
  pointer-events: none;
  z-index: 5;
  animation: ripple-out 0.52s var(--ease-out-expo) forwards;
}

@keyframes ripple-out {
  0% {
    transform: translate(-50%, -50%) scale(0.45);
    opacity: 0.9;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.65);
    opacity: 0;
  }
}

.burst {
  width: 17%;
  transform: translate(-50%, -90%);
  z-index: 8;
  pointer-events: none;
}

/* Side Panel */
aside {
  grid-column: 2;
  grid-row: 1 / span 2;
  background: rgba(27, 25, 37, 0.96);
  border: 1px solid #373245;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

h2 {
  font-size: 22px;
  font-weight: 500;
  color: #f6ecdb;
}

.current {
  color: #ffdb9c;
}

#turn {
  padding: 2px 0 14px;
}

/* 3D Dice */
#dice {
  --die: 84px;
  width: calc(var(--die) * 1.5);
  height: calc(var(--die) * 1.38);
  margin: 0 0 8px;
  perspective: 340px;
  position: relative;
}

.center #dice {
  --die: 9.2cqi;
  width: var(--die);
  height: var(--die);
  margin: 0;
  z-index: 4;
}

#dice .stage {
  width: var(--die);
  height: var(--die);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  transition: transform 0.2s var(--ease-out-expo);
}

#dice .cube {
  width: 100%;
  height: 100%;
  position: absolute;
  transform-style: preserve-3d;
}

#dice .face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 15%;
  gap: 8%;
  background: linear-gradient(145deg, #fffdf7 0%, #f5e2ba 52%, #e3c183 100%);
  border-radius: 18%;
  box-shadow:
    inset 0 0 0 1.5px #c59b59,
    inset 0 -4px 8px rgba(102, 71, 28, 0.22);
  backface-visibility: hidden;
}

#dice .face.top {
  background: linear-gradient(145deg, #ffffff 0%, #f8e8c5 55%, #ebd094 100%);
}

#dice .face.right,
#dice .face.bottom {
  background: linear-gradient(145deg, #efd5a1 0%, #d5b172 100%);
}

#dice .face.left,
#dice .face.back {
  background: linear-gradient(145deg, #e7c78f 0%, #c69f61 100%);
}

#dice .face.front { transform: translateZ(calc(var(--die) / 2)); }
#dice .face.back { transform: rotateY(180deg) translateZ(calc(var(--die) / 2)); }
#dice .face.right { transform: rotateY(90deg) translateZ(calc(var(--die) / 2)); }
#dice .face.left { transform: rotateY(-90deg) translateZ(calc(var(--die) / 2)); }
#dice .face.top { transform: rotateX(90deg) translateZ(calc(var(--die) / 2)); }
#dice .face.bottom { transform: rotateX(-90deg) translateZ(calc(var(--die) / 2)); }

#dice .pip.on {
  width: 78%;
  height: 78%;
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #4a3d54 0%, #17121e 78%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 2px rgba(0, 0, 0, 0.65);
}

#dice:after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -10%;
  height: 22%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.58) 0%, transparent 72%);
  border-radius: 50%;
  z-index: -1;
}

#dice .value {
  position: absolute;
  left: 50%;
  bottom: -22%;
  transform: translateX(-50%);
  min-width: 1.65em;
  padding: 1px 6px;
  border-radius: 7px;
  background: linear-gradient(180deg, #fff0cf, #e8c788);
  color: #241b27;
  font: 700 clamp(10px, 2.2cqi, 15px)/1.25 "Fraunces", Georgia, serif;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  z-index: 1;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

#dice .value:empty {
  display: none;
}

#note,
details p {
  font-size: 14px;
  line-height: 1.5;
  color: #cfc7d8;
}

#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#controls button {
  background: #eec578;
  color: #221a26;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(238, 197, 120, 0.24);
  transition:
    background-color 0.15s ease,
    transform 0.15s var(--ease-out-expo);
}

#controls button:hover:enabled {
  background: #f5d391;
}

#controls button:active:enabled {
  transform: scale(0.98);
}

#controls button:disabled {
  opacity: 0.5;
  cursor: default;
}

button:focus-visible,
summary:focus-visible {
  outline: 3px solid #e6c6ff;
  outline-offset: 2px;
}

details {
  border-top: 1px solid #373245;
  padding-top: 14px;
}

summary {
  cursor: pointer;
  font-weight: 600;
  color: #e9decb;
  transition: color 0.15s ease;
}

summary:hover {
  color: #eec578;
}

body.celebrate #turn {
  color: #ffdf9e;
}

/* Reaction Tray */
#tray {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#react-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b9b1c4;
  font-weight: 700;
  text-align: center;
}

#reactions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.react {
  position: relative;
}

.pawn-pick {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #6a6278;
  border-radius: 999px;
  background: #1b1724;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
  z-index: 6;
}

.pawn-pick[hidden] {
  display: none;
}

#reactions .pawn-pick button {
  width: 28px;
  height: 28px;
  font: 700 12px "Plus Jakarta Sans", system-ui, sans-serif;
  color: #fff8ea;
}

#reactions button.emoji.open {
  background: #3a314c;
  box-shadow: 0 0 0 2px #eec578;
}

#reactions button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #4a4358;
  border-radius: 999px;
  background: #252130;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    transform 0.15s var(--ease-out-expo),
    background-color 0.15s ease;
}

#reactions button .glyph {
  display: block;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

#reactions button:hover:enabled {
  background: #312b40;
  transform: translateY(-2px);
}

#reactions button:active:enabled {
  transform: scale(0.95);
}

#reactions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.floater {
  position: absolute;
  z-index: 12;
  pointer-events: none;
  font-size: clamp(28px, 6vw, 46px);
  line-height: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55));
  -webkit-user-select: none;
  user-select: none;
}

.sound-wave {
  position: absolute;
  z-index: 9;
  width: 38px;
  height: 26px;
  pointer-events: none;
}

.piece > .sound-wave {
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
}

#board > .sound-wave {
  transform: translate(-50%, calc(-100% - 10px));
}

.sound-wave .say {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  padding: 4px 5px 5px;
  box-sizing: border-box;
  border-radius: 10px;
  background: #fffaf0;
  border: 1.5px solid #2a2018;
  box-shadow: 2px 3px 0 #2a2018;
  transform-origin: 50% 130%;
  animation: say-pop 0.22s cubic-bezier(0.2, 1.35, 0.36, 1) both, say-talk 0.46s ease-in-out 0.22s infinite;
}

.sound-wave .say:after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  margin-left: -5px;
  background: #fffaf0;
  border-right: 1.5px solid #2a2018;
  border-bottom: 1.5px solid #2a2018;
  transform: rotate(45deg);
}

.sound-wave i {
  display: block;
  width: 3px;
  border-radius: 99px;
  background: #3b2a1e;
  transform-origin: center bottom;
  animation: sound-bar 0.42s ease-in-out infinite;
}

.sound-wave i:nth-child(1) { height: 7px; }
.sound-wave i:nth-child(2) { height: 14px; animation-delay: 0.1s; }
.sound-wave i:nth-child(3) { height: 11px; animation-delay: 0.2s; }
.sound-wave i:nth-child(4) { height: 8px; animation-delay: 0.28s; }

@keyframes sound-bar {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

@keyframes say-pop {
  from { transform: scale(0.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes say-talk {
  0%, 100% { transform: scale(1, 1); }
  35% { transform: scale(1.08, 0.92); }
  70% { transform: scale(0.96, 1.08); }
}

.piece > .floater.on-pawn {
  left: 50%;
  top: 6%;
  z-index: 8;
  font-size: clamp(18px, 4.4cqi, 32px);
}

.floater .glyph {
  display: block;
  transform-origin: 50% 60%;
}

.floater.laugh .glyph,
.mood.laugh {
  animation: emoji-laugh 0.42s ease-in-out infinite;
}

.floater.cry .glyph,
.mood.cry {
  animation: emoji-cry 1.15s ease-in-out infinite;
}

.floater.fire .glyph { animation: emoji-fire 0.55s ease-in-out infinite; }
.floater.clap .glyph { animation: emoji-clap 0.38s ease-in-out infinite; }
.floater.skull .glyph { animation: emoji-skull 0.7s ease-in-out infinite; }
.floater.crown .glyph { animation: emoji-crown 1.1s ease-in-out infinite; }
.floater.mad .glyph { animation: emoji-mad 0.28s linear infinite; }
.floater.deal .glyph { animation: emoji-deal 0.8s ease-in-out infinite; }

.floater .tear {
  position: absolute;
  left: 18%;
  top: 34%;
  width: 7px;
  height: 10px;
  border-radius: 50% 50% 50% 0;
  background: #8fd4ff;
  box-shadow: inset -1px -1px 0 #fff7;
  animation: tear-fall 0.85s ease-in infinite;
}

.floater.cry .tear {
  width: 9px;
  height: 12px;
  animation-duration: 1.2s;
}

.floater .tear.b {
  left: auto;
  right: 18%;
  animation-delay: 0.38s;
}

.mood.laugh,
.mood.cry {
  display: inline-block;
}

@keyframes emoji-laugh {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  25% { transform: rotate(12deg) scale(1.16, 0.9); }
  50% { transform: rotate(-14deg) scale(0.92, 1.14); }
  75% { transform: rotate(9deg) scale(1.18, 0.88); }
}

@keyframes emoji-cry {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  35% { transform: translateY(2px) rotate(6deg); }
  70% { transform: translateY(5px) rotate(-3deg) scale(1.05); }
}

@keyframes emoji-fire {
  0%, 100% { transform: scale(1) rotate(-4deg); }
  50% { transform: scale(1.14, 0.9) rotate(5deg); }
}

@keyframes emoji-clap {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(0.78) scaleY(1.12); }
}

@keyframes emoji-skull {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg); }
  75% { transform: rotate(10deg); }
}

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

@keyframes emoji-mad {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px) rotate(-6deg); }
  75% { transform: translateX(2px) rotate(6deg); }
}

@keyframes emoji-deal {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes tear-fall {
  0% { opacity: 0; transform: translateY(0) rotate(-45deg) scale(0.5); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translateY(26px) rotate(-45deg) scale(1); }
}

.mood {
  font-weight: 400;
  margin-left: 3px;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 700px) {
  main {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  h1 {
    font-size: 28px;
  }
  .title {
    padding: 4px 0 8px;
  }
  .layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  #board,
  #tray,
  aside {
    width: min(100%, calc(100dvh - 250px));
    max-width: 100%;
    min-width: 0;
    margin-inline: auto;
  }
  #board {
    border-width: 7px;
    border-radius: 16px;
  }
  aside {
    position: sticky;
    bottom: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    text-align: center;
  }
  #turn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
    margin: 0;
    padding: 0;
    text-align: center;
  }
  #who,
  #note {
    width: 100%;
    margin: 0;
    text-align: center;
  }
  #who {
    font-size: 18px;
  }
  #controls {
    justify-content: center;
    width: 100%;
    margin-top: 6px;
  }
  #controls button {
    min-height: 44px;
    flex: 1;
  }
  #reactions {
    width: 100%;
    justify-content: center;
    gap: 6px;
  }
  #reactions button {
    width: 36px;
    height: 36px;
  }
  details {
    order: 3;
    width: 100%;
    text-align: center;
  }
  summary {
    width: fit-content;
    margin-inline: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .base.current:after,
  .piece:enabled:before,
  #board.shake,
  .land-ripple {
    animation: none;
  }
  .piece,
  .base,
  #dice .stage,
  #reactions button:hover:enabled,
  #controls button {
    transition: none;
    transform: none;
  }
  .floater .glyph,
  .floater .tear,
  .mood.laugh,
  .mood.cry,
  .sound-wave .say,
  .sound-wave i {
    animation: none;
  }
}
