:root {
  --bg-0: #163226;
  --bg-1: #1f4333;
  --ink: #14241c;
  --paper: #f7f1e4;
  --cream: #fffaf1;
  --inspire: #d99214;
  --inspire-deep: #b56f08;
  --demo: #7a3030;
  --demo-deep: #5c2222;
  --think: #3d5f86;
  --think-deep: #2c4664;
  --holiday: #2f6a4a;
  --holiday-deep: #215238;
  --accent: #efc56a;
  --shadow: 0 18px 50px rgba(8, 22, 16, 0.45);
  --radius: 22px;
  --font-display: "Unbounded", sans-serif;
  --font-body: "Manrope", sans-serif;
  --cell-border: #cbbfa3;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--cream);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(239, 197, 106, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(61, 95, 134, 0.22), transparent 50%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1) 45%, #18362b);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: radial-gradient(rgba(255, 255, 255, 0.35) 0.6px, transparent 0.7px);
  background-size: 7px 7px;
  mix-blend-mode: soft-light;
}

button,
input {
  font: inherit;
}

.screen {
  display: none;
  min-height: 100dvh;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 20px 16px 28px;
  position: relative;
  z-index: 1;
}

.screen--play {
  width: min(780px, 100%);
  gap: 10px;
  padding-bottom: 18px;
}

@media (max-width: 560px) {
  .token-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.screen.is-active {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise 420ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.brand {
  display: grid;
  gap: 14px;
  padding-top: 18px;
}

.brand__row {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.brand__logo {
  width: auto;
  height: clamp(72px, 18vw, 96px);
  aspect-ratio: 3 / 1.15;
  object-fit: contain;
  object-position: center;
  border-radius: 16px;
  background: #ffffff !important;
  padding: 8px 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  flex: 0 0 auto;
  /* не даём мобильному forced-dark инвертировать логотип */
  color-scheme: only light;
  -webkit-filter: none !important;
  filter: none !important;
  forced-color-adjust: none;
}

.brand__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

.brand__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 5.4vw, 2.05rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.brand__lead {
  margin: 0;
  color: rgba(255, 250, 241, 0.78);
  font-size: 1.02rem;
  line-height: 1.5;
  max-width: 34ch;
}

.panel {
  background: rgba(20, 42, 32, 0.55);
  border: 1px solid rgba(244, 239, 228, 0.12);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(10px);
}

.panel label {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 250, 241, 0.62);
  margin-bottom: 8px;
}

.panel input {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}

.rules {
  margin: 0;
  padding-left: 1.1rem;
  color: rgba(255, 250, 241, 0.72);
  line-height: 1.45;
  font-size: 0.95rem;
}

.rules li + li {
  margin-top: 0.45rem;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.btn--compact {
  padding: 10px 14px;
  font-size: 0.88rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn:not(:disabled):active {
  transform: translateY(1px) scale(0.99);
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #d99214);
  color: #1a2a20;
  box-shadow: 0 12px 28px rgba(217, 146, 20, 0.28);
}

.btn--ghost {
  background: rgba(255, 250, 241, 0.08);
  color: var(--cream);
  border: 1px solid rgba(255, 250, 241, 0.18);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-row--stretch {
  display: grid;
}

.btn-row--finale {
  display: grid;
  gap: 10px;
  justify-content: stretch;
}

.btn--block {
  width: 100%;
  justify-self: stretch;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar__actions {
  display: flex;
  gap: 8px;
}

.topbar__who {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.topbar__meta {
  font-size: 0.82rem;
  color: rgba(255, 250, 241, 0.62);
}

/* —— Monopoly board —— */
.board-wrap {
  position: relative;
  width: 100%;
  max-width: 740px;
  margin: 0 auto;
}

.board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  aspect-ratio: 1 / 1;
  width: min(100%, 90vh, 740px);
  margin-inline: auto;
  background: #1d4030;
  gap: 3px;
  padding: 3px;
  border: 3px solid #d9c9a5;
  border-radius: 12px;
  box-shadow:
    0 0 0 4px #2a4a3a,
    var(--shadow);
  overflow: visible;
}

.board__center {
  grid-column: 2 / 10;
  grid-row: 2 / 10;
  background:
    radial-gradient(circle at 30% 20%, rgba(239, 197, 106, 0.12), transparent 45%),
    linear-gradient(160deg, #204836, #163528);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  gap: 6px;
  padding: 8px 10px;
  text-align: center;
  border: 1px solid rgba(217, 201, 165, 0.25);
  border-radius: 8px;
  overflow: hidden;
}

.board__brand {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.8vw, 12px);
  width: 100%;
  max-width: 100%;
  padding: 0 2px;
}

.board__center-logo {
  width: auto;
  height: clamp(40px, 11vw, 58px);
  aspect-ratio: 3 / 1.15;
  object-fit: contain;
  object-position: center;
  border-radius: 10px;
  background: #ffffff !important;
  padding: 5px 8px;
  flex: 0 0 auto;
  color-scheme: only light;
  -webkit-filter: none !important;
  filter: none !important;
  forced-color-adjust: none;
}

.board__center-title {
  font-family: var(--font-display);
  font-size: clamp(0.7rem, 2.5vw, 1rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  text-align: left;
  max-width: none;
}

.decks {
  display: flex;
  gap: clamp(8px, 2vw, 14px);
  align-items: flex-end;
  justify-content: center;
}

.deck {
  width: clamp(64px, 16vw, 96px);
  height: clamp(90px, 23vw, 132px);
  border-radius: 10px;
  border: 2px solid rgba(255, 250, 241, 0.5);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #fffaf1;
  cursor: pointer;
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  padding: 0;
}

.deck__picto {
  width: clamp(1.9rem, 6vw, 2.7rem);
  height: clamp(1.9rem, 6vw, 2.7rem);
  color: #fffaf1;
  opacity: 0.92;
}

.deck__picto svg {
  width: 100%;
  height: 100%;
  display: block;
}

.deck--inspire {
  background: linear-gradient(160deg, var(--inspire), var(--inspire-deep));
}
.deck--demotivate {
  background: linear-gradient(160deg, var(--demo), var(--demo-deep));
}
.deck--think {
  background: linear-gradient(160deg, var(--think), var(--think-deep));
}

.deck.is-lit {
  transform: translateY(-6px) scale(1.08);
  box-shadow:
    0 0 0 3px rgba(239, 197, 106, 0.95),
    0 0 22px rgba(239, 197, 106, 0.55),
    0 14px 28px rgba(0, 0, 0, 0.35);
  z-index: 3;
  animation: deck-pulse 1.1s ease-in-out infinite;
}

@keyframes deck-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

.deck.is-dim,
.deck.is-locked {
  filter: grayscale(0.35) brightness(0.7);
  pointer-events: none;
}

.deck-legend {
  font-size: clamp(0.58rem, 1.8vw, 0.78rem);
  line-height: 1.3;
  color: rgba(255, 250, 241, 0.78);
  max-width: 28ch;
  min-height: 2.4em;
}

.deck-legend strong {
  color: var(--accent);
}

.cell {
  appearance: none;
  position: relative;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  perspective: 600px;
  cursor: pointer;
  background: transparent;
  font: inherit;
  color: inherit;
}

.cell__inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cell.is-flipped .cell__inner {
  transform: rotateY(180deg);
}

.cell__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: grid;
  place-items: center;
  border-radius: 4px;
  padding: 2px;
}

.cell__front {
  color: rgba(255, 250, 241, 0.9);
  background: #2f6a4a;
}

.cell__back {
  transform: rotateY(180deg);
  background: #f4efe4;
  color: #14241c;
  align-content: center;
  gap: 2px;
  padding: 4px;
  text-align: center;
}

.cell--inspire .cell__front {
  background: #c8871a;
}
.cell--demotivate .cell__front {
  background: #7a3030;
}
.cell--think .cell__front {
  background: #3d5f86;
}
.cell--holiday .cell__front {
  background: #2f6a4a;
}
.cell--start .cell__front {
  background: #8a7038;
}

.cell.is-active {
  z-index: 2;
}

.cell.is-active .cell__front {
  box-shadow: inset 0 0 0 2px #efc56a;
}

.cell.is-visited:not(.is-active) .cell__front {
  filter: saturate(0.8) brightness(0.92);
}

.cell__picto {
  width: 58%;
  height: 58%;
  max-width: 36px;
  max-height: 36px;
  color: rgba(255, 250, 241, 0.88);
  display: grid;
  place-items: center;
}

.cell__picto svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cell__back-num {
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 3.2vw, 1.35rem);
  font-weight: 700;
  opacity: 0.9;
  letter-spacing: -0.03em;
}

.play-audio {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 14px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(14, 32, 24, 0.88);
  border: 1px solid rgba(244, 239, 228, 0.14);
}

.play-audio[hidden] {
  display: none !important;
}

.play-audio__row {
  display: grid;
  gap: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 250, 241, 0.62);
}

.play-audio__row select,
.play-audio__row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.play-audio__row select {
  border: 0;
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--paper);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
}

.cell {
  z-index: 2;
  -webkit-tap-highlight-color: rgba(239, 197, 106, 0.35);
  touch-action: manipulation;
}

.cell-peek-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.cell-peek-overlay[hidden] {
  display: none !important;
}

.cell-peek-overlay__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 22, 16, 0.55);
  cursor: pointer;
}

.cell-peek {
  position: relative;
  z-index: 1;
  width: min(100%, 360px);
  max-height: min(70vh, 420px);
  overflow: auto;
  margin: 0;
  padding: 16px 18px 18px;
  border-radius: 16px;
  background: #f4efe4;
  color: #14241c;
  border: 1px solid #cbbfa3;
  box-shadow: var(--shadow);
  animation: rise 280ms ease both;
}

.cell-peek__close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: transparent;
  color: #5d6f64;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.cell-peek__num {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a7038;
}

.cell-peek__tag {
  margin-top: 2px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5d6f64;
}

.cell-peek__title {
  margin: 6px 0 8px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
  padding-right: 24px;
}

.cell-peek__text {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.cell-peek__action {
  margin: 10px 0 0;
  font-weight: 800;
  font-size: 0.9rem;
  color: #7a3030;
}

.token {
  position: absolute;
  /* меньше клетки, чтобы не перекрывать пиктограмму и тап */
  width: clamp(22px, 5.5vw, 30px);
  height: clamp(22px, 5.5vw, 30px);
  margin: 0;
  transform: translate(-50%, -50%);
  border-radius: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  z-index: 6;
  transition: left 140ms linear, top 140ms linear;
  pointer-events: none;
  display: grid;
  place-items: center;
  overflow: visible;
}

/* слой: клетка → круглая подложка → жетон */
.token__back {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fffdf6 0%, #f4efe4 48%, #e2d6c0 100%);
  border: 2px solid rgba(22, 50, 38, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 3px 0 rgba(22, 50, 38, 0.2),
    0 6px 12px rgba(0, 0, 0, 0.28);
  z-index: 0;
}

.token__art {
  position: relative;
  z-index: 1;
  width: 72%;
  height: 72%;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 1px 0 rgba(22, 50, 38, 0.2));
}

.token__art svg {
  width: 100%;
  height: 100%;
  display: block;
}

.fly-card {
  position: absolute;
  width: 54px;
  height: 76px;
  margin: 0;
  border-radius: 6px;
  border: 2px solid rgba(255, 250, 241, 0.5);
  z-index: 8;
  pointer-events: none;
  transition:
    left 400ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 400ms cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.fly-card--inspire {
  background: linear-gradient(160deg, var(--inspire), var(--inspire-deep));
}
.fly-card--demotivate {
  background: linear-gradient(160deg, var(--demo), var(--demo-deep));
}
.fly-card--think {
  background: linear-gradient(160deg, var(--think), var(--think-deep));
}

.card-overlay__panel.is-deal-in .chance-card {
  animation: card-flip-in 480ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes card-flip-in {
  from {
    opacity: 0;
    transform: rotateY(-55deg) scale(0.86);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.token-panel {
  display: grid;
  gap: 12px;
}

.token-note {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: rgba(255, 250, 241, 0.68);
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.mode-card {
  text-align: left;
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(244, 239, 228, 0.14);
  background: rgba(255, 250, 241, 0.05);
  color: var(--cream);
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.mode-card.is-selected {
  background: rgba(239, 197, 106, 0.14);
  border-color: rgba(239, 197, 106, 0.7);
}

.mode-card__title {
  font-weight: 800;
  font-size: 0.95rem;
}

.mode-card__blurb {
  font-size: 0.82rem;
  color: rgba(255, 250, 241, 0.68);
}

/* —— Iso prototype: вся доска наклонена —— */
body[data-board-mode="iso"] .board-wrap {
  perspective: none;
  padding: 28px 8px 48px;
}

body[data-board-mode="iso"] .board {
  transform: rotateX(58deg) rotateZ(-36deg) scale(0.88);
  transform-style: preserve-3d;
  transform-origin: center center;
  box-shadow:
    18px 28px 0 #12281f,
    28px 48px 40px rgba(0, 0, 0, 0.4);
}

body[data-board-mode="iso"] .board__center {
  overflow: visible;
}

body[data-board-mode="iso"] .decks {
  gap: clamp(16px, 3.5vw, 28px);
  align-items: flex-end;
  transform-style: preserve-3d;
}

/* стопки карт: смещённые слои теней, без кривого tilt поверх доски */
body[data-board-mode="iso"] .deck {
  transform: translateZ(12px);
  border-radius: 6px;
  box-shadow:
    2px 2px 0 rgba(0, 0, 0, 0.18),
    4px 4px 0 currentColor,
    6px 6px 0 rgba(0, 0, 0, 0.2),
    8px 8px 0 currentColor,
    12px 16px 22px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

body[data-board-mode="iso"] .deck--inspire {
  color: #9a6508;
}
body[data-board-mode="iso"] .deck--demotivate {
  color: #4a1a1a;
}
body[data-board-mode="iso"] .deck--think {
  color: #1e3350;
}

body[data-board-mode="iso"] .deck.is-lit {
  transform: translateZ(22px) translateY(-6px) scale(1.05);
  box-shadow:
    0 0 0 3px rgba(239, 197, 106, 0.95),
    2px 2px 0 rgba(0, 0, 0, 0.18),
    4px 4px 0 currentColor,
    6px 6px 0 rgba(0, 0, 0, 0.2),
    8px 8px 0 currentColor,
    14px 20px 28px rgba(0, 0, 0, 0.4);
}

body[data-board-mode="iso"] .chance-card {
  transform: rotateX(8deg) rotateY(-18deg);
  transform-origin: center center;
  box-shadow:
    10px 14px 0 rgba(42, 49, 47, 0.18),
    18px 24px 0 rgba(42, 49, 47, 0.1),
    0 22px 50px rgba(0, 0, 0, 0.4);
}

body[data-board-mode="iso"] .card-overlay__panel.is-deal-in .chance-card {
  animation: card-iso-in 480ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes card-iso-in {
  from {
    opacity: 0;
    transform: rotateX(8deg) rotateY(-42deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: rotateX(8deg) rotateY(-18deg);
  }
}

body[data-board-mode="iso"] .token {
  /* жетон поверх наклонной доски читается лучше чуть крупнее */
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  filter: drop-shadow(4px 6px 4px rgba(0, 0, 0, 0.35));
}

body[data-board-mode="iso"] .cell__front {
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}

.token-pick {
  appearance: none;
  border: 1px solid rgba(244, 239, 228, 0.14);
  background: rgba(255, 250, 241, 0.05);
  color: var(--cream);
  border-radius: 16px;
  padding: 12px 8px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.token-pick.is-selected {
  background: rgba(239, 197, 106, 0.16);
  border-color: rgba(239, 197, 106, 0.75);
}

.token-pick__art {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fffdf6 0%, #f4efe4 48%, #e2d6c0 100%);
  display: grid;
  place-items: center;
  border: 2px solid rgba(244, 239, 228, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 4px 10px rgba(0, 0, 0, 0.25);
}

.token-pick__art svg {
  width: 68%;
  height: 68%;
  display: block;
}

.token-pick__title {
  font-size: 0.78rem;
  font-weight: 800;
}

.hint {
  min-height: 1.25em;
  margin: 0;
  text-align: center;
  color: rgba(255, 250, 241, 0.72);
  font-size: 0.9rem;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border-radius: 18px;
  background: rgba(14, 32, 24, 0.78);
  border: 1px solid rgba(244, 239, 228, 0.12);
  backdrop-filter: blur(14px);
}

.die {
  width: 64px;
  height: 64px;
  perspective: 240px;
  display: grid;
  place-items: center;
}

.die__cube {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(145deg, #fffdf8, #e8dfcf);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.08),
    0 10px 22px rgba(0, 0, 0, 0.28);
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
}

.die.is-rolling .die__cube {
  animation: die-toss 700ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes die-toss {
  0% {
    transform: translateY(0) rotateX(0deg) rotateY(0deg) scale(1);
  }
  25% {
    transform: translateY(-18px) rotateX(120deg) rotateY(-80deg) scale(1.08);
  }
  55% {
    transform: translateY(-6px) rotateX(260deg) rotateY(140deg) scale(1.02);
  }
  80% {
    transform: translateY(2px) rotateX(340deg) rotateY(200deg) scale(0.98);
  }
  100% {
    transform: translateY(0) rotateX(360deg) rotateY(360deg) scale(1);
  }
}

.die__face {
  width: 40px;
  height: 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  padding: 2px;
}

.die__pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a2a20;
  justify-self: center;
  align-self: center;
  opacity: 0;
}

.die__face[data-value="1"] .die__pip:nth-child(5) {
  opacity: 1;
}
.die__face[data-value="2"] .die__pip:nth-child(1),
.die__face[data-value="2"] .die__pip:nth-child(9) {
  opacity: 1;
}
.die__face[data-value="3"] .die__pip:nth-child(1),
.die__face[data-value="3"] .die__pip:nth-child(5),
.die__face[data-value="3"] .die__pip:nth-child(9) {
  opacity: 1;
}
.die__face[data-value="4"] .die__pip:nth-child(1),
.die__face[data-value="4"] .die__pip:nth-child(3),
.die__face[data-value="4"] .die__pip:nth-child(7),
.die__face[data-value="4"] .die__pip:nth-child(9) {
  opacity: 1;
}
.die__face[data-value="5"] .die__pip:nth-child(1),
.die__face[data-value="5"] .die__pip:nth-child(3),
.die__face[data-value="5"] .die__pip:nth-child(5),
.die__face[data-value="5"] .die__pip:nth-child(7),
.die__face[data-value="5"] .die__pip:nth-child(9) {
  opacity: 1;
}
.die__face[data-value="6"] .die__pip:nth-child(1),
.die__face[data-value="6"] .die__pip:nth-child(3),
.die__face[data-value="6"] .die__pip:nth-child(4),
.die__face[data-value="6"] .die__pip:nth-child(6),
.die__face[data-value="6"] .die__pip:nth-child(7),
.die__face[data-value="6"] .die__pip:nth-child(9) {
  opacity: 1;
}

/* —— Chance-style card overlay —— */
.card-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 12px;
}

.card-overlay[hidden] {
  display: none !important;
}

.card-overlay__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 22, 16, 0.62);
  cursor: pointer;
}

.card-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(320px, 92%);
}

.chance-card {
  background: #f7f1e4;
  color: var(--ink);
  border-radius: 14px;
  border: 4px solid #2a312f;
  box-shadow:
    0 0 0 3px #efc56a,
    0 22px 50px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.chance-card__header {
  padding: 12px 14px 10px;
  text-align: center;
  color: #fffaf1;
}

.chance-card--inspire .chance-card__header {
  background: linear-gradient(180deg, var(--inspire), var(--inspire-deep));
}
.chance-card--demotivate .chance-card__header {
  background: linear-gradient(180deg, var(--demo), var(--demo-deep));
}
.chance-card--think .chance-card__header {
  background: linear-gradient(180deg, var(--think), var(--think-deep));
}
.chance-card--holiday .chance-card__header {
  background: linear-gradient(180deg, var(--holiday), var(--holiday-deep));
}
.chance-card--start .chance-card__header {
  background: linear-gradient(180deg, #6d5a2f, #3f351c);
}

.chance-card__eyebrow {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}

.chance-card__title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.chance-card__art {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 18px 12px 10px;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.55), transparent 55%),
    #efe6d4;
  border-bottom: 1px solid #d9c9a5;
}

.chance-card__picto {
  width: 3.2rem;
  height: 3.2rem;
  color: #3a4a40;
}

.chance-card__picto svg {
  width: 100%;
  height: 100%;
  display: block;
}

.chance-card__effect {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  color: #5d6f64;
}

.chance-card__text {
  margin: 0;
  padding: 14px 16px 8px;
  font-size: 0.98rem;
  line-height: 1.45;
  text-align: center;
}

.chance-card__footer {
  margin: 0 14px 14px;
  padding: 12px;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.35;
  background: #ebe2d1;
  border: 1px solid #cbbfa3;
  border-radius: 6px;
}

.chance-card__actions {
  padding: 0 14px 14px;
  display: grid;
}

.finale {
  text-align: center;
  gap: 14px;
}

.finale__eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(239, 197, 106, 0.85);
}

.finale__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  letter-spacing: -0.03em;
}

.finale__text {
  margin: 0 auto;
  max-width: 38ch;
  color: rgba(255, 250, 241, 0.88);
  line-height: 1.55;
  font-size: 1.08rem;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(20, 42, 32, 0.45);
  border: 1px solid rgba(244, 239, 228, 0.12);
}

.postcard-wrap {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #000;
}

.postcard-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
}

.mood-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.mood-pill {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  background: rgba(255, 250, 241, 0.08);
  border: 1px solid rgba(255, 250, 241, 0.14);
}

.audio-panel {
  display: grid;
  gap: 12px;
}

.audio-panel__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.audio-panel__head strong {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.audio-panel__head span {
  font-size: 0.82rem;
  color: rgba(255, 250, 241, 0.62);
}

.audio-panel__note {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: rgba(255, 250, 241, 0.7);
}

.pack-grid {
  display: grid;
  gap: 8px;
}

.pack-card {
  text-align: left;
  border-radius: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(244, 239, 228, 0.14);
  background: rgba(255, 250, 241, 0.05);
  color: var(--cream);
  cursor: pointer;
  display: grid;
  gap: 4px;
}

.pack-card.is-selected {
  background: rgba(239, 197, 106, 0.14);
  border-color: rgba(239, 197, 106, 0.7);
}

.pack-card__title {
  font-weight: 800;
  font-size: 0.95rem;
}

.pack-card__blurb {
  font-size: 0.82rem;
  color: rgba(255, 250, 241, 0.68);
}

.pack-card__listen {
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.audio-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: rgba(255, 250, 241, 0.82);
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.volume-row {
  display: grid;
  gap: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 250, 241, 0.62);
}

.volume-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.share-panel {
  margin: 0 auto;
  width: min(100%, 420px);
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(20, 42, 32, 0.5);
  border: 1px solid rgba(244, 239, 228, 0.12);
  text-align: left;
}

.share-panel__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.share-panel__note,
.share-panel__hint {
  margin: 6px 0 0;
  font-size: 0.85rem;
  line-height: 1.4;
  color: rgba(255, 250, 241, 0.7);
}

.share-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 12px;
}

@media (min-width: 420px) {
  .share-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 720px) {
  .screen {
    padding-top: 28px;
  }
}

/* —— Mobile —— */
@media (max-width: 560px) {
  .screen {
    width: 100%;
    padding: 14px 12px calc(18px + env(safe-area-inset-bottom));
  }

  .screen--play {
    width: 100%;
    gap: 8px;
  }

  .brand__row {
    gap: 10px;
  }

  .brand__logo {
    height: 64px;
  }

  .brand__title {
    font-size: clamp(1.2rem, 7vw, 1.55rem);
  }

  .board-wrap {
    max-width: 100%;
  }

  .board {
    width: min(100%, 78vh);
    gap: 2px;
    padding: 2px;
  }

  .board__center-logo {
    height: clamp(32px, 9vw, 44px);
  }

  .board__center-title {
    font-size: clamp(0.62rem, 3.2vw, 0.85rem);
  }

  .deck {
    width: clamp(56px, 18vw, 78px);
    height: clamp(78px, 26vw, 108px);
  }

  .controls {
    grid-template-columns: 1fr auto;
    padding: 8px;
  }

  .topbar__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .token-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }

  .token-pick {
    padding: 8px 4px;
  }

  .token-pick__title {
    font-size: 0.7rem;
  }

  .cell-peek {
    width: min(100%, 340px);
  }

  .btn {
    min-height: 48px;
  }
}
