:root {
  color-scheme: light;
  --bg: #0d1b16;
  --bg-2: #163327;
  --panel: rgba(242, 236, 215, 0.96);
  --panel-dark: rgba(12, 39, 30, 0.92);
  --text: #132018;
  --muted: #4d5a51;
  --accent: #ce8d2b;
  --accent-2: #b73f31;
  --line: rgba(255, 255, 255, 0.12);
  --table: radial-gradient(circle at top, #26523e 0%, #153629 42%, #0a1712 100%);
  font-family: "Trebuchet MS", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(206, 141, 43, 0.2), transparent 24%),
    radial-gradient(circle at bottom right, rgba(183, 63, 49, 0.15), transparent 18%),
    linear-gradient(135deg, #0b1411, #11271f 55%, #09110e);
  color: #f7f3e7;
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #dcb677;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 56px);
}

.subtitle {
  margin: 10px 0 0;
  color: rgba(247, 243, 231, 0.8);
}

.panel {
  border-radius: 24px;
  padding: 24px;
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.home-panel {
  max-width: 640px;
  background: var(--panel);
  color: var(--text);
}

.field,
.join-row,
.actions {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid rgba(19, 32, 24, 0.15);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  cursor: pointer;
  background: #274a38;
  color: #fff9ec;
  transition: transform 120ms ease, opacity 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button.is-pending,
button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.9);
}

button.primary {
  background: linear-gradient(135deg, #c08025, #e8b15e);
  color: #261405;
  font-weight: 800;
}

.join-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.rules-card {
  padding: 18px;
  border-radius: 16px;
  background: rgba(15, 37, 29, 0.06);
}

.rules-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.rules-card ul {
  margin: 0;
  padding-left: 18px;
}

.room-layout,
.game-layout {
  display: grid;
  gap: 18px;
}

.room-layout {
  grid-template-columns: 1.15fr 0.85fr;
}

.room-card,
.status-card,
.game-card,
.side-card {
  background: rgba(12, 39, 30, 0.9);
  color: #f8f3e7;
  border: 1px solid var(--line);
}

.room-header,
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #f0deb1;
}

.player-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.seat-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.seat-card.active {
  box-shadow: 0 0 0 2px rgba(232, 177, 94, 0.65);
}

.seat-card h3 {
  margin: 0 0 8px;
}

.meta-line {
  margin: 4px 0;
  color: rgba(247, 243, 231, 0.78);
}

.stack {
  display: grid;
  gap: 10px;
}

.table {
  background: var(--table);
  border-radius: 28px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.table-center {
  text-align: center;
  margin: 22px 0;
}

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

.cards.centered {
  justify-content: center;
}

.card {
  width: 72px;
  height: 102px;
  border-radius: 14px;
  background: #faf4e6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border: 2px solid rgba(38, 27, 13, 0.08);
  gap: 2px;
}

.card.black {
  color: #1d1a17;
}

.card.red {
  color: #b12c26;
}

.card-rank {
  font-size: 24px;
  line-height: 1;
}

.card-suit {
  font-size: 22px;
  line-height: 1;
}

.card.back {
  background: linear-gradient(135deg, #5c1d18, #3f110d);
  color: #f7d39a;
}

.table-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 18px;
}

.action-row,
.bet-row,
.quick-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-row button,
.quick-row button {
  flex: 1;
  min-width: 110px;
}

.danger {
  background: linear-gradient(135deg, #7a261f, #b04035);
}

.control-card {
  margin-top: 14px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.control-card.is-busy {
  box-shadow: inset 0 0 0 1px rgba(232, 177, 94, 0.45);
}

.control-card.is-settlement {
  opacity: 0.45;
}

.status-banner {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(232, 177, 94, 0.14);
  color: #f4dfac;
}

.pending-banner {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(232, 177, 94, 0.14);
  color: #f6dd9f;
  font-weight: 700;
}

.log-list {
  margin: 0;
  padding-left: 18px;
  color: rgba(247, 243, 231, 0.84);
}

.winner {
  color: #e8c478;
  font-weight: 800;
}

.settlement-panel {
  border: 1px solid rgba(232, 177, 94, 0.28);
  background:
    linear-gradient(135deg, rgba(232, 177, 94, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.06);
}

.muted {
  color: rgba(247, 243, 231, 0.7);
}

.footer-note {
  margin-top: 16px;
  color: rgba(247, 243, 231, 0.64);
  font-size: 14px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.text-link {
  color: #f1d899;
  text-decoration: none;
  font-weight: 700;
}

.text-link.dark {
  color: #1f4c38;
}

.debug-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
}

.debug-panel {
  background: rgba(12, 39, 30, 0.9);
  color: #f8f3e7;
  border: 1px solid var(--line);
}

.debug-actions {
  display: grid;
  gap: 12px;
}

.debug-seat-controls {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.debug-seat-controls h3,
.debug-json h3 {
  margin: 0;
}

.debug-json pre {
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: #dce7df;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 900px) {
  .room-layout,
  .table-grid,
  .player-grid,
  .two-col,
  .debug-layout {
    grid-template-columns: 1fr;
  }

  .card {
    width: 60px;
    height: 88px;
  }

  .card-rank {
    font-size: 20px;
  }

  .card-suit {
    font-size: 18px;
  }
}
