:root {
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --void: #02050a;
  --deep-space: #050a12;
  --panel: rgba(7, 13, 24, 0.9);
  --panel-solid: #0a111d;
  --panel-soft: rgba(12, 24, 38, 0.86);
  --holo-blue: #72e8ff;
  --holo-blue-soft: rgba(114, 232, 255, 0.26);
  --saber-gold: #ffd15c;
  --saber-gold-soft: rgba(255, 209, 92, 0.34);
  --warning-red: #ff4058;
  --rebel-blue: #4fb2ff;
  --force-green: #58e39b;
  --muted: #92a7b8;
  --ink: #eaf6ff;
  background: var(--void);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background-color: var(--void);
  background-image:
    linear-gradient(180deg, rgba(3, 7, 14, 0.18), rgba(1, 4, 9, 0.88)),
    url("./assets/star-ui/space-opera-bg.jpg"),
    repeating-linear-gradient(115deg, transparent 0 38px, rgba(114, 232, 255, 0.035) 39px 40px);
  background-position: center, center, center;
  background-repeat: no-repeat, no-repeat, repeat;
  background-size: auto, cover, auto;
}

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

body::before {
  background:
    linear-gradient(90deg, transparent, rgba(114, 232, 255, 0.08), transparent) 50% 0 / 1px 100% no-repeat,
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 96px);
  opacity: 0.8;
}

body::after {
  background:
    linear-gradient(110deg, transparent 0 46%, rgba(255, 209, 92, 0.1) 47%, transparent 48%),
    linear-gradient(250deg, transparent 0 52%, rgba(114, 232, 255, 0.08) 53%, transparent 54%);
  mix-blend-mode: screen;
  opacity: 0.5;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid var(--holo-blue);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(170px, 24vh) minmax(190px, 1fr) auto auto;
  gap: 10px;
  width: min(100vw, 430px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.top-bar,
.bottom-bar,
.bet-area,
.road-area {
  position: relative;
  border: 1px solid rgba(114, 232, 255, 0.24);
  border-radius: 6px;
  background:
    url("./assets/star-ui/holo-panel.png") center / 100% 100% no-repeat,
    linear-gradient(135deg, rgba(255, 209, 92, 0.08), transparent 24%),
    linear-gradient(180deg, rgba(11, 21, 36, 0.95), rgba(3, 8, 16, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 0 24px rgba(114, 232, 255, 0.06),
    0 16px 32px rgba(0, 0, 0, 0.35);
}

.top-bar::before,
.bottom-bar::before,
.bet-area::before,
.road-area::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent 0, rgba(114, 232, 255, 0.16) 48%, transparent 52%) top / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(114, 232, 255, 0.035) 19px 20px);
  content: "";
  pointer-events: none;
}

.top-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 64px;
  padding: 9px 20px 9px 20px;
  border-color: transparent;
  background:
    url("./assets/star-ui/hud-header.png") center / 100% 100% no-repeat,
    linear-gradient(180deg, rgba(8, 17, 30, 0.9), rgba(2, 7, 14, 0.9));
}

.top-bar > div:first-child {
  grid-column: 1;
  align-self: center;
  min-width: 0;
  max-width: 176px;
  padding-left: 20px;
  transform: translateY(-2px);
}

.top-bar > div {
  min-width: 0;
}

.room-name,
.round-text {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-name {
  color: #f7fbff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.15;
  text-shadow: 0 0 12px rgba(114, 232, 255, 0.36);
}

.round-text,
.balance span {
  color: var(--muted);
  font-size: 10px;
}

.round-text {
  max-width: 170px;
}

.timer {
  position: relative;
  grid-column: 2;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background:
    url("./assets/star-ui/status-ring.png") center / 118% 118% no-repeat,
    radial-gradient(circle, rgba(255, 209, 92, 0.2), rgba(3, 9, 17, 0.78) 60%);
  color: var(--saber-gold);
  font-size: 23px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 209, 92, 0.62);
  box-shadow:
    inset 0 0 14px rgba(114, 232, 255, 0.1),
    0 0 18px rgba(114, 232, 255, 0.18);
}

.timer::before,
.timer::after {
  content: none;
}

.balance {
  grid-column: 3;
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 0;
  padding-right: 20px;
  text-align: right;
  transform: translateY(-5px);
}

.balance span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.balance strong {
  max-width: 100%;
  overflow: hidden;
  color: var(--saber-gold);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.1;
  text-overflow: ellipsis;
  text-shadow: 0 0 12px rgba(255, 209, 92, 0.42);
}

.table-area {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  align-items: stretch;
  gap: 8px;
  padding: 12px 0;
}

.table-area::before {
  position: absolute;
  inset: 4px -2px;
  z-index: -1;
  border: 1px solid rgba(114, 232, 255, 0.26);
  border-radius: 46% / 20%;
  background:
    linear-gradient(90deg, transparent 0 49%, rgba(114, 232, 255, 0.18) 50%, transparent 51%),
    repeating-linear-gradient(0deg, transparent 0 16px, rgba(114, 232, 255, 0.05) 17px 18px),
    radial-gradient(ellipse at center, rgba(30, 92, 111, 0.64), rgba(4, 13, 24, 0.92) 67%);
  box-shadow:
    inset 0 0 34px rgba(114, 232, 255, 0.15),
    0 0 30px rgba(114, 232, 255, 0.08);
  content: "";
}

.table-area::after {
  position: absolute;
  inset: 18px 24px;
  z-index: -1;
  border-top: 1px solid rgba(255, 209, 92, 0.22);
  border-bottom: 1px solid rgba(255, 209, 92, 0.14);
  content: "";
  pointer-events: none;
}

.hand-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  min-width: 0;
  gap: 8px;
}

.hand-title {
  color: #f7fbff;
  font-size: 14px;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(114, 232, 255, 0.45);
}

.cards {
  display: flex;
  justify-content: center;
  min-height: 72px;
  gap: 6px;
  perspective: 700px;
}

.card,
.flip-card {
  display: grid;
  place-items: center;
  width: 42px;
  height: 62px;
  border-radius: 5px;
}

.card {
  border: 1px solid rgba(6, 14, 24, 0.24);
  background:
    linear-gradient(135deg, rgba(114, 232, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #fbfdff, #d8e7f0);
  color: #111827;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.36),
    0 9px 16px rgba(0, 0, 0, 0.36);
}

.card.red {
  color: #c92d35;
}

.card-back {
  position: relative;
  overflow: hidden;
  border: 0;
  background: url("./assets/star-ui/card-back.png") center / 100% 100% no-repeat;
  box-shadow:
    0 8px 14px rgba(0, 0, 0, 0.32);
}

.empty-card {
  border: 1px dashed rgba(114, 232, 255, 0.36);
  background: rgba(114, 232, 255, 0.05);
  box-shadow: inset 0 0 20px rgba(114, 232, 255, 0.08);
}

.flip-card {
  background: transparent;
  animation: card-rise 180ms ease both;
  transform-style: preserve-3d;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  animation: card-flip 520ms ease both;
  transform-style: preserve-3d;
}

.flip-card .card {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.card-front {
  transform: rotateY(180deg);
}

.card span {
  font-size: 18px;
  font-weight: 950;
}

.card small {
  font-size: 16px;
  line-height: 1;
}

.point {
  color: var(--saber-gold);
  font-size: 15px;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(255, 209, 92, 0.44);
}

.result-badge {
  position: relative;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border: 0;
  border-radius: 50%;
  background:
    url("./assets/star-ui/status-ring.png") center / 100% 100% no-repeat,
    radial-gradient(circle, rgba(255, 209, 92, 0.16), rgba(3, 9, 17, 0.76) 62%),
    conic-gradient(from 0deg, transparent, rgba(114, 232, 255, 0.32), transparent, rgba(255, 209, 92, 0.3), transparent);
  color: var(--saber-gold);
  font-size: 15px;
  font-weight: 950;
  text-align: center;
  text-shadow: 0 0 13px rgba(255, 209, 92, 0.56);
  box-shadow:
    inset 0 0 22px rgba(255, 209, 92, 0.1),
    0 0 20px rgba(255, 209, 92, 0.18);
}

.result-badge::before {
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(114, 232, 255, 0.24);
  border-radius: inherit;
  content: "";
}

.result-badge.banker {
  color: #ff7282;
  border-color: rgba(255, 64, 88, 0.66);
  text-shadow: 0 0 13px rgba(255, 64, 88, 0.54);
}

.result-badge.player {
  color: #7edcff;
  border-color: rgba(114, 232, 255, 0.72);
  text-shadow: 0 0 13px rgba(114, 232, 255, 0.58);
}

.result-badge.tie {
  color: #75f0af;
  border-color: rgba(88, 227, 155, 0.72);
  text-shadow: 0 0 13px rgba(88, 227, 155, 0.58);
}

.road-area {
  --road-content-edge-inset: 18px;
  --road-control-h: 32px;
  --road-board-h: 145px;
  --road-cell-size: 18px;
  --road-grid-gap: 2px;
  display: grid;
  grid-template-rows: var(--road-control-h) var(--road-board-h);
  row-gap: 6px;
  align-content: center;
  min-height: 176px;
  padding: 13px 8px 14px;
  overflow: hidden;
}

.road-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: calc(100% - var(--road-content-edge-inset) * 2);
  margin: 0 auto;
}

.road-tab,
.bet-actions button,
.bottom-bar button,
.record-tab {
  min-height: 38px;
  border: 1px solid rgba(114, 232, 255, 0.16);
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(21, 39, 53, 0.95), rgba(12, 23, 32, 0.94));
  color: #e8f8ff;
  font-weight: 800;
  box-shadow: inset 0 0 16px rgba(114, 232, 255, 0.05);
}

.road-tab {
  min-height: var(--road-control-h);
}

.road-tab.active {
  border-color: rgba(114, 232, 255, 0.7);
  background:
    linear-gradient(135deg, rgba(114, 232, 255, 0.22), transparent 34%),
    linear-gradient(180deg, rgba(13, 45, 62, 0.98), rgba(7, 20, 33, 0.98));
  color: #eafaff;
  font-weight: 950;
  text-shadow: 0 0 10px rgba(114, 232, 255, 0.42);
  box-shadow:
    inset 0 0 18px rgba(114, 232, 255, 0.14),
    0 0 16px rgba(114, 232, 255, 0.16);
}

.record-tab.active {
  border-color: rgba(255, 209, 92, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), transparent 30%),
    linear-gradient(180deg, #ffe07d, #d99b1d);
  color: #16120a;
  font-weight: 950;
  box-shadow: 0 0 18px rgba(255, 209, 92, 0.22);
}

.road-board {
  display: grid;
  grid-template-rows: repeat(6, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: var(--road-cell-size);
  gap: var(--road-grid-gap);
  width: calc(100% - var(--road-content-edge-inset) * 2);
  height: var(--road-board-h);
  min-height: 0;
  margin-inline: auto;
  align-content: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 7px 8px;
  border: 1px solid rgba(114, 232, 255, 0.16);
  border-radius: 5px;
  background:
    linear-gradient(90deg, rgba(114, 232, 255, 0.12) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(0deg, rgba(114, 232, 255, 0.1) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(180deg, rgba(3, 12, 18, 0.76), rgba(1, 8, 12, 0.92));
  box-shadow: inset 0 0 24px rgba(114, 232, 255, 0.1);
  scrollbar-color: rgba(114, 232, 255, 0.5) transparent;
  scrollbar-width: thin;
}

.road-board::-webkit-scrollbar {
  height: 4px;
}

.road-board::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(114, 232, 255, 0.48);
}

.hidden {
  display: none !important;
}

.road-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  font-size: 8px;
  font-weight: 950;
  box-shadow: 0 0 12px currentColor;
}

.bead-board .road-dot.banker {
  background: var(--warning-red);
  color: var(--warning-red);
}

.bead-board .road-dot.player {
  background: var(--rebel-blue);
  color: var(--rebel-blue);
}

.bead-board .road-dot.tie {
  background: var(--force-green);
  color: var(--force-green);
}

.big-board .road-dot {
  border: 2px solid currentColor;
  background: rgba(2, 7, 12, 0.72);
}

.big-board .road-dot.banker {
  color: #ff687a;
}

.big-board .road-dot.player {
  color: #70caff;
}

.pair-mark,
.tie-mark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.pair-mark.banker {
  top: -1px;
  left: -1px;
  background: #ff4058;
}

.pair-mark.player {
  right: -1px;
  bottom: -1px;
  background: #4fb2ff;
}

.tie-mark {
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 11px;
  height: 11px;
  background: #58e39b;
  color: #02140a;
  font-size: 7px;
}

.bet-area {
  --bet-area-h: clamp(232px, 29vh, 248px);
  --bet-safe-x: clamp(12px, 4vw, 16px);
  --bet-gap: 6px;
  --bet-action-h: 34px;
  --chip-size: clamp(34px, 10.6vw, 42px);
  --bet-grid-h: 120px;
  --bet-button-edge-inset: 14px;
  --bet-button-gap: calc(var(--bet-gap) + var(--bet-button-edge-inset) / 2);
  --bet-primary-edge-inset: 10px;
  --bet-primary-center-inset: 3.5px;
  display: grid;
  grid-template-rows: var(--chip-size) var(--bet-grid-h) var(--bet-action-h);
  gap: var(--bet-gap);
  height: var(--bet-area-h);
  overflow: hidden;
  padding: 22px var(--bet-safe-x) 18px;
}

.chip-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: var(--bet-gap);
  min-height: 0;
}

.chip {
  position: relative;
  justify-self: center;
  width: var(--chip-size);
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background:
    url("./assets/star-ui/credit-chip.png") center / 118% 118% no-repeat,
    radial-gradient(circle, rgba(255, 209, 92, 0.18), rgba(7, 16, 28, 0.88));
  color: #171106;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(255, 232, 149, 0.42);
  box-shadow:
    0 0 12px rgba(255, 209, 92, 0.16),
    0 2px 8px rgba(0, 0, 0, 0.34);
  transition:
    transform 140ms ease,
    filter 140ms ease,
    box-shadow 140ms ease;
}

.chip::before {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 235, 154, 0.38);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.chip::after {
  position: absolute;
  inset: -5px;
  border: 2px solid rgba(114, 232, 255, 0.9);
  border-radius: inherit;
  box-shadow:
    0 0 12px rgba(114, 232, 255, 0.8),
    0 0 22px rgba(255, 209, 92, 0.35);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: scale(0.88);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.chip.active {
  background:
    url("./assets/star-ui/credit-chip.png") center / 122% 122% no-repeat,
    radial-gradient(circle, #fff1a5 0 34%, #ffd15c 35% 64%, #8d5a12 65%);
  color: #12100a;
  filter: saturate(1.24) brightness(1.08);
  transform: translateY(-2px) scale(1.08);
  box-shadow:
    0 0 10px rgba(114, 232, 255, 0.48),
    0 0 22px rgba(255, 209, 92, 0.58),
    0 2px 10px rgba(0, 0, 0, 0.36);
}

.chip.active::before {
  inset: 6px;
  border-color: rgba(255, 249, 214, 0.82);
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.32);
}

.chip.active::after {
  opacity: 1;
  transform: scale(1);
}

.bet-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1.2fr) minmax(0, 0.85fr);
  gap: var(--bet-gap);
  min-height: 0;
}

.bet-box {
  position: relative;
  display: grid;
  align-content: center;
  gap: 1px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(114, 232, 255, 0.14);
  border-radius: 6px;
  background:
    linear-gradient(135deg, rgba(114, 232, 255, 0.1), transparent 40%),
    linear-gradient(180deg, rgba(17, 33, 45, 0.92), rgba(10, 19, 27, 0.95));
  box-shadow: inset 0 0 18px rgba(114, 232, 255, 0.06);
}

.bet-box::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0, rgba(255, 255, 255, 0.08) 50%, transparent 100%) top / 100% 1px no-repeat,
    linear-gradient(135deg, transparent 0 78%, rgba(255, 209, 92, 0.18) 79% 82%, transparent 83%);
  content: "";
  pointer-events: none;
}

.bet-box[data-bet-type="BANKER"],
.bet-box[data-bet-type="PLAYER"] {
  grid-column: span 3;
  min-height: 0;
}

.bet-box[data-bet-type="BANKER"] {
  justify-self: start;
  width: calc(100% - var(--bet-primary-edge-inset) - var(--bet-primary-center-inset));
  transform: translateX(var(--bet-primary-edge-inset));
  border-color: rgba(255, 64, 88, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 64, 88, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(35, 18, 26, 0.95), rgba(12, 16, 24, 0.96));
}

.bet-box[data-bet-type="PLAYER"] {
  justify-self: start;
  width: calc(100% - var(--bet-primary-edge-inset) - var(--bet-primary-center-inset));
  transform: translateX(var(--bet-primary-center-inset));
  border-color: rgba(79, 178, 255, 0.34);
  background:
    linear-gradient(135deg, rgba(79, 178, 255, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(15, 27, 43, 0.95), rgba(8, 15, 26, 0.96));
}

.bet-box[data-bet-type="TIE"],
.bet-box[data-bet-type="BANKER_PAIR"],
.bet-box[data-bet-type="PLAYER_PAIR"] {
  grid-column: span 2;
  width: calc(100% - var(--bet-button-edge-inset));
}

.bet-box[data-bet-type="TIE"] {
  justify-self: end;
}

.bet-box[data-bet-type="BANKER_PAIR"] {
  justify-self: center;
}

.bet-box[data-bet-type="PLAYER_PAIR"] {
  justify-self: start;
}

.bet-box[data-bet-type="TIE"] {
  border-color: rgba(88, 227, 155, 0.3);
}

.bet-box[data-bet-type="TIE"] span,
.bet-box[data-bet-type="BANKER_PAIR"] span,
.bet-box[data-bet-type="PLAYER_PAIR"] span,
.bet-box[data-bet-type="TIE"] strong,
.bet-box[data-bet-type="BANKER_PAIR"] strong,
.bet-box[data-bet-type="PLAYER_PAIR"] strong {
  font-size: 13px;
}

.bet-box[data-bet-type="TIE"] small,
.bet-box[data-bet-type="BANKER_PAIR"] small,
.bet-box[data-bet-type="PLAYER_PAIR"] small {
  font-size: 8px;
}

.bet-box span {
  position: relative;
  z-index: 1;
  font-size: 15px;
  font-weight: 950;
  line-height: 1.1;
}

.bet-box small {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
}

.bet-box strong {
  position: relative;
  z-index: 1;
  color: var(--saber-gold);
  font-size: 15px;
  font-weight: 950;
  text-shadow: 0 0 10px rgba(255, 209, 92, 0.36);
}

.bet-actions,
.bottom-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.bet-actions button,
.bottom-bar button {
  min-width: 0;
  padding: 0 8px;
  white-space: nowrap;
}

.bet-actions {
  min-height: 0;
  gap: var(--bet-button-gap);
  padding-inline: var(--bet-button-edge-inset);
}

.bet-actions button {
  min-height: var(--bet-action-h);
}

.bet-actions button.confirm {
  border-color: rgba(255, 64, 88, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #ae2335, #671622);
  color: #fff5f6;
  font-weight: 950;
  box-shadow: 0 0 16px rgba(255, 64, 88, 0.2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  filter: saturate(0.65);
}

.bottom-bar {
  --bottom-button-edge-inset: 14px;
  padding: 8px calc(8px + var(--bottom-button-edge-inset));
}

.history-panel {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  border: 1px solid rgba(114, 232, 255, 0.24);
  background:
    repeating-linear-gradient(0deg, transparent 0 32px, rgba(114, 232, 255, 0.035) 33px 34px),
    linear-gradient(180deg, rgba(8, 17, 30, 0.98), rgba(2, 6, 12, 0.98));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
  transform: translateX(110%);
  transition: transform 180ms ease;
}

.history-panel.open {
  transform: translateY(0);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-bottom: 10px;
  color: #f7fbff;
}

.history-head button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(114, 232, 255, 0.24);
  border-radius: 50%;
  background: rgba(114, 232, 255, 0.1);
  font-size: 22px;
}

.record-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.history-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow: auto;
}

.history-item,
.bet-record-item {
  border: 1px solid rgba(114, 232, 255, 0.12);
  border-radius: 5px;
  background: rgba(114, 232, 255, 0.06);
}

.history-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 8px;
}

.history-item small {
  color: var(--muted);
}

.record-table-head,
.bet-record-item {
  display: grid;
  grid-template-columns: 58px 42px minmax(86px, 1fr) 70px;
  align-items: center;
  gap: 8px;
}

.record-table-head {
  margin-bottom: 6px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 11px;
}

.bet-record-item {
  min-height: 38px;
  padding: 0 8px;
}

.bet-record-item strong,
.bet-record-item em {
  font-style: normal;
  font-weight: 950;
}

.bet-record-item.win strong,
.bet-record-item.win em {
  color: #75f0af;
}

.bet-record-item.lose strong,
.bet-record-item.lose em {
  color: #ff7282;
}

.bet-record-item.push strong,
.bet-record-item.push em {
  color: var(--saber-gold);
}

.bet-record-item small {
  color: var(--muted);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 60px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 22px;
  left: 18px;
  z-index: 5;
  max-width: 390px;
  margin: auto;
  padding: 11px 14px;
  border: 1px solid rgba(255, 209, 92, 0.42);
  border-radius: 6px;
  background: rgba(9, 16, 27, 0.95);
  color: var(--saber-gold);
  text-align: center;
  box-shadow: 0 0 24px rgba(255, 209, 92, 0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: 160ms ease;
  pointer-events: none;
}

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

@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.9);
  }
}

@keyframes card-flip {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(180deg);
  }
}

@media (hover: hover) {
  .road-tab:hover,
  .bet-actions button:hover,
  .bottom-bar button:hover,
  .record-tab:hover,
  .bet-box:hover,
  .chip:hover {
    border-color: rgba(114, 232, 255, 0.46);
    box-shadow:
      inset 0 0 18px rgba(114, 232, 255, 0.11),
      0 0 18px rgba(114, 232, 255, 0.1);
  }
}

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

@media (max-width: 360px) {
  .app-shell {
    gap: 8px;
    padding-inline: 8px;
  }

  .top-bar {
    grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
    padding-inline: 13px;
  }

  .timer {
    width: 48px;
    height: 48px;
    font-size: 22px;
  }

  .card,
  .flip-card {
    width: 36px;
    height: 56px;
  }

  .chip {
    width: var(--chip-size);
    font-size: 10px;
  }

  .bet-box span {
    font-size: 14px;
  }

  .bet-actions button,
  .bottom-bar button {
    padding-inline: 4px;
    font-size: 13px;
  }
}
