:root {
  --bg: #0f1216;
  --bg-elevated: #171b22;
  --panel: #1c222b;
  --panel-soft: #222a36;
  --accent: #f5c76b;
  --accent-strong: #f39b24;
  --accent-soft: #ffdca8;
  --text: #f4f1ea;
  --muted: #9ca6b2;
  --outline: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --card-back:
    radial-gradient(circle at 20% 20%, rgba(240, 197, 123, 0.35), transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(82, 125, 168, 0.25), transparent 55%),
    linear-gradient(135deg, #1f2a44, #2f6b7a, #f0c57b);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Rubik', system-ui, sans-serif;
  background: radial-gradient(circle at top, rgba(45, 55, 70, 0.6), transparent 60%),
    radial-gradient(circle at 20% 10%, rgba(55, 32, 20, 0.5), transparent 40%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'Cinzel', serif;
  margin: 0;
}

.page {
  max-width: 98vw;
  margin: 0 auto;
  padding: 28px 16px 50px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(30, 36, 45, 0.95), rgba(16, 18, 23, 0.9));
  border: 1px solid var(--outline);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-title {
  font-size: 24px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.room-info {
  font-weight: 600;
  color: var(--accent-soft);
}

main {
  margin-top: 28px;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hidden {
  display: none !important;
}

.hero-card {
  position: relative;
  padding: 28px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(244, 199, 107, 0.12), rgba(30, 38, 48, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.hero-card::after {
  content: '';
  position: absolute;
  inset: -120% 40% 0 -20%;
  background: radial-gradient(circle, rgba(245, 199, 107, 0.2), transparent 65%);
  opacity: 0.6;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.hero-copy p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-ribbon {
  position: absolute;
  right: 24px;
  bottom: 22px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 18, 22, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--accent-soft);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.card {
  background: var(--panel);
  border: 1px solid var(--outline);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.lobby-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.identity {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

input, select, button {
  font-family: inherit;
  font-size: 15px;
}

input, select {
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
}

input:focus, select:focus {
  outline: 2px solid rgba(245, 199, 107, 0.4);
  border-color: rgba(245, 199, 107, 0.6);
}

.avatar-select-label {
  align-items: flex-start;
}

.avatar-label-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 500;
}

.avatar-label-icon {
  font-size: 20px;
}

.lobby-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.option-card {
  background: rgba(15, 18, 24, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-card h3 {
  font-size: 18px;
}

.invite-primary {
  border-color: rgba(245, 199, 107, 0.65);
  box-shadow:
    0 0 0 1px rgba(245, 199, 107, 0.2),
    0 12px 24px rgba(0, 0, 0, 0.35);
  background: rgba(32, 26, 16, 0.78);
}

.invite-primary h3 {
  color: #ffe2ab;
}

.invite-secondary {
  opacity: 0.75;
}

button {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1b1204;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(243, 155, 36, 0.3);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

#addBotBtn.is-disabled:disabled,
#removeBotBtn.is-disabled:disabled,
#inviteFriendBtn.is-disabled:disabled,
#startGameBtn.is-disabled:disabled {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  box-shadow: none;
}

.invite-link-input {
  width: 100%;
}

button.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.lobby-divider {
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.checkbox-line {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.public-rooms-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.card-head .note {
  font-size: 13px;
  color: var(--muted);
}

.note {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

#publicRoomsList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.public-room-join {
  background: rgba(12, 14, 18, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 12px 14px;
  color: inherit;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.public-room-join:hover {
  border-color: rgba(245, 199, 107, 0.6);
}

.public-room-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.public-room-name {
  font-weight: 600;
}

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

.public-room-avatars {
  display: inline-flex;
  gap: 6px;
  font-size: 18px;
}

.table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
}

.table-area {
  position: relative;
  border-radius: 24px;
  padding: 12px;
  background: radial-gradient(circle at top, rgba(26, 70, 52, 0.7), rgba(15, 24, 20, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-height: 320px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.table-area.lobby .table-stage,
.table-area.lobby .hand-area {
  display: none;
}

.table-area.lobby {
  background: transparent;
  border: none;
  min-height: 0;
  padding: 0;
  gap: 0;
}

.table-stage {
  position: relative;
  padding: clamp(52px, 6vw, 88px) clamp(28px, 3vw, 48px) clamp(48px, 5vw, 80px);
}

.seat-left,
.seat-right,
.seat-info-left,
.seat-info-right {
  display: none;
}

.table-header h2 {
  font-size: 22px;
}

.table-header p {
  margin: 8px 0 0;
  color: var(--muted);
}

.table-substatus {
  font-size: 13px;
  color: var(--accent-soft);
  margin: 6px 0 0;
}

.table-substatus.chat-highlight {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 251, 214, 0.98), rgba(255, 214, 140, 0.9) 45%, rgba(243, 155, 36, 0.85) 100%);
  color: #2a1400;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.85);
  box-shadow:
    0 0 16px rgba(255, 231, 160, 0.95),
    0 0 32px rgba(245, 199, 107, 0.8),
    0 0 60px rgba(243, 155, 36, 0.7);
  animation: chatGlow 1.6s ease-in-out infinite;
}

.status-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-right: 6px;
}

.winner-name {
  font-weight: 700;
  color: #ffd972;
  text-shadow: 0 0 12px rgba(255, 217, 114, 0.6);
}

.winner-points {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 217, 114, 0.2);
  border: 1px solid rgba(255, 217, 114, 0.45);
  color: #ffe7a0;
  font-weight: 600;
}

.scoreline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

.score-pill strong {
  color: #ffe7a0;
  font-weight: 700;
}

.score-pill.winner {
  background: linear-gradient(135deg, #ffd972, #ff8f5f);
  color: #2b1600;
  border: 1px solid rgba(255, 233, 180, 0.9);
  box-shadow: 0 0 18px rgba(255, 180, 80, 0.6);
}

.score-pill.winner strong {
  color: #2b1600;
}

.table-surface {
  position: relative;
  width: 100%;
  min-height: max(360px, min(52vh, 520px));
  border-radius: 22px;
  background: rgba(12, 18, 14, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto;
  grid-template-columns: 1fr;
  row-gap: 16px;
  padding: 14px clamp(14px, 2.5vw, 22px);
  align-content: space-between;
}

.table-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(245, 199, 107, 0.15), transparent 70%);
  opacity: 0.6;
  animation: pulseGlow 6s ease-in-out infinite;
}

.pile {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-soft);
  cursor: pointer;
}

.pile-count {
  font-size: 11px;
  color: var(--muted);
}

.piles-row {
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(120px, 1fr);
  align-items: flex-start;
  column-gap: 16px;
  row-gap: 10px;
  width: min(100%, 680px);
  z-index: 4;
  grid-row: 2;
  justify-self: center;
}

.pile.draw {
  justify-self: start;
  z-index: 5;
}

.pile.discard {
  width: 100%;
  align-items: flex-start;
  min-height: 70px;
}

.discard-stack {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  width: 100%;
  row-gap: 10px;
  min-height: 70px;
}

.discard-stack .rummy-card {
  margin-left: 0;
  margin-right: -24px;
}

.discard-stack .rummy-card:first-child {
  margin-left: 0;
}

.discard-stack .rummy-card:last-child {
  margin-right: 0;
}

.rummy-card {
  width: 50px;
  height: 70px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  font-weight: 600;
  font-size: 11px;
  padding: 6px;
  line-height: 1;
  position: relative;
  background: rgba(20, 24, 30, 0.9);
}

.rummy-card.back {
  background: var(--card-back);
}

.rummy-card.face {
  background: rgba(244, 241, 234, 0.95);
  color: #1e1a12;
}

.rummy-card.face .card-value {
  font-variant-numeric: tabular-nums;
}

.rummy-card.face .card-suit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  opacity: 0.35;
  color: currentColor;
  pointer-events: none;
}

.rummy-card.face.red {
  color: #c6413d;
}

.rummy-card.face.black {
  color: #1b1916;
}

.rummy-card.pending-reveal {
  opacity: 0;
}

.rummy-card.selected {
  outline: 2px solid rgba(245, 199, 107, 0.95);
  transform: translateY(-10px) scale(1.02);
  box-shadow:
    0 10px 24px rgba(245, 199, 107, 0.35),
    0 0 18px rgba(245, 199, 107, 0.55);
}

.fly-card {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  transition: transform 240ms ease, opacity 240ms ease;
  will-change: transform;
}

.seat {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 140px;
  color: var(--text);
}

.seat-info {
  position: absolute;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text);
  z-index: 2;
}

.seat-info-top {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.seat-info-bottom {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

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

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

.seat-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}

.seat-avatar {
  font-size: 16px;
}

.seat-top {
  grid-row: 1;
  justify-self: center;
  width: min(90%, 860px);
}

.seat-right {
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.seat-left {
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.seat-bottom {
  grid-row: 3;
  justify-self: center;
  width: min(96%, 860px);
  align-items: stretch;
}

.seat-hand {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 52px;
  min-width: 46px;
}

.hand-count {
  font-size: 12px;
  color: var(--muted);
}

.seat-melds {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.seat-top .seat-melds {
  width: 100%;
  max-width: none;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(12, 16, 20, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.25);
}

.seat-bottom .seat-melds {
  min-height: 140px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(12, 16, 20, 0.35);
  border: 1px dashed rgba(245, 199, 107, 0.28);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.seat-left .seat-melds,
.seat-right .seat-melds {
  max-width: 140px;
}

.seat-top .rummy-card,
.seat-left .rummy-card,
.seat-right .rummy-card {
  width: 38px;
  height: 52px;
  font-size: 11px;
}

.seat-top .meld,
.seat-left .meld,
.seat-right .meld {
  padding: 2px;
}

.seat-info .rummy-card {
  width: 34px;
  height: 46px;
  font-size: 10px;
}

.seat-top .rummy-card,
.seat-left .rummy-card,
.seat-right .rummy-card,
.seat-info .rummy-card {
  padding: 4px;
}

.meld {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}

.meld .rummy-card {
  margin-left: -12px;
}

.meld .rummy-card:first-child {
  margin-left: 0;
}

.meld.selected {
  border-color: rgba(245, 199, 107, 0.9);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.host-controls {
  background: linear-gradient(140deg, rgba(245, 199, 107, 0.12), rgba(20, 24, 30, 0.85));
}

.host-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

#playersList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(12, 14, 18, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.player-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.player-avatar {
  font-size: 18px;
}

.host-pill {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-soft);
}

.bot-pill {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8fd0ff;
}

.pill {
  background: rgba(245, 199, 107, 0.15);
  color: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.chat-log {
  height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
}

.chat-line {
  background: rgba(12, 14, 18, 0.6);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-line.system {
  color: var(--muted);
  font-style: italic;
}

.chat-author {
  font-weight: 600;
  margin-right: 6px;
}

.chat-form {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.chat-form input {
  flex: 1;
}

.room-footer {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.link-button {
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
  font-size: 14px;
}

.fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 205, 110, 0.15), transparent 40%),
    radial-gradient(circle at 80% 30%, rgba(110, 196, 255, 0.18), transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(255, 120, 165, 0.12), transparent 45%);
}

.fireworks.hidden {
  display: none;
}

.firework {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  width: var(--size, 6px);
  height: var(--size, 6px);
  color: hsl(var(--hue, 40), 85%, 60%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.1);
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.45));
  animation: firework-burst var(--duration, 1.6s) ease-out var(--delay, 0s) forwards;
}

.firework::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  box-shadow:
    0 calc(-1 * var(--spread, 30px)) 0 currentColor,
    0 var(--spread, 30px) 0 currentColor,
    var(--spread, 30px) 0 0 currentColor,
    calc(-1 * var(--spread, 30px)) 0 0 currentColor,
    calc(var(--spread, 30px) * 0.78) calc(var(--spread, 30px) * 0.78) 0 currentColor,
    calc(var(--spread, 30px) * -0.78) calc(var(--spread, 30px) * 0.78) 0 currentColor,
    calc(var(--spread, 30px) * 0.78) calc(var(--spread, 30px) * -0.78) 0 currentColor,
    calc(var(--spread, 30px) * -0.78) calc(var(--spread, 30px) * -0.78) 0 currentColor,
    calc(var(--spread, 30px) * 0.5) calc(var(--spread, 30px) * 1.1) 0 currentColor,
    calc(var(--spread, 30px) * -0.5) calc(var(--spread, 30px) * 1.1) 0 currentColor;
  animation: firework-spin var(--duration, 1.6s) linear var(--delay, 0s) forwards;
}

.firework::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
  box-shadow:
    0 calc(-0.65 * var(--spread, 30px)) 0 currentColor,
    0 calc(0.65 * var(--spread, 30px)) 0 currentColor,
    calc(0.65 * var(--spread, 30px)) 0 0 currentColor,
    calc(-0.65 * var(--spread, 30px)) 0 0 currentColor;
  animation: firework-spin calc(var(--duration, 1.6s) + 0.2s) linear var(--delay, 0s) reverse;
}

.firework.streak {
  width: 2px;
  height: var(--trail, 70px);
  background: linear-gradient(180deg, transparent, currentColor, transparent);
  border-radius: 999px;
  transform: translate(-50%, -50%) scaleY(0.2);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.6));
  animation: firework-streak var(--duration, 1.6s) ease-out var(--delay, 0s) forwards;
}

.firework.streak::before,
.firework.streak::after {
  content: none;
}

@keyframes firework-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.1);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.7);
  }
}

@keyframes firework-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(180deg);
  }
}

@keyframes firework-streak {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scaleY(0.2);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scaleY(1.1);
  }
}

.modal-root {
  position: fixed;
  inset: 0;
  background: rgba(5, 6, 10, 0.7);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 50;
}

.modal-root.hidden {
  display: none;
}

.modal-surface {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 24px;
  width: min(440px, 90vw);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-close {
  align-self: flex-end;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  padding: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.hand-area {
  padding: 4px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hand-cards {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 82px;
}

.hand-area .rummy-card {
  width: 56px;
  height: 78px;
  font-size: 12px;
}

.hand-cards .rummy-card {
  margin-left: -18px;
}

.hand-cards .rummy-card:first-child {
  margin-left: 0;
}

.hand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.turn-flip {
  animation: turnFlip 360ms ease;
  transform-origin: center;
}

.turn-highlight {
  color: #ffe9bf;
  text-shadow: 0 0 8px rgba(255, 220, 168, 0.7), 0 0 18px rgba(245, 199, 107, 0.55);
  animation: turnGlow 700ms ease;
}

#tableStatus.your-turn {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 234, 0.7), rgba(245, 199, 107, 0.6) 45%, rgba(243, 155, 36, 0.55) 100%);
  color: #2b1600;
  border: 1px solid rgba(255, 232, 170, 0.5);
  box-shadow:
    0 0 10px rgba(255, 234, 190, 0.55),
    0 0 20px rgba(245, 199, 107, 0.45),
    0 0 36px rgba(243, 155, 36, 0.4);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.35);
}

.attention-glow {
  box-shadow:
    0 0 0 2px rgba(245, 199, 107, 0.45),
    0 0 16px rgba(245, 199, 107, 0.5);
  border-radius: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes pulseGlow {
  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.7;
  }
}

@keyframes chatGlow {
  0%,
  100% {
    box-shadow:
      0 0 16px rgba(255, 231, 160, 0.95),
      0 0 32px rgba(245, 199, 107, 0.8),
      0 0 60px rgba(243, 155, 36, 0.7);
  }
  50% {
    box-shadow:
      0 0 20px rgba(255, 245, 208, 1),
      0 0 40px rgba(245, 199, 107, 0.9),
      0 0 72px rgba(243, 155, 36, 0.85);
  }
}

@keyframes turnFlip {
  0% {
    transform: perspective(300px) rotateY(0deg);
    opacity: 1;
  }
  45% {
    transform: perspective(300px) rotateY(90deg);
    opacity: 0.1;
  }
  55% {
    transform: perspective(300px) rotateY(90deg);
    opacity: 0.1;
  }
  100% {
    transform: perspective(300px) rotateY(0deg);
    opacity: 1;
  }
}

@keyframes turnGlow {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .table-layout {
    grid-template-columns: 1fr;
  }

  .seat-bottom .seat-melds {
    min-height: 110px;
  }
}

@media (max-width: 700px) {
  .page {
    padding: 24px 16px 40px;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-ribbon {
    position: static;
    margin-top: 16px;
  }

  .seat-bottom .seat-melds {
    min-height: 80px;
  }
}
