:root {
  color-scheme: dark;
  --bg: #090c12;
  --panel: #111722;
  --panel-2: #171f2d;
  --line: rgba(255, 255, 255, 0.09);
  --text: #edf3f8;
  --muted: #8290a3;
  --green: #00e99b;
  --green-dark: #00a96f;
  --red: #ff416c;
  --gold: #ffc857;
  --blue: #5cc8ff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: clip;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 10%, rgba(0, 233, 155, 0.09), transparent 30rem),
    radial-gradient(circle at 92% 78%, rgba(255, 65, 108, 0.08), transparent 32rem),
    linear-gradient(180deg, #0b0f17 0%, #07090e 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
  touch-action: manipulation;
  user-select: none;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(92, 200, 255, 0.8);
  outline-offset: 3px;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px max(24px, calc((100vw - 1400px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(9, 12, 18, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(0, 233, 155, 0.4);
  border-radius: 10px;
  color: var(--green);
  background: rgba(0, 233, 155, 0.08);
  box-shadow: inset 0 0 18px rgba(0, 233, 155, 0.08);
}

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

.practice-badge {
  padding: 7px 10px;
  border: 1px solid rgba(92, 200, 255, 0.25);
  border-radius: 999px;
  color: var(--blue);
  background: rgba(92, 200, 255, 0.06);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.balance-box {
  display: grid;
  min-width: 110px;
  gap: 1px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-align: right;
}

.balance-box span {
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.balance-box strong {
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95rem;
}

.button,
.mode-button,
.chip-button,
.roll-button,
.bank-button,
.dialog-close {
  border: 0;
  cursor: pointer;
}

.button {
  min-height: 44px;
  padding: 0 15px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 850;
}

.button-ghost {
  border: 1px solid var(--line);
  background: var(--panel);
}

.button-primary {
  color: #03110c;
  background: var(--green);
}

.page-shell {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 28px 24px 42px;
}

.game-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 24px;
  background: linear-gradient(155deg, rgba(20, 27, 39, 0.98), rgba(10, 14, 21, 0.98));
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.045);
}

.game-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 14% 0%, rgba(0, 233, 155, 0.08), transparent 18rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent);
}

.game-title-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.sound-toggle {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(92, 200, 255, 0.24);
  border-radius: 999px;
  color: var(--blue);
  background: rgba(92, 200, 255, 0.06);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sound-toggle[aria-pressed="false"] {
  border-color: var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.sound-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: rgba(92, 200, 255, 0.09);
  font-size: 1rem;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  letter-spacing: -0.04em;
}

.mode-selector {
  position: relative;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, minmax(82px, 1fr));
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0e15;
}

.mode-button {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 850;
}

.mode-button:hover:not(:disabled):not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.mode-button.active {
  color: #04120d;
  background: var(--green);
  box-shadow: 0 5px 18px rgba(0, 233, 155, 0.2);
}

.mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.notice {
  margin: 16px 28px 0;
  padding: 11px 14px;
  border: 1px solid rgba(255, 65, 108, 0.4);
  border-radius: 9px;
  color: #ff9ab1;
  background: rgba(255, 65, 108, 0.08);
  font-size: 0.82rem;
  font-weight: 700;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 13, 0.42);
}

.stat {
  display: grid;
  min-height: 76px;
  align-content: center;
  gap: 5px;
  padding: 14px 22px;
  border-right: 1px solid var(--line);
}

.stat:last-child {
  border-right: 0;
}

.stat span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat strong {
  color: #f7fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.02rem;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.05);
}

.stat:first-child strong { color: var(--gold); }

.stat strong i {
  color: inherit;
  font-style: normal;
}

.room-bar {
  position: relative;
  z-index: 6;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 28px;
  border-bottom: 1px solid rgba(92, 200, 255, 0.2);
  color: var(--blue);
  background: rgba(92, 200, 255, 0.055);
  font-size: 0.74rem;
}

.room-bar > div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.room-bar strong {
  letter-spacing: 0.03em;
}

.room-bar i {
  margin-left: 5px;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-style: normal;
  letter-spacing: 0.12em;
}

.room-format {
  padding: 4px 7px;
  border: 1px solid rgba(255, 200, 87, 0.24);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(255, 200, 87, 0.06);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 13px rgba(0, 233, 155, 0.8);
}

.room-actions {
  display: flex;
  gap: 7px;
}

.bet-proposal {
  position: relative;
  z-index: 6;
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 28px;
  border-bottom: 1px solid rgba(255, 200, 87, 0.28);
  background: linear-gradient(90deg, rgba(255, 200, 87, 0.115), rgba(255, 200, 87, 0.035));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}

.proposal-copy {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 2px 12px;
}

.proposal-copy span {
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.proposal-copy strong {
  color: var(--gold);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
}

.proposal-copy small {
  grid-column: 1 / -1;
  color: #d9dfdd;
  font-size: 0.7rem;
  line-height: 1.35;
}

.proposal-actions {
  display: flex;
  gap: 7px;
}

.proposal-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: rgba(5, 12, 9, 0.72);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.proposal-button.approve {
  border-color: rgba(0, 233, 155, 0.48);
  color: #061b12;
  background: linear-gradient(110deg, var(--green), #64ffc8);
}

.proposal-button.reject,
.proposal-button.cancel {
  border-color: rgba(255, 65, 108, 0.36);
  color: #ff9db3;
}

.proposal-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.room-button {
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid rgba(92, 200, 255, 0.25);
  border-radius: 7px;
  color: var(--blue);
  background: rgba(92, 200, 255, 0.06);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
}

.room-button.danger {
  border-color: rgba(255, 65, 108, 0.25);
  color: #ff8aa4;
  background: rgba(255, 65, 108, 0.06);
}

.table {
  position: relative;
  display: grid;
  min-height: 450px;
  grid-template-rows: 1fr auto 1fr;
  overflow: hidden;
  padding: 24px clamp(24px, 7vw, 100px);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    radial-gradient(ellipse at center, #192331 0%, #0c111a 68%);
  background-size: 42px 42px, 42px 42px, auto;
  isolation: isolate;
  box-shadow: inset 0 18px 55px rgba(0, 0, 0, 0.28), inset 0 -22px 65px rgba(0, 0, 0, 0.38);
}

.table::before {
  position: absolute;
  inset: 15px;
  border: 1px solid rgba(0, 233, 155, 0.14);
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: scaleY(0.45);
}

.table::after {
  position: absolute;
  z-index: 4;
  inset: 8% 12%;
  background:
    radial-gradient(circle at 12% 24%, var(--green) 0 3px, transparent 4px),
    radial-gradient(circle at 28% 72%, var(--gold) 0 3px, transparent 4px),
    radial-gradient(circle at 48% 18%, var(--blue) 0 3px, transparent 4px),
    radial-gradient(circle at 67% 78%, var(--green) 0 3px, transparent 4px),
    radial-gradient(circle at 84% 30%, var(--gold) 0 3px, transparent 4px);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: scale(0.55) rotate(-8deg);
}

.table.celebrate::after {
  animation: celebration-burst 1.2s ease-out both;
}

.table-glow {
  position: absolute;
  inset: 20% 25%;
  border-radius: 50%;
  background: rgba(0, 233, 155, 0.08);
  filter: blur(65px);
  pointer-events: none;
}

.table.rolling .table-glow {
  animation: table-energy 720ms ease-in-out infinite alternate;
}

.table.result-win { animation: table-win-flash 1.05s ease-out; }
.table.result-loss { animation: table-loss-flash 850ms ease-out; }
.table.result-tie,
.table.result-point { animation: table-point-flash 850ms ease-out; }

.table.craps-mode {
  grid-template-rows: 1fr;
}

.table.craps-mode .player-side {
  align-self: center;
}

.farkle-extra {
  display: none;
}

.farkle-tray-label {
  display: none;
}

.table.farkle-mode {
  min-height: 610px;
  grid-template-rows: 1fr auto 1fr;
  padding: 24px clamp(18px, 5vw, 72px);
  background:
    radial-gradient(circle at 50% 44%, rgba(0, 233, 155, 0.13), transparent 32%),
    radial-gradient(circle at 18% 20%, rgba(255, 200, 87, 0.055) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 72%, rgba(255, 255, 255, 0.04) 0 1px, transparent 2px),
    linear-gradient(145deg, #13251f 0%, #0b1715 55%, #08110f 100%);
  background-size: auto, 23px 23px, 29px 29px, auto;
}

.table.farkle-mode::before {
  inset: 12px;
  border-color: rgba(255, 200, 87, 0.13);
  border-radius: 28px;
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.22);
  transform: none;
}

.table.farkle-mode .farkle-extra {
  display: block;
}

.table.farkle-mode .table-divider {
  display: flex;
  width: min(540px, 84%);
  justify-self: center;
  color: rgba(255, 200, 87, 0.62);
}

.table.farkle-mode .opponent-side,
.table.farkle-mode .player-side {
  align-self: center;
  justify-self: center;
  width: min(440px, 100%);
  flex-direction: column;
  gap: 9px;
  padding: 13px 18px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 110%, rgba(0, 233, 155, 0.07), transparent 52%),
    linear-gradient(145deg, rgba(22, 34, 32, 0.96), rgba(5, 11, 11, 0.93));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.055), inset 0 -18px 34px rgba(0, 0, 0, 0.12), 0 18px 42px rgba(0, 0, 0, 0.28);
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

.table.farkle-mode .opponent-side {
  border-color: rgba(255, 65, 108, 0.2);
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 65, 108, 0.07), transparent 52%),
    linear-gradient(145deg, rgba(25, 31, 32, 0.96), rgba(8, 11, 12, 0.93));
}

.table.farkle-mode .player-side {
  border-color: rgba(0, 233, 155, 0.22);
}

.table.farkle-mode.farkle-bot-turn .opponent-side {
  border-color: rgba(255, 65, 108, 0.72);
  box-shadow: inset 0 0 34px rgba(255, 65, 108, 0.1), 0 0 28px rgba(255, 65, 108, 0.16);
  transform: translateY(-2px);
  animation: active-rival 1.35s ease-in-out infinite alternate;
}

.table.farkle-mode.farkle-player-turn .player-side {
  border-color: rgba(0, 233, 155, 0.72);
  box-shadow: inset 0 0 34px rgba(0, 233, 155, 0.09), 0 0 28px rgba(0, 233, 155, 0.14);
  transform: translateY(-2px);
  animation: active-player 1.35s ease-in-out infinite alternate;
}

.table.farkle-mode .side-label {
  order: -2;
  min-width: 0;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 10px;
  padding: 7px 13px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(2, 7, 7, 0.56);
  text-align: left;
}

.table.farkle-mode .side-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table.farkle-mode .opponent-side .side-label span {
  color: #f7fafc;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.18);
}

.table.farkle-mode .side-label strong {
  font-size: 1.3rem;
}

.table.farkle-mode .farkle-tray-label {
  order: -1;
  display: block;
  color: rgba(237, 243, 248, 0.54);
  font-size: 0.59rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.table.farkle-mode .dice-pair {
  display: grid;
  width: auto;
  min-width: 0;
  grid-template-columns: repeat(3, 52px);
  gap: 14px;
}

.table.farkle-mode .die {
  width: 52px;
  height: 52px;
}

.table.farkle-mode .face-1 { transform: translateZ(26px); }
.table.farkle-mode .face-2 { transform: rotateY(180deg) translateZ(26px); }
.table.farkle-mode .face-3 { transform: rotateY(90deg) translateZ(26px); }
.table.farkle-mode .face-4 { transform: rotateY(-90deg) translateZ(26px); }
.table.farkle-mode .face-5 { transform: rotateX(90deg) translateZ(26px); }
.table.farkle-mode .face-6 { transform: rotateX(-90deg) translateZ(26px); }

.table.farkle-mode .die.held .face {
  border-color: rgba(255, 200, 87, 0.85);
  box-shadow: inset -7px -8px 14px rgba(61, 43, 20, 0.18), inset 5px 5px 10px rgba(255, 255, 255, 0.82), 0 0 22px rgba(255, 200, 87, 0.52);
}

.table:not(.pvp-mode) .opponent-side .side-label span {
  color: #f7fafc;
}

.roll-side {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 5vw, 72px);
}

.opponent-side {
  align-self: end;
}

.player-side {
  align-self: start;
}

.side-label {
  display: grid;
  min-width: 135px;
  gap: 4px;
}

.side-label span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.side-label strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 2.2rem;
}

.opponent-side .side-label {
  text-align: right;
}

.opponent-side .side-label strong {
  color: var(--red);
}

.player-side .side-label strong {
  color: var(--green);
}

.dice-pair {
  display: flex;
  min-width: 180px;
  justify-content: center;
  gap: 32px;
}

.table-divider {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255, 255, 255, 0.22);
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.table-divider::before,
.table-divider::after {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  content: "";
}

.event {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  padding: 12px 22px;
  border: 1px solid currentColor;
  border-radius: 12px;
  background: rgba(6, 9, 14, 0.9);
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.5);
  font-size: clamp(1.25rem, 4vw, 2.6rem);
  font-weight: 950;
  letter-spacing: 0.05em;
  opacity: 0;
  pointer-events: none;
  text-transform: uppercase;
  transform: translate(-50%, -40%) scale(0.9);
}

.event.show {
  animation: event-pop 1.7s ease both;
}

.event.win { color: var(--green); }
.event.loss { color: var(--red); }
.event.tie,
.event.point { color: var(--gold); }

.controls {
  position: relative;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 0.7fr);
  align-items: center;
  gap: 22px;
  padding: 20px 28px;
  border-top: 1px solid var(--line);
  background: rgba(14, 19, 28, 0.98);
}

.status-block {
  display: flex;
  align-items: center;
  gap: 11px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px rgba(0, 233, 155, 0.75);
}

.status-block div {
  display: grid;
  gap: 3px;
}

.status-block span:not(.status-dot) {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status-block strong {
  font-size: 0.86rem;
}

.bet-controls {
  display: flex;
  align-items: stretch;
  gap: 7px;
}

.bet-input-wrap {
  display: grid;
  min-width: 108px;
  align-content: center;
  gap: 2px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
}

.bet-input-wrap span {
  color: var(--muted);
  font-size: 0.5rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bet-input-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--gold);
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 900;
}

.bet-input-wrap:focus-within {
  border-color: rgba(255, 200, 87, 0.58);
  box-shadow: 0 0 0 3px rgba(255, 200, 87, 0.08);
}

.bet-input-wrap:has(input:disabled) {
  opacity: 0.45;
}

.chip-button {
  min-width: 56px;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: var(--panel-2);
  font-size: 0.82rem;
  font-weight: 850;
}

.chip-button:hover:not(:disabled) {
  border-color: rgba(0, 233, 155, 0.55);
  color: var(--green);
}

.chip-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.forfeit-button {
  border-color: rgba(255, 65, 108, 0.35);
  color: #ff8aa4;
}

.primary-actions {
  display: grid;
  min-width: 220px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.primary-actions .roll-button {
  grid-column: 1 / -1;
}

.primary-actions.banking .roll-button {
  grid-column: auto;
}

.primary-actions.exiting .roll-button {
  grid-column: auto;
}

.bank-button {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 11px;
  color: #1b1100;
  background: linear-gradient(110deg, var(--gold), #ffe09b);
  box-shadow: 0 8px 25px rgba(255, 200, 87, 0.17);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.leave-game-button {
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid rgba(255, 65, 108, 0.44);
  border-radius: 11px;
  color: #ffdbe3;
  background: linear-gradient(145deg, rgba(141, 28, 55, 0.92), rgba(72, 17, 30, 0.96));
  box-shadow: 0 8px 25px rgba(255, 65, 108, 0.12);
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.leave-game-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.bank-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.48;
}

.roll-button {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 20px;
  border-radius: 11px;
  color: #03120c;
  background: linear-gradient(110deg, var(--green), #4affbe);
  box-shadow: 0 8px 25px rgba(0, 233, 155, 0.18);
  font-size: 0.85rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: box-shadow 180ms ease, transform 180ms ease, filter 180ms ease;
}

.roll-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(0, 233, 155, 0.25);
}

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

.fairness-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #0a0e15;
  font-size: 0.68rem;
  font-weight: 700;
}

.fairness-bar i {
  margin-right: 7px;
  color: var(--green);
  font-size: 0.55rem;
  font-style: normal;
}

dialog {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: #111722;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(2, 4, 8, 0.76);
  backdrop-filter: blur(8px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  margin-bottom: 0;
}

.dialog-close {
  width: 44px;
  height: 44px;
  border-radius: 9px;
  color: var(--muted);
  background: var(--panel-2);
  font-size: 1.4rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.rules-grid section {
  padding: 22px;
  background: #111722;
}

.rules-grid h3 {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 0.9rem;
}

.rules-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.online-options {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.online-option {
  display: grid;
  gap: 5px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
}

.online-option:hover:not(:disabled) {
  border-color: rgba(0, 233, 155, 0.45);
}

.online-option.primary-option {
  border-color: rgba(0, 233, 155, 0.28);
  background: rgba(0, 233, 155, 0.07);
}

.online-option strong {
  font-size: 0.9rem;
}

.online-option span {
  color: var(--muted);
  font-size: 0.75rem;
}

.online-option:disabled,
.join-option button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.join-option {
  display: grid;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0c1119;
}

.join-option label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.join-option > div {
  display: flex;
  gap: 8px;
}

.join-option input {
  min-width: 0;
  min-height: 42px;
  flex: 1;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #070a0f;
  font: 800 0.88rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
  outline: 0;
  text-transform: uppercase;
}

.join-option input:focus {
  border-color: var(--blue);
}

.online-status {
  min-height: 20px;
  margin: 2px 2px 0;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.45;
}

.toast {
  position: fixed;
  z-index: 300;
  right: 22px;
  bottom: 22px;
  max-width: min(370px, calc(100% - 44px));
  padding: 13px 17px;
  border: 1px solid rgba(0, 233, 155, 0.35);
  border-radius: 10px;
  color: var(--text);
  background: rgba(17, 23, 34, 0.96);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.45);
  font-size: 0.8rem;
  font-weight: 750;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@keyframes tumble {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  36% { transform: rotateX(158deg) rotateY(226deg) rotateZ(48deg); }
  72% { transform: rotateX(318deg) rotateY(472deg) rotateZ(-34deg); }
  100% { transform: rotateX(520deg) rotateY(720deg) rotateZ(18deg); }
}

@keyframes drop-in {
  0% { filter: blur(0.6px) drop-shadow(0 16px 13px rgba(0, 0, 0, 0.08)); transform: translateY(-64px) rotateZ(-4deg) scale(0.88); }
  58% { filter: blur(0) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.28)); transform: translateY(7px) rotateZ(2deg) scale(1.025); }
  74% { transform: translateY(-4px) rotateZ(-1deg) scale(0.99); }
  88% { transform: translateY(2px) rotateZ(0.5deg) scale(1.006); }
  100% { filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.2)); transform: translateY(0) rotateZ(0) scale(1); }
}

@keyframes active-player {
  from { box-shadow: inset 0 0 28px rgba(0, 233, 155, 0.06), 0 0 20px rgba(0, 233, 155, 0.1); }
  to { box-shadow: inset 0 0 38px rgba(0, 233, 155, 0.11), 0 0 34px rgba(0, 233, 155, 0.18); }
}

@keyframes active-rival {
  from { box-shadow: inset 0 0 28px rgba(255, 65, 108, 0.06), 0 0 20px rgba(255, 65, 108, 0.1); }
  to { box-shadow: inset 0 0 38px rgba(255, 65, 108, 0.11), 0 0 34px rgba(255, 65, 108, 0.18); }
}

@keyframes event-pop {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.86); }
  18%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -55%) scale(1.03); }
}

@keyframes table-energy {
  from { opacity: 0.65; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1.14); }
}

@keyframes table-win-flash {
  0%, 100% { box-shadow: inset 0 0 0 rgba(0, 233, 155, 0); }
  35% { box-shadow: inset 0 0 90px rgba(0, 233, 155, 0.24); }
}

@keyframes table-loss-flash {
  0%, 100% { box-shadow: inset 0 0 0 rgba(255, 65, 108, 0); }
  35% { box-shadow: inset 0 0 80px rgba(255, 65, 108, 0.2); }
}

@keyframes table-point-flash {
  0%, 100% { box-shadow: inset 0 0 0 rgba(255, 200, 87, 0); }
  35% { box-shadow: inset 0 0 75px rgba(255, 200, 87, 0.18); }
}

@keyframes celebration-burst {
  0% { opacity: 0; transform: scale(0.55) rotate(-8deg); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.4) rotate(9deg); }
}

@media (max-width: 900px) {
  .practice-badge { display: none; }
  .game-heading { align-items: stretch; flex-direction: column; }
  .game-title-row { width: 100%; justify-content: space-between; }
  .mode-selector { width: 100%; }
  .stat-strip { grid-template-columns: repeat(3, 1fr); }
  .stat { border-bottom: 1px solid var(--line); }
  .stat:nth-child(3) { border-right: 0; }
  .stat:nth-child(4), .stat:nth-child(5) { border-bottom: 0; }
  .stat-record { grid-column: span 2; }
  .controls { grid-template-columns: 1fr auto; }
  .primary-actions { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .page-shell { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .navbar {
    position: sticky;
    min-height: 60px;
    align-items: center;
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  }
  .brand {
    min-width: 0;
    gap: 7px;
    margin: 0;
    font-size: 0.78rem;
    letter-spacing: 0.11em;
  }
  .brand-mark { width: 30px; height: 30px; flex: 0 0 30px; border-radius: 9px; }
  .nav-actions { min-width: 0; flex-wrap: nowrap; justify-content: flex-end; gap: 5px; }
  .balance-box { min-width: 74px; padding: 6px 8px; border-radius: 9px; }
  .balance-box span { font-size: 0.52rem; }
  .balance-box strong { font-size: 0.8rem; }
  .nav-actions .button { min-height: 40px; padding: 0 9px; font-size: 0.68rem; }
  .page-shell {
    padding: 10px max(8px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .game-card {
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(0, 0, 0, 0.48), inset 0 1px rgba(255, 255, 255, 0.04);
  }
  .game-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 15px;
    padding: 17px 15px 15px;
  }
  .game-title-row { width: 100%; justify-content: space-between; gap: 12px; }
  .sound-toggle { min-height: 42px; flex: 0 0 auto; }
  .game-heading h1 { font-size: 1.55rem; }
  .mode-selector { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; padding: 5px; border-radius: 14px; }
  .mode-button { min-height: 46px; padding: 0 6px; font-size: 0.7rem; }
  .notice { margin: 10px 12px 0; padding: 10px 12px; font-size: 0.75rem; }
  .room-bar { align-items: center; flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 9px 14px; }
  .bet-proposal { align-items: stretch; flex-direction: column; gap: 10px; padding: 12px 14px; }
  .proposal-actions { width: 100%; }
  .proposal-button { min-height: 48px; flex: 1 1 0; padding-inline: 10px; }
  .room-actions { margin-left: auto; }
  .room-button { min-height: 42px; padding-inline: 12px; }
  .stat { min-height: 62px; gap: 4px; padding: 10px; background: linear-gradient(155deg, rgba(255, 255, 255, 0.014), transparent); }
  .stat span { font-size: 0.54rem; letter-spacing: 0.075em; }
  .stat strong { font-size: 0.86rem; }
  .table {
    min-height: 360px;
    padding: 20px 10px;
    background-size: 32px 32px, 32px 32px, auto;
  }
  .table::before { inset: 20px -38px; transform: scaleY(0.5); }
  .roll-side { gap: 14px; }
  .opponent-side .side-label { order: initial; text-align: right; }
  .side-label { min-width: 78px; gap: 3px; }
  .side-label span { font-size: 0.58rem; line-height: 1.25; }
  .side-label strong { font-size: 1.55rem; }
  .dice-pair { min-width: 130px; gap: 18px; }
  .die { width: 56px; height: 56px; }
  .face { padding: 7px; border-radius: 11px; }
  .face-1 { transform: translateZ(28px); }
  .face-2 { transform: rotateY(180deg) translateZ(28px); }
  .face-3 { transform: rotateY(90deg) translateZ(28px); }
  .face-4 { transform: rotateY(-90deg) translateZ(28px); }
  .face-5 { transform: rotateX(90deg) translateZ(28px); }
  .face-6 { transform: rotateX(-90deg) translateZ(28px); }
  .pip { width: 8px; height: 8px; }
  .table-divider { gap: 10px; }
  .event { max-width: calc(100% - 32px); padding: 10px 16px; font-size: 1.35rem; text-align: center; }
  .table.farkle-mode { min-height: 552px; padding: 18px 8px; }
  .table.farkle-mode .opponent-side,
  .table.farkle-mode .player-side { width: min(286px, 100%); gap: 8px; padding: 11px 14px 14px; border-radius: 19px; }
  .table.farkle-mode .side-label { gap: 8px; padding: 6px 11px; }
  .table.farkle-mode .side-label span { font-size: 0.57rem; }
  .table.farkle-mode .side-label strong { font-size: 1.12rem; }
  .table.farkle-mode .farkle-tray-label { font-size: 0.53rem; }
  .table.farkle-mode .table-divider { width: min(250px, 82%); font-size: 0.56rem; }
  .table.farkle-mode .dice-pair { width: auto; min-width: 0; grid-template-columns: repeat(3, 48px); gap: 12px; }
  .table.farkle-mode .die { width: 48px; height: 48px; }
  .table.farkle-mode .face { padding: 6px; border-radius: 12px; }
  .table.farkle-mode .face-1 { transform: translateZ(24px); }
  .table.farkle-mode .face-2 { transform: rotateY(180deg) translateZ(24px); }
  .table.farkle-mode .face-3 { transform: rotateY(90deg) translateZ(24px); }
  .table.farkle-mode .face-4 { transform: rotateY(-90deg) translateZ(24px); }
  .table.farkle-mode .face-5 { transform: rotateX(90deg) translateZ(24px); }
  .table.farkle-mode .face-6 { transform: rotateX(-90deg) translateZ(24px); }
  .table.farkle-mode .pip { width: 7.5px; height: 7.5px; }
  .controls { grid-template-columns: 1fr; gap: 12px; padding: 14px; background: linear-gradient(180deg, rgba(18, 25, 36, 0.99), rgba(10, 15, 22, 0.99)); }
  .status-block { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(7, 10, 15, 0.54); }
  .status-block strong { font-size: 0.8rem; line-height: 1.35; }
  .bet-controls { order: 2; width: 100%; flex-wrap: wrap; }
  .bet-input-wrap { min-height: 50px; flex: 1 1 118px; }
  .chip-button { min-width: 0; height: 48px; flex: 1 1 0; padding: 0 8px; border-radius: 11px; }
  .primary-actions { grid-column: auto; order: 3; min-width: 0; }
  .bank-button,
  .leave-game-button,
  .roll-button { min-height: 60px; border-radius: 14px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24); }
  .fairness-bar { align-items: flex-start; flex-direction: column; gap: 6px; padding: 11px 14px; font-size: 0.6rem; line-height: 1.4; }
  dialog { width: calc(100% - 20px); max-height: calc(100dvh - 20px); border-radius: 16px; }
  .dialog-header { position: sticky; z-index: 2; top: 0; padding: 16px; background: rgba(17, 23, 34, 0.97); backdrop-filter: blur(14px); }
  .dialog-header h2 { font-size: 1.25rem; }
  .rules-grid { grid-template-columns: 1fr; }
  .rules-grid section { padding: 17px; }
  .online-options { gap: 10px; padding: 15px; }
  .online-option { padding: 15px; }
  .join-option { padding: 13px; }
  .join-option input { min-height: 46px; font-size: 0.8rem; }
  .toast {
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    max-width: none;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .navbar { padding-inline: 10px; }
  .brand { font-size: 0.72rem; letter-spacing: 0.09em; }
  .brand-mark { width: 28px; height: 28px; flex-basis: 28px; }
  .balance-box { min-width: 68px; padding-inline: 6px; }
  .nav-actions .button { padding-inline: 7px; font-size: 0.64rem; }
  .game-heading { padding: 15px 13px 13px; }
  .game-heading h1 { font-size: 1.42rem; }
  .sound-toggle { width: 42px; justify-content: center; padding: 0; }
  .sound-toggle #sound-label { display: none; }
  .eyebrow { font-size: 0.59rem; }
  .mode-button { min-height: 44px; font-size: 0.66rem; }
  .stat { min-height: 56px; padding-inline: 8px; }
  .stat strong { font-size: 0.82rem; }
  .table { min-height: 340px; padding-inline: 6px; }
  .roll-side { gap: 10px; }
  .side-label { min-width: 70px; }
  .dice-pair { min-width: 120px; gap: 16px; }
  .die { width: 52px; height: 52px; }
  .face-1 { transform: translateZ(26px); }
  .face-2 { transform: rotateY(180deg) translateZ(26px); }
  .face-3 { transform: rotateY(90deg) translateZ(26px); }
  .face-4 { transform: rotateY(-90deg) translateZ(26px); }
  .face-5 { transform: rotateX(90deg) translateZ(26px); }
  .face-6 { transform: rotateX(-90deg) translateZ(26px); }
  .table.farkle-mode { min-height: 540px; }
  .table.farkle-mode .opponent-side,
  .table.farkle-mode .player-side { width: min(268px, 100%); }
  .table.farkle-mode .dice-pair { grid-template-columns: repeat(3, 45px); gap: 10px; }
  .table.farkle-mode .die { width: 45px; height: 45px; }
  .table.farkle-mode .face-1 { transform: translateZ(22.5px); }
  .table.farkle-mode .face-2 { transform: rotateY(180deg) translateZ(22.5px); }
  .table.farkle-mode .face-3 { transform: rotateY(90deg) translateZ(22.5px); }
  .table.farkle-mode .face-4 { transform: rotateY(-90deg) translateZ(22.5px); }
  .table.farkle-mode .face-5 { transform: rotateX(90deg) translateZ(22.5px); }
  .table.farkle-mode .face-6 { transform: rotateX(-90deg) translateZ(22.5px); }
  .controls { padding: 12px; }
  .bank-button,
  .roll-button { min-height: 56px; padding-inline: 15px; }
}

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

/* Casino edition — final presentation layer */
:root {
  --bg: #050806;
  --panel: #101714;
  --panel-2: #18211d;
  --line: rgba(231, 203, 132, 0.13);
  --text: #f4f1e8;
  --muted: #9da7a0;
  --green: #20e79a;
  --green-dark: #08754f;
  --red: #ff496d;
  --gold: #e9c66d;
  --gold-bright: #ffe7a3;
  --blue: #6bc9ff;
}

body {
  background:
    radial-gradient(circle at 50% -8%, rgba(215, 178, 90, 0.12), transparent 30rem),
    radial-gradient(circle at 7% 28%, rgba(11, 139, 91, 0.13), transparent 34rem),
    radial-gradient(circle at 94% 82%, rgba(117, 14, 40, 0.12), transparent 34rem),
    repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.008) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #0b100d 0%, #040605 100%);
}

.navbar {
  border-bottom-color: rgba(233, 198, 109, 0.16);
  background: rgba(5, 9, 7, 0.9);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.26);
}

.brand { color: var(--gold-bright); }

.brand-mark {
  border-color: rgba(233, 198, 109, 0.55);
  border-radius: 50%;
  color: #fff4c9;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.2), transparent 26%),
    linear-gradient(145deg, #176c4c, #073a29);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.24), 0 0 20px rgba(233, 198, 109, 0.15);
  font-size: 1.25rem;
}

.brand-copy { display: grid; line-height: 1; }
.brand-copy strong { font-size: inherit; }
.brand-copy small { margin-top: 4px; color: rgba(233, 198, 109, 0.58); font-size: 0.48rem; letter-spacing: 0.26em; }

.practice-badge {
  border-color: rgba(233, 198, 109, 0.3);
  color: var(--gold);
  background: rgba(233, 198, 109, 0.06);
}

.balance-box {
  border-color: rgba(233, 198, 109, 0.22);
  background: linear-gradient(145deg, rgba(27, 35, 30, 0.98), rgba(10, 15, 12, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 7px 20px rgba(0, 0, 0, 0.22);
}

.balance-box strong { color: var(--gold-bright); }

.game-card {
  border-color: rgba(233, 198, 109, 0.2);
  background: linear-gradient(155deg, rgba(21, 29, 25, 0.99), rgba(7, 11, 9, 0.99));
  box-shadow: 0 32px 95px rgba(0, 0, 0, 0.58), inset 0 1px rgba(255, 245, 213, 0.05);
}

.game-heading {
  border-bottom-color: rgba(233, 198, 109, 0.13);
  background:
    radial-gradient(circle at 15% 0%, rgba(32, 231, 154, 0.1), transparent 21rem),
    radial-gradient(circle at 84% 100%, rgba(233, 198, 109, 0.075), transparent 20rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.game-heading h1 {
  color: #fff9e8;
  text-shadow: 0 5px 24px rgba(0, 0, 0, 0.38);
}

.eyebrow { color: var(--gold); }

.marquee-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(32, 231, 154, 0.1), 0 0 14px rgba(32, 231, 154, 0.85);
  animation: live-pulse 1.35s ease-in-out infinite alternate;
}

.sound-toggle {
  border-color: rgba(233, 198, 109, 0.28);
  color: var(--gold-bright);
  background: rgba(233, 198, 109, 0.055);
}

.sound-icon { background: rgba(233, 198, 109, 0.1); }

.mode-selector {
  border-color: rgba(233, 198, 109, 0.17);
  background: rgba(3, 7, 5, 0.78);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.28);
}

.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mode-button i {
  display: grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  color: rgba(244, 241, 232, 0.68);
  font-size: 0.62rem;
  font-style: normal;
  letter-spacing: -0.08em;
}

.mode-button.active {
  color: #06140e;
  background: linear-gradient(145deg, #5dffc4, #16d98e);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.36), 0 8px 24px rgba(32, 231, 154, 0.2);
}

.mode-button.active i {
  border-color: rgba(6, 20, 14, 0.2);
  color: #06140e;
  background: rgba(255, 255, 255, 0.2);
}

.stat-strip {
  gap: 1px;
  border-bottom-color: rgba(233, 198, 109, 0.13);
  background: rgba(233, 198, 109, 0.1);
}

.stat {
  border-right: 0;
  background:
    radial-gradient(circle at 85% 10%, rgba(233, 198, 109, 0.055), transparent 55%),
    linear-gradient(155deg, #101813, #080d0a);
}

.stat:first-child strong { color: var(--gold-bright); }

.table,
.table.farkle-mode {
  min-height: 490px;
  border: 9px solid transparent;
  border-radius: 36px;
  background:
    radial-gradient(circle at 16% 25%, rgba(255, 255, 255, 0.035) 0 1px, transparent 1.6px) padding-box,
    radial-gradient(circle at 78% 70%, rgba(235, 209, 142, 0.04) 0 1px, transparent 1.8px) padding-box,
    repeating-linear-gradient(118deg, rgba(255, 255, 255, 0.011) 0 1px, transparent 1px 8px) padding-box,
    radial-gradient(ellipse at center, #12583f 0%, #0a3a2a 52%, #061f18 100%) padding-box,
    linear-gradient(145deg, #895a35 0%, #3b2113 22%, #9b6a3d 44%, #2b160d 72%, #74452b 100%) border-box;
  background-size: 27px 27px, 31px 31px, auto, auto, auto;
  box-shadow:
    inset 0 0 0 2px rgba(239, 207, 126, 0.3),
    inset 0 18px 54px rgba(0, 0, 0, 0.2),
    inset 0 -28px 70px rgba(0, 0, 0, 0.32),
    0 18px 42px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(15, 7, 4, 0.9);
}

.table.farkle-mode { min-height: 680px; }

.table::before,
.table.farkle-mode::before {
  inset: 7px;
  border: 1px solid rgba(255, 226, 154, 0.2);
  border-radius: 24px;
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.18);
  transform: none;
}

.table::after {
  inset: 5% 7%;
  background:
    radial-gradient(circle at 8% 18%, #ffe29a 0 4px, transparent 5px),
    radial-gradient(circle at 18% 72%, #23efa1 0 4px, transparent 5px),
    radial-gradient(circle at 30% 35%, #ff5478 0 3px, transparent 4px),
    radial-gradient(circle at 43% 83%, #ffe29a 0 4px, transparent 5px),
    radial-gradient(circle at 55% 18%, #6bc9ff 0 3px, transparent 4px),
    radial-gradient(circle at 67% 65%, #23efa1 0 4px, transparent 5px),
    radial-gradient(circle at 79% 28%, #ff5478 0 3px, transparent 4px),
    radial-gradient(circle at 91% 76%, #ffe29a 0 4px, transparent 5px);
  filter: drop-shadow(0 0 8px rgba(255, 226, 154, 0.36));
}

.table-glow {
  z-index: 0;
  inset: 24% 22%;
  background: radial-gradient(circle, rgba(75, 255, 184, 0.13), rgba(233, 198, 109, 0.04) 40%, transparent 70%);
  filter: blur(54px);
}

.table-plaque {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(330px, 62%);
  place-items: center;
  color: rgba(255, 232, 174, 0.1);
  pointer-events: none;
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%) rotate(-4deg);
}

.table-plaque span { font-size: 1.15rem; }
.table-plaque strong { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.6rem, 4vw, 3rem); letter-spacing: 0.12em; }
.table-plaque small { font-size: 0.5rem; font-weight: 900; letter-spacing: 0.34em; }
.table.farkle-mode .table-plaque { opacity: 0.5; }

.roll-side { z-index: 3; }

.side-label {
  padding: 9px 14px;
  border: 1px solid rgba(233, 198, 109, 0.16);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(4, 9, 6, 0.74), rgba(19, 27, 22, 0.68));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 8px 20px rgba(0, 0, 0, 0.18);
}

.opponent-side .side-label strong { color: #ff6d89; }
.player-side .side-label strong { color: #68ffbf; }

.table.farkle-mode .opponent-side,
.table.farkle-mode .player-side {
  width: min(460px, 100%);
  gap: 9px;
  padding: 17px 22px 20px;
  border: 1px solid rgba(233, 198, 109, 0.23);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 115%, rgba(32, 231, 154, 0.14), transparent 55%),
    linear-gradient(145deg, rgba(8, 48, 34, 0.88), rgba(3, 19, 14, 0.91));
  box-shadow: inset 0 1px rgba(255, 245, 213, 0.08), inset 0 -22px 42px rgba(0, 0, 0, 0.14), 0 18px 42px rgba(0, 0, 0, 0.29);
}

.table.farkle-mode .opponent-side {
  background:
    radial-gradient(circle at 50% -15%, rgba(255, 73, 109, 0.15), transparent 54%),
    linear-gradient(145deg, rgba(61, 14, 25, 0.88), rgba(20, 5, 10, 0.92));
}

.table.farkle-mode .side-label {
  order: -3;
  width: min(300px, 100%);
  grid-template-columns: 1fr auto;
  justify-content: stretch;
}

.table.farkle-mode .score-meter {
  order: -2;
  display: block;
  width: min(270px, 88%);
}

.table.farkle-mode .farkle-tray-label { order: -1; color: rgba(255, 240, 204, 0.6); }

.score-meter {
  position: relative;
  display: none;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.55);
}

.score-meter i {
  display: block;
  width: var(--score-progress, 0%);
  height: 100%;
  border-radius: inherit;
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.player-meter i { background: linear-gradient(90deg, #088e5d, #48ffc0, #fff0a8); box-shadow: 0 0 14px rgba(72, 255, 192, 0.45); }
.opponent-meter i { background: linear-gradient(90deg, #821d37, #ff5478, #ffc0cb); box-shadow: 0 0 14px rgba(255, 84, 120, 0.42); }

.table.farkle-mode .roll-side::before {
  position: absolute;
  z-index: 5;
  top: -11px;
  right: 24px;
  padding: 5px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: #07110c;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.35);
  font-size: 0.5rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  opacity: 0;
  text-transform: uppercase;
  transition: opacity 180ms ease, transform 180ms ease;
  transform: translateY(4px);
}

.table.farkle-mode.farkle-player-turn .player-side::before {
  color: #67ffc0;
  content: "Your turn";
  opacity: 1;
  transform: translateY(0);
}

.table.farkle-mode.farkle-bot-turn .opponent-side::before {
  color: #ff7892;
  content: "Machine rolling";
  opacity: 1;
  transform: translateY(0);
}

.dice-pair { perspective: 1150px; perspective-origin: 50% 22%; -webkit-perspective: 1150px; }

.die {
  position: relative;
  width: 68px;
  height: 68px;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform-origin: 50% 72%;
  filter: drop-shadow(0 12px 9px rgba(0, 0, 0, 0.32));
  transition: filter 180ms ease, transform 180ms ease;
}

.die::before {
  position: absolute;
  z-index: -1;
  right: 4px;
  bottom: -18px;
  left: 4px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.16) 52%, transparent 74%);
  content: "";
  opacity: 0.9;
  pointer-events: none;
  transform: rotateX(72deg);
  transition: opacity 180ms ease, transform 180ms ease;
}

.die-core {
  position: absolute;
  inset: 0;
  transform: rotateX(0deg) rotateY(0deg);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transform-origin: 50% 50%;
  transition: transform 520ms cubic-bezier(0.16, 0.84, 0.22, 1);
}

.die.dropping::before { transform: rotateX(72deg) scale(1.55); }

.face-1 { transform: translateZ(34px); }
.face-2 { transform: rotateY(180deg) translateZ(34px); }
.face-3 { transform: rotateY(90deg) translateZ(34px); }
.face-4 { transform: rotateY(-90deg) translateZ(34px); }
.face-5 { transform: rotateX(90deg) translateZ(34px); }
.face-6 { transform: rotateX(-90deg) translateZ(34px); }

.table.farkle-mode .die { width: 54px; height: 54px; }
.table.farkle-mode .face-1 { transform: translateZ(27px); }
.table.farkle-mode .face-2 { transform: rotateY(180deg) translateZ(27px); }
.table.farkle-mode .face-3 { transform: rotateY(90deg) translateZ(27px); }
.table.farkle-mode .face-4 { transform: rotateY(-90deg) translateZ(27px); }
.table.farkle-mode .face-5 { transform: rotateX(90deg) translateZ(27px); }
.table.farkle-mode .face-6 { transform: rotateX(-90deg) translateZ(27px); }

.die.held { filter: drop-shadow(0 11px 13px rgba(255, 219, 130, 0.32)); transform: translateY(-4px); }
.die.held .face { border-color: rgba(255, 218, 128, 0.9); }

.table-divider {
  color: rgba(255, 230, 169, 0.56);
  text-shadow: 0 0 15px rgba(233, 198, 109, 0.16);
}

.table-divider::before,
.table-divider::after { background: linear-gradient(90deg, transparent, rgba(233, 198, 109, 0.34), transparent); }

.event {
  padding: 15px 28px;
  border: 1px solid currentColor;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.07), transparent 70%),
    rgba(3, 8, 5, 0.94);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.06), 0 18px 65px rgba(0, 0, 0, 0.58), 0 0 32px rgba(233, 198, 109, 0.12);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.08em;
}

.controls {
  border-top-color: rgba(233, 198, 109, 0.17);
  background:
    repeating-linear-gradient(105deg, rgba(255, 255, 255, 0.011) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #151d19, #090e0b);
  box-shadow: inset 0 1px rgba(255, 245, 213, 0.04);
}

.status-block {
  min-height: 56px;
  padding: 9px 13px;
  border: 1px solid rgba(233, 198, 109, 0.13);
  border-radius: 13px;
  background: rgba(3, 8, 5, 0.46);
}

.status-dot { animation: status-pulse 1.3s ease-in-out infinite alternate; }

.bet-controls { align-items: center; }

.chip-button:not(.forfeit-button) {
  width: 56px;
  min-width: 56px;
  height: 56px;
  padding: 0;
  border: 4px dashed rgba(255, 242, 209, 0.62);
  border-radius: 50%;
  color: #fff4d0;
  background:
    radial-gradient(circle, #153a2c 0 48%, transparent 49%),
    repeating-conic-gradient(#177650 0 12deg, #e4c36d 12deg 20deg, #0f4d38 20deg 42deg);
  box-shadow: inset 0 0 0 3px #082c20, inset 0 0 0 5px rgba(233, 198, 109, 0.52), 0 8px 18px rgba(0, 0, 0, 0.28);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
}

.chip-button:not(.forfeit-button):hover:not(:disabled) {
  color: #fffbe9;
  filter: brightness(1.14);
  transform: translateY(-2px) rotate(3deg);
}

.forfeit-button {
  min-width: 76px;
  border-radius: 11px;
  background: rgba(113, 17, 39, 0.24);
}

.bank-button,
.roll-button {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 242, 205, 0.32);
  isolation: isolate;
}

.bank-button {
  color: #231704;
  background: linear-gradient(145deg, #fff0ac, #d9aa43 70%, #a87622);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.62), 0 10px 28px rgba(191, 137, 37, 0.22);
}

.roll-button {
  color: #03120c;
  background: linear-gradient(145deg, #76ffd0, #20df95 56%, #09a96e);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 11px 30px rgba(18, 211, 138, 0.24);
}

.bank-button::after,
.roll-button::after {
  position: absolute;
  z-index: -1;
  top: -80%;
  bottom: -80%;
  left: -42%;
  width: 26%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  content: "";
  pointer-events: none;
  transform: rotate(18deg);
  animation: button-shine 3.4s ease-in-out infinite;
}

.roll-arrow {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: rgba(2, 20, 13, 0.12);
  font-size: 1rem;
}

.fairness-bar {
  border-top-color: rgba(233, 198, 109, 0.11);
  background: #050906;
}

.toast {
  border-color: rgba(233, 198, 109, 0.32);
  border-radius: 13px;
  background: rgba(9, 16, 12, 0.97);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.52);
}

@keyframes tumble {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  34% { transform: rotateX(calc(164deg * var(--spin-x, 1))) rotateY(calc(238deg * var(--spin-y, 1))) rotateZ(47deg); }
  68% { transform: rotateX(calc(336deg * var(--spin-x, 1))) rotateY(calc(486deg * var(--spin-y, 1))) rotateZ(-32deg); }
  100% { transform: rotateX(calc(540deg * var(--spin-x, 1))) rotateY(calc(734deg * var(--spin-y, 1))) rotateZ(21deg); }
}

@keyframes drop-in {
  0% { filter: blur(0.8px) drop-shadow(0 21px 14px rgba(0, 0, 0, 0.1)); transform: translate3d(var(--launch-x, 0), -78px, 0) rotateZ(var(--launch-z, -4deg)) scale(0.84); }
  54% { filter: blur(0) drop-shadow(0 4px 4px rgba(0, 0, 0, 0.34)); transform: translate3d(0, 8px, 0) rotateZ(-2deg) scale(1.035); }
  70% { transform: translate3d(2px, -5px, 0) rotateZ(1.2deg) scale(0.985); }
  86% { transform: translate3d(-1px, 2px, 0) rotateZ(-0.5deg) scale(1.008); }
  100% { filter: drop-shadow(0 12px 9px rgba(0, 0, 0, 0.32)); transform: translate3d(0, 0, 0) rotateZ(0) scale(1); }
}

@keyframes live-pulse { to { opacity: 0.5; transform: scale(0.78); } }
@keyframes status-pulse { to { opacity: 0.58; transform: scale(0.82); } }
@keyframes button-shine { 0%, 62% { left: -42%; } 88%, 100% { left: 124%; } }

@keyframes table-win-flash {
  0%, 100% { filter: brightness(1); }
  36% { filter: brightness(1.24) saturate(1.18); box-shadow: inset 0 0 120px rgba(32, 231, 154, 0.3), 0 20px 56px rgba(0, 0, 0, 0.44); }
}

@keyframes table-loss-flash {
  0%, 100% { filter: brightness(1); }
  36% { filter: brightness(1.1) saturate(1.15); box-shadow: inset 0 0 100px rgba(255, 73, 109, 0.25), 0 20px 56px rgba(0, 0, 0, 0.44); }
}

@keyframes table-point-flash {
  0%, 100% { filter: brightness(1); }
  36% { filter: brightness(1.16); box-shadow: inset 0 0 100px rgba(233, 198, 109, 0.24), 0 20px 56px rgba(0, 0, 0, 0.44); }
}

@media (max-width: 680px) {
  .brand-copy small { display: none; }
  .game-heading { background: radial-gradient(circle at 10% 0%, rgba(32, 231, 154, 0.1), transparent 18rem), linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent); }
  .mode-button { gap: 7px; }
  .mode-button i { min-width: 26px; height: 26px; }
  .stat { min-height: 64px; }
  .table,
  .table.farkle-mode {
    min-height: 420px;
    padding: 24px 9px;
    border-width: 6px;
    border-radius: 27px;
    background-size: 23px 23px, 27px 27px, auto, auto, auto;
  }
  .table::before,
  .table.farkle-mode::before { inset: 5px; border-radius: 18px; }
  .table.farkle-mode { min-height: 620px; padding-block: 22px; }
  .table-plaque { width: 75%; }
  .table.farkle-mode .opponent-side,
  .table.farkle-mode .player-side { width: min(292px, 100%); gap: 8px; padding: 14px 16px 16px; border-radius: 21px; }
  .table.farkle-mode .side-label { width: min(248px, 100%); }
  .table.farkle-mode .score-meter { width: min(226px, 88%); }
  .table.farkle-mode .roll-side::before { right: 14px; }
  .die { width: 58px; height: 58px; }
  .face { padding: 7px; border-radius: 14px; }
  .face-1 { transform: translateZ(29px); }
  .face-2 { transform: rotateY(180deg) translateZ(29px); }
  .face-3 { transform: rotateY(90deg) translateZ(29px); }
  .face-4 { transform: rotateY(-90deg) translateZ(29px); }
  .face-5 { transform: rotateX(90deg) translateZ(29px); }
  .face-6 { transform: rotateX(-90deg) translateZ(29px); }
  .table.farkle-mode .dice-pair { grid-template-columns: repeat(3, 50px); gap: 12px; }
  .table.farkle-mode .die { width: 50px; height: 50px; }
  .table.farkle-mode .face-1 { transform: translateZ(25px); }
  .table.farkle-mode .face-2 { transform: rotateY(180deg) translateZ(25px); }
  .table.farkle-mode .face-3 { transform: rotateY(90deg) translateZ(25px); }
  .table.farkle-mode .face-4 { transform: rotateY(-90deg) translateZ(25px); }
  .table.farkle-mode .face-5 { transform: rotateX(90deg) translateZ(25px); }
  .table.farkle-mode .face-6 { transform: rotateX(-90deg) translateZ(25px); }
  .controls { background: repeating-linear-gradient(105deg, rgba(255, 255, 255, 0.011) 0 1px, transparent 1px 7px), linear-gradient(180deg, #151d19, #090e0b); }
  .bet-controls { justify-content: center; }
  .bet-input-wrap { flex-basis: 100%; }
  .chip-button:not(.forfeit-button) { min-width: 58px; height: 58px; flex: 0 0 58px; }
  .forfeit-button { min-height: 48px; flex: 1 1 auto; }
  .primary-actions {
    position: fixed;
    z-index: 80;
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(9px + env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    width: auto;
    max-width: 520px;
    margin-inline: auto;
    padding: 6px;
    border: 1px solid rgba(233, 198, 109, 0.28);
    border-radius: 18px;
    background: rgba(5, 12, 8, 0.9);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.56), inset 0 1px rgba(255, 255, 255, 0.045);
    backdrop-filter: blur(18px);
  }
  .bank-button,
  .leave-game-button,
  .roll-button { min-height: 62px; }
  .toast { bottom: calc(94px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .brand-copy strong { font-size: 0.72rem; }
  .mode-button { gap: 5px; }
  .mode-button i { min-width: 23px; height: 23px; font-size: 0.56rem; }
  .table,
  .table.farkle-mode { min-height: 400px; padding-inline: 7px; }
  .table.farkle-mode { min-height: 600px; }
  .table.farkle-mode .opponent-side,
  .table.farkle-mode .player-side { width: min(276px, 100%); padding-inline: 12px; }
  .die { width: 54px; height: 54px; }
  .face-1 { transform: translateZ(27px); }
  .face-2 { transform: rotateY(180deg) translateZ(27px); }
  .face-3 { transform: rotateY(90deg) translateZ(27px); }
  .face-4 { transform: rotateY(-90deg) translateZ(27px); }
  .face-5 { transform: rotateX(90deg) translateZ(27px); }
  .face-6 { transform: rotateX(-90deg) translateZ(27px); }
  .table.farkle-mode .dice-pair { grid-template-columns: repeat(3, 46px); gap: 11px; }
  .table.farkle-mode .die { width: 46px; height: 46px; }
  .table.farkle-mode .face-1 { transform: translateZ(23px); }
  .table.farkle-mode .face-2 { transform: rotateY(180deg) translateZ(23px); }
  .table.farkle-mode .face-3 { transform: rotateY(90deg) translateZ(23px); }
  .table.farkle-mode .face-4 { transform: rotateY(-90deg) translateZ(23px); }
  .table.farkle-mode .face-5 { transform: rotateX(90deg) translateZ(23px); }
  .table.farkle-mode .face-6 { transform: rotateX(-90deg) translateZ(23px); }
  .chip-button:not(.forfeit-button) { min-width: 54px; height: 54px; flex-basis: 54px; }
  .event { padding: 13px 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-dot,
  .status-dot,
  .bank-button::after,
  .roll-button::after { animation: none !important; }
}

/* Stable physical dice motion — shared by Duel, Craps, Farkle, and PvP. */
.die.dropping {
  z-index: 8;
  animation: dice-land var(--roll-duration, 780ms) cubic-bezier(0.18, 0.78, 0.22, 1) both;
  animation-delay: var(--motion-delay, 0ms);
  will-change: transform;
}

.die-core.tumbling {
  animation: dice-spin var(--roll-duration, 780ms) cubic-bezier(0.16, 0.72, 0.2, 1) both;
  animation-delay: var(--motion-delay, 0ms);
  transition: none !important;
  will-change: transform;
}

@keyframes dice-spin {
  0% { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
  28% { transform: rotateX(calc(176deg * var(--spin-x, 1))) rotateY(calc(248deg * var(--spin-y, 1))) rotateZ(54deg); }
  62% { transform: rotateX(calc(402deg * var(--spin-x, 1))) rotateY(calc(516deg * var(--spin-y, 1))) rotateZ(-38deg); }
  84% { transform: rotateX(calc(548deg * var(--spin-x, 1))) rotateY(calc(692deg * var(--spin-y, 1))) rotateZ(24deg); }
  100% { transform: rotateX(calc(640deg * var(--spin-x, 1))) rotateY(calc(804deg * var(--spin-y, 1))) rotateZ(8deg); }
}

@keyframes dice-land {
  0% { transform: translate3d(var(--launch-x, 0), var(--throw-y, -132px), 42px) rotateZ(var(--launch-z, -4deg)) scale(0.84); }
  18% { transform: translate3d(24px, -82px, 27px) rotateZ(-3deg) scale(0.91); }
  32% { transform: translate3d(13px, -29px, 8px) rotateZ(1.4deg) scale(0.98); }
  42% { transform: translate3d(8px, 1px, 0) rotateZ(-0.6deg) scale3d(1.025, 0.975, 1); }
  55% { transform: translate3d(5px, 0, 28px) rotateZ(0.75deg) scale(0.99); }
  66% { transform: translate3d(3px, 1px, 0) rotateZ(-0.28deg) scale3d(1.014, 0.986, 1); }
  77% { transform: translate3d(2px, 0, 10px) rotateZ(0.2deg) scale(0.996); }
  84% { transform: translate3d(1px, 0.5px, 0) rotateZ(-0.1deg) scale3d(1.006, 0.994, 1); }
  92% { transform: translate3d(0.5px, 0, 3px) rotateZ(0.04deg) scale(0.999); }
  97% { transform: translate3d(0, 0.3px, 0) rotateZ(0) scale(1.001); }
  100% { transform: translate3d(0, 0, 0) rotateZ(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .die.dropping,
  .die-core.tumbling { animation-duration: 90ms !important; }
}

/* Precision table presentation — Web Animations drives every new physical roll. */
.die.physics-rolling {
  z-index: 9;
  filter: none;
  transition: none !important;
  will-change: transform, opacity;
}

.die.physics-rolling .die-core {
  transition: none !important;
  will-change: transform;
}

.die.physics-rolling::before {
  animation: physical-die-shadow var(--motion-duration, 1050ms) cubic-bezier(0.16, 0.72, 0.2, 1) var(--motion-delay, 0ms) both;
  will-change: opacity, transform, filter;
}

@keyframes physical-die-shadow {
  0% { opacity: 0.12; filter: blur(5px); transform: rotateX(72deg) translateY(8px) scale(0.62); }
  18% { opacity: 0.24; filter: blur(3.8px); transform: rotateX(72deg) translateY(6px) scale(0.72); }
  32% { opacity: 0.58; filter: blur(1.9px); transform: rotateX(72deg) translateY(3px) scale(0.9); }
  42% { opacity: 0.94; filter: blur(0.25px); transform: rotateX(72deg) scale(1.08); }
  55% { opacity: 0.38; filter: blur(3px); transform: rotateX(72deg) translateY(4px) scale(1.24); }
  66% { opacity: 0.91; filter: blur(0.35px); transform: rotateX(72deg) scale(1.04); }
  77% { opacity: 0.6; filter: blur(1.55px); transform: rotateX(72deg) translateY(2px) scale(1.12); }
  84% { opacity: 0.9; filter: blur(0.2px); transform: rotateX(72deg) scale(1.02); }
  92% { opacity: 0.76; filter: blur(0.75px); transform: rotateX(72deg) scale(1.05); }
  97% { opacity: 0.91; filter: blur(0.1px); transform: rotateX(72deg) scale(1.01); }
  100% { opacity: 0.9; filter: blur(0); transform: rotateX(72deg) scale(1); }
}

/* ---- Die face: single clean recipe (structure + finish in one place) ---- */
.face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  padding: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 16px;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.96), transparent 34%),
    linear-gradient(145deg, #ffffff 0%, #f8f7f3 50%, #deddd7 100%);
  box-shadow:
    inset -7px -8px 14px rgba(0, 0, 0, 0.1),
    inset 6px 6px 11px rgba(255, 255, 255, 1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 1px 0 rgba(255, 255, 255, 0.6);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-origin: 50% 50%;
  overflow: hidden;
}

/* One soft top-left glare — a single clean highlight, not a stack of overlapping tints */
.face::before {
  position: absolute;
  z-index: 0;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 40%);
  content: "";
  pointer-events: none;
}

.pip {
  position: relative;
  z-index: 2;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #424242 0%, #131313 42%, #000 100%);
  box-shadow:
    inset 1px 1px 2px rgba(255, 255, 255, 0.12),
    inset -2px -2px 3px rgba(0, 0, 0, 0.8),
    0 1px 1px rgba(255, 255, 255, 0.45);
  visibility: hidden;
}

.pip.on {
  visibility: visible;
}

/* Opponent side: a bold solid-red die instead of a muddy tinted pip — clean, instant contrast at a glance */
.opponent-side .face {
  border-color: rgba(0, 0, 0, 0.22);
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.34), transparent 34%),
    linear-gradient(145deg, #ff4658 0%, #db1934 54%, #970c20 100%);
  box-shadow:
    inset -7px -8px 14px rgba(0, 0, 0, 0.28),
    inset 6px 6px 11px rgba(255, 255, 255, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.25),
    0 0 0 1px rgba(0, 0, 0, 0.25),
    0 1px 0 rgba(255, 255, 255, 0.2);
}

.opponent-side .face::before {
  background: radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 40%);
}

.opponent-side .pip {
  background: #ffffff;
  box-shadow:
    inset -1px -1px 2px rgba(0, 0, 0, 0.18),
    0 1px 1px rgba(0, 0, 0, 0.25);
}

@media (max-width: 680px) {
  .die { filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.3)); }
  .face {
    box-shadow:
      inset -5px -6px 10px rgba(0, 0, 0, 0.08),
      inset 4px 4px 8px rgba(255, 255, 255, 1),
      0 0 0 1px rgba(0, 0, 0, 0.08);
  }
}

/* Digital casino displays use tabular figures so changing values never jump. */
.balance-box strong,
.stat strong,
.side-label strong,
#proposal-amount,
#room-code {
  font-family: "SFMono-Regular", "Roboto Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: 0.075em;
}

.side-label strong {
  min-width: 4.4ch;
  padding: 5px 8px;
  border: 1px solid rgba(108, 255, 194, 0.2);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(4, 13, 9, 0.96), rgba(1, 5, 3, 0.98)),
    repeating-linear-gradient(90deg, transparent 0 4px, rgba(255, 255, 255, 0.018) 4px 5px);
  box-shadow: inset 0 0 13px rgba(61, 255, 179, 0.07), 0 1px rgba(255, 255, 255, 0.04);
  line-height: 1;
  text-align: right;
  text-shadow: 0 0 5px currentColor, 0 0 13px currentColor;
}

.opponent-side .side-label strong {
  border-color: rgba(255, 109, 137, 0.22);
  box-shadow: inset 0 0 13px rgba(255, 65, 102, 0.07), 0 1px rgba(255, 255, 255, 0.04);
}

.stat strong,
.balance-box strong {
  text-shadow: 0 0 9px color-mix(in srgb, currentColor 44%, transparent);
}

@media (max-width: 680px) {
  .dice-pair { perspective: 980px; perspective-origin: 50% 18%; -webkit-perspective: 980px; }
  .die.physics-rolling { filter: none; }
  .die.physics-rolling::before { filter: none !important; }
  .face::after { opacity: 0.32; }
  .side-label strong { padding: 4px 6px; letter-spacing: 0.045em; }
}

@media (prefers-reduced-motion: reduce) {
  .die.physics-rolling,
  .die.physics-rolling .die-core { will-change: auto; }
}

/* Low-volume original house playlists. */
.audio-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.music-picker {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 6px;
  padding: 0 25px 0 9px;
  border: 1px solid rgba(233, 198, 109, 0.28);
  border-radius: 999px;
  color: var(--gold-bright);
  background: rgba(233, 198, 109, 0.055);
}

.music-picker::after {
  position: absolute;
  right: 10px;
  color: rgba(255, 240, 199, 0.72);
  content: "⌄";
  font-size: 0.72rem;
  pointer-events: none;
}

.music-icon {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 50%;
  background: rgba(233, 198, 109, 0.1);
  font-size: 0.82rem;
}

.music-picker select {
  max-width: 132px;
  border: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  appearance: none;
}

.music-picker select:focus-visible {
  border-radius: 5px;
  box-shadow: 0 0 0 2px rgba(105, 255, 196, 0.55);
}

.music-picker option {
  color: #f8f2e2;
  background: #0a130f;
}

@media (max-width: 680px) {
  .audio-controls { min-width: 0; flex-wrap: wrap; gap: 5px; }
  .music-picker { min-height: 42px; }
}

@media (max-width: 420px) {
  .game-title-row > div:first-child { min-width: 0; }
  .audio-controls { flex: 0 1 150px; }
  .music-picker { min-height: 40px; padding-right: 21px; padding-left: 7px; }
  .music-picker::after { right: 7px; }
  .music-picker select { max-width: 88px; font-size: 0.57rem; }
}
