:root {
  color-scheme: dark;
  --bg: #080705;
  --panel: #12100d;
  --panel-2: #1b1711;
  --felt: #14523a;
  --felt-dark: #082a20;
  --gold: #f4b84a;
  --orange: #ff8800;
  --red: #d91f2d;
  --blue: #3aa7ff;
  --ink: #f7f1e4;
  --muted: #b7a992;
  --line: rgba(244, 184, 74, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 136, 0, 0.12), transparent 28%),
    radial-gradient(circle at 85% 25%, rgba(58, 167, 255, 0.10), transparent 30%),
    linear-gradient(145deg, #030302, #11100c 56%, #050504);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, #282015, #17120c);
  color: var(--ink);
  cursor: pointer;
  min-height: 34px;
  padding: 7px 11px;
}

button:hover,
button.is-active {
  border-color: rgba(255, 136, 0, 0.86);
  color: #fff;
}

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

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: #070604;
  color: var(--ink);
  padding: 8px 10px;
}

.card-room {
  height: 100vh;
  overflow: hidden;
  padding: 12px 16px;
}

.card-room[data-view="lobby"] .game-layout,
.card-room[data-view="table"] .lobby-screen {
  display: none;
}

.topbar {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  height: 66px;
  margin: 0 auto 10px;
  max-width: 1500px;
}

.eyebrow {
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(24px, 3.4vw, 40px);
  line-height: 1;
  margin: 0;
}

.beta-tag {
  border: 1px solid rgba(244, 184, 74, 0.38);
  border-radius: 999px;
  color: var(--gold);
  display: inline-flex;
  font-size: 0.38em;
  font-weight: 700;
  line-height: 1;
  margin-left: 8px;
  padding: 6px 9px;
  text-transform: uppercase;
  vertical-align: middle;
}

.panel-tabs {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
}

.connection-pill {
  align-items: center;
  justify-self: end;
  border: 1px solid rgba(125, 255, 156, 0.3);
  border-radius: 999px;
  color: #9fffc1;
  display: inline-flex;
  gap: 8px;
  padding: 8px 12px;
}

.topbar-actions {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  justify-self: end;
}

.site-back-link {
  align-items: center;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 700;
  min-height: 36px;
  padding: 8px 13px;
  text-decoration: none;
}

.site-back-link:hover {
  border-color: rgba(255, 136, 0, 0.62);
  color: var(--gold);
}

.status-dot {
  background: #7dff9c;
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(125, 255, 156, 0.8);
  height: 8px;
  width: 8px;
}

.game-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 16px;
  height: calc(100vh - 100px);
  margin: 0 auto;
  max-width: 1500px;
  min-height: 0;
}

.lobby-screen {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr) minmax(260px, 0.85fr);
  gap: 16px;
  height: calc(100vh - 100px);
  margin: 0 auto;
  max-width: 1500px;
  min-height: 0;
}

.lobby-card {
  background: linear-gradient(180deg, rgba(18, 16, 13, 0.96), rgba(7, 6, 4, 0.96));
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.lobby-card .field-label {
  display: block;
  margin: 12px 0 6px;
}

.compact-code-label {
  margin-top: 4px;
}

.wide-button {
  margin-top: 14px;
  width: 100%;
}

.helper-text {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 12px 0 0;
}

.room-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  max-height: calc(100vh - 265px);
  overflow-y: auto;
}

.room-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto;
  min-height: 58px;
  text-align: left;
}

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

.room-row small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.room-row em {
  color: #9fffc1;
  font-style: normal;
  font-weight: 700;
}

.empty-room {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  padding: 12px;
}

.auth-prompt {
  border-color: rgba(244, 184, 74, 0.3);
}

.auth-prompt strong,
.auth-prompt span {
  display: block;
}

.auth-prompt strong {
  color: var(--gold);
  font-size: 15px;
  margin-bottom: 6px;
}

.auth-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.auth-button {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  text-decoration: none;
}

.auth-button.primary {
  background: linear-gradient(180deg, #ff9e24, #d46a00);
  border-color: transparent;
  color: #1a0d02;
}

.side-panel {
  background: linear-gradient(180deg, rgba(18, 16, 13, 0.96), rgba(7, 6, 4, 0.96));
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 0;
  overflow: hidden;
  padding: 12px;
}

.panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.panel-heading span,
.field-label,
.settings-grid label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.panel-heading strong {
  color: var(--gold);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 6px 0 10px;
}

.small-button {
  min-width: 58px;
}

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

.settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.host-actions {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.primary-button {
  background: linear-gradient(180deg, #ff9e24, #d46a00);
  border-color: transparent;
  color: #1a0d02;
  font-weight: 700;
}

.rule-card {
  background: rgba(255, 136, 0, 0.08);
  border: 1px solid rgba(255, 136, 0, 0.22);
  border-radius: 8px;
  padding: 10px;
}

.rule-card span {
  color: var(--gold);
  font-weight: 700;
}

.rule-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 8px 0 0;
}

.table-wrap {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.table-status {
  align-items: center;
  background: rgba(7, 6, 4, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  grid-template-columns: 1fr auto 1fr;
  min-height: 34px;
  padding: 6px 14px;
}

.table-status strong {
  color: var(--ink);
  font-size: 14px;
}

.table-status span:last-child {
  text-align: right;
}

.felt-table {
  aspect-ratio: auto;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.08), transparent 45%),
    radial-gradient(ellipse at center, #1d6b4c, var(--felt) 42%, var(--felt-dark) 74%);
  border: 13px solid #24160d;
  border-radius: 48%;
  box-shadow:
    inset 0 0 0 7px rgba(244, 184, 74, 0.22),
    inset 0 0 50px rgba(0, 0, 0, 0.55),
    0 30px 80px rgba(0, 0, 0, 0.55);
  height: 100%;
  width: 100%;
  min-height: 0;
  overflow: visible;
  position: relative;
}

.table-rail {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 48%;
  inset: 13px;
  pointer-events: none;
  position: absolute;
}

.felt-table::after {
  border-radius: inherit;
  box-shadow: inset 0 0 42px rgba(0, 0, 0, 0.42);
  content: "";
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 3;
}

.table-center {
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, 38vw);
  z-index: 4;
}

.community-cards {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  min-height: 84px;
}

.pot-display {
  align-items: center;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  display: inline-flex;
  gap: 10px;
  left: 50%;
  margin-top: 6px;
  padding: 6px 14px;
  position: relative;
  transform: translateX(-50%);
}

.pot-display.is-pulsing {
  animation: potPulse 900ms ease-out;
}

.pot-display.is-pulsing::after {
  animation: chipSpark 900ms ease-out;
  border: 2px solid rgba(244, 184, 74, 0.55);
  border-radius: 50%;
  content: "";
  height: 10px;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
}

.pot-display span {
  color: var(--muted);
}

.pot-display strong {
  color: var(--gold);
}

.table-message {
  color: #fff8e2;
  font-size: 12px;
  margin: 7px auto 0;
  max-width: 520px;
  min-height: 22px;
  text-align: center;
}

.seats {
  inset: 0;
  position: absolute;
  z-index: 5;
}

.seat {
  background: rgba(7, 6, 4, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  left: var(--seat-left, 50%);
  isolation: isolate;
  min-height: 84px;
  padding: 7px;
  position: absolute;
  top: var(--seat-top, 50%);
  transform: translate(-50%, -50%);
  width: 124px;
  z-index: 1;
}

.seat::before {
  border-radius: 10px;
  content: "";
  inset: -5px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  transition: opacity 180ms ease;
  z-index: 0;
}

.seat > * {
  position: relative;
  z-index: 1;
}

.seat.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 22px rgba(244, 184, 74, 0.25);
}

.seat.has-action-timer::before {
  animation: actionTimer 18s linear infinite;
  background: conic-gradient(from 0deg, rgba(244, 184, 74, 0.95), rgba(255, 136, 0, 0.65), transparent 72%);
  opacity: 1;
}

.seat.is-winner {
  border-color: rgba(244, 184, 74, 0.95);
  box-shadow:
    0 0 0 1px rgba(244, 184, 74, 0.32),
    0 0 28px rgba(244, 184, 74, 0.5),
    inset 0 0 24px rgba(244, 184, 74, 0.12);
}

.seat.is-winner::before {
  animation: winnerGlow 1400ms ease-in-out infinite alternate;
  background: radial-gradient(circle, rgba(244, 184, 74, 0.42), transparent 64%);
  opacity: 1;
}

.seat.is-mine {
  border-color: rgba(125, 255, 156, 0.5);
}

.seat.is-folded {
  opacity: 0.58;
}

.seat.is-sitting-out,
.seat.is-disconnected {
  border-color: rgba(183, 169, 146, 0.28);
  opacity: 0.72;
}

.seat.is-disconnected .seat-badge {
  border-color: rgba(217, 31, 45, 0.42);
  color: #ffb0b0;
}

.seat.is-sitting-out .seat-badge {
  border-color: rgba(244, 184, 74, 0.32);
  color: var(--muted);
}

.seat-name-row,
.seat-stack-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.seat-name {
  color: var(--ink);
  font-weight: 700;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-badge {
  background: rgba(255, 136, 0, 0.16);
  border: 1px solid rgba(255, 136, 0, 0.24);
  border-radius: 999px;
  color: var(--gold);
  font-size: 10px;
  min-width: 26px;
  padding: 2px 7px;
  text-align: center;
}

.seat-stack-row {
  color: var(--muted);
  font-size: 10px;
  margin-top: 4px;
}

.seat-bet {
  color: #9fffc1;
}

.hand-fan {
  height: 36px;
  margin-top: 4px;
  position: relative;
}

.seat-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.seat-actions button {
  flex: 1;
  font-size: 11px;
  min-height: 23px;
  padding: 4px 7px;
}

@keyframes actionTimer {
  to {
    transform: rotate(360deg);
  }
}

@keyframes winnerGlow {
  from {
    filter: blur(2px);
    transform: scale(0.98);
  }

  to {
    filter: blur(7px);
    transform: scale(1.08);
  }
}

@keyframes potPulse {
  0% {
    box-shadow: 0 0 0 rgba(244, 184, 74, 0);
    transform: translateX(-50%) scale(1);
  }

  35% {
    box-shadow: 0 0 28px rgba(244, 184, 74, 0.42);
    transform: translateX(-50%) scale(1.08);
  }

  100% {
    box-shadow: 0 0 0 rgba(244, 184, 74, 0);
    transform: translateX(-50%) scale(1);
  }
}

@keyframes chipSpark {
  0% {
    box-shadow:
      0 0 0 rgba(244, 184, 74, 0),
      0 0 0 rgba(244, 184, 74, 0);
    opacity: 0.9;
  }

  100% {
    box-shadow:
      -42px -12px 0 -3px rgba(244, 184, 74, 0),
      38px 14px 0 -3px rgba(255, 136, 0, 0),
      -20px 24px 0 -4px rgba(244, 184, 74, 0),
      18px -25px 0 -4px rgba(255, 136, 0, 0);
    height: 34px;
    opacity: 0;
    width: 34px;
  }
}

.playing-card {
  align-items: flex-start;
  background: linear-gradient(145deg, #fffdf5, #dcd5c9);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 7px;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.34);
  color: #14100c;
  display: flex;
  flex-direction: column;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  height: 70px;
  justify-content: flex-start;
  line-height: 1;
  position: relative;
  width: 50px;
  padding: 7px 0 0 8px;
}

.playing-card.red {
  color: #ba1524;
}

.playing-card .rank {
  font-size: 18px;
  letter-spacing: 0;
}

.playing-card .suit {
  font-size: 18px;
  margin-top: 2px;
}

.playing-card::before {
  bottom: 8px;
  content: attr(data-suit);
  font-size: 22px;
  left: 50%;
  line-height: 1;
  position: absolute;
  transform: translateX(-50%);
}

.playing-card.is-hole {
  height: 42px;
  position: absolute;
  top: 1px;
  width: 31px;
  padding: 5px 0 0 5px;
}

.playing-card.is-hole .rank {
  font-size: 15px;
}

.playing-card.is-hole .suit {
  font-size: 14px;
}

.playing-card.is-hole::before {
  bottom: 4px;
  font-size: 16px;
}

.playing-card.is-hidden {
  background:
    linear-gradient(135deg, rgba(255, 136, 0, 0.16), transparent 40%),
    repeating-linear-gradient(45deg, #14100c 0 5px, #21160d 5px 10px);
  color: transparent;
  padding: 0;
}

.playing-card.is-hidden::after {
  color: var(--gold);
  content: "SH";
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
}

.playing-card.is-hidden::before {
  content: "";
}

.action-dock {
  align-items: center;
  background: rgba(7, 6, 4, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(170px, 0.9fr) auto;
  gap: 10px;
  margin-top: 0;
  padding: 10px;
}

.action-dock span,
.action-dock strong {
  display: block;
}

#activeSeatLabel {
  color: var(--ink);
  font-weight: 700;
}

#toCallLabel,
#raiseLabel {
  color: var(--muted);
  font-size: 13px;
}

.bet-control {
  align-items: center;
  display: grid;
  gap: 5px;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.panel-tab {
  flex: 1;
}

.table-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-body {
  display: none;
  min-height: 0;
}

.panel-body.is-active {
  display: flex;
  flex: 1;
  flex-direction: column;
  margin-top: 12px;
  min-height: 0;
}

.chat-messages,
.event-log,
.rules-text {
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.chat-line,
.log-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 8px;
}

.chat-line strong,
.log-line strong {
  color: var(--gold);
}

.chat-form {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.rules-text h3 {
  color: var(--gold);
  margin: 0 0 8px;
}

.rules-text p,
.rules-text li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.rules-text ul {
  margin: 8px 0 16px;
  padding-left: 18px;
}

@media (max-width: 1180px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .card-room {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .game-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .lobby-screen {
    grid-template-columns: 1fr;
    height: auto;
  }

  .room-list {
    max-height: none;
  }

  .side-panel {
    min-height: 0;
  }

  .table-center {
    width: min(540px, 64vw);
  }

  .table-panel {
    min-height: 440px;
  }
}

@media (max-width: 760px) {
  .card-room {
    padding: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 12px;
    height: auto;
    margin-bottom: 16px;
  }

  .connection-pill {
    max-width: 100%;
    min-height: 42px;
    padding: 9px 14px;
    white-space: nowrap;
  }

  .topbar-actions {
    align-items: flex-start;
    flex-wrap: wrap;
    justify-self: start;
  }

  .felt-table {
    aspect-ratio: auto;
    border-width: 10px;
    border-radius: 28px;
    height: clamp(640px, 78vh, 720px);
    min-height: 640px;
    max-height: 720px;
    overflow: hidden;
  }

  .table-rail {
    border-radius: 22px;
  }

  .table-center {
    top: 46%;
    width: min(300px, calc(100% - 54px));
  }

  .community-cards {
    flex-wrap: nowrap;
    gap: 4px;
    min-height: 62px;
  }

  .seat {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    min-height: 92px;
    padding: 6px;
    width: min(136px, 36vw);
  }

  .seat-name {
    font-size: 11px;
  }

  .seat-stack-row {
    font-size: 9px;
    margin-top: 2px;
  }

  .hand-fan {
    height: 30px;
    margin-top: 2px;
  }

  .seat-actions {
    margin-top: 2px;
  }

  .seat-actions button {
    font-size: 10px;
    min-height: 25px;
    padding: 3px 6px;
  }

  .playing-card {
    border-radius: 6px;
    height: 58px;
    padding: 6px 0 0 7px;
    width: 42px;
  }

  .playing-card .rank,
  .playing-card .suit {
    font-size: 15px;
  }

  .playing-card::before {
    bottom: 6px;
    font-size: 18px;
  }

  .playing-card.is-hole {
    height: 34px;
    padding: 4px 0 0 4px;
    width: 25px;
  }

  .playing-card.is-hole .rank,
  .playing-card.is-hole .suit {
    font-size: 11px;
  }

  .playing-card.is-hole::before {
    bottom: 3px;
    font-size: 13px;
  }

  .action-dock {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
}
