:root {
  color-scheme: dark;
  --bg: #080c12;
  --panel: rgba(13, 17, 23, 0.86);
  --panel-strong: rgba(7, 10, 15, 0.96);
  --line: rgba(255, 255, 255, 0.13);
  --text: #f8f3e7;
  --muted: #a8b2bd;
  --gold: #f5c85f;
  --red: #c93a35;
  --blue: #1966c2;
  --green: #0b853d;
  --felt: #0d6738;
  --felt-dark: #06341e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  background:
    radial-gradient(circle at 50% 18%, rgba(29, 106, 67, 0.36), transparent 34%),
    linear-gradient(135deg, #101722 0%, #070a10 58%, #121821 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--text);
  background: linear-gradient(#242c39, #141a23);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.1), 0 8px 20px rgba(0, 0, 0, 0.26);
  font-weight: 850;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.45);
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  min-height: 100dvh;
}

.screen {
  display: none;
  min-height: 100dvh;
}

.screen.active {
  display: grid;
}

.entry-screen {
  align-content: center;
  gap: 22px;
  padding: max(24px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
}

.entry-hero {
  display: grid;
  gap: 8px;
}

.eyebrow {
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
}

.entry-hero h1 {
  font-size: 42px;
  line-height: 1.04;
}

.entry-hero p,
.service-line,
.lobby-action p {
  color: var(--muted);
  font-size: 14px;
}

.entry-panel,
.lobby-card,
.rule-strip,
.viewer-panel,
.settlement-sheet {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.entry-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.join-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.join-box button {
  min-width: 104px;
}

.primary {
  background: linear-gradient(#1e72c8, #0d346f);
}

.danger {
  background: linear-gradient(#c23c39, #671512);
}

.success {
  background: linear-gradient(#18a34d, #075d2a);
}

.warning {
  color: #1a1102;
  background: linear-gradient(#ffe48e, #d99a30);
}

.ghost {
  color: #e7edf5;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.large {
  min-height: 58px;
  font-size: 18px;
}

.advanced-settings,
.room-settings {
  color: var(--muted);
  font-size: 13px;
}

.advanced-settings summary,
.room-settings summary {
  min-height: 36px;
  cursor: pointer;
}

.advanced-settings label,
.room-settings label {
  margin-top: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.nickname-panel {
  display: grid;
  gap: 8px;
}

.nickname-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.nickname-options button {
  min-height: 40px;
  padding: 0;
  color: #fff4c7;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.nickname-options button.selected {
  border-color: rgba(245, 200, 95, 0.78);
  color: #1a1102;
  background: linear-gradient(#ffe48e, #d99a30);
}

.room-list-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.room-list-head,
.room-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.room-list-head strong {
  display: block;
  color: #fff4c7;
}

.room-list {
  display: grid;
  gap: 8px;
}

.room-list p {
  color: var(--muted);
  font-size: 13px;
}

.room-item {
  width: 100%;
  min-height: 58px;
  border-color: rgba(245, 200, 95, 0.18);
  padding: 8px 10px;
  text-align: left;
  background: rgba(5, 9, 14, 0.52);
}

.room-item strong,
.room-item small {
  display: block;
}

.room-item strong {
  color: #fff4c7;
  font-size: 15px;
}

.room-item small {
  color: var(--muted);
  font-size: 12px;
}

.room-item span {
  color: #ffe58b;
  font-weight: 950;
}

.service-line {
  text-align: center;
}

.lobby-screen {
  grid-template-rows: auto auto 1fr auto;
  gap: 14px;
  padding: max(12px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
}

.lobby-header,
.table-topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.table-topbar {
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
}

.icon-btn {
  display: grid;
  width: 48px;
  min-height: 48px;
  place-items: center;
  padding: 0;
  font-size: 30px;
}

.lobby-header strong {
  display: block;
  color: #fff4c7;
  font-size: 32px;
  line-height: 1;
}

.copy-btn {
  min-width: 68px;
}

.lobby-card {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.lobby-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-pill,
.score-pill,
.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.34);
  color: var(--text);
  font-size: 12px;
}

.lobby-players {
  display: grid;
  gap: 10px;
}

.lobby-player {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.lobby-player.self {
  border-color: rgba(245, 200, 95, 0.52);
}

.lobby-player strong {
  display: block;
  font-size: 16px;
}

.lobby-player small,
.profile-card small,
.viewer-profile small {
  color: var(--muted);
}

.chips {
  color: #ffe58b;
  font-weight: 850;
}

.rule-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
}

.rule-strip span {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  padding: 9px 10px;
  color: #dce4ee;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  line-height: 1.25;
}

.lobby-action {
  display: grid;
  gap: 8px;
}

.game-screen {
  grid-template-rows: auto minmax(310px, 1fr) auto auto;
  gap: 8px;
  overflow: hidden;
  padding: max(8px, env(safe-area-inset-top)) 8px 0;
  background: rgba(2, 5, 9, 0.28);
}

.table-topbar {
  min-height: 54px;
}

.room-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  min-width: 0;
}

.room-title strong,
.room-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-title span,
.table-counters {
  color: var(--muted);
  font-size: 12px;
}

.countdown-badge {
  width: max-content;
  max-width: 100%;
  border: 1px solid rgba(245, 200, 95, 0.38);
  border-radius: 999px;
  padding: 2px 8px;
  color: #fff4c7;
  background: rgba(245, 200, 95, 0.12);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.35;
}

.countdown-badge:empty,
.countdown-badge[hidden] {
  display: none;
}

.table-counters {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.sound-toggle {
  min-height: 38px;
  border-radius: 999px;
  padding: 0 10px;
  color: #fff4c7;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: none;
  font-size: 12px;
}

.sound-toggle.muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.poker-table {
  position: relative;
  min-height: 310px;
  overflow: hidden;
}

.table-felt {
  position: absolute;
  inset: 54px 4px 42px;
  border-radius: 36px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(18, 128, 73, 0.9), rgba(6, 57, 34, 0.98) 68%),
    var(--felt);
  box-shadow:
    inset 0 0 0 8px #101217,
    inset 0 0 0 13px #262323,
    inset 0 0 0 18px #050607,
    0 22px 60px rgba(0, 0, 0, 0.58);
}

.table-rail {
  position: absolute;
  inset: 26px 24px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 28px;
}

.table-center {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(260px, 72vw);
  transform: translate(-50%, -50%);
}

.deck-stack {
  position: relative;
  width: 48px;
  height: 64px;
}

.deck-stack .card {
  position: absolute;
}

.deck-stack .card:nth-child(2) {
  transform: translate(4px, 4px);
}

.deck-stack .card:nth-child(3) {
  transform: translate(8px, 8px);
}

.center-status {
  display: grid;
  justify-items: center;
  gap: 4px;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 14px;
  background: rgba(4, 22, 14, 0.68);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  text-align: center;
  backdrop-filter: blur(8px);
}

.center-status strong {
  color: #fff4c7;
  font-size: 16px;
}

.center-status span {
  overflow: hidden;
  max-width: 210px;
  color: #c1cbd2;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dealerArea,
#playersGrid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.seat-position {
  position: absolute;
  z-index: 3;
  display: grid;
  justify-items: center;
  width: 120px;
  pointer-events: auto;
}

.dealer-position {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.seat-1 {
  top: 42%;
  left: 0;
  transform: translateY(-50%);
}

.seat-2 {
  top: 42%;
  right: 0;
  transform: translateY(-50%);
}

.seat-3 {
  right: 10%;
  bottom: 0;
}

.profile-row {
  display: flex;
  align-items: center;
  max-width: 128px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(245, 200, 95, 0.58);
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.94);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.06),
    0 8px 18px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.pixel-avatar {
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 0;
  padding: 4px;
}

.pixel-avatar i {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.profile-card {
  display: grid;
  min-width: 72px;
  margin-left: -4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  padding: 5px 7px 5px 10px;
  background: rgba(12, 16, 22, 0.86);
  backdrop-filter: blur(8px);
}

.profile-main {
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-main strong {
  overflow: hidden;
  max-width: 58px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.profile-card .chips {
  font-size: 12px;
}

.profile-card small {
  font-size: 10px;
}

.bet-chip {
  justify-self: start;
  border-radius: 999px;
  padding: 2px 8px;
  color: #1a1102;
  background: var(--gold);
  font-size: 10px;
  font-weight: 950;
}

.seat-position.active .avatar {
  border-color: #fff4b8;
  animation: decisionPulse 1.1s ease-in-out infinite;
}

.seat-position.active .profile-row::after {
  position: absolute;
  right: -4px;
  top: -8px;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(5, 9, 14, 0.95);
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 18px rgba(245, 200, 95, 0.72);
  content: "";
  animation: decisionDot 1s ease-in-out infinite;
}

.dealer-badge {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 999px;
  color: #1a1102;
  background: var(--gold);
  font-size: 16px;
  font-weight: 950;
  box-shadow: 0 0 0 2px rgba(5, 9, 14, 0.85), 0 0 18px rgba(245, 200, 95, 0.45);
}

.dealer-crown::before {
  content: "♛";
  line-height: 1;
}

.seat-position.dealer-changed .avatar,
.seat-position.dealer-changed .profile-card {
  animation: dealerHandoff 2s ease both;
}

.hand-wrap {
  display: grid;
  gap: 5px;
  width: 100%;
}

.viewer-hands .hand-wrap {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px;
}

.hand-wrap.active-hand {
  border-color: rgba(245, 200, 95, 0.62);
  background: rgba(245, 200, 95, 0.08);
  box-shadow: 0 0 0 1px rgba(245, 200, 95, 0.12), 0 0 22px rgba(245, 200, 95, 0.2);
}

.hand-wrap.active-hand .hand-row {
  filter: drop-shadow(0 0 12px rgba(245, 200, 95, 0.62));
}

.hand-row {
  display: flex;
  min-height: 44px;
  justify-content: center;
  gap: 0;
}

.compact-seat .hand-row {
  transform: translateY(6px);
}

.compact-seat .hand-meta {
  display: none;
}

.hand-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.card {
  position: relative;
  display: grid;
  width: 42px;
  height: 58px;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(15, 18, 24, 0.16);
  border-radius: 7px;
  color: #151922;
  background: linear-gradient(155deg, #ffffff 0%, #f3f0ea 100%);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  font-weight: 950;
}

.compact-seat .card {
  width: 28px;
  height: 38px;
  margin-left: -8px;
}

.compact-seat .card:first-child {
  margin-left: 0;
}

.viewer-panel .card {
  width: 54px;
  height: 76px;
}

.card.red {
  color: #c7202e;
}

.card.back {
  border: 2px solid rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.13) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.13) 25%, transparent 25%),
    #6b2b27;
  background-size: 9px 9px;
}

.card.mini {
  width: 42px;
  height: 58px;
}

.rank {
  font-size: 18px;
}

.compact-seat .rank {
  font-size: 12px;
}

.suit {
  position: absolute;
  right: 6px;
  bottom: 4px;
  font-size: 14px;
}

.compact-seat .suit {
  right: 4px;
  bottom: 3px;
  font-size: 10px;
}

.score-pill {
  font-size: 11px;
}

.score-pill.hot {
  color: #1b1302;
  border-color: transparent;
  background: var(--gold);
  font-weight: 900;
}

.score-pill.hand-index.active {
  color: #1b1302;
  border-color: transparent;
  background: var(--gold);
  font-weight: 950;
}

.score-pill.bust {
  color: #ff6b63;
  border-color: rgba(255, 107, 99, 0.42);
  background: rgba(201, 58, 53, 0.14);
  font-weight: 900;
}

.state-bust {
  color: #ff6b63;
  font-weight: 950;
}

.tag {
  color: var(--gold);
  font-size: 11px;
  font-weight: 850;
}

.my-zone {
  position: relative;
  z-index: 6;
  padding: 0 0 4px;
}

.viewer-panel {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 10px;
  background: var(--panel-strong);
}

.seat-position.showdown-focus .avatar,
.viewer-panel:has(.result-badge) .avatar {
  border-color: #fff4b8;
  box-shadow:
    0 0 0 4px rgba(245, 200, 95, 0.22),
    0 0 32px rgba(245, 200, 95, 0.58);
}

.viewer-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.viewer-hands {
  display: grid;
  gap: 8px;
}

.viewer-hands .hand-row {
  min-height: 78px;
}

.viewer-hands .hand-meta {
  justify-content: flex-start;
}

.action-panel {
  position: relative;
  z-index: 8;
  display: grid;
  gap: 7px;
  padding: 7px 8px max(9px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(8, 12, 18, 0.78), rgba(8, 12, 18, 0.98));
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.turn-note {
  min-height: 20px;
  color: #fff4c7;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.dissolve-inline {
  min-height: 34px;
  justify-self: center;
  border-color: rgba(255, 107, 99, 0.32);
  border-radius: 999px;
  padding: 0 12px;
  color: #ffb5af;
  background: rgba(201, 58, 53, 0.09);
  box-shadow: none;
  font-size: 12px;
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-buttons.hidden {
  display: none;
}

.action-buttons button {
  min-height: 52px;
  padding: 0 8px;
  font-size: 16px;
}

.bet-panel {
  display: none;
  gap: 8px;
}

.bet-panel.show {
  display: grid;
}

.chat-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.quick-chat {
  display: flex;
  max-width: 38vw;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 1px;
}

.quick-chat button {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 0 9px;
  color: #fff4c7;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
  font-size: 12px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  min-width: 0;
}

.chat-form input {
  min-height: 36px;
  border-radius: 999px;
  font-size: 13px;
}

.chat-form button {
  min-height: 36px;
  border-radius: 999px;
  padding: 0 12px;
}

.bet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.bet-head strong {
  color: #ffe58b;
  font-size: 26px;
}

.bet-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.bet-options button {
  min-height: 44px;
  padding: 0;
}

.bet-options button.selected {
  border-color: rgba(245, 200, 95, 0.76);
  color: #1a1102;
  background: linear-gradient(#ffe48e, #d99a30);
}

.settlement-sheet {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 12;
  display: none;
  gap: 12px;
  padding: 14px;
  background: rgba(8, 12, 18, 0.98);
}

.settlement-sheet.show {
  display: grid;
}

.showdown-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  display: none;
  min-width: 230px;
  max-width: calc(100% - 48px);
  border: 1px solid rgba(245, 200, 95, 0.38);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(7, 11, 16, 0.92);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.46);
  text-align: center;
  transform: translate(-50%, -50%);
  animation: showdownPop 520ms ease both;
}

.showdown-banner.show {
  display: grid;
  gap: 4px;
}

.showdown-banner strong {
  color: #fff4c7;
  font-size: 17px;
}

.showdown-banner span,
.showdown-banner em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.showdown-banner em {
  color: var(--gold);
  font-weight: 850;
}

.danmaku-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

.danmaku {
  position: absolute;
  left: 100%;
  max-width: 78%;
  border: 1px solid rgba(245, 200, 95, 0.34);
  border-radius: 999px;
  padding: 6px 12px;
  color: #fff4c7;
  background: rgba(5, 9, 14, 0.78);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
  animation: danmakuFly 6.2s linear forwards;
}

.result-badge {
  position: absolute;
  z-index: 8;
  right: -4px;
  top: -8px;
  display: grid;
  justify-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(5, 9, 14, 0.94);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
  animation: resultFloat 900ms ease both;
}

.result-badge strong {
  color: #fff4c7;
  font-size: 12px;
  white-space: nowrap;
}

.result-badge span {
  color: #ffe58b;
  font-size: 16px;
  font-weight: 950;
}

.result-badge.lose span {
  color: #ff9b96;
}

.settlement-events {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.settlement-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  animation: chipSettle 520ms ease both;
}

.settlement-row strong,
.settlement-row small {
  display: block;
}

.settlement-row span {
  color: #ffe58b;
  font-size: 22px;
  font-weight: 950;
}

.settlement-row.lose span {
  color: #ff9b96;
}

.settlement-row.dealer-total {
  border-color: rgba(245, 200, 95, 0.34);
  background: rgba(245, 200, 95, 0.08);
}

.dealer-switch-panel {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(245, 200, 95, 0.5);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(245, 200, 95, 0.18), rgba(245, 200, 95, 0.06)),
    rgba(9, 13, 18, 0.92);
  box-shadow: 0 0 24px rgba(245, 200, 95, 0.16);
  animation: chipSettle 520ms ease both;
}

.dealer-switch-panel span {
  color: var(--muted);
  font-size: 12px;
}

.dealer-switch-panel strong {
  color: #fff4c7;
  font-size: 18px;
}

.scoreboard-panel {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(245, 200, 95, 0.26);
  border-radius: 8px;
  padding: 10px;
  background: rgba(245, 200, 95, 0.07);
}

.scoreboard-panel > strong {
  color: #fff4c7;
}

.scoreboard-panel ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scoreboard-panel li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.scoreboard-panel li strong {
  color: #ffe58b;
}

.toast {
  position: fixed;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 30;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid rgba(245, 200, 95, 0.42);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  background: rgba(15, 17, 21, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, -12px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  pointer-events: none;
}

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

.cinematic-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  overflow: hidden;
  background: rgba(2, 4, 8, 0.72);
  pointer-events: none;
}

.cinematic-overlay.show {
  display: grid;
  animation: cinematicOverlayIn 180ms ease both;
}

.cinematic-overlay.out {
  animation: cinematicOverlayOut 260ms ease both;
}

.cinematic-burst-lines {
  position: absolute;
  inset: -12%;
  opacity: 0.75;
  background:
    repeating-conic-gradient(from 4deg, rgba(255, 255, 255, 0.2) 0deg 2deg, transparent 2deg 9deg),
    radial-gradient(circle, transparent 0 18%, rgba(0, 0, 0, 0.4) 58%, rgba(0, 0, 0, 0.82));
  animation: cinematicSpinPop 1.6s ease-out both;
}

.cinematic-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 18px;
  width: min(760px, 92vw);
  padding: 28px 18px;
  text-align: center;
}

.cinematic-title {
  position: relative;
  z-index: 4;
  margin: 0;
  color: #fff3b0;
  font-size: clamp(58px, 14vw, 132px);
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 0.88;
  text-shadow:
    0 5px 0 #7b180e,
    0 10px 0 #2d0805,
    0 0 28px rgba(245, 200, 95, 0.65);
  transform: rotate(-3deg);
}

.cinematic-cow-pack {
  position: relative;
  z-index: 3;
  display: flex;
  min-height: 166px;
  align-items: end;
  justify-content: center;
  gap: clamp(4px, 2vw, 14px);
}

.cinematic-cow {
  position: relative;
  width: clamp(78px, 14vw, 128px);
  height: clamp(88px, 15vw, 142px);
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.28));
  animation: cinematicCowCharge 1.45s cubic-bezier(0.15, 0.9, 0.25, 1.1) both;
}

.cinematic-cow:nth-child(2) {
  animation-delay: 60ms;
}

.cinematic-cow:nth-child(3) {
  animation-delay: 120ms;
}

.cinematic-cow:nth-child(4) {
  animation-delay: 180ms;
}

.cinematic-cow:nth-child(5) {
  animation-delay: 240ms;
}

.cinematic-cow-body {
  position: absolute;
  inset: 57% 14% 0;
  border: 5px solid #191919;
  border-bottom: 0;
  border-radius: 50% 50% 18% 18%;
  background: #f7ecdc;
  box-shadow: inset -7px -8px 0 rgba(0, 0, 0, 0.08);
}

.cinematic-cow-body::before,
.cinematic-cow-body::after {
  position: absolute;
  border-radius: 999px;
  background: #b9b0aa;
  content: "";
}

.cinematic-cow-body::before {
  width: 28%;
  height: 34%;
  left: 18%;
  bottom: 18%;
  transform: rotate(-15deg);
}

.cinematic-cow-body::after {
  width: 22%;
  height: 28%;
  right: 16%;
  bottom: 12%;
  transform: rotate(18deg);
}

.cinematic-cow-head {
  position: absolute;
  left: 50%;
  top: 9%;
  width: 72%;
  height: 64%;
  border: 5px solid #191919;
  border-radius: 46% 48% 45% 44%;
  background: #f8efe1;
  box-shadow: inset -6px -7px 0 rgba(0, 0, 0, 0.06);
  transform: translateX(-50%);
}

.cinematic-cow-head::before,
.cinematic-cow-head::after {
  position: absolute;
  top: -2%;
  z-index: -1;
  width: 44%;
  height: 34%;
  border: 5px solid #191919;
  border-radius: 64% 28% 62% 32%;
  background: #f4dfbf;
  content: "";
}

.cinematic-cow-head::before {
  left: -34%;
  transform: rotate(-30deg);
}

.cinematic-cow-head::after {
  right: -34%;
  transform: rotate(30deg) scaleX(-1);
}

.cinematic-horn {
  position: absolute;
  top: -24%;
  z-index: -2;
  width: 30%;
  height: 36%;
  border: 5px solid #191919;
  border-bottom: 0;
  border-radius: 80% 80% 20% 20%;
  background: #fff0cf;
}

.cinematic-horn.left {
  left: -16%;
  transform: rotate(-38deg);
}

.cinematic-horn.right {
  right: -16%;
  transform: rotate(38deg);
}

.cinematic-forehead {
  position: absolute;
  left: 16%;
  top: 5%;
  width: 32%;
  height: 28%;
  border-radius: 44% 42% 55% 45%;
  background: #bdb5af;
  opacity: 0.9;
  transform: rotate(10deg);
}

.cinematic-hair {
  position: absolute;
  left: 50%;
  top: -13%;
  width: 7px;
  height: 17px;
  border-radius: 999px;
  background: #191919;
  transform-origin: bottom;
}

.cinematic-hair:nth-of-type(3) {
  transform: translateX(-50%) rotate(-28deg);
}

.cinematic-hair:nth-of-type(4) {
  transform: translateX(-50%) rotate(0deg);
}

.cinematic-hair:nth-of-type(5) {
  transform: translateX(-50%) rotate(28deg);
}

.cinematic-eye {
  position: absolute;
  top: 30%;
  width: 24%;
  height: 27%;
  border: 5px solid #191919;
  border-radius: 999px;
  background: #fff;
}

.cinematic-eye.left {
  left: 18%;
}

.cinematic-eye.right {
  right: 18%;
}

.cinematic-eye::after {
  position: absolute;
  left: 42%;
  top: 34%;
  width: 32%;
  height: 34%;
  border-radius: 999px;
  background: #111;
  content: "";
}

.cinematic-snout {
  position: absolute;
  left: 50%;
  bottom: -2%;
  width: 76%;
  height: 34%;
  border: 5px solid #191919;
  border-radius: 48% 48% 40% 42%;
  background: #ead9cb;
  transform: translateX(-50%) rotate(1deg);
}

.cinematic-snout::before,
.cinematic-snout::after {
  position: absolute;
  top: 35%;
  width: 18%;
  height: 34%;
  border-radius: 999px;
  background: #111;
  content: "";
}

.cinematic-snout::before {
  left: 24%;
  transform: rotate(-18deg);
}

.cinematic-snout::after {
  right: 24%;
  transform: rotate(18deg);
}

.cinematic-mouth {
  position: absolute;
  left: 50%;
  bottom: -17%;
  width: 30%;
  height: 26%;
  border: 5px solid #191919;
  border-top: 0;
  border-radius: 0 0 999px 999px;
  background: #111;
  transform: translateX(-50%);
}

.cinematic-tooth {
  position: absolute;
  bottom: -12%;
  width: 12%;
  height: 18%;
  border: 3px solid #191919;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #fff;
}

.cinematic-tooth.left {
  left: 35%;
}

.cinematic-tooth.right {
  right: 35%;
}

.cinematic-spark {
  position: absolute;
  z-index: 1;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 18px var(--gold);
  animation: cinematicSparkFly 1.3s ease-out both;
}

.cinematic-overlay.twenty-one .cinematic-burst-lines {
  background:
    repeating-conic-gradient(from 12deg, rgba(114, 198, 255, 0.35) 0deg 2deg, transparent 2deg 12deg),
    radial-gradient(circle, rgba(20, 91, 155, 0.72), rgba(0, 0, 0, 0.86) 62%);
}

.cinematic-overlay.twenty-one .cinematic-title {
  color: #eaffff;
  text-shadow:
    0 5px 0 #125d9b,
    0 10px 0 #082844,
    0 0 32px rgba(114, 198, 255, 0.9);
  animation: cinematicSlashHit 1.25s ease both;
}

.cinematic-slash {
  position: absolute;
  z-index: 2;
  width: min(580px, 88vw);
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #eaffff, #6ecbff, transparent);
  box-shadow: 0 0 28px rgba(114, 198, 255, 0.95);
  animation: cinematicSlashLine 900ms ease-out both;
}

.cinematic-overlay.bust .cinematic-burst-lines {
  background:
    repeating-conic-gradient(from 0deg, rgba(231, 71, 63, 0.36) 0deg 3deg, transparent 3deg 10deg),
    radial-gradient(circle, rgba(122, 13, 16, 0.82), rgba(0, 0, 0, 0.9) 64%);
}

.cinematic-overlay.bust .cinematic-title {
  color: #fff;
  text-shadow:
    0 5px 0 #9d1711,
    0 10px 0 #320605,
    0 0 32px rgba(231, 71, 63, 0.9);
  animation: cinematicBustShake 900ms ease both;
}

.cinematic-cracked-card {
  position: absolute;
  z-index: 2;
  width: 110px;
  height: 154px;
  border: 3px solid #171717;
  border-radius: 12px;
  background: #fff7e8;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.44);
  animation: cinematicCrackedCard 1.35s ease both;
}

.cinematic-cracked-card::before {
  position: absolute;
  inset: 18px 44px 18px 48px;
  border-left: 6px solid var(--red);
  transform: skew(-18deg);
  content: "";
}

.card.dealt {
  animation: dealIn 430ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card.flip {
  animation: flipIn 520ms ease both;
}

.card.special {
  box-shadow: 0 0 0 2px rgba(245, 200, 95, 0.28), 0 8px 16px rgba(0, 0, 0, 0.3);
}

.card.special-animate {
  animation: specialPulse 900ms ease both;
}

@keyframes dealIn {
  from {
    opacity: 0;
    transform: translate(0, -34px) rotate(7deg) scale(0.78);
  }
  to {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
}

@keyframes flipIn {
  from {
    transform: rotateY(90deg);
  }
  to {
    transform: rotateY(0deg);
  }
}

@keyframes specialPulse {
  0%,
  100% {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
    transform: translateY(0) scale(1);
  }
  45% {
    box-shadow: 0 0 0 4px rgba(245, 200, 95, 0.22), 0 0 28px rgba(245, 200, 95, 0.5);
    transform: translateY(-5px) scale(1.05);
  }
}

@keyframes chipSettle {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes showdownPop {
  from {
    opacity: 0;
    transform: translate(-50%, -44%) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes resultFloat {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.92);
  }
  45% {
    opacity: 1;
    transform: translateY(-4px) scale(1.03);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dealerHandoff {
  0%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow:
      inset 0 0 0 2px rgba(255, 255, 255, 0.06),
      0 8px 18px rgba(0, 0, 0, 0.34);
  }
  28%,
  70% {
    transform: translateY(-3px) scale(1.08);
    box-shadow:
      0 0 0 4px rgba(245, 200, 95, 0.22),
      0 0 30px rgba(245, 200, 95, 0.68);
  }
}

@keyframes danmakuFly {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-100vw - 100%));
  }
}

@keyframes decisionPulse {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 3px rgba(0, 0, 0, 0.28),
      0 10px 24px rgba(0, 0, 0, 0.38);
  }
  50% {
    box-shadow:
      inset 0 0 0 3px rgba(0, 0, 0, 0.28),
      0 0 0 4px rgba(245, 200, 95, 0.24),
      0 0 28px rgba(245, 200, 95, 0.62);
  }
}

@keyframes decisionDot {
  0%,
  100% {
    transform: scale(0.82);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes cinematicOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes cinematicOverlayOut {
  to {
    opacity: 0;
    transform: scale(1.02);
  }
}

@keyframes cinematicSpinPop {
  from {
    opacity: 0;
    transform: scale(0.8) rotate(-24deg);
  }
  to {
    opacity: 0.78;
    transform: scale(1.05) rotate(4deg);
  }
}

@keyframes cinematicCowCharge {
  0% {
    opacity: 0;
    transform: translateY(120px) rotate(-14deg) scale(0.5);
  }
  58% {
    opacity: 1;
    transform: translateY(-12px) rotate(7deg) scale(1.12);
  }
  74% {
    transform: translateY(4px) rotate(-4deg) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

@keyframes cinematicSparkFly {
  from {
    opacity: 0;
    transform: translate(0, 0) scale(0.2);
  }
  20% {
    opacity: 1;
  }
  to {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(1);
  }
}

@keyframes cinematicSlashLine {
  0% {
    opacity: 0;
    transform: rotate(-15deg) scaleX(0);
  }
  35% {
    opacity: 1;
    transform: rotate(-15deg) scaleX(1);
  }
  100% {
    opacity: 0;
    transform: rotate(-15deg) scaleX(1.04) translateX(80px);
  }
}

@keyframes cinematicSlashHit {
  from {
    opacity: 0;
    transform: translateX(-60px) skew(-12deg) scale(0.72);
  }
  55% {
    opacity: 1;
    transform: translateX(12px) skew(-12deg) scale(1.12);
  }
  to {
    opacity: 1;
    transform: translateX(0) skew(-8deg) scale(1);
  }
}

@keyframes cinematicBustShake {
  0% {
    opacity: 0;
    transform: rotate(4deg) scale(0.7);
  }
  35% {
    opacity: 1;
    transform: rotate(-6deg) scale(1.14);
  }
  46% {
    transform: rotate(5deg) scale(1.04);
  }
  58% {
    transform: rotate(-4deg) scale(1.08);
  }
  100% {
    transform: rotate(-2deg) scale(1);
  }
}

@keyframes cinematicCrackedCard {
  from {
    opacity: 0;
    transform: translateY(-120px) rotate(-18deg) scale(0.65);
  }
  52% {
    opacity: 1;
    transform: translateY(8px) rotate(10deg) scale(1.08);
  }
  to {
    opacity: 0.88;
    transform: translateY(0) rotate(10deg) scale(1);
  }
}

@media (max-width: 430px) {
  .table-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "back title counters counters"
      "back title bgm sound";
    gap: 6px 8px;
    align-items: center;
  }

  .table-topbar .icon-btn {
    grid-area: back;
  }

  .room-title {
    grid-area: title;
  }

  .table-counters {
    grid-area: counters;
    grid-auto-flow: column;
    gap: 8px;
    justify-self: end;
    font-size: 11px;
  }

  #bgmBtn {
    grid-area: bgm;
  }

  #soundToggleBtn {
    grid-area: sound;
  }

  .sound-toggle {
    min-height: 32px;
    padding: 0 9px;
    font-size: 11px;
  }

  .countdown-badge {
    white-space: normal;
  }
}

@media (min-width: 760px) {
  .entry-screen {
    max-width: 460px;
    margin: 0 auto;
  }

  .settings-grid,
  .rule-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lobby-screen {
    max-width: 760px;
    margin: 0 auto;
  }

  .game-screen {
    grid-template-rows: auto minmax(520px, 1fr) auto auto;
    min-height: 100dvh;
    padding: 10px 12px 0;
  }

  .poker-table {
    min-height: 520px;
  }

  .table-felt {
    inset: 74px 7% 52px;
    border-radius: 999px;
  }

  .table-rail {
    inset: 36px 54px;
    border-radius: 999px;
  }

  .table-center {
    width: min(360px, 34vw);
  }

  .dealer-position {
    top: 16px;
  }

  .seat-position {
    width: 190px;
  }

  .seat-1 {
    left: 5%;
  }

  .seat-2 {
    right: 5%;
  }

  .seat-3 {
    right: 20%;
    bottom: 14px;
  }

  .avatar {
    width: 44px;
    height: 44px;
  }

  .profile-card {
    min-width: 116px;
    padding: 8px 10px 8px 13px;
  }

  .profile-main strong {
    max-width: 92px;
    font-size: 16px;
  }

  .profile-card .chips {
    font-size: 16px;
  }

  .compact-seat .card {
    width: 38px;
    height: 52px;
  }

  .my-zone {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
  }

  .action-panel {
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
  }
}

@media (max-width: 360px) {
  .entry-hero h1 {
    font-size: 36px;
  }

  .action-buttons button {
    font-size: 14px;
  }

  .viewer-panel .card {
    width: 48px;
    height: 68px;
  }
}
