:root {
  --gold: #f5c46b;
  --ice: #eaf6ff;
  --muted: rgba(234, 246, 255, 0.72);
  --glass: rgba(8, 10, 18, 0.58);
  --glass-strong: rgba(7, 8, 14, 0.82);
  --line: rgba(255, 255, 255, 0.16);
  --blue: #ffd34d;
  --green: #8cdf63;
  --red: #b678ff;
  --live: #ff2d55;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #030409;
  color: var(--ice);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", Arial, sans-serif;
}

button {
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.game {
  position: relative;
  width: min(100vw, calc(100dvh * 0.5625));
  height: 100dvh;
  min-height: min(620px, 100dvh);
  overflow: hidden;
  isolation: isolate;
  background: #07070d;
  box-shadow: 0 0 42px rgba(0, 0, 0, 0.78);
}

.lobby-view {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: calc(14px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(14, 17, 28, 0.94), rgba(6, 8, 16, 0.96) 52%, rgba(5, 7, 12, 0.98)),
    #07070d;
  scrollbar-width: none;
}

.lobby-view::-webkit-scrollbar {
  display: none;
}

.game.is-lobby .lobby-view {
  display: block;
}

.game.is-lobby .stage-bg,
.game.is-lobby .stage-draw-video,
.game.is-lobby .stage-vignette,
.game.is-lobby .prize-fireworks,
.game.is-lobby .live-top,
.game.is-lobby .right-rail,
.game.is-lobby .deal-area,
.game.is-lobby .host-speech,
.game.is-lobby .live-chat,
.game.is-lobby .countdown,
.game.is-lobby .prediction-panel,
.game.is-lobby .chip-rack,
.game.is-lobby .controls {
  display: none;
}

.lobby-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 340px);
  align-items: center;
  gap: 10px;
}

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

.lobby-logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.75), transparent 18%),
    linear-gradient(135deg, #ff4f7b, #725dff 62%, #35c7ff);
  color: #fff;
  font-size: 17px;
  font-weight: 1000;
  line-height: 1;
}

.lobby-top strong {
  display: block;
  color: #fff;
  font-size: 26px;
  font-weight: 1000;
  line-height: 1;
}

.lobby-top span {
  display: block;
  margin-top: 5px;
  color: rgba(234, 246, 255, 0.68);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.lobby-player {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  height: 42px;
  display: grid;
  grid-template-columns: 38px minmax(64px, 1fr) auto;
  align-items: center;
  gap: 10px;
  justify-self: end;
  padding: 0;
}

.lobby-player-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.7), transparent 17%),
    linear-gradient(135deg, #f5c46b, #ff3e72 58%, #725dff);
  color: #fff;
  font-size: 16px;
  font-weight: 1000;
  line-height: 1;
}

.lobby-player b,
.lobby-player span,
.lobby-player strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-player b {
  color: #fff;
  font-size: 18px;
  font-weight: 1000;
}

.lobby-player span {
  margin-top: 0;
  color: rgba(245, 196, 107, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.lobby-player-name,
.lobby-player-balance {
  min-width: 0;
}

.lobby-player-balance {
  display: flex;
  align-items: baseline;
  gap: 6px;
  justify-self: end;
  padding-left: 12px;
  border-left: 1px solid rgba(245, 196, 107, 0.28);
  text-align: right;
}

.lobby-player strong {
  margin-top: 0;
  color: #fff0bd;
  font-size: 24px;
  font-weight: 1000;
}

.table-card > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  transform: scale(var(--table-zoom, 1.01));
  transform-origin: center;
}

.table-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02) 30%, rgba(0, 0, 0, 0.72)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 48%, rgba(0, 0, 0, 0.12));
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 45, 85, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 1000;
  line-height: 1;
  box-shadow: 0 0 16px rgba(255, 45, 85, 0.3);
}

.status-pill.drawing {
  background: rgba(245, 196, 107, 0.92);
  color: #23140a;
}

.status-pill.maintenance {
  background: rgba(84, 89, 108, 0.92);
}

.table-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.table-card {
  position: relative;
  min-width: 0;
  width: 100%;
  height: clamp(172px, calc((100dvh - 116px) / 4), 280px);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: rgba(11, 13, 22, 0.82);
  overflow: hidden;
  text-align: left;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.table-card:disabled {
  cursor: default;
  opacity: 0.62;
}

.table-countdown {
  min-width: 42px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.68);
  color: #fff;
  font-size: 13px;
  font-weight: 1000;
}

.table-info {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(8, 10, 18, 0.58);
  backdrop-filter: blur(13px);
}

.table-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.table-name-row strong {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 20px;
  font-weight: 1000;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-name-row span {
  flex: 0 0 auto;
}

.table-name-row .table-title-group {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-sub {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: rgba(234, 246, 255, 0.68);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.table-min {
  flex: 0 0 auto;
  color: rgba(245, 196, 107, 0.92);
  font-size: 12px;
  font-weight: 1000;
  line-height: 1;
}

.mini-road {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.table-enter {
  flex: 0 0 auto;
  min-width: 42px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 7px;
  background: linear-gradient(180deg, #ff3e72, #c91f64);
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
  line-height: 1;
}

.mini-road i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.36);
}

.mini-road .blue {
  background: var(--blue);
}

.mini-road .green {
  background: var(--green);
}

.mini-road .red {
  background: var(--red);
}

.stage-bg,
.stage-draw-video,
.stage-vignette {
  position: absolute;
  inset: 0;
}

.stage-bg,
.stage-draw-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  background: #07070d;
  filter: saturate(1.02) contrast(1.01);
  transform: scale(1.01);
}

.stage-bg {
  z-index: -4;
}

.stage-draw-video {
  z-index: -3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.stage-draw-video.is-active {
  opacity: 1;
}

.stage-vignette {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.18)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent 24%, transparent 62%, rgba(0, 0, 0, 0.34));
  pointer-events: none;
}

.prize-fireworks {
  position: absolute;
  inset: 0;
  z-index: 14;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.prize-fireworks.is-active {
  opacity: 1;
}

.live-top {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(196px, 0.84fr) minmax(0, 1.16fr);
  align-items: center;
  gap: 8px;
}

.back-button,
.host-card,
.wallet-chip,
.sound-button,
.right-rail button,
.result-banner,
.countdown,
.control-btn {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 17, 28, 0.72), rgba(7, 8, 14, 0.62));
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
}

.back-button {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
}

.back-button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 26px;
  width: 17px;
  height: 13px;
  border: 3px solid #fff;
  border-top: 0;
  border-radius: 2px;
  transform: translateX(-50%);
}

.back-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 17px;
  width: 16px;
  height: 16px;
  border-left: 3px solid #fff;
  border-top: 3px solid #fff;
  border-radius: 2px 0 0 0;
  transform: translateX(-50%) rotate(45deg);
}

.host-card {
  min-width: 0;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 8px;
}

.host-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.78), transparent 18%),
    linear-gradient(135deg, #ff4f7b, #725dff 60%, #35c7ff);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.host-copy {
  min-width: 0;
}

.host-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.host-line strong {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: clamp(13px, 2.9vw, 17px);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.host-copy > span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: clamp(10px, 2.5vw, 12px);
  line-height: 1;
}

.live-badge {
  flex: 0 0 auto;
  padding: 3px 5px;
  border-radius: 4px;
  background: var(--live);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  box-shadow: 0 0 16px rgba(255, 45, 85, 0.42);
}

.wallet-chip {
  height: 52px;
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(44px, 0.55fr) minmax(106px, 1.45fr);
  align-items: center;
  align-content: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 8px;
}

.wallet-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.7), transparent 17%),
    linear-gradient(135deg, #f5c46b, #ff3e72 58%, #725dff);
  color: #fff;
  font-size: 16px;
  font-weight: 1000;
  line-height: 1;
}

.wallet-player,
.wallet-balance {
  min-width: 0;
  display: grid;
  grid-template-rows: 11px 22px;
  align-content: center;
  row-gap: 4px;
}

.wallet-player b,
.wallet-player span,
.wallet-balance span,
.wallet-balance strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-player b {
  color: #fff;
  font-size: clamp(14px, 3vw, 17px);
  font-weight: 1000;
  line-height: 22px;
}

.wallet-player span,
.wallet-balance span {
  margin-top: 0;
  color: rgba(245, 196, 107, 0.82);
  font-size: clamp(9px, 2.2vw, 11px);
  font-weight: 800;
  line-height: 11px;
}

.wallet-balance {
  justify-self: end;
  width: 100%;
  padding-left: 10px;
  border-left: 1px solid rgba(245, 196, 107, 0.24);
  text-align: right;
}

.wallet-balance strong {
  color: #fff0bd;
  font-size: clamp(18px, 4.2vw, 24px);
  font-weight: 1000;
  line-height: 22px;
  text-shadow: 0 0 14px rgba(245, 196, 107, 0.22);
}

.sound-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-content: center;
  gap: 2px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
}

.sound-glyph {
  position: relative;
  width: 28px;
  height: 26px;
  display: block;
}

.sound-glyph::before {
  content: "♪";
  position: absolute;
  inset: -5px 0 auto;
  color: #fff;
  font-size: 30px;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.18);
}

.sound-glyph::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 11px;
  width: 24px;
  height: 3px;
  border-radius: 99px;
  background: #ff8aa3;
  opacity: 0;
  transform: rotate(-38deg);
  box-shadow: 0 0 8px rgba(255, 45, 85, 0.32);
}

.sound-button.is-muted .sound-glyph::after {
  opacity: 1;
}

.sound-button.is-muted .sound-glyph::before {
  color: rgba(255, 255, 255, 0.58);
}

.road-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-content: center;
  gap: 2px;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
}

.road-glyph {
  width: 27px;
  height: 24px;
  display: grid;
  grid-template-columns: repeat(3, 6px);
  grid-auto-rows: 6px;
  align-content: center;
  justify-content: center;
  gap: 3px;
}

.road-glyph::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow:
    9px 0 0 var(--red),
    18px 0 0 var(--green),
    0 9px 0 var(--green),
    9px 9px 0 var(--blue),
    18px 9px 0 var(--red),
    0 18px 0 var(--red),
    9px 18px 0 var(--green),
    18px 18px 0 var(--blue);
}

.right-rail {
  position: absolute;
  top: clamp(145px, 24svh, 235px);
  right: 12px;
  z-index: 9;
  display: grid;
  gap: 10px;
}

.right-rail button {
  width: 52px;
  height: 54px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  padding: 5px;
  border-radius: 8px;
  cursor: pointer;
}

.right-rail span {
  color: #fff;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.18);
}

.right-rail small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.road-sheet {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(92px + env(safe-area-inset-top));
  z-index: 18;
  max-height: calc(100dvh - 118px);
  overflow: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(7, 8, 14, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.34);
  scrollbar-width: none;
}

.road-sheet::-webkit-scrollbar {
  display: none;
}

.road-sheet[hidden] {
  display: none;
}

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

.road-sheet strong {
  color: #fff;
  font-size: 15px;
  font-weight: 1000;
  line-height: 1;
}

.road-sheet button {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.road-sheet-grid {
  display: grid;
  gap: 9px;
}

.road-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.road-stat {
  min-width: 0;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.road-stat i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px color-mix(in srgb, currentColor 44%, transparent);
}

.road-stat b {
  color: #fff;
  font-size: 12px;
}

.road-stat em {
  min-width: 24px;
  color: #fff2c8;
  font-style: normal;
  text-align: right;
}

.road-stat.blue {
  color: var(--blue);
}

.road-stat.green {
  color: var(--green);
}

.road-stat.red {
  color: var(--red);
}

.road-section {
  display: grid;
  gap: 5px;
}

.road-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.road-section-title span {
  color: #fff;
  font-size: 13px;
  font-weight: 1000;
}

.road-section-title small {
  color: rgba(255, 255, 255, 0.56);
  font-size: 11px;
  font-weight: 800;
}

.road-board {
  display: grid;
  grid-template-rows: repeat(6, minmax(0, 1fr));
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent),
    rgba(0, 0, 0, 0.18);
}

.bead-road {
  grid-template-columns: repeat(16, minmax(0, 1fr));
}

.big-road {
  grid-template-columns: repeat(18, minmax(0, 1fr));
}

.road-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-right: 1px solid rgba(255, 255, 255, 0.13);
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.025);
}

.road-mark {
  --road-color: rgba(255, 255, 255, 0.7);
  width: 70%;
  height: 70%;
  display: block;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.44), transparent 24%),
    var(--road-color);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.28);
}

.big-road .road-mark {
  width: 68%;
  height: 68%;
  border-width: 2px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--road-color);
  text-shadow: none;
}

.road-mark.blue {
  --road-color: var(--blue);
}

.big-road .road-mark.blue {
  color: var(--blue);
}

.road-mark.green {
  --road-color: var(--green);
}

.big-road .road-mark.green {
  color: var(--green);
}

.road-mark.red {
  --road-color: var(--red);
}

.big-road .road-mark.red {
  color: var(--red);
}

.road-mark.is-latest {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.64),
    0 0 13px color-mix(in srgb, var(--road-color) 58%, transparent);
}

.camera-glyph {
  position: relative;
  display: block;
  width: 24px;
  height: 17px;
  border-radius: 4px;
  background: #fff;
}

.camera-glyph::before {
  content: "";
  position: absolute;
  left: 4px;
  top: -5px;
  width: 9px;
  height: 5px;
  border-radius: 3px 3px 0 0;
  background: #fff;
}

.camera-glyph::after {
  content: "";
  position: absolute;
  inset: 4px 7px;
  border: 2px solid #11131c;
  border-radius: 50%;
}

.deal-area {
  position: absolute;
  left: 56px;
  right: 72px;
  z-index: 6;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.deal-area.draw-only {
  top: clamp(250px, 39svh, 355px);
}

.result-banner {
  min-width: min(100%, 310px);
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 10px 18px;
  border-color: rgba(245, 196, 107, 0.42);
  border-radius: 8px;
  color: #fff2c8;
  font-size: clamp(17px, 4.7vw, 24px);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 18px rgba(245, 196, 107, 0.28);
}

.result-banner[hidden] {
  display: none;
}

.result-banner.is-visible {
  animation: result-pop 220ms ease both;
}

@keyframes result-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-banner.win-blue {
  border-color: rgba(85, 170, 255, 0.75);
  color: #c6e4ff;
}

.result-banner.win-green {
  border-color: rgba(140, 223, 99, 0.75);
  color: #d9ffc6;
}

.result-banner.win-red {
  border-color: rgba(255, 91, 85, 0.75);
  color: #ffc9c7;
}

.host-speech,
.live-chat {
  position: absolute;
  z-index: 5;
  pointer-events: none;
}

.host-speech {
  left: 16px;
  top: calc(160px + env(safe-area-inset-top));
  width: min(72%, 320px);
  min-height: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.94);
  font-size: 13px;
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.78);
  animation: chat-in 220ms ease both;
}

.host-speech b {
  flex: 0 0 auto;
  color: #ff8aa3;
  font-size: inherit;
}

.host-speech span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-chat {
  left: 16px;
  top: calc(188px + env(safe-area-inset-top));
  width: min(72%, 300px);
  display: grid;
  gap: 7px;
}

.live-chat p {
  max-width: 100%;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-self: start;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(11px, 3vw, 14px);
  line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.78);
  animation: chat-in 220ms ease both;
}

.live-chat b {
  flex: 0 0 auto;
  color: #8fd7ff;
  font-size: inherit;
}

.live-chat span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-chat .me b {
  color: var(--gold);
}

.live-chat .host b,
.live-chat .system b {
  color: #ff8aa3;
}

@keyframes chat-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.countdown span {
  display: block;
  color: rgba(255, 241, 203, 0.84);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.countdown {
  position: absolute;
  left: 16px;
  top: calc(78px + env(safe-area-inset-top));
  right: auto;
  bottom: auto;
  z-index: 7;
  width: 74px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 4px solid rgba(245, 196, 107, 0.78);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.12), transparent 46%),
    linear-gradient(180deg, rgba(43, 45, 58, 0.9), rgba(8, 10, 18, 0.92)),
    rgba(7, 8, 14, 0.82);
  box-shadow:
    0 0 0 2px rgba(255, 45, 85, 0.48),
    0 10px 22px rgba(0, 0, 0, 0.34);
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease, visibility 160ms ease;
}

.countdown::before {
  content: none;
}

.countdown span,
.countdown strong {
  position: relative;
  z-index: 1;
}

.countdown strong {
  margin: 0;
  color: #fff;
  font-size: 34px;
  font-weight: 1000;
  line-height: 1;
}

.countdown.is-warning {
  border-color: rgba(255, 63, 74, 0.92);
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.16), transparent 46%),
    linear-gradient(180deg, rgba(45, 18, 30, 0.94), rgba(12, 10, 18, 0.92)),
    rgba(7, 8, 14, 0.86);
  box-shadow:
    0 0 0 2px rgba(255, 45, 85, 0.54),
    0 0 24px rgba(255, 45, 85, 0.38);
  animation: countdown-warning 720ms ease-in-out infinite;
}

.countdown.is-warning span {
  color: rgba(255, 205, 214, 0.9);
}

@keyframes countdown-warning {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.045);
  }
}

.game.is-drawing .countdown {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  animation: none;
}

.prediction-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: clamp(132px, 17.4svh, 168px);
  z-index: 6;
  height: clamp(78px, 11.6svh, 100px);
  display: grid;
  grid-template-rows: 1fr;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.bet-grid {
  display: grid;
  grid-template-columns: 1fr 0.84fr 1fr;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.bet-status {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 2;
  min-height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(245, 196, 107, 0.46);
  border-radius: 999px;
  background: rgba(7, 8, 14, 0.7);
  color: #fff0bd;
  font-size: 12px;
  font-weight: 1000;
  line-height: 1;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.26);
  pointer-events: none;
}

.game.is-bet-locked .bet-status {
  display: inline-flex;
}

.game.is-bet-locked .roadmap {
  bottom: calc(100% + 38px);
}

.bet-zone {
  position: relative;
  min-width: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 8px 5px;
  border: 1px solid color-mix(in srgb, currentColor 68%, transparent);
  border-radius: 8px;
  background: rgba(4, 6, 12, 0.48);
  backdrop-filter: blur(8px);
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 12px 18px rgba(0, 0, 0, 0.22);
}

.bet-zone::before {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, currentColor 15%, transparent), color-mix(in srgb, currentColor 32%, transparent));
  opacity: 0.72;
}

.bet-zone > span,
.bet-zone > small,
.zone-bet {
  position: relative;
  z-index: 1;
}

.bet-zone > span {
  color: currentColor;
  font-size: clamp(23px, 6.5vw, 35px);
  font-weight: 900;
  line-height: 1;
  transform-origin: center;
}

.bet-zone > small {
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(11px, 3.1vw, 14px);
  font-weight: 900;
  line-height: 1;
  transform-origin: center;
}

.zone-bet {
  position: absolute;
  left: 50%;
  bottom: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: calc(100% - 16px);
  min-height: 32px;
  padding: 0;
  color: #fff;
  font-size: clamp(12px, 3.2vw, 16px);
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.36));
  transform: translateX(-50%);
  transform-origin: center bottom;
}

.chip-tone-10 {
  --marker-chip-color: #30323a;
  --marker-chip-core: #e8e8ea;
}

.chip-tone-50 {
  --marker-chip-color: #704925;
  --marker-chip-core: #91643a;
}

.chip-tone-100 {
  --marker-chip-color: #6d3496;
  --marker-chip-core: #8b4ab2;
}

.chip-tone-500 {
  --marker-chip-color: #a82322;
  --marker-chip-core: #ce3835;
}

.chip-tone-1000 {
  --marker-chip-color: #1353a5;
  --marker-chip-core: #2370cf;
}

.chip-tone-5000 {
  --marker-chip-color: #552579;
  --marker-chip-core: #71379b;
}

.zone-bet i {
  position: relative;
  width: clamp(23px, 5.9vw, 30px);
  height: clamp(23px, 5.9vw, 30px);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, rgba(255, 255, 255, 0.92) 0 10deg, transparent 10deg 35deg, rgba(255, 255, 255, 0.92) 35deg 48deg, transparent 48deg 90deg, rgba(255, 255, 255, 0.92) 90deg 103deg, transparent 103deg 146deg, rgba(255, 255, 255, 0.92) 146deg 160deg, transparent 160deg 214deg, rgba(255, 255, 255, 0.92) 214deg 228deg, transparent 228deg 270deg, rgba(255, 255, 255, 0.92) 270deg 284deg, transparent 284deg 326deg, rgba(255, 255, 255, 0.92) 326deg 340deg, transparent 340deg),
    var(--marker-chip-core);
  box-shadow:
    inset 0 0 0 5px color-mix(in srgb, var(--marker-chip-color) 76%, transparent),
    inset 0 -3px 0 rgba(0, 0, 0, 0.22),
    0 3px 7px rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: clamp(8px, 2.1vw, 10px);
  font-style: normal;
  font-weight: 1000;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.zone-bet b {
  min-width: 0;
  max-width: 78px;
  overflow: hidden;
  padding: 4px 7px 5px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  font-size: inherit;
  font-weight: 1000;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.22);
}

.bet-zone.has-bet .zone-bet {
  display: flex;
}

.fly-chip {
  position: fixed;
  z-index: 40;
  width: clamp(34px, 8vw, 42px);
  height: clamp(34px, 8vw, 42px);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    conic-gradient(from 0deg, rgba(255, 255, 255, 0.92) 0 10deg, transparent 10deg 35deg, rgba(255, 255, 255, 0.92) 35deg 48deg, transparent 48deg 90deg, rgba(255, 255, 255, 0.92) 90deg 103deg, transparent 103deg 146deg, rgba(255, 255, 255, 0.92) 146deg 160deg, transparent 160deg 214deg, rgba(255, 255, 255, 0.92) 214deg 228deg, transparent 228deg 270deg, rgba(255, 255, 255, 0.92) 270deg 284deg, transparent 284deg 326deg, rgba(255, 255, 255, 0.92) 326deg 340deg, transparent 340deg),
    var(--marker-chip-core);
  box-shadow:
    inset 0 0 0 7px color-mix(in srgb, var(--marker-chip-color) 76%, transparent),
    inset 0 -5px 0 rgba(0, 0, 0, 0.22),
    0 11px 20px rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: clamp(11px, 2.8vw, 15px);
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.55);
  transform-origin: center;
  will-change: transform, opacity;
}

.crowd-chip {
  position: fixed;
  z-index: 32;
  width: clamp(16px, 3.8vw, 22px);
  height: clamp(16px, 3.8vw, 22px);
  border: 0;
  border-radius: 50%;
  pointer-events: none;
  background:
    conic-gradient(from 0deg, rgba(255, 255, 255, 0.82) 0 10deg, transparent 10deg 35deg, rgba(255, 255, 255, 0.82) 35deg 48deg, transparent 48deg 90deg, rgba(255, 255, 255, 0.82) 90deg 103deg, transparent 103deg 146deg, rgba(255, 255, 255, 0.82) 146deg 160deg, transparent 160deg 214deg, rgba(255, 255, 255, 0.82) 214deg 228deg, transparent 228deg 270deg, rgba(255, 255, 255, 0.82) 270deg 284deg, transparent 284deg 326deg, rgba(255, 255, 255, 0.82) 326deg 340deg, transparent 340deg),
    var(--marker-chip-core);
  box-shadow:
    inset 0 0 0 3px color-mix(in srgb, var(--marker-chip-color) 76%, transparent),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 8px 12px rgba(0, 0, 0, 0.34);
  opacity: 0.76;
  transform-origin: center;
  will-change: transform, opacity;
}

.bet-zone.has-bet {
  filter: brightness(1.18);
  box-shadow: 0 0 22px color-mix(in srgb, currentColor 45%, transparent);
}

.game.is-bet-locked .bet-zone.has-bet {
  border-color: color-mix(in srgb, currentColor 58%, transparent);
  filter: saturate(0.82) brightness(0.78);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 16px rgba(0, 0, 0, 0.22);
}

.game.is-bet-locked .bet-zone:not(.has-bet) {
  filter: saturate(0.62) brightness(0.62);
}

.bet-zone.has-bet > span {
  transform: none;
}

.bet-zone.has-bet > small {
  opacity: 0;
  transform: none;
}

.zone-blue {
  color: var(--blue);
}

.zone-green {
  color: var(--green);
}

.zone-red {
  color: var(--red);
}

.roadmap {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: calc(100% + 8px);
  min-height: 13px;
  display: flex;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
  pointer-events: none;
}

.road-dot {
  width: 11px;
  height: 11px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.45);
}

.road-dot.blue {
  background: var(--blue);
}

.road-dot.green {
  background: var(--green);
}

.road-dot.red {
  background: var(--red);
}

.chip-rack {
  position: absolute;
  left: 50%;
  bottom: clamp(78px, 8.6svh, 90px);
  z-index: 8;
  width: calc(100% - 38px);
  max-width: 390px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(7px, 1.5vw, 10px);
  transform: translateX(-50%);
}

.chip {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, rgba(255, 255, 255, 0.92) 0 10deg, transparent 10deg 35deg, rgba(255, 255, 255, 0.92) 35deg 48deg, transparent 48deg 90deg, rgba(255, 255, 255, 0.92) 90deg 103deg, transparent 103deg 146deg, rgba(255, 255, 255, 0.92) 146deg 160deg, transparent 160deg 214deg, rgba(255, 255, 255, 0.92) 214deg 228deg, transparent 228deg 270deg, rgba(255, 255, 255, 0.92) 270deg 284deg, transparent 284deg 326deg, rgba(255, 255, 255, 0.92) 326deg 340deg, transparent 340deg),
    var(--chip-color);
  box-shadow: 0 9px 12px rgba(0, 0, 0, 0.36), inset 0 -5px 0 rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

.chip::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 58%), var(--chip-core);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.74);
}

.chip span {
  position: relative;
  z-index: 1;
  color: #fff;
  font-size: clamp(12px, 3.7vw, 19px);
  font-weight: 1000;
  line-height: 1;
  text-shadow: 0 2px 3px rgba(0, 0, 0, 0.52);
}

.chip.selected {
  transform: translateY(-7px) scale(1.08);
  filter: brightness(1.18);
}

.game.is-bet-locked .chip-rack,
.game.is-drawing .chip-rack {
  opacity: 0.72;
  filter: saturate(0.9);
  pointer-events: none;
}

.game.is-bet-locked .chip.selected,
.game.is-drawing .chip.selected {
  transform: none;
}

.chip-black {
  --chip-color: #30323a;
  --chip-core: #e8e8ea;
}

.chip-brown {
  --chip-color: #704925;
  --chip-core: #91643a;
}

.chip-purple {
  --chip-color: #6d3496;
  --chip-core: #8b4ab2;
}

.chip-red {
  --chip-color: #a82322;
  --chip-core: #ce3835;
}

.chip-blue {
  --chip-color: #1353a5;
  --chip-core: #2370cf;
}

.chip-violet {
  --chip-color: #552579;
  --chip-core: #71379b;
}

.controls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 8;
  display: grid;
  grid-template-columns: 0.84fr 1.28fr 0.84fr;
  gap: 9px;
}

.control-btn {
  min-width: 0;
  min-height: clamp(52px, 7.1svh, 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, 1.3vw, 8px);
  padding: 7px 10px;
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.control-btn b {
  flex: 0 0 auto;
  min-width: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(18px, 4.2vw, 23px);
  font-weight: 1000;
  line-height: 1;
}

.control-btn span {
  min-width: 0;
  font-size: clamp(13px, 3vw, 15px);
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
  white-space: nowrap;
}

#doubleBtn b {
  font-size: clamp(18px, 4vw, 22px);
}

#confirmBtn b {
  font-size: clamp(22px, 4.8vw, 25px);
  transform: translateY(-1px);
}

#clearBtn b {
  font-size: clamp(19px, 4.2vw, 22px);
}

.control-btn.primary {
  border-color: rgba(255, 45, 85, 0.72);
  background: linear-gradient(180deg, rgba(255, 45, 85, 0.92), rgba(129, 33, 104, 0.78));
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 45, 85, 0.28);
}

.control-btn:disabled,
.bet-zone:disabled,
.chip:disabled {
  cursor: default;
  opacity: 0.48;
}

.game.is-bet-locked .control-btn:disabled,
.game.is-bet-locked .bet-zone:disabled,
.game.is-bet-locked .chip:disabled {
  opacity: 1;
}

.game.is-bet-locked .control-btn {
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(14, 15, 22, 0.58), rgba(6, 7, 11, 0.62));
  color: rgba(255, 255, 255, 0.48);
  box-shadow: none;
}

.game.is-bet-locked .control-btn b {
  color: rgba(255, 255, 255, 0.5);
}

.game.is-bet-locked .control-btn.primary {
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(20, 20, 28, 0.64), rgba(7, 8, 12, 0.7));
  color: rgba(255, 255, 255, 0.56);
}

.toast {
  position: absolute;
  left: 50%;
  bottom: clamp(218px, 28svh, 294px);
  z-index: 20;
  max-width: 86%;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(7, 8, 14, 0.9);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-height: 720px) {
  .game {
    min-height: 560px;
  }

  .host-card {
    height: 50px;
  }

  .wallet-chip {
    height: 50px;
  }

  .right-rail {
    top: 130px;
    gap: 8px;
  }

  .right-rail button {
    width: 48px;
    height: 52px;
  }

  .road-sheet {
    top: calc(88px + env(safe-area-inset-top));
    right: 12px;
  }

  .deal-area.draw-only {
    top: clamp(232px, 38svh, 274px);
  }

  .host-speech {
    left: 16px;
    top: calc(142px + env(safe-area-inset-top));
    width: min(72%, 300px);
  }

  .live-chat {
    left: 16px;
    top: calc(168px + env(safe-area-inset-top));
    width: min(72%, 280px);
  }

  .countdown {
    top: calc(68px + env(safe-area-inset-top));
    width: 66px;
    height: 66px;
    border-width: 4px;
  }

  .countdown strong {
    font-size: 30px;
  }

  .countdown span {
    font-size: 11px;
  }

  .prediction-panel {
    bottom: 160px;
    height: 82px;
  }
}

@media (max-width: 390px) {
  .live-top {
    grid-template-columns: minmax(142px, 0.72fr) minmax(0, 1.28fr);
    gap: 6px;
  }

  .back-button {
    width: 38px;
    height: 38px;
  }

  .host-card {
    height: 50px;
    padding: 6px 8px;
  }

  .host-avatar {
    width: 36px;
    height: 36px;
  }

  .wallet-chip {
    height: 50px;
    grid-template-columns: 34px minmax(32px, 0.7fr) minmax(82px, 1.3fr);
    gap: 7px;
    padding-inline: 7px;
  }

  .wallet-avatar {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .wallet-player b {
    font-size: 13px;
  }

  .wallet-player span {
    font-size: 9px;
  }

  .wallet-balance {
    padding-left: 7px;
  }

  .wallet-balance strong {
    font-size: 20px;
  }

  .sound-button {
    width: 38px;
    height: 38px;
  }

  .road-button {
    width: 38px;
    height: 38px;
  }

  .deal-area {
    left: 46px;
    right: 62px;
  }

  .result-banner {
    padding-inline: 12px;
  }

  .control-btn {
    gap: 4px;
    padding-inline: 6px;
  }

  .control-btn b {
    min-width: 20px;
    font-size: 17px;
  }

  #confirmBtn b {
    font-size: 20px;
  }
}
