@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800;900&display=swap');

/* ──────── Design Tokens ──────── */
:root {
  --bg: #0c0e1a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-raised: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.14);
  --text: #eef2ff;
  --text-muted: #7c85a6;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.25);
  --red: #f43f5e;
  --red-glow: rgba(244, 63, 94, 0.25);
  --gold: #fbbf24;
  --gold-glow: rgba(251, 191, 36, 0.2);
  --blue: #38bdf8;
  --felt: #0a2e1f;
  --felt-light: #134e35;
  --radius: 14px;
  --radius-sm: 10px;
  --card-width: 60px;
  --card: rgba(255, 255, 255, 0.04);
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
}

/* ──────── Reset ──────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(99, 102, 241, 0.12), transparent),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(34, 197, 94, 0.08), transparent);
  -webkit-font-smoothing: antialiased;
}

.eyebrow {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ──────── Buttons ──────── */
.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.login-button,
.suit-button,
.card-button,
.mini-button {
  min-height: 40px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 180ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  box-shadow: 0 4px 16px var(--accent-glow);
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.ghost-button,
.mini-button {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0 14px;
}

.ghost-button:hover:not(:disabled),
.mini-button:hover:not(:disabled) {
  background: var(--surface-raised);
  border-color: var(--border-bright);
}

.danger-button {
  color: #fff;
  background: linear-gradient(135deg, var(--red), #e11d48);
  box-shadow: 0 4px 16px var(--red-glow);
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.danger-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--red-glow);
}

/* ──────── Panels ──────── */
.login-panel,
.sync-panel,
.side-panel,
.center-table,
.score-card,
.player-seat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

/* ── Login ── */
.login-panel {
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.login-panel h2 {
  font-size: 1rem;
  font-weight: 800;
}

.login-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.login-button {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  color: var(--text);
  text-align: left;
  justify-content: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.login-button strong {
  font-size: 0.95rem;
}

.login-button small {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.login-button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px var(--accent-glow);
}

.login-button:hover:not(.active) {
  background: var(--surface-raised);
  border-color: var(--border-bright);
}

/* ── Sync ── */
.sync-panel {
  padding: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
}

.sync-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.sync-panel p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.sync-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.sync-controls label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.sync-controls input {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  font-weight: 700;
  text-transform: uppercase;
  width: 140px;
}

.sync-controls input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* ── Scoreboard ── */
.score-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.score-card {
  padding: 14px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.score-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.team-one::before {
  background: linear-gradient(90deg, var(--green), #4ade80);
}

.team-two::before {
  background: linear-gradient(90deg, var(--blue), #7dd3fc);
}

.score-card span {
  display: block;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-card strong {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text);
}

.score-card b {
  display: block;
  margin-top: 4px;
  font-size: 1.6rem;
  font-weight: 900;
}

/* ──────── Game Grid ──────── */
.game-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
  width: 100%;
}

/* ── Side Panel ── */
.side-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.panel-section {
  min-width: 0;
}

.state-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.state-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.state-list div:last-child {
  border-bottom: 0;
}

.state-list dt {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
}

.state-list dd {
  margin: 0;
  text-align: right;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

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

.trick-score span {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  font-weight: 800;
  text-align: center;
  font-size: 0.85rem;
}

.event-log {
  display: grid;
  gap: 6px;
  max-height: 260px;
  margin: 0;
  padding-left: 18px;
  overflow-y: auto;
}

.event-log li {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* ──────── Play Area — Flow Grid (NO absolute positioning) ──────── */
.play-area {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 32px 48px;
  border-radius: 280px;
  min-height: 560px;
  background:
    radial-gradient(ellipse 50% 40% at center, rgba(34, 197, 94, 0.1), transparent),
    linear-gradient(160deg, var(--felt), var(--felt-light) 40%, var(--felt));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 0 40px rgba(34, 197, 94, 0.08);
  overflow: visible;
}

.seat-slot {
  display: flex;
  overflow: visible;
  padding: 8px;
}

.slot-top {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-content: center;
}

.slot-left {
  grid-column: 1;
  grid-row: 2;
  align-items: flex-start;
}

.slot-right {
  grid-column: 3;
  grid-row: 2;
  align-items: flex-start;
}

.slot-bottom {
  grid-column: 1 / -1;
  grid-row: 3;
  justify-content: center;
}

.players-ring-slot {
  width: 100%;
  overflow: visible;
  display: flex;
}

.slot-top .players-ring-slot,
.slot-bottom .players-ring-slot {
  justify-content: center;
}

.slot-left .players-ring-slot {
  justify-content: flex-end;
}

.slot-right .players-ring-slot {
  justify-content: flex-start;
}

/* Removed slot-top/slot-bottom forced width */

/* ── Player Seats ── */
.player-seat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  min-width: 0;
  width: 170px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  overflow: visible;
}

.player-seat.is-self {
  width: 100%;
  max-width: 420px;
}

.seat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.seat-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.seat-header span {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.1);
}

.badge.turn {
  color: #000;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

.badge.login {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ── Cards ── */
.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  row-gap: 8px;
  align-content: flex-start;
  min-height: 60px;
  overflow: visible;
  padding-top: 4px;
  padding-bottom: 12px;
}

.card-button,
.card-face {
  width: var(--card-width);
  height: auto;
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  box-sizing: border-box;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(226, 232, 240, 0.92)),
    #fff;
  color: #111827;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 200ms ease;
  flex-shrink: 0;
}

.card-button {
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.card-button:hover:not(:disabled) {
  transform: translateY(-10px) scale(1.08);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.48), 0 0 24px var(--accent-glow);
  z-index: 10;
  border-color: var(--accent);
}

.card-button.illegal {
  opacity: 0.35;
  filter: grayscale(0.6);
}

.card-button:disabled {
  opacity: 1 !important;
  cursor: default;
}

.card-button:disabled .card-face {
  filter: brightness(0.7) contrast(0.85);
}

.card-face {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  padding: 6px 4px;
  font-weight: 900;
  height: 100%;
  position: relative;
}

.card-rank {
  font-size: 1.1rem;
  line-height: 1;
}

.card-suit {
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
}

.playing-card .corner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.playing-card .corner.top-left {
  justify-self: start;
  align-self: start;
}

.playing-card .corner.bottom-right {
  justify-self: end;
  align-self: end;
  transform: rotate(180deg);
}

.playing-card .rank {
  font-size: 0.9rem;
  line-height: 1;
}

.playing-card .center-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
}

.playing-card .suit-icon-small {
  width: 14px;
  height: 14px;
}

.playing-card .suit-icon-large {
  width: 30px;
  height: 30px;
}

.suit-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
}

.card-suit .suit-icon {
  width: 22px;
  height: 22px;
}

.inline-card {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
}

.inline-joker {
  color: #4f46e5;
}

.inline-suit-icon {
  width: 16px;
  height: 16px;
}

.state-list .suit-icon-dark,
.phodi-box .suit-icon-dark {
  filter: brightness(2.2);
}

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

.card-joker {
  color: #e2e8f0;
  background:
    linear-gradient(160deg, #0f172a, #1e293b),
    #111827;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
}

.card-joker .suit-icon {
  filter: brightness(1.2) drop-shadow(0 4px 10px rgba(148, 163, 184, 0.4));
}

.card-back {
  display: block;
  width: 28px;
  min-height: 40px;
  border-radius: 5px;
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 8px),
    radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.14) 0 2px, transparent 2px 8px),
    repeating-linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0 3px, rgba(30, 64, 175, 0.35) 3px 6px),
    linear-gradient(160deg, #1e3a8a, #0f172a);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Center Table ── */
.center-table {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  min-height: 180px;
  align-self: center;
}

/* ── Table Overlay ── */
.table-overlay {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.table-overlay-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.center-score-pill {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 8px 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.trump-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 4px 16px;
  background: #111424;
  /* matching dark background from screenshot */
  box-shadow: inset 0 0 10px rgba(251, 191, 36, 0.05);
  min-width: 100px;
}

.trump-title {
  color: var(--gold);
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  align-self: center;
  margin-bottom: 2px;
}

.trump-main {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.trump-main .suit-icon {
  width: 18px;
  height: 18px;
}

.status-line {
  color: var(--gold);
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.35;
  text-shadow: 0 0 14px var(--gold-glow);
}

.trick-pile {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.played-card {
  display: grid;
  gap: 4px;
  justify-items: center;
  transition: all 0.4s ease;
}

.played-card span {
  font-size: 0.7rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-muted);
}

/* ── Trick Result Animation ── */
.winner-card {
  animation: winnerPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.winner-card .card-face {
  box-shadow: 0 0 20px var(--gold), 0 0 40px rgba(251, 191, 36, 0.3);
  border-color: var(--gold);
}

.winner-card span {
  color: var(--gold);
  font-weight: 800;
}

.loser-card {
  animation: loserFade 0.5s ease forwards;
}

@keyframes winnerPop {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.15) translateY(-6px);
  }

  100% {
    transform: scale(1.08) translateY(-4px);
  }
}

@keyframes loserFade {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0.4;
    transform: scale(0.92);
  }
}

.trick-winner-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  animation: bannerSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.trick-winner-banner.team-a {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: var(--green);
}

.trick-winner-banner.team-b {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(56, 189, 248, 0.05));
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: var(--blue);
}

.trick-winner-banner .winner-icon {
  font-size: 1.4rem;
}

.trick-winner-banner strong {
  font-size: 1rem;
}

.trick-winner-banner span:last-child {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
}

@keyframes bannerSlideIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.action-panel {
  display: grid;
  gap: 10px;
}

.action-panel p {
  margin: 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
}

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

.suit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suit-button {
  min-width: 80px;
  padding: 8px 12px;
  font-size: 1rem;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(226, 232, 240, 0.9)),
    #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: #111827;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.suit-label {
  font-weight: 800;
}

.mini-suit .suit-icon {
  width: 16px;
  height: 16px;
}

.suit-button.card-red {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(226, 232, 240, 0.9)),
    #fff;
  color: var(--red);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.suit-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.phodi-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, 0.08);
  color: var(--gold);
}

.hidden-hand-note {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.8rem;
}

/* ──────── Responsive ──────── */
@media (max-width: 1100px) {
  .game-grid {
    grid-template-columns: 1fr;
  }

  .score-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .login-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .login-panel,
  .sync-panel {
    grid-template-columns: 1fr;
  }

  .play-area {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto auto;
    min-height: auto;
    border-radius: 60px;
    padding: 24px;
  }

  .slot-top {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .slot-left {
    grid-column: 1;
    grid-row: 2;
  }

  .slot-right {
    grid-column: 2;
    grid-row: 2;
  }

  .center-table {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .slot-bottom {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .player-seat {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  :root {
    --card-width: 38px;
  }

  .hand {
    gap: 3px;
    row-gap: 6px;
    padding-top: 4px;
    padding-bottom: 10px;
    min-height: 50px;
  }

  .card-button {
    padding: 0;
  }

  .card-button,
  .card-face {
    border-radius: 7px;
  }

  .app-shell {
    padding: 10px;
  }

  .topbar {
    gap: 8px;
  }

  .topbar h1 {
    font-size: 1.6rem;
  }

  .topbar-brand .logo {
    font-size: 1.8rem;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1;
  }

  .login-panel,
  .sync-panel {
    padding: 12px;
  }

  .login-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .login-button {
    padding: 10px;
  }

  .sync-controls {
    flex-direction: column;
  }

  .sync-controls input {
    width: 100%;
  }

  .score-strip {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .score-card {
    padding: 10px;
  }

  .score-card b {
    font-size: 1.3rem;
  }

  .side-panel {
    padding: 14px;
  }

  .play-area {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, auto);
    padding: 16px;
    gap: 8px;
    border-radius: 32px;
  }

  .slot-top,
  .slot-left,
  .slot-right,
  .slot-bottom {
    grid-column: 1;
  }

  .slot-top {
    grid-row: 1;
  }

  .slot-left {
    grid-row: 2;
  }

  .center-table {
    grid-column: 1;
    grid-row: 3;
  }

  .slot-right {
    grid-row: 4;
  }

  .slot-bottom {
    grid-row: 5;
  }

  .player-seat {
    max-width: 100%;
  }

  .center-table {
    padding: 12px;
  }

  .card-button,
  .card-face {
    width: var(--card-width);
  }

  .card-rank {
    font-size: 0.85rem;
  }

  .card-suit {
    font-size: 1rem;
  }

  .card-face .rank {
    font-size: 0.7rem;
  }

  .card-face .suit-icon-small {
    width: 10px;
    height: 10px;
  }

  .card-face .suit-icon-large {
    width: 20px;
    height: 20px;
  }

  .card-face.card-joker .suit-icon-small {
    width: 14px;
    height: 14px;
  }

  .card-face.card-joker .suit-icon-large {
    width: 28px;
    height: 28px;
  }

  .card-suit .suit-icon {
    width: 16px;
    height: 16px;
  }

  .suit-button .suit-icon {
    width: 14px;
    height: 14px;
  }

  .inline-suit-icon {
    width: 12px;
    height: 12px;
  }

  .card-back {
    width: 20px;
    min-height: 28px;
    font-size: 0.5rem;
    border-radius: 4px;
  }

  .trick-pile {
    gap: 6px;
  }
}

/* Login screen */
.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 80% at 50% 20%, rgba(99, 102, 241, 0.15), transparent),
    radial-gradient(ellipse 60% 60% at 80% 80%, rgba(244, 63, 94, 0.1), transparent),
    linear-gradient(135deg, rgba(12, 14, 26, 0.96), rgba(10, 46, 31, 0.92)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0 1px, transparent 1px 18px);
  animation: bgPulse 10s infinite alternate;
}

@keyframes bgPulse {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

.login-stage {
  width: min(1040px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
  transform: translateY(0);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.login-stage:hover {
  transform: translateY(-4px);
  box-shadow: 0 50px 120px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.login-hero {
  position: relative;
  display: grid;
  align-content: space-between;
  min-height: 620px;
  padding: 38px;
  background:
    linear-gradient(150deg, rgba(251, 191, 36, 0.18), transparent 28%),
    linear-gradient(340deg, rgba(56, 189, 248, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(10, 46, 31, 0.86), rgba(12, 14, 26, 0.72));
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.phantx-mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  color: #0c0e1a;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  box-shadow: 0 18px 42px rgba(249, 115, 22, 0.25);
  font-size: 1.35rem;
  font-weight: 900;
}

.card-fan {
  position: absolute;
  inset: 125px 60px auto auto;
  width: 360px;
  height: 330px;
}

.fan-card {
  position: absolute;
  width: 150px;
  height: 210px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  color: #111827;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(226, 232, 240, 0.9)),
    #fff;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.34);
  font-weight: 900;
}

.fan-card .rank {
  font-size: 1.4rem;
  line-height: 1;
}

.fan-card .center-area {
  min-height: 64px;
}

.fan-card .suit-icon-small {
  width: 18px;
  height: 18px;
}

.fan-card .suit-icon-large {
  width: 56px;
  height: 56px;
}

.fan-card-one {
  left: 18px;
  top: 48px;
  transform: rotate(-15deg);
  color: #e11d48;
  z-index: 2;
}

.fan-card-two {
  left: 112px;
  top: 20px;
  transform: rotate(3deg);
  color: #0f172a;
  z-index: 3;
}

.fan-card-three {
  left: 198px;
  top: 68px;
  transform: rotate(17deg);
  color: #e2e8f0;
  background:
    linear-gradient(160deg, #0f172a, #1e293b),
    #111827;
  z-index: 4;
}

.fan-card-three .suit-icon {
  filter: brightness(1.2) drop-shadow(0 4px 10px rgba(148, 163, 184, 0.4));
}


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

.hero-copy h1 {
  margin: 10px 0 0;
  font-size: clamp(4.2rem, 10vw, 7.8rem);
  line-height: 0.82;
  letter-spacing: 0;
  color: #fff;
  text-shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
}

.login-card {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(28px, 5vw, 54px);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(12, 14, 26, 0.94)),
    rgba(12, 14, 26, 0.9);
}

.login-logo {
  width: fit-content;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(251, 191, 36, 0.08);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.login-title {
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.login-subtitle {
  max-width: 360px;
  color: #aeb8d4;
  font-size: 1rem;
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.login-form label {
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-form input::placeholder {
  color: rgba(174, 184, 212, 0.5);
}

.login-form input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px var(--accent-glow);
  transform: scale(1.01);
}

#usernameFieldContainer {
  transition: all 0.3s ease;
  overflow: hidden;
}

.login-submit {
  min-height: 54px;
  margin-top: 8px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--accent), #818cf8);
  box-shadow: 0 12px 30px var(--accent-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.login-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #818cf8, var(--accent));
  box-shadow: 0 16px 40px rgba(99, 102, 241, 0.45);
}

.login-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.login-mode-tab {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #aeb8d4;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 180ms ease;
}

.login-mode-tab.is-active {
  color: #fff;
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.12);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.12);
}

.login-mode-tab:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.login-mode-toggle {
  width: 100%;
  margin-top: 4px;
  min-height: 44px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #c7d2fe;
  border-color: transparent;
  background: transparent;
}

.login-mode-toggle:hover:not(:disabled) {
  color: #fde68a;
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
}

.login-dev-tools {
  display: none;
}

.login-error {
  min-height: 22px;
  color: #fecdd3;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.login-hint:empty {
  display: none;
}

@media (max-width: 1100px) {
  .login-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-hero {
    min-height: 300px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .card-fan {
    inset: 58px 30px auto auto;
    transform: scale(0.74);
    transform-origin: top right;
  }
}

@media (max-width: 640px) {
  .login-screen {
    padding: 12px;
    place-items: stretch;
  }

  .login-stage {
    min-height: calc(100dvh - 24px);
    border-radius: 18px;
  }

  .login-hero {
    min-height: 210px;
    padding: 22px;
  }

  .phantx-mark {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    font-size: 1rem;
  }

  .card-fan {
    inset: 34px -2px auto auto;
    transform: scale(0.46);
  }

  .hero-copy h1 {
    font-size: clamp(3rem, 18vw, 4.4rem);
  }

  .login-card {
    padding: 24px;
    align-content: start;
  }

  .login-title {
    font-size: 2.25rem;
  }

  .login-subtitle {
    font-size: 0.94rem;
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .login-screen {
    place-items: stretch;
    align-items: flex-start;
    padding: 12px;
    overflow-y: auto;
  }

  .login-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-hero {
    display: none; /* Hide hero in small landscape mode to save vertical space */
  }

  .login-card {
    padding: 24px;
    align-content: start;
  }
}

/* Modern game UI refresh */
.app-shell {
  display: grid;
  grid-template-rows: auto auto 1fr;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  width: min(1520px, 100%);
  margin: 0 auto;
  padding: 22px;
  gap: 18px;
}

.topbar {
  position: static;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.035)),
    rgba(12, 14, 26, 0.78);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.topbar-brand .logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(251, 191, 36, 0.36);
  border-radius: 14px;
  color: #0c0e1a;
  background: linear-gradient(135deg, #fbbf24, #f97316);
  font-size: 1rem;
  font-weight: 900;
  filter: none;
  box-shadow: 0 14px 30px rgba(249, 115, 22, 0.24);
}

.topbar-brand .logo-icon {
  width: 26px;
  height: 26px;
}

.topbar h1 {
  letter-spacing: 0;
}

.user-badge {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(34, 197, 94, 0.24);
  border-radius: 999px;
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.09);
  font-size: 0.82rem;
  font-weight: 800;
}

.score-strip {
  gap: 12px;
}

.score-card {
  min-height: 112px;
  padding: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035)),
    rgba(15, 23, 42, 0.64);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
}

.score-card::after {
  content: '';
  position: absolute;
  inset: auto 12px 12px auto;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
}

.score-card span {
  color: #96a3c7;
}

.score-card strong {
  position: relative;
  z-index: 1;
  min-height: 26px;
  color: #f8fafc;
  font-size: 0.95rem;
}

.score-card b {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  font-size: 2rem;
}

.game-grid {
  grid-template-columns: minmax(288px, 330px) minmax(0, 1fr);
  gap: 18px;
}

.side-panel {
  position: sticky;
  top: 104px;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    rgba(15, 23, 42, 0.7);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.22);
}

.panel-section {
  padding: 0 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.state-list div {
  padding: 10px 0;
}

.state-list dd {
  color: #f8fafc;
}

.trick-score span {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(34, 197, 94, 0.13), rgba(56, 189, 248, 0.08)),
    rgba(255, 255, 255, 0.05);
}

.event-log {
  max-height: 300px;
  padding: 0 4px 0 22px;
}

.event-log li {
  padding: 7px 0;
  color: #b6c0d8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.event-log li:last-child {
  border-bottom: 0;
}

.play-area {
  position: relative;
  min-height: 650px;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at center, rgba(251, 191, 36, 0.12), transparent 21%),
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(34, 197, 94, 0.16), transparent 58%),
    linear-gradient(150deg, #073021 0%, #0c5137 45%, #061d18 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    inset 0 0 0 7px rgba(255, 255, 255, 0.035),
    inset 0 0 80px rgba(0, 0, 0, 0.28),
    0 28px 80px rgba(0, 0, 0, 0.28);
}

.table-overlay {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  pointer-events: none;
  z-index: 1;
}

.table-overlay-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.team-score-spot {
  display: flex;
}

.team-score-spot:first-child {
  justify-content: flex-end;
}

.team-score-spot:last-child {
  justify-content: flex-start;
}

.center-score-pill {
  min-width: 110px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.7), rgba(3, 7, 18, 0.32));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.center-score-pill span {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.72);
}

.center-score-pill b {
  font-size: 1.25rem;
  font-weight: 950;
  color: #fff;
}

.team-a-pill {
  border-color: rgba(34, 197, 94, 0.35);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22), 0 0 22px rgba(34, 197, 94, 0.12);
}

.team-b-pill {
  border-color: rgba(56, 189, 248, 0.35);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22), 0 0 22px rgba(56, 189, 248, 0.12);
}

.trump-spot,
.haath-spot {
  pointer-events: none;
}

.trump-badge {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 16px;
  border: 1px solid rgba(251, 191, 36, 0.4);
  background:
    radial-gradient(circle at 20% 10%, rgba(251, 191, 36, 0.18), transparent 50%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(3, 7, 18, 0.35));
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.25),
    0 0 0 2px rgba(251, 191, 36, 0.16),
    0 0 30px rgba(251, 191, 36, 0.14);
  color: #fde68a;
  min-width: 190px;
}

.trump-title {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(253, 230, 138, 0.85);
}

.trump-main {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.trump-icon {
  width: 26px;
  height: 26px;
  filter: brightness(1.9) drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
}

.trump-name {
  font-size: 1.05rem;
  color: #fff;
}

.haath-panel {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.62), rgba(3, 7, 18, 0.25));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
  min-width: 210px;
  color: #e2e8f0;
}

.haath-title {
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.78);
}

.haath-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.haath-name {
  font-weight: 800;
  font-size: 0.82rem;
  color: rgba(226, 232, 240, 0.9);
}

.haath-count {
  min-width: 34px;
  text-align: center;
  font-weight: 900;
  font-size: 0.9rem;
  padding: 4px 10px;
  border-radius: 999px;
  color: #0b1220;
  background: linear-gradient(135deg, rgba(251, 191, 36, 1), rgba(99, 102, 241, 0.9));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.badge.badge-subtle {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
}

.play-area::before {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(251, 191, 36, 0.18);
  border-radius: 17px;
  pointer-events: none;
}

.player-seat {
  padding: 14px;
  border-radius: 16px;
  position: relative;
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.78), rgba(15, 23, 42, 0.48)),
    rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

.player-seat.is-self {
  padding: 16px;
  width: min(520px, 100%);
  max-width: 520px;
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow:
    0 20px 46px rgba(0, 0, 0, 0.28),
    0 0 0 2px rgba(99, 102, 241, 0.35),
    0 0 28px rgba(99, 102, 241, 0.35);
  background:
    linear-gradient(145deg, rgba(30, 41, 59, 0.88), rgba(15, 23, 42, 0.58)),
    rgba(0, 0, 0, 0.32);
}

.player-seat.is-self::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 20px;
  border: 1px solid rgba(129, 140, 248, 0.4);
  pointer-events: none;
}

.seat-header h3 {
  color: #f8fafc;
  font-size: 1rem;
}

.seat-header span {
  color: #98a4c0;
}

.badge {
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
}

.badge.turn {
  color: #111827;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.badge.login {
  background: linear-gradient(135deg, var(--accent), #38bdf8);
}

.hand {
  gap: 6px;
  row-gap: 8px;
  min-height: 70px;
}

.seat-actions {
  display: grid;
  gap: 8px;
  min-height: 0;
}

.seat-action-label {
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.seat-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seat-actions .action-button {
  min-width: 88px;
}

.mini-suit {
  min-width: 44px;
  min-height: 38px;
  padding: 0 10px;
}

.card-button,
.card-face {
  width: var(--card-width);
  height: auto;
  aspect-ratio: 5 / 7;
  border-radius: 10px;
  box-sizing: border-box;
}

.card-button {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.card-face {
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.97), rgba(226, 232, 240, 0.92)),
    #fff;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.3);
  font-weight: 900;
}

.card-joker {
  color: #e2e8f0;
  background:
    linear-gradient(160deg, #0f172a, #1e293b),
    #111827;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
}

.card-joker .suit-icon {
  object-fit: contain;
  filter: brightness(1.2) drop-shadow(0 4px 10px rgba(148, 163, 184, 0.4));
}

.card-button:hover:not(:disabled) .card-face {
  border-color: rgba(251, 191, 36, 0.72);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34), 0 0 0 3px rgba(251, 191, 36, 0.15);
}

.card-back {
  width: 34px;
  min-height: 48px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 8px),
    radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.14) 0 2px, transparent 2px 8px),
    repeating-linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0 3px, rgba(30, 64, 175, 0.35) 3px 6px),
    linear-gradient(160deg, #1e3a8a, #0f172a);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

.center-table {
  min-height: 245px;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(3, 7, 18, 0.5), rgba(3, 7, 18, 0.22)),
    rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.025),
    0 22px 48px rgba(0, 0, 0, 0.22);
}

.status-line {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(251, 191, 36, 0.26);
  border-radius: 999px;
  color: #fde68a;
  background: rgba(251, 191, 36, 0.08);
  font-size: 0.9rem;
}

.trick-pile {
  min-height: 112px;
  padding: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.action-panel {
  min-height: 76px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.action-row,
.suit-actions {
  gap: 10px;
}

.action-button {
  min-width: 112px;
}

.suit-button {
  min-width: 116px;
  border-radius: 12px;
}

.seat-actions .mini-suit {
  min-width: 44px;
  min-height: 38px;
  padding: 0 10px;
}

.trick-winner-banner {
  justify-content: center;
  border-radius: 14px;
}

@media (max-width: 1100px) {

  .topbar,
  .side-panel {
    position: static;
  }

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

  .play-area {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    top: 0;
    border-radius: 14px;
  }

  .user-badge {
    width: 100%;
    justify-content: center;
  }

  .score-card {
    min-height: 94px;
  }

  .play-area {
    padding: 10px;
    border-radius: 18px;
  }

  .table-overlay {
    flex-direction: column;
    align-items: center;
  }

  .table-overlay-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .team-score-spot:first-child,
  .team-score-spot:last-child {
    justify-content: center;
  }

  .trump-badge,
  .haath-panel {
    width: min(360px, 100%);
  }

  .play-area::before {
    inset: 8px;
    border-radius: 14px;
  }

  .hand {
    gap: 3px;
    row-gap: 6px;
    min-height: 50px;
  }

  .card-button,
  .card-face {
    width: var(--card-width);
    border-radius: 7px;
  }

  .card-face .rank {
    font-size: 0.7rem;
  }

  .card-face .suit-icon-small {
    width: 10px;
    height: 10px;
  }

  .card-face .suit-icon-large {
    width: 20px;
    height: 20px;
  }

  .card-face {
    padding: 4px 3px;
  }

  .card-face.card-joker .suit-icon-small {
    width: 14px;
    height: 14px;
  }

  .card-face.card-joker .suit-icon-large {
    width: 28px;
    height: 28px;
  }

  .card-back {
    width: 20px;
    min-height: 28px;
    border-radius: 4px;
  }

  .player-seat {
    padding: 10px;
  }

  .player-seat.is-self {
    padding: 12px;
    width: 100%;
    max-width: 100%;
  }
}

/* Lobby styles */
.lobby-screen .login-stage {
  width: min(720px, 100%);
  grid-template-columns: 1fr;
  min-height: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.lobby-screen .login-card {
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.38);
}


.room-selection-card {
  text-align: left;
  align-content: start;
}

.lobby-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.lobby-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.lobby-title .login-logo {
  margin: 0;
}

.lobby-title .login-title {
  margin: 0;
}

.lobby-title .login-subtitle {
  margin-top: 6px;
}

.lobby-screen .login-subtitle {
  max-width: 100%;
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  margin-top: 1.5rem;
}

.lobby-choice {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  flex-shrink: 0;
}

.lobby-choice button {
  min-height: 44px;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  padding: 0 16px !important;
  flex: 1;
}

.lobby-choice button.is-active {
  border-color: rgba(251, 191, 36, 0.7);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.2);
}

.lobby-panel {
  padding: 0.25rem 0 0;
}

.lobby-form {
  gap: 0.75rem;
}

.lobby-form button {
  width: 100%;
}

.secondary-button {
  color: #c7d2fe;
  background: rgba(15, 23, 42, 0.55);
  box-shadow: none;
  padding: 0 18px;
  border: 1px solid rgba(129, 140, 248, 0.55);
}

.secondary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: rgba(30, 41, 59, 0.6);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.35);
}

@media (max-width: 768px) {
  .lobby-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .lobby-choice {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .lobby-screen .login-stage {
    width: 100%;
  }

  .lobby-screen .login-card {
    padding: 20px;
  }

  .lobby-header {
    flex-direction: column;
    gap: 1.2rem;
    align-items: stretch;
  }

  .lobby-choice {
    grid-template-columns: repeat(2, 1fr);
  }

  .lobby-title {
    gap: 10px;
  }

  .lobby-title .login-title {
    font-size: 1.8rem;
  }

  .login-logo {
    padding: 0 8px !important;
    font-size: 0.65rem !important;
  }
}

.teams-container {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.team-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.team-column h3 {
  color: #fff;
  font-size: 1rem;
  margin: 0 0 0.5rem 0;
  text-align: center;
}

.seat-btn {
  padding: 0.75rem;
  font-size: 0.9rem;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seat-btn[data-taken="true"] {
  background: rgba(251, 191, 36, 0.15);
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(251, 191, 36, 0.4);
  cursor: not-allowed;
}
/* ═══════════════════════════════════════════════════ */
/* ═══  COMPACT NAVBAR                             ═══ */
/* ═══════════════════════════════════════════════════ */

.topbar-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  border-radius: 14px;
  min-height: auto;
  flex-shrink: 0;
}

.topbar-compact .topbar-actions {
  margin-left: auto;
}

.topbar-compact .topbar-brand {
  gap: 10px;
}

.topbar-compact h1 {
  font-size: 1.1rem;
}

.topbar-compact .logo-sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.topbar-compact .logo-sm .logo-icon {
  width: 20px;
  height: 20px;
}

/* ═══════════════════════════════════════════════════ */
/* ═══  SCOREBOARD BAR                             ═══ */
/* ═══════════════════════════════════════════════════ */

.scoreboard-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: min(1020px, 100%);
  align-self: center;
  padding: 6px 10px;
  margin-top: 6px;
  flex-shrink: 0;
}

.sb-team {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.sb-team-a {
  border-left: 4px solid #3b82f6;
  border-radius: 12px 0 0 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.15), rgba(255, 255, 255, 0.06));
}

.sb-team-b {
  border-right: 4px solid #9333ea;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(147, 51, 234, 0.15));
}

.sb-team-label {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sb-team-a .sb-team-label { color: #93c5fd; }
.sb-team-b .sb-team-label { color: #d8b4fe; }

.sb-team-names {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sb-team-score {
  font-size: 1.4rem;
  font-weight: 900;
  min-width: 28px;
  text-align: center;
  text-shadow: 0 0 12px currentColor;
}

.sb-team-a .sb-team-score { color: #60a5fa; }
.sb-team-b .sb-team-score { color: #c084fc; }

.sb-center {
  padding: 8px 22px;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(253, 230, 138, 0.2);
}

.sb-round {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fde68a;
}

@media (max-width: 640px) {
  .scoreboard-bar { display: none; }
}

/* ═══════════════════════════════════════════════════ */
/* ═══  FULL-VIEW APP SHELL                        ═══ */
/* ═══════════════════════════════════════════════════ */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  padding: clamp(6px, 1.2vw, 10px);
  gap: clamp(4px, 1vw, 8px);
  overflow: hidden;
}

/* ── 3-column game layout ── */
.game-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  gap: 10px;
  align-items: stretch;
  padding-top: 16px;
}

/* ── Info panels (left & right) ── */
.table-info-panel {
  width: 160px;
  min-width: 140px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  scrollbar-width: none;
}

.table-info-panel::-webkit-scrollbar {
  display: none;
}

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-card-label {
  font-size: 0.55rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.info-card-value {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.info-panel-header {
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 6px 10px 0;
}

.info-log {
  list-style-position: inside;
  padding: 0 10px 10px;
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-log li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.68rem;
  list-style: none;
}

/* ═══════════════════════════════════════════════════ */
/* ═══  POKER TABLE LAYOUT                        ═══ */
/* ═══════════════════════════════════════════════════ */

.poker-table-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(6px, 1.2vh, 10px);
  flex: 1;
  min-height: 0;
  min-width: 0;
  margin: 0 auto;
  padding: clamp(42px, 7vh, 68px) 10px 4px;
}

/* ── The Oval Table ── */
.poker-table {
  position: relative;
  width: 100%;
  max-width: 1020px;
  aspect-ratio: 2.2 / 1;
  max-height: clamp(280px, 52vh, 560px);
  border-radius: 9999px;
  border: 22px solid #8a3324;
  background: radial-gradient(ellipse at center, #22c55e 0%, #166534 50%, #14532d 100%);
  background-clip: padding-box;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.6),
    inset 0 10px 20px rgba(0, 0, 0, 0.8),
    0 0 0 4px rgba(138, 51, 36, 0.6);
  overflow: visible;
}

/* Inner shadow/glow effect */
.table-inner-shadow {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 2;
}

/* Decorative gold betting line */
.table-betting-line {
  position: absolute;
  inset: 24px;
  border-radius: 9999px;
  border: 2px solid rgba(255, 215, 0, 0.4);
  pointer-events: none;
  z-index: 3;
}


.table-throw-area {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8;
  width: clamp(128px, 24vw, 192px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: none;
  border-radius: 999px;
  display: grid;
  place-items: center;
  pointer-events: none;
}


/* ── Player Avatar Slots ── */
.avatar-slot {
  position: absolute;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.avatar-top {
  top: -5%;
  left: 50%;
  transform: translate(-50%, -100%);
}

.avatar-left {
  top: 50%;
  left: 0%;
  transform: translate(-120%, -50%);
}

.avatar-right {
  top: 50%;
  right: 0%;
  transform: translate(120%, -50%);
}

.avatar-bottom {
  bottom: 0%;
  left: 50%;
  transform: translate(-50%, 70%);
}

/* ── Player Avatar Box ── */
.player-avatar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 4px solid;
  background: #f3f4f6;
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.55),
    inset 0 3px 5px rgba(0, 0, 0, 0.4);
  color: #4b5563;
  transition: all 0.3s ease;
  z-index: 40;
}

.avatar-user-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}

.avatar-name {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.9);
}

/* Team A = Blue */
.team-a-avatar {
  border-color: rgba(59, 130, 246, 0.9);
}

/* Team B = Purple */
.team-b-avatar {
  border-color: rgba(168, 85, 247, 0.9);
}

.team-a-avatar .avatar-name {
  color: #60a5fa;
}

.team-b-avatar .avatar-name {
  color: #c084fc;
}

/* Self = gold ring */
.avatar-self {
  box-shadow:
    0 0 0 3px rgba(251, 191, 36, 0.6),
    0 8px 16px rgba(0, 0, 0, 0.55),
    0 0 20px rgba(251, 191, 36, 0.25);
  transform: scale(1.08);
}

/* Turn indicator = pulsing border */
.avatar-turn {
  animation: avatarPulse 1.5s ease-in-out infinite;
}

.player-avatar.avatar-self .avatar-name {
  top: auto;
  bottom: calc(100% + 10px);
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}

@keyframes avatarPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.5), 0 8px 24px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.9), 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 30px rgba(251, 191, 36, 0.4); }
}

/* Team badge below avatar */
.avatar-team-badge {
  position: absolute;
  bottom: -10px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  color: #fff;
  border: 1px solid;
  white-space: nowrap;
}

.avatar-team-a-badge {
  background: rgba(30, 64, 175, 0.95);
  border-color: rgba(96, 165, 250, 0.6);
}

.avatar-team-b-badge {
  background: rgba(107, 33, 168, 0.95);
  border-color: rgba(192, 132, 252, 0.6);
}

/* Small role badges (D=dealer, C=cutter, ★=declarer) */
.avatar-roles {
  position: absolute;
  top: -8px;
  right: -8px;
  display: flex;
  gap: 3px;
}

.avatar-role-badge {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.55rem;
  font-weight: 900;
  color: #111;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.avatar-role-declarer {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
}

.avatar-role-haath {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #fff;
}

/* ── Trump Display on Table ── */
.table-trump-display {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
}

.on-table-trump {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 20px rgba(251, 191, 36, 0.15);
}

.on-table-trump-label {
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: rgba(253, 230, 138, 0.85);
  text-transform: uppercase;
}

.on-table-trump-suit {
  width: 24px;
  height: 24px;
  filter: brightness(1.6) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

.on-table-trump-name {
  font-size: 0.6rem;
  font-weight: 800;
  color: #fff;
}

/* ── Cut Card on Table ── */
.table-cut-card {
  position: absolute;
  z-index: 15;
  pointer-events: none;
  transition: all 0.4s ease;
}

/* ── Phodi reveal on table ── */
.table-phodi-display {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 19;
  pointer-events: none;
}

.table-phodi-display:empty {
  display: none;
}

.on-table-phodi {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), 0 0 24px rgba(251, 191, 36, 0.18);
  animation: phodiRevealIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.on-table-phodi-label {
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(253, 230, 138, 0.9);
}

.on-table-phodi-player {
  font-size: 0.62rem;
  font-weight: 800;
  color: #fde68a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.on-table-phodi-cards {
  display: flex;
  align-items: center;
  gap: 10px;
}

.on-table-phodi-cards .playing-card {
  transform: scale(0.72);
  transform-origin: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

@keyframes phodiRevealIn {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.info-card-value .inline-card + .inline-card {
  margin-left: 4px;
}

/* Positions near each player slot (closer to players) */
.cut-pos-bottom {
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
}

.cut-pos-top {
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
}

.cut-pos-left {
  top: 50%;
  left: 12%;
  transform: translateY(-50%);
}

.cut-pos-right {
  top: 50%;
  right: 12%;
  transform: translateY(-50%);
}

.cut-card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.cut-card-tag {
  font-size: 0.48rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(253, 230, 138, 0.8);
  background: rgba(0, 0, 0, 0.5);
  padding: 1px 8px;
  border-radius: 999px;
}

/* Scale the real card component down for the cut card */
.cut-card-wrapper .playing-card {
  transform: scale(0.65);
  transform-origin: top center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Card back for hidden cut card */
.card-back {
  display: block;
  width: 54px;
  height: 78px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background:
    repeating-linear-gradient(135deg, rgba(59,130,246,0.35) 0 3px, rgba(30,64,175,0.35) 3px 6px),
    linear-gradient(160deg, #1e3a8a, #0f172a);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transform: scale(0.65);
  transform-origin: top center;
}

/* ── Status Message (center of table) ── */
.table-status-msg {
  position: absolute;
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(253, 230, 138, 0.3);
  color: #fde68a;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
}

.table-status-msg:empty {
  display: none;
}

/* ── Player Actions on Table ── */
.table-player-actions {
  position: absolute;
  bottom: 16%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 22;
  display: flex;
  justify-content: center;
}

.table-player-actions:empty {
  display: none;
}

.on-table-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.on-table-actions .seat-action-label {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(253, 230, 138, 0.3);
  color: #fde68a;
  padding: 3px 14px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.on-table-actions .seat-action-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.on-table-actions .action-button {
  font-size: 0.75rem;
  padding: 6px 18px;
  min-width: 60px;
}

.on-table-actions .suit-button {
  padding: 6px 10px;
}

/* ── Trick Pile (played cards on the table) ── */
.table-trick-pile {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

.table-trick-pile:empty {
  display: none;
}

.table-trick-pile .played-card {
  pointer-events: auto;
}

/* ── Bottom Hand Area ── */
.bottom-hand-area {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: clamp(6px, 1.8vh, 16px);
}

.bottom-hand-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: min(700px, 92vw);
}

@media (max-height: 760px) {
  .poker-table {
    max-height: 46vh;
  }

  .poker-table-wrapper {
    padding-top: 42px;
  }

  .bottom-hand-area {
    margin-top: 6px;
  }
}

.bottom-hand-content .hand {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: nowrap;
  min-height: 70px;
  overflow: visible;
  padding: 4px 0 12px;
}

.bottom-hand-content .hand .card-button {
  margin: 0 -4px;
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 200ms ease;
}

.bottom-hand-content .hand .card-button:hover:not(:disabled) {
  transform: translateY(-16px) scale(1.1);
  z-index: 10;
}

.bottom-hand-content .seat-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding-top: 4px;
}

.bottom-hand-content .seat-action-label {
  background: rgba(15, 23, 42, 0.75);
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid rgba(253, 230, 138, 0.3);
}

.bottom-hand-content .seat-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* ═══ Responsive overrides for poker table ═══ */

@media (max-width: 1100px) {
  .poker-table {
    border-width: 22px;
  }

  .table-betting-line {
    inset: 18px;
  }

  .player-avatar {
    width: 52px;
    height: 52px;
  }

}

@media (max-width: 768px) {
  .poker-table {
    border-width: 16px;
    aspect-ratio: 2 / 1;
  }

  .table-betting-line {
    inset: 12px;
  }

  .player-avatar {
    width: 48px;
    height: 48px;
    border-radius: 999px;
  }


  .avatar-name {
    font-size: 0.5rem;
    max-width: 72px;
  }

  .avatar-user-icon {
    width: 16px;
    height: 16px;
  }


  .avatar-team-badge {
    font-size: 0.5rem;
    padding: 1px 5px;
    bottom: -8px;
  }

  .on-table-trump-suit {
    width: 22px;
    height: 22px;
  }

  .cut-card-wrapper .playing-card,
  .card-back {
    transform: scale(0.55);
  }

  .table-status-msg {
    font-size: 0.65rem;
  }

  .optic-score-chip {
    padding: 3px 8px;
    font-size: 0.55rem;
  }

  .optic-score-value {
    font-size: 0.8rem;
  }

  .optic-round-pill {
    font-size: 0.5rem;
    padding: 2px 8px;
  }

  .bottom-hand-content .hand {
    gap: 2px;
  }

  .bottom-hand-content .hand .card-button {
    margin: 0 -5px;
  }
}

@media (max-width: 640px) {
  .poker-table {
    border-width: 12px;
    aspect-ratio: 1.8 / 1;
  }

  .table-betting-line {
    inset: 8px;
    border-width: 1px;
  }

  .player-avatar {
    width: 44px;
    height: 44px;
    border-radius: 999px;
  }


  .avatar-user-icon {
    width: 14px;
    height: 14px;
  }

  .avatar-name {
    font-size: 0.48rem;
    max-width: 64px;
  }


  .avatar-team-badge {
    font-size: 0.45rem;
    padding: 1px 4px;
    bottom: -7px;
  }

  .avatar-role-badge {
    width: 16px;
    height: 16px;
    font-size: 0.48rem;
  }

  .on-table-trump {
    padding: 5px 10px;
  }
  .on-table-trump-suit {
    width: 18px;
    height: 18px;
  }

  .on-table-trump-name {
    font-size: 0.55rem;
  }

  .cut-card-wrapper .playing-card,
  .card-back {
    transform: scale(0.5);
  }

  .table-status-msg {
    font-size: 0.58rem;
    padding: 3px 10px;
  }

  .table-info-panel {
    display: none;
  }
}

/* ──────── 6-Player Refinements ──────── */
.login-select {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  font-family: inherit;
  font-size: 0.95rem;
}

.login-select:focus {
  border-color: rgba(251, 191, 36, 0.72);
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.12);
}

.avatar-slot-6-0 {
  bottom: 0%;
  left: 50%;
  transform: translate(-50%, 70%);
}
.avatar-slot-6-1 {
  bottom: 22%;
  right: 0%;
  transform: translate(110%, 50%);
}
.avatar-slot-6-2 {
  top: 22%;
  right: 0%;
  transform: translate(110%, -50%);
}
.avatar-slot-6-3 {
  top: -5%;
  left: 50%;
  transform: translate(-50%, -100%);
}
.avatar-slot-6-4 {
  top: 22%;
  left: 0%;
  transform: translate(-110%, -50%);
}
.avatar-slot-6-5 {
  bottom: 22%;
  left: 0%;
  transform: translate(-110%, 50%);
}

@media (max-width: 768px) {
  .avatar-slot-6-1 {
    transform: translate(90%, 50%);
  }
  .avatar-slot-6-2 {
    transform: translate(90%, -50%);
  }
  .avatar-slot-6-4 {
    transform: translate(-90%, -50%);
  }
  .avatar-slot-6-5 {
    transform: translate(-90%, 50%);
  }
}

@media (max-width: 640px) {
  .avatar-slot-6-0 { transform: translate(-50%, 60%) !important; }
  .avatar-slot-6-1 { transform: translate(95%, 40%) !important; }
  .avatar-slot-6-2 { transform: translate(95%, -40%) !important; }
  .avatar-slot-6-3 { transform: translate(-50%, -95%) !important; }
  .avatar-slot-6-4 { transform: translate(-95%, -40%) !important; }
  .avatar-slot-6-5 { transform: translate(-95%, 40%) !important; }
}

/* ═══════════════════════════════════════════════════ */
/* ═══  FLOATING GAME HUD                          ═══ */
/* ═══════════════════════════════════════════════════ */

.game-hud {
  display: none; /* shown on mobile via media query */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  padding-top: max(env(safe-area-inset-top, 8px), 8px);
  pointer-events: none;
}

.game-hud > * {
  pointer-events: auto;
}

.hud-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(12, 14, 26, 0.7);
  backdrop-filter: blur(16px);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.hud-btn:active {
  transform: scale(0.92);
  background: rgba(12, 14, 26, 0.9);
}

.hud-score-pill {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(12, 14, 26, 0.7);
  backdrop-filter: blur(16px);
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 800;
}

.hud-team {
  padding: 6px 12px;
  letter-spacing: 0.06em;
}

.hud-team b {
  font-size: 0.9rem;
  font-weight: 900;
}

.hud-team-a {
  color: #93c5fd;
}

.hud-team-b {
  color: #d8b4fe;
}

.hud-round {
  padding: 6px 10px;
  background: rgba(253, 230, 138, 0.12);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  color: #fde68a;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

/* ═══════════════════════════════════════════════════ */
/* ═══  GAME MENU DRAWER                           ═══ */
/* ═══════════════════════════════════════════════════ */

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.is-open {
  display: block;
  opacity: 1;
}

.game-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  width: min(320px, 85vw);
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.97), rgba(12, 14, 26, 0.98));
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 20px 0 60px rgba(0, 0, 0, 0.6);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-top: max(env(safe-area-inset-top, 0px), 0px);
}

.game-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-logo {
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fde68a;
}

.drawer-close-btn {
  background: rgba(255, 255, 255, 0.06);
}

.drawer-user {
  padding: 10px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-user .user-badge {
  width: 100%;
  justify-content: center;
}

.drawer-section {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.drawer-section-title {
  font-size: 0.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.drawer-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.drawer-info-row:last-child {
  border-bottom: 0;
}

.drawer-info-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.drawer-info-value {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
}

.drawer-log-section {
  max-height: 200px;
  overflow-y: auto;
}

.drawer-log {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-log li {
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.drawer-actions {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
}

.drawer-actions button {
  width: 100%;
}

/* ═══════════════════════════════════════════════════ */
/* ═══  NEW DESKTOP/LANDSCAPE UI (MATCHING MOCKUP) ═══ */
/* ═══════════════════════════════════════════════════ */

/* Header */
.game-header.desktop-only {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.1); }

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.crown-icon { color: var(--gold); font-size: 1.4rem; }
.header-brand h1 { font-size: 1.2rem; font-weight: 800; letter-spacing: 1px; color: white; margin: 0; }

.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.scoreboard-pill {
  display: flex;
  align-items: center;
  background: #0f1222;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  overflow: hidden;
}
.sb-side { display: flex; align-items: center; gap: 12px; padding: 8px 24px; }
.sb-team-a { color: #60a5fa; }
.sb-team-b { color: #c084fc; }
.sb-label { font-size: 0.75rem; font-weight: 800; letter-spacing: 1px; }
.sb-score { font-size: 1.8rem; font-weight: 900; }
.sb-mid {
  background: rgba(251, 191, 36, 0.1);
  padding: 8px 24px;
  border-left: 1px solid rgba(251, 191, 36, 0.2);
  border-right: 1px solid rgba(251, 191, 36, 0.2);
}
.sb-round { color: var(--gold); font-size: 1.2rem; font-weight: 900; }

/* Main Layout */
.game-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
}

.left-sidebar-tab {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: none;
  padding: 24px 8px;
  border-radius: 0 12px 12px 0;
  cursor: pointer;
  z-index: 100;
}

/* Right Sidebar */
.right-sidebar-panel {
  width: 280px;
  background: #0f1222;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  margin-right: 24px;
  margin-top: 80px;
  margin-bottom: 24px;
  display: none; /* hidden by default */
  flex-direction: column;
  padding: 20px;
  z-index: 100;
}
.right-sidebar-panel.is-open {
  display: flex;
}
.sidebar-section { margin-bottom: 24px; }
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
}
.sidebar-line { flex: 1; border: none; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar-info-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; letter-spacing: 1px; }
.sidebar-value { font-size: 0.9rem; font-weight: 700; color: white; }
.text-gold { color: var(--gold) !important; }
.sidebar-log-section { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.sidebar-log {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-right: 8px;
}
.sidebar-log li { margin-bottom: 12px; line-height: 1.4; }
.sidebar-log li span { color: #c084fc; }
.sidebar-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  color: white;
  padding: 12px;
  font-weight: 800;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: auto;
}

/* Table Overrides */
.poker-table-wrapper {
  flex: 1;
  padding: 120px 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
}
.poker-table {
  border: 24px solid #5d4037; /* Wood rim */
  box-shadow: 
    inset 0 10px 30px rgba(0,0,0,0.8),
    0 20px 50px rgba(0,0,0,0.8),
    0 0 0 2px #3e2723,
    inset 0 0 0 2px #8d6e63;
  background: radial-gradient(ellipse at center, #0e6c38 0%, #06401e 100%);
  aspect-ratio: 2.2 / 1;
  max-width: 900px;
  max-height: 55vh;
}
.table-betting-line {
  inset: 20px;
  border: 1.5px dashed rgba(251, 191, 36, 0.5);
}

/* Center Table Elements */
.table-status-container {
  position: absolute;
  top: 78%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 5;
}
.table-status-pill {
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: white;
  font-weight: 800;
  letter-spacing: 1px;
  font-size: 0.75rem;
  padding: 6px 24px;
  border-radius: 24px;
}
.table-status-decorator {
  width: 40px;
  height: 2px;
  background: rgba(251, 191, 36, 0.4);
}
.cut-card-tag {
  background: rgba(0,0,0,0.6);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 6px;
  display: block;
  text-align: center;
}

/* Avatars */
.player-avatar {
  background: #0f1222;
  border: 3px solid rgba(255,255,255,0.1);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-avatar.team-a-avatar { border-color: #3b82f6; box-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }
.player-avatar.team-b-avatar { border-color: #9333ea; box-shadow: 0 0 20px rgba(147, 51, 234, 0.4); }
/* Removed .avatar-self yellow border to respect team colors */

.avatar-p-badge {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  background: #3b82f6;
  color: white;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 8px;
}
.team-b-avatar .avatar-p-badge { background: #9333ea; }
.avatar-chip-count {
  position: absolute;
  bottom: -24px;
  background: rgba(0,0,0,0.7);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.chip-icon {
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 1px dashed white;
}
.avatar-roles { position: absolute; top: -10px; left: -10px; }
.avatar-role-badge {
  background: var(--gold);
  color: black;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 900;
}
.avatar-name { display: none; } /* Hide old name label */

/* Turn indicator */
@keyframes intenseTurnPulse {
  0%, 100% { box-shadow: 0 0 0 4px white, 0 0 15px rgba(255,255,255,0.5); }
  50% { box-shadow: 0 0 0 8px white, 0 0 30px rgba(255,255,255,0.8); }
}
.player-avatar.avatar-turn {
  animation: intenseTurnPulse 1s ease-in-out infinite !important;
  z-index: 10;
}

/* Bottom Area & Action Bar */
.bottom-area-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
}
.bottom-hand-content .hand {
  padding-bottom: 0;
  min-height: auto;
}
.bottom-hand-content .hand .card-button {
  width: 80px;
}
.bottom-action-bar {
  display: flex;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 12px 24px;
  border-radius: 16px;
  gap: 16px;
  margin-top: -12px;
  z-index: 20;
}
.action-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 10px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.action-btn:hover { background: rgba(255,255,255,0.1); }
.btn-gold {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border-color: #fbbf24;
  color: black;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 4px 12px var(--gold-glow); }
.btn-red-text { color: #ef4444; }

/* ═══════════════════════════════════════════════════ */
/* ═══  MOBILE GAME LAYOUT OVERHAUL                ═══ */
/* ═══════════════════════════════════════════════════ */

@media (max-width: 1100px) {
  /* Hide desktop topbar and desktop-only elements on tablet/mobile */
  .desktop-only,
  .desktop-only-topbar {
    display: none !important;
  }

  /* Show floating HUD on tablet/mobile */
  .game-hud {
    display: flex;
  }

  /* Hide side panels on tablet/mobile — info is in the drawer */
  .table-info-panel {
    display: none !important;
  }

  /* Scoreboard bar hidden on mobile (scores are in HUD) */
  .scoreboard-bar {
    display: none !important;
  }

  /* App shell: fill the entire viewport */
  .app-shell {
    padding: 0 !important;
    gap: 0 !important;
    height: 100dvh;
    overflow: hidden;
  }

  /* Game layout: single column, fill everything */
  .game-layout {
    padding-top: 0;
    gap: 0;
  }

  /* Table wrapper: let it fill space and push hand to bottom */
  .poker-table-wrapper {
    padding-top: calc(max(env(safe-area-inset-top, 8px), 8px) + 52px);
    padding-left: 6px;
    padding-right: 6px;
    padding-bottom: 4px;
    justify-content: flex-start;
  }

  /* Hand area and actions at the bottom */
  .bottom-area-container {
    margin-top: auto;
    padding-bottom: max(env(safe-area-inset-bottom, 8px), 8px);
  }
  .bottom-hand-area {
    margin-top: 0;
    padding-bottom: 0;
  }
}

/* Extra small screens (phones) */
@media (max-width: 640px) {
  .poker-table-wrapper {
    padding-top: calc(max(env(safe-area-inset-top, 6px), 6px) + 48px);
    padding-left: 4px;
    padding-right: 4px;
  }

  .poker-table {
    max-height: 55vh;
  }

  .bottom-hand-content .hand {
    min-height: 55px;
    padding-bottom: 8px;
  }

  .bottom-hand-content .hand .card-button {
    margin: 0 -6px;
  }
}

/* Landscape mode fix for game screen */
@media (max-height: 500px) and (orientation: landscape) {
  .poker-table {
    max-height: 65vh;
    border-width: 8px;
  }

  .poker-table-wrapper {
    padding-top: calc(max(env(safe-area-inset-top, 4px), 4px) + 44px);
  }

  .player-avatar {
    transform: scale(0.75);
  }

  .bottom-hand-content .hand .card-button {
    margin: 0 -8px;
  }
}

/* Desktop: hide HUD and drawer, show topbar */
@media (min-width: 1101px) {
  .game-hud,
  .drawer-backdrop,
  .game-drawer {
    display: none !important;
  }
}
