:root {
  color-scheme: light;
  --bg: #f4f1e8;
  --panel: #fffaf0;
  --ink: #191b24;
  --muted: #626674;
  --line: #d6cbb8;
  --accent: #166e67;
  --accent-strong: #0d504b;
  --danger: #b83b3b;
  --success: #237248;
  --table: #2f6f62;
  --night: #172134;
  --slot-gap: clamp(116px, 28vw, 230px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--night);
  color: var(--ink);
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  z-index: -2;
  background:
    url("../assets/privoz-sign-intro.jpg") center / cover no-repeat,
    var(--night);
  background-position: 72% center;
}

body::after {
  z-index: -1;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 231, 170, 0.16), transparent 34%),
    linear-gradient(90deg, rgba(14, 20, 33, 0.78), rgba(14, 20, 33, 0.36) 48%, rgba(14, 20, 33, 0.4)),
    linear-gradient(180deg, rgba(14, 20, 33, 0.12), rgba(14, 20, 33, 0.74));
}

button,
input {
  font: inherit;
}

.app {
  display: grid;
  min-height: 100vh;
  padding: 24px;
}

.intro-screen {
  display: grid;
  width: min(100%, 980px);
  min-height: calc(100vh - 48px);
  align-content: end;
  justify-self: center;
  padding-block: clamp(150px, 25vh, 230px) clamp(28px, 7vh, 68px);
  color: white;
}

.intro-eyebrow {
  color: #ffd27c;
}

.intro-screen h1 {
  max-width: 760px;
  margin-bottom: clamp(24px, 4vw, 38px);
  text-shadow: 0 18px 48px rgba(0, 0, 0, 0.4);
}

.intro-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  width: min(100%, 700px);
  margin: 0 0 16px;
  border: 0;
  padding: 0;
}

.intro-levels legend {
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.92rem;
}

.intro-levels label {
  cursor: pointer;
}

.intro-levels input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.intro-levels span {
  display: grid;
  min-height: 96px;
  align-content: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(7, 12, 24, 0.42);
  padding: 16px;
  color: white;
  backdrop-filter: blur(8px);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.intro-levels strong {
  font-size: 1.28rem;
  line-height: 1.2;
}

.intro-levels small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
}

.intro-levels input:checked + span {
  border-color: #ffd27c;
  background: rgba(255, 210, 124, 0.18);
  transform: translateY(-2px);
}

.intro-levels input:focus-visible + span,
.intro-start:focus-visible,
.intro-sound:focus-visible {
  outline: 3px solid rgba(255, 210, 124, 0.34);
  outline-offset: 3px;
}

.intro-bankroll {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.04rem;
}

.intro-bankroll strong {
  color: #ffd27c;
  font-size: 1.24rem;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.intro-start {
  display: inline-flex;
  width: fit-content;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  background: #ffd27c;
  padding: 0 22px;
  color: #171006;
  font-weight: 900;
}

.intro-start:hover {
  background: #ffe0a3;
}

.app.has-started {
  place-items: stretch center;
  padding: 8px;
}

.app.has-started .intro-screen {
  display: none;
}

.app:not(.has-started) .game-panel {
  display: none;
}

.game-panel {
  display: flex;
  width: min(100%, 1220px);
  min-height: calc(100vh - 16px);
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.78);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px);
}

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

.title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.back-action {
  display: inline-grid;
  width: 38px;
  min-width: 38px;
  height: 38px;
  place-items: center;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.88);
  color: var(--accent-strong);
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
}

.back-action:hover {
  background: #eef8f5;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.game-panel .eyebrow {
  display: none;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 8vw, 5.8rem);
  line-height: 0.95;
}

.game-panel h1 {
  font-size: clamp(1.55rem, 2.2vw, 2.25rem);
  line-height: 1;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 5px;
  min-width: min(100%, 420px);
}

.stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.84);
  padding: 6px 10px;
  color: var(--muted);
  font-size: 0.7rem;
}

.stats strong {
  display: block;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.1;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
}

.difficulty,
.bet-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.difficulty legend,
.bet-controls legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.difficulty label,
.bet-controls label {
  cursor: pointer;
}

.difficulty input,
.bet-controls input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.difficulty span,
.bet-controls span,
.primary-action {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  white-space: nowrap;
}

.difficulty input:checked + span,
.bet-controls input:checked + span {
  border-color: var(--accent);
  background: #dff0ec;
  color: var(--accent-strong);
  font-weight: 800;
}

.difficulty input:focus-visible + span,
.bet-controls input:focus-visible + span,
.primary-action:focus-visible,
.back-action:focus-visible,
.icon-action:focus-visible,
.cup:focus-visible {
  outline: 3px solid rgba(22, 110, 103, 0.32);
  outline-offset: 3px;
}

.action-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.primary-action {
  cursor: pointer;
  border-color: transparent;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.icon-action {
  display: inline-grid;
  width: 36px;
  min-width: 36px;
  height: 36px;
  place-items: center;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.86);
  color: var(--accent-strong);
}

.icon-action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-action svg path:first-child {
  fill: currentColor;
  stroke: none;
}

.icon-action[aria-pressed="true"] {
  border-color: var(--accent);
  background: #dff0ec;
}

.icon-action[aria-pressed="true"] .sound-off,
.icon-action[aria-pressed="false"] .sound-wave {
  display: none;
}

.intro-sound {
  width: 48px;
  min-width: 48px;
  height: 48px;
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(7, 12, 24, 0.46);
  color: #ffd27c;
  backdrop-filter: blur(8px);
}

.intro-sound[aria-pressed="true"] {
  border-color: #ffd27c;
  background: rgba(255, 210, 124, 0.18);
  color: white;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.icon-action:hover {
  background: #eef8f5;
}

.intro-sound:hover {
  background: rgba(255, 210, 124, 0.14);
}

.primary-action:disabled,
.difficulty input:disabled + span,
.bet-controls input:disabled + span {
  cursor: not-allowed;
  opacity: 0.58;
}

.status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stage {
  position: relative;
  flex: 1;
  min-height: min(74vh, 760px);
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(20, 15, 10, 0.3)),
    #6f4c32;
  perspective: 900px;
}

.stage::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 20, 28, 0.04), rgba(12, 8, 5, 0.54)),
    radial-gradient(ellipse at 50% 67%, rgba(255, 231, 174, 0.22), transparent 42%);
  content: "";
}

.market-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0 0 50%;
  background:
    linear-gradient(180deg, rgba(19, 23, 31, 0.18), rgba(19, 23, 31, 0.72)),
    url("../assets/privoz-sign-intro.jpg") center 38% / cover no-repeat;
  filter: saturate(0.92);
}

.table-plane {
  position: absolute;
  z-index: 1;
  right: -9%;
  bottom: -24%;
  left: -9%;
  height: 94%;
  border-radius: 38px 38px 0 0;
  background:
    linear-gradient(90deg, rgba(45, 23, 11, 0.26) 0 1px, transparent 1px 21%),
    linear-gradient(180deg, rgba(255, 226, 174, 0.18), rgba(40, 22, 10, 0.55)),
    repeating-linear-gradient(88deg, #7c5436 0 58px, #68452c 58px 64px, #8d6241 64px 132px);
  box-shadow: inset 0 28px 55px rgba(255, 228, 174, 0.18), inset 0 -40px 70px rgba(0, 0, 0, 0.38);
  transform: rotateX(54deg);
  transform-origin: center bottom;
}

.table-plane::before {
  position: absolute;
  right: 13%;
  bottom: 28%;
  color: rgba(5, 5, 4, 0.68);
  content: "⚓";
  font-size: clamp(3.6rem, 9vw, 7rem);
  font-weight: 900;
  opacity: 0.82;
  text-shadow:
    1px 1px 0 rgba(0, 0, 0, 0.18),
    -1px 0 rgba(255, 226, 174, 0.08);
  transform: rotate(-13deg);
}

.table-plane::after {
  position: absolute;
  left: 13%;
  bottom: 37%;
  color: rgba(32, 18, 10, 0.46);
  content: "Одесса";
  font-family: "Trebuchet MS", "Segoe Print", cursive;
  font-size: clamp(1.25rem, 3.2vw, 2.6rem);
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow:
    1px 1px 0 rgba(255, 226, 174, 0.16),
    -1px -1px 0 rgba(24, 12, 5, 0.28);
  transform: rotate(9deg);
}

.table-line {
  position: absolute;
  right: 7%;
  bottom: 50%;
  left: 7%;
  z-index: 1;
  height: 3px;
  background:
    linear-gradient(90deg, transparent, rgba(33, 18, 8, 0.32), transparent),
    rgba(255, 232, 176, 0.32);
  box-shadow: 0 4px 14px rgba(20, 10, 4, 0.28);
}

.cup {
  --offset: 0;
  --shuffle-duration: 420ms;
  position: absolute;
  z-index: 3;
  bottom: clamp(66px, 13vh, 124px);
  left: 50%;
  width: clamp(116px, 15vw, 168px);
  aspect-ratio: 1 / 1.05;
  cursor: pointer;
  border: 0;
  background: transparent;
  padding: 0;
  transform:
    translateX(calc(var(--offset, 0) * var(--slot-gap) - 50%))
    rotateX(12deg)
    rotateZ(calc(var(--offset, 0) * -3deg));
  transition:
    transform var(--shuffle-duration, 420ms) cubic-bezier(0.2, 0.8, 0.18, 1),
    filter 160ms ease;
}

.cup:disabled {
  cursor: default;
}

.cup:hover:not(:disabled) {
  filter: brightness(1.05);
}

.cup-art {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.ball-art {
  position: absolute;
  z-index: 1;
  right: 31%;
  bottom: 0;
  width: 38%;
  opacity: 0;
  transform: translateY(14px) scale(0.72);
  transition:
    opacity 200ms ease,
    transform 220ms ease;
  pointer-events: none;
}

.cup.show-ball .ball-art {
  opacity: 1;
  transform: translateY(42px) scale(1);
}

.cup.reveal .cup-art {
  transform: translateY(-30px) rotate(-3deg);
  transition: transform 240ms ease;
}

.selection-marker {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  opacity: 0;
  transform: translateX(-50%) scale(0.7);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.cup.correct .selection-marker,
.cup.incorrect .selection-marker {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.cup.correct .selection-marker {
  background: var(--success);
}

.cup.incorrect .selection-marker {
  background: var(--danger);
}

.stage.is-shuffling .cup {
  filter: drop-shadow(0 18px 20px rgba(20, 25, 35, 0.2));
}

.result-overlay {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: end start;
  padding: clamp(16px, 4vw, 38px);
  background:
    linear-gradient(180deg, rgba(10, 10, 12, 0.02), rgba(10, 10, 12, 0.58)),
    var(--result-photo, none) center / cover no-repeat;
  opacity: 0;
  pointer-events: none;
  transform: scale(1.04);
}

.result-overlay.is-visible {
  animation: result-photo-pop 1600ms ease-in-out both;
}

.result-overlay.is-loss {
  --result-photo: url("../assets/dealer-loss.jpg");
}

.result-overlay.is-win {
  --result-photo: url("../assets/dealer-win.jpg");
}

.result-caption {
  max-width: min(100%, 520px);
  border-radius: 8px;
  background: rgba(10, 12, 16, 0.66);
  padding: 12px 14px;
  color: white;
  font-weight: 900;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.56);
}

.pawn-modal {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: none;
  place-items: center;
  padding: clamp(16px, 4vw, 38px);
  background:
    radial-gradient(circle at 50% 42%, rgba(0, 0, 0, 0.08), transparent 32%),
    rgba(12, 10, 8, 0.58);
}

.pawn-modal.is-visible {
  display: grid;
}

.pawn-card {
  width: min(100%, 560px);
  border: 1px solid rgba(255, 226, 174, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.98), rgba(237, 223, 196, 0.98));
  padding: clamp(18px, 3vw, 28px);
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.42);
}

.pawn-card .eyebrow {
  margin-bottom: 5px;
  color: var(--accent-strong);
}

.pawn-card h2 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  line-height: 1;
}

.pawn-copy,
.pawn-empty {
  margin: 0 0 14px;
  color: var(--muted);
}

.pawn-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.pawn-options button {
  display: grid;
  min-height: 160px;
  align-items: center;
  justify-items: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.92);
  padding: 10px;
  color: var(--ink);
  text-align: center;
}

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

.pawn-options button:hover:not(:disabled),
.pawn-options button:focus-visible {
  border-color: var(--accent);
  background: #e9f3ef;
}

.pawn-options button:disabled {
  cursor: default;
  opacity: 0.42;
}

.pawn-picture {
  display: grid;
  width: 100%;
  min-height: 112px;
  place-items: center;
}

.pawn-picture img {
  width: min(100%, 126px);
  max-height: 118px;
  object-fit: contain;
  filter: drop-shadow(0 12px 14px rgba(33, 22, 10, 0.16));
}

.pawn-options strong {
  color: var(--accent-strong);
  font-size: 1.1rem;
}

.pawn-close {
  min-height: 38px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 800;
}

.pawn-close:hover,
.pawn-close:focus-visible {
  border-color: var(--danger);
  color: var(--danger);
}

@keyframes result-photo-pop {
  0% {
    opacity: 0;
    transform: scale(1.05);
  }

  14%,
  78% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.02);
  }
}

.dealer-pop {
  position: absolute;
  z-index: 7;
  top: clamp(16px, 5vh, 46px);
  left: 50%;
  width: clamp(170px, 23vw, 255px);
  aspect-ratio: 1.12 / 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -28%) scale(0.82);
}

.dealer-cartoon {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.dealer-cartoon::before {
  position: absolute;
  inset: 20% 17% 5%;
  border-radius: 46% 46% 44% 44%;
  background:
    radial-gradient(circle at 58% 63%, rgba(128, 65, 40, 0.24) 0 4%, transparent 5%),
    radial-gradient(circle at 38% 54%, rgba(255, 195, 155, 0.8), transparent 30%),
    linear-gradient(135deg, #9a5438, #dc9a68 47%, #7d3f2c);
  box-shadow: inset 10px 0 18px rgba(255, 225, 197, 0.26), inset -10px -8px 24px rgba(75, 30, 20, 0.28), 0 26px 46px rgba(0, 0, 0, 0.34);
  content: "";
}

.dealer-cap {
  position: absolute;
  z-index: 3;
  top: 7%;
  left: 22%;
  width: 56%;
  height: 28%;
  border-radius: 54% 54% 20% 20%;
  background:
    linear-gradient(180deg, #29303a, #111620);
  box-shadow: inset 0 8px 14px rgba(255, 255, 255, 0.08), 0 6px 12px rgba(0, 0, 0, 0.28);
  transform: rotate(-7deg);
}

.dealer-cap::after {
  position: absolute;
  right: -12%;
  bottom: -4%;
  width: 44%;
  height: 28%;
  border-radius: 999px;
  background: #141923;
  content: "";
}

.dealer-ear {
  position: absolute;
  top: 48%;
  z-index: 1;
  width: 15%;
  height: 22%;
  border-radius: 999px;
  background: #b66f4e;
}

.dealer-ear-left {
  left: 12%;
}

.dealer-ear-right {
  right: 12%;
}

.dealer-eye {
  position: absolute;
  z-index: 4;
  top: 48%;
  width: 17%;
  height: 8%;
  border-radius: 999px;
  background: #18151a;
  transform: rotate(-9deg);
}

.dealer-eye::after {
  position: absolute;
  top: 38%;
  left: 44%;
  width: 17%;
  height: 36%;
  border-radius: 999px;
  background: white;
  content: "";
}

.dealer-eye-left {
  --eye-tilt: -9deg;
  left: 33%;
}

.dealer-eye-right {
  --eye-tilt: 9deg;
  right: 30%;
  transform: rotate(9deg);
}

.dealer-nose {
  position: absolute;
  z-index: 4;
  top: 53%;
  left: 48%;
  width: 11%;
  height: 18%;
  border-radius: 54% 54% 48% 48%;
  background: linear-gradient(120deg, #9e563a, #e5a273);
  box-shadow: 4px 3px 0 rgba(72, 30, 19, 0.22);
}

.dealer-moustache {
  position: absolute;
  z-index: 4;
  top: 68%;
  left: 34%;
  width: 34%;
  height: 10%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 25% 45%, #221516 0 35%, transparent 36%),
    radial-gradient(ellipse at 75% 45%, #221516 0 35%, transparent 36%);
}

.dealer-mouth {
  position: absolute;
  z-index: 5;
  top: 71%;
  left: 42%;
  width: 28%;
  height: 10%;
  overflow: hidden;
  border-radius: 0 0 999px 999px;
  background: #2a1412;
  transform-origin: center top;
}

.dealer-pop.is-pre .dealer-mouth,
.dealer-pop.is-loss .dealer-mouth {
  animation: crooked-smile 780ms 120ms ease-in-out both;
}

.dealer-pop.is-win .dealer-mouth {
  animation: spit-mouth 900ms 120ms ease-in-out both;
}

.dealer-pop.is-pre .dealer-eye,
.dealer-pop.is-loss .dealer-eye,
.dealer-pop.is-win .dealer-eye {
  animation: shifty-eyes 760ms ease-in-out both;
}

.gold-tooth {
  position: absolute;
  top: 9%;
  left: 50%;
  width: 18%;
  height: 54%;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(135deg, #fff3a0, #d9961f);
  box-shadow: 0 0 0 rgba(255, 228, 105, 0);
  opacity: 0;
}

.gold-tooth::after {
  position: absolute;
  top: -13px;
  left: -7px;
  width: 26px;
  height: 26px;
  background: conic-gradient(from 45deg, transparent 0 18%, rgba(255, 255, 255, 0.95) 19% 21%, transparent 22% 48%, rgba(255, 247, 164, 0.95) 49% 51%, transparent 52%);
  content: "";
  opacity: 0;
}

.spit-drop {
  position: absolute;
  z-index: 6;
  top: 72%;
  left: 64%;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(225, 244, 240, 0.86);
  opacity: 0;
}

.dealer-pop.is-pre,
.dealer-pop.is-loss {
  animation: dealer-grin 980ms ease-in-out both;
}

.dealer-pop.is-win {
  animation: dealer-spit-pop 1120ms ease-in-out both;
}

.dealer-pop.is-pre .gold-tooth,
.dealer-pop.is-loss .gold-tooth {
  animation: tooth-flash 760ms 170ms ease-out both;
}

.dealer-pop.is-win .spit-drop {
  animation: spit-sideways 720ms 270ms ease-out both;
}

.player-hand {
  --target-offset: 0;
  position: absolute;
  z-index: 6;
  bottom: -16%;
  left: 50%;
  width: clamp(190px, 23vw, 285px);
  height: clamp(180px, 22vw, 250px);
  opacity: 0;
  pointer-events: none;
  transform:
    translateX(calc(var(--target-offset) * var(--slot-gap) - 50%))
    translateY(70%)
    rotate(calc(var(--target-offset) * -8deg));
}

.player-hand::before {
  position: absolute;
  right: 10%;
  bottom: 0;
  width: 42%;
  height: 54%;
  border-radius: 42% 38% 32% 30%;
  background:
    radial-gradient(circle at 70% 18%, rgba(73, 37, 20, 0.16) 0 5%, transparent 6%),
    linear-gradient(90deg, #b86f4d, #e5aa7d 50%, #a65e3d);
  box-shadow: inset 9px 0 16px rgba(255, 224, 190, 0.24), 0 18px 28px rgba(0, 0, 0, 0.22);
  content: "";
}

.player-hand::after {
  position: absolute;
  right: 22%;
  bottom: 46%;
  width: 40%;
  height: 24%;
  border-radius: 999px 999px 22px 22px;
  background:
    radial-gradient(ellipse at 25% 64%, rgba(94, 46, 26, 0.2) 0 11%, transparent 12%),
    radial-gradient(ellipse at 50% 58%, rgba(94, 46, 26, 0.2) 0 11%, transparent 12%),
    radial-gradient(ellipse at 75% 56%, rgba(94, 46, 26, 0.2) 0 11%, transparent 12%),
    linear-gradient(90deg, #a95f3f, #d99a70 55%, #9c5738);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.18);
  content: "";
  transform: rotate(-5deg);
}

.pointing-finger {
  position: absolute;
  right: 43%;
  bottom: 60%;
  width: 15%;
  height: 56%;
  border-radius: 999px 999px 20px 20px;
  background:
    radial-gradient(ellipse at 50% 12%, rgba(255, 241, 220, 0.9) 0 18%, transparent 19%),
    linear-gradient(180deg, rgba(99, 48, 27, 0.22) 0 2px, transparent 2px 36%),
    linear-gradient(90deg, #ba704d, #e7ae80 55%, #9f5a3a);
  box-shadow: inset 6px 0 10px rgba(255, 230, 199, 0.26), 0 12px 18px rgba(0, 0, 0, 0.22);
  transform-origin: bottom center;
  transform: rotate(-16deg);
}

.pointing-finger::before,
.pointing-finger::after {
  position: absolute;
  bottom: -17%;
  width: 82%;
  height: 28%;
  border-radius: 999px;
  background: linear-gradient(90deg, #a85f3e, #d99b70);
  content: "";
}

.pointing-finger::before {
  right: 82%;
  transform: rotate(-34deg);
}

.pointing-finger::after {
  left: 86%;
  width: 96%;
  height: 33%;
  transform: rotate(36deg);
}

.player-hand.is-pointing {
  animation: first-person-point 840ms cubic-bezier(0.22, 0.82, 0.18, 1) both;
}

@keyframes tattooed-fingers {
  from {
    transform: translateY(-22px) rotateX(18deg) rotateZ(-13deg);
  }

  to {
    transform: translateY(4px) rotateX(18deg) rotateZ(9deg);
  }
}

@keyframes first-person-point {
  0% {
    opacity: 0;
    transform:
      translateX(calc(var(--target-offset) * var(--slot-gap) - 50%))
      translateY(78%)
      rotate(calc(var(--target-offset) * -12deg));
  }

  26%,
  72% {
    opacity: 1;
    transform:
      translateX(calc(var(--target-offset) * var(--slot-gap) - 50%))
      translateY(14%)
      rotate(calc(var(--target-offset) * -8deg));
  }

  100% {
    opacity: 0;
    transform:
      translateX(calc(var(--target-offset) * var(--slot-gap) - 50%))
      translateY(62%)
      rotate(calc(var(--target-offset) * -8deg));
  }
}

@keyframes dealer-grin {
  0% {
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.82) rotate(-3deg);
  }

  18%,
  78% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1) rotate(1deg);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -26%) scale(0.9) rotate(3deg);
  }
}

@keyframes dealer-spit-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -32%) scale(0.9) rotate(2deg);
  }

  16%,
  82% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1) rotate(-1deg);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -18%) scale(0.92) rotate(-3deg);
  }
}

@keyframes tooth-flash {
  0%,
  100% {
    opacity: 0;
    box-shadow: 0 0 0 rgba(255, 228, 105, 0);
  }

  35%,
  66% {
    opacity: 1;
    box-shadow: 0 0 26px rgba(255, 228, 105, 0.95);
  }
}

@keyframes spit-sideways {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.6);
  }

  20% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(62px, 62px) scale(1.3);
  }
}

@keyframes crooked-smile {
  0%,
  100% {
    width: 24%;
    height: 6%;
    transform: rotate(-5deg) scaleY(0.62);
  }

  38%,
  78% {
    width: 35%;
    height: 13%;
    transform: rotate(-7deg) scaleY(1);
  }
}

@keyframes spit-mouth {
  0%,
  100% {
    width: 24%;
    height: 7%;
    transform: translateX(0) rotate(-3deg);
  }

  34%,
  76% {
    width: 18%;
    height: 16%;
    transform: translateX(18px) rotate(9deg);
  }
}

@keyframes shifty-eyes {
  0%,
  100% {
    transform: translateX(0) rotate(var(--eye-tilt, -9deg));
  }

  35% {
    transform: translateX(-3px) rotate(var(--eye-tilt, -9deg));
  }

  70% {
    transform: translateX(4px) rotate(var(--eye-tilt, -9deg));
  }
}

@media (max-width: 720px) {
  .app {
    padding: 8px;
  }

  .intro-screen {
    min-height: calc(100vh - 28px);
  }

  .intro-levels {
    grid-template-columns: 1fr;
  }

  .intro-levels span {
    min-height: 74px;
  }

  .game-panel {
    min-height: calc(100vh - 16px);
    padding: 8px;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .controls {
    display: grid;
    grid-template-columns: minmax(168px, 1fr) minmax(160px, 0.9fr);
    align-items: stretch;
    gap: 6px;
  }

  .stats {
    width: auto;
    min-width: 0;
  }

  .stats span {
    padding: 5px 7px;
    font-size: 0.64rem;
  }

  .stats strong {
    font-size: 0.98rem;
  }

  .difficulty,
  .bet-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
  }

  .difficulty span,
  .bet-controls span,
  .primary-action {
    width: 100%;
    min-height: 34px;
    padding-inline: 7px;
  }

  .action-row {
    width: 100%;
  }

  .primary-action {
    flex: 1;
  }

  .stage {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .topbar,
  .controls {
    flex-direction: column;
  }

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

  .stats {
    width: 100%;
  }

  .pawn-options {
    grid-template-columns: 1fr;
  }

  .pawn-options button {
    min-height: 118px;
    grid-template-columns: 1fr auto;
    text-align: left;
  }

  .pawn-picture {
    min-height: 96px;
    justify-items: start;
  }

  .pawn-picture img {
    width: min(100%, 118px);
    max-height: 104px;
  }
}

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