:root {
  color-scheme: light;
  --felt: #f3ecda;
  --felt-dark: #17261d;
  --ink: #17261d;
  --paper: #fbf7ed;
  --muted: #e9dfc8;
  --gold: #cf9f52;
  --red: #a74e2f;
  --black: #17261d;
  --line: rgba(23, 38, 29, 0.24);
  --panel: rgba(23, 38, 29, 0.86);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow: hidden;
  background: var(--felt-dark);
  color: white;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

#felt {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

.table {
  position: relative;
  z-index: 1;
  width: min(1220px, calc(100vw - 28px));
  height: 100vh;
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto auto;
  gap: 14px;
  padding: 18px 0 20px;
}

.cover {
  justify-items: center;
  position: relative;
  min-height: calc(100vh - 38px);
  display: grid;
  place-content: center;
  gap: 20px;
  text-align: center;
  padding-top: 138px;
}

.cover h1 {
  font-size: clamp(4rem, 13vw, 9rem);
}

.howto-card {
  position: absolute;
  top: 12px;
  left: 50%;
  width: 112px;
  aspect-ratio: 0.72;
  display: grid;
  place-items: center;
  gap: 6px;
  border: 4px solid rgba(255, 253, 249, 0.92);
  border-radius: 14px;
  background:
    radial-gradient(circle at 74% 20%, rgba(207, 159, 82, 0.42), transparent 34%),
    rgba(255, 253, 249, 0.92);
  color: var(--ink);
  box-shadow: 0 22px 56px rgba(23, 38, 29, 0.24);
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.6rem;
  font-weight: 950;
  line-height: 1;
  transform-origin: center bottom;
  translate: -50% 0;
  animation: howtoDeal 620ms cubic-bezier(0.2, 0.82, 0.22, 1) both;
  transition:
    transform 190ms ease,
    box-shadow 190ms ease,
    filter 190ms ease;
}

.howto-card span {
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
}

.howto-card:hover {
  transform: translateY(-5px) rotate(-4deg) scale(1.04);
  box-shadow: 0 30px 70px rgba(79, 16, 32, 0.36);
  filter: brightness(1.03);
}

.rules-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 38, 29, 0.68);
}

.rules-card {
  width: min(680px, calc(100vw - 40px));
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: clamp(24px, 6vw, 56px);
  border: 4px solid rgba(255, 253, 249, 0.94);
  background:
    radial-gradient(circle at 80% 18%, rgba(255, 253, 249, 0.82), transparent 34%),
    linear-gradient(135deg, rgba(23, 38, 29, 0.96), rgba(70, 89, 67, 0.92) 48%, rgba(207, 159, 82, 0.88) 78%, rgba(251, 247, 237, 0.92));
  box-shadow: 0 30px 90px rgba(23, 38, 29, 0.42);
  color: #fffdf9;
  text-align: left;
  animation: rulesCardIn 260ms ease both;
}

.rules-modal:not(.hidden) {
  animation: rulesFadeIn 180ms ease both;
}

.rules-spade {
  width: 76px;
  aspect-ratio: 0.72;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255, 253, 249, 0.92);
  border-radius: 10px;
  background: rgba(255, 253, 249, 0.9);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3.4rem;
}

.rules-card h2 {
  margin: 0;
  color: #fffdf9;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  text-align: center;
}

.rules-card ol {
  width: min(480px, 100%);
  margin: 0;
  padding-left: 26px;
  font-size: clamp(1rem, 2.4vw, 1.35rem);
  font-weight: 850;
}

.rules-card li + li {
  margin-top: 8px;
}

#closeRulesButton {
  min-width: 150px;
  min-height: 48px;
  border: 0;
  background: #fffdf9;
  color: var(--ink);
  font-weight: 950;
  cursor: pointer;
  transition:
    transform 160ms ease,
    filter 160ms ease;
}

#closeRulesButton:hover {
  transform: translateY(-3px);
  filter: brightness(1.04);
}

@keyframes howtoDeal {
  0% {
    opacity: 0;
    transform: translateY(38px) rotate(10deg) scale(0.82);
  }

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

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

@keyframes rulesCardIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.cover label {
  width: min(420px, calc(100vw - 48px));
  justify-self: center;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 850;
  text-align: left;
  text-transform: uppercase;
}

.cover input,
.bot-options select {
  height: 54px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 0 14px;
  font-size: 1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.cover-actions {
  justify-self: center;
  width: min(420px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.cover-actions button {
  min-height: 84px;
  border: 2px solid rgba(23, 38, 29, .45);
  background: var(--gold);
  color: #1d160c;
  padding: 14px;
  font-size: clamp(1.45rem, 4vw, 2.25rem);
  font-weight: 950;
  cursor: pointer;
  line-height: 1;
  transition:
    transform 130ms ease,
    filter 130ms ease;
}

#playBotsButton {
  background: var(--ink);
  color: white;
}

#playFriendsButton {
  background: #f0c66b;
  color: var(--ink);
}

#playTournamentButton {
  background: #fffdf9;
  color: #8c321d;
  border-color: #a74e2f;
}

.cover-actions button:hover {
  transform: translateY(-3px);
  filter: brightness(1.04);
}

.difficulty-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: min(520px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.06)),
    rgba(23, 38, 29, 0.9);
  box-shadow: 0 22px 70px rgba(23, 38, 29, 0.28);
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.difficulty-panel.hidden {
  display: grid;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 14px)) scale(0.96);
  visibility: hidden;
}

.difficulty-panel h2 {
  margin: 0;
  font-size: 1.45rem;
}

.difficulty-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.difficulty-buttons button {
  min-height: 64px;
  border: 1px solid rgba(240, 198, 107, 0.42);
  background: var(--gold);
  color: #1d160c;
  font-weight: 950;
  cursor: pointer;
}

.bot-options {
  width: 100%;
  justify-self: stretch;
}

.bot-options.hidden {
  display: none;
}

.lobby {
  grid-row: 1 / -1;
  width: min(760px, calc(100vw - 48px));
  justify-self: center;
  align-self: center;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: none;
  padding: 22px;
  text-align: center;
}

.lobby h2,
.lobby p {
  margin: 0;
}

.lobby label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.lobby input,
.lobby select {
  height: 44px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 0 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.lobby select {
  min-width: 76px;
}

.lobby-row,
.mode-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.lobby-row.hidden {
  display: none;
}

.lobby button {
  min-height: 44px;
  border: 0;
  background: var(--gold);
  color: #1d160c;
  padding: 0 14px;
  font-weight: 950;
  cursor: pointer;
}

.lobby-message {
  margin: 0;
  min-height: 32px;
  color: white;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.35;
}

.invite-link {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.player-auth {
  justify-self: center;
  text-align: center;
  width: min(430px, 100%);
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(207, 159, 82, .45);
  border-radius: 16px;
  background: #fffdf9;
  box-shadow: 0 12px 28px rgba(23, 38, 29, .16);
}

.player-auth label { display: grid; gap: 6px; font-weight: 800; }
.player-auth > label:first-child { color: #a87518; font-size: 1.05rem; font-weight: 950; letter-spacing: .02em; }
.player-auth small { color: #465943; }
.player-auth input { width: 100%; text-transform: none; }
.player-auth button {
  width: 100%;
  min-height: 50px;
  justify-self: stretch;
  border: 2px solid #8f681f;
  border-radius: 10px;
  background: #cf9f52;
  color: #17261d;
  font-size: 1.05rem;
  font-weight: 950;
  cursor: pointer;
}
.auth-message { min-height: 1.3em; margin: 0; color: #465943; font-weight: 700; }
.cover-actions button:disabled { opacity: .68; cursor: not-allowed; filter: grayscale(.25); }

.seating-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(207, 159, 82, .45);
  background: rgba(255, 255, 255, .05);
  text-align: left;
}

.seating-panel > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.seating-panel small { color: var(--muted); }

.seating-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(112px, 1fr);
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 7px;
  scroll-snap-type: x proximity;
}

.seat-card {
  position: relative;
  min-height: 112px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 8px;
  background: rgba(251, 247, 237, .1);
  cursor: grab;
  scroll-snap-align: start;
}

.seat-card:active { cursor: grabbing; }
.seat-card > strong { padding-right: 22px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-card > small { font-size: .62rem; }
.seat-number {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--gold);
  color: #17261d;
  font-size: .68rem;
  font-weight: 950;
}

.seat-controls {
  display: flex;
  gap: 5px;
  margin-top: auto;
}

.lobby .seat-controls button {
  min-height: 28px;
  flex: 1;
  padding: 0;
  border-radius: 5px;
  font-size: 1rem;
}

.lobby .seat-controls button:disabled { opacity: .25; cursor: default; }
.empty-seat { opacity: .48; cursor: default; border-style: dashed; }

.topbar,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 0.9;
  background: linear-gradient(110deg, #17261d 0%, #465943 38%, #cf9f52 72%, #fbf7ed 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.score-strip {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: min(600px, 56vw);
}

.score-card,
.opponent,
.center-table,
.bid-panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.04)),
    var(--panel);
  backdrop-filter: blur(7px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.16);
}

.score-card {
  padding: 10px;
  min-height: 72px;
  min-width: 116px;
}

.score-card span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.score-card strong {
  display: block;
  font-size: 1.35rem;
}

.score-card em {
  display: block;
  color: var(--gold);
  font-size: 0.76rem;
  font-style: normal;
  margin-top: 2px;
}

.play-area {
  position: relative;
  min-height: 500px;
  border: 1px solid rgba(23, 38, 29, 0.28);
  background:
    radial-gradient(ellipse at center, rgba(207, 159, 82, 0.2), transparent 58%),
    rgba(243, 236, 218, 0.34);
  overflow: hidden;
}

.opponent {
  position: absolute;
  min-width: 76px;
  min-height: 56px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  text-align: center;
}

.judgement-board {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 3;
  width: 172px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 253, 249, 0.32);
  background:
    linear-gradient(135deg, rgba(255, 253, 249, 0.2), rgba(255, 253, 249, 0.06)),
    rgba(23, 38, 29, 0.88);
  box-shadow: 0 18px 46px rgba(23, 38, 29, 0.24);
}

.judgement-board h2 {
  margin: 0;
  color: var(--gold);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.judgement-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.judgement-row strong {
  color: #fffdf9;
  font-size: 1.1rem;
}

body.your-turn-alert::after {
  content: "";
  position: fixed;
  z-index: 50;
  inset: 0;
  border: 8px solid #d51f2d;
  box-shadow: inset 0 0 26px rgba(213,31,45,.76), 0 0 20px rgba(213,31,45,.55);
  pointer-events: none;
  animation: yourTurnPulse 900ms ease-in-out infinite alternate;
}

@keyframes yourTurnPulse {
  from { border-color:#9f1420; box-shadow:inset 0 0 14px rgba(213,31,45,.48); }
  to { border-color:#ff3343; box-shadow:inset 0 0 38px rgba(213,31,45,.9); }
}

@media (prefers-reduced-motion: reduce) {
  body.your-turn-alert::after { animation:none; }
}

.leaderboard-button {
  position: fixed;
  z-index: 15;
  top: 18px;
  right: 18px;
  min-height: 42px;
  border: 1px solid rgba(23, 38, 29, 0.28);
  border-radius: 999px;
  padding: 9px 15px;
  background: rgba(251, 247, 237, 0.92);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(23, 38, 29, 0.15);
}

.leaderboard-card { position: relative; }
.leaderboard-close {
  position: absolute;
  top: 12px;
  right: 12px;
  min-width: 38px;
  min-height: 38px;
  border: 0;
  background: #fffdf9;
  color: var(--ink);
  font-size: 1.4rem;
}
.leaderboard-content { width: 100%; overflow-x: auto; }
.leaderboard-content table { width: 100%; border-collapse: collapse; }
.leaderboard-content th, .leaderboard-content td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 253, 249, 0.28);
  text-align: right;
}
.leaderboard-content th:nth-child(2), .leaderboard-content td:nth-child(2) { text-align: left; font-weight: 950; }
.leaderboard-content th { color: #efd48f; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.judgement-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}
.judgement-stats strong:last-child {
  color: var(--gold);
}

.opponent h2 {
  position: relative;
  z-index: 2;
  width: max-content;
  max-width: 92px;
  margin: -11px auto 0;
  padding: 2px 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #17261d;
  color: #fff9ef;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poker-player {
  position: relative;
  display: block;
  width: 58px;
  height: 52px;
  margin: 0 auto;
  transform: scale(0.82);
  transform-origin: top center;
}

.poker-player::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 13px;
  width: 39px;
  height: 37px;
  border: 2px solid #17261d;
  border-radius: 17px 17px 8px 8px;
  background: #8d6849;
  box-shadow: 0 5px 8px rgba(23, 38, 29, 0.25);
}

.player-head {
  position: absolute;
  z-index: 2;
  left: 21px;
  top: 0;
  width: 17px;
  height: 18px;
  border: 2px solid #17261d;
  border-radius: 50%;
  background: #b87952;
}

.player-body {
  position: absolute;
  left: 15px;
  top: 17px;
  width: 29px;
  height: 31px;
  border: 2px solid #17261d;
  border-radius: 13px 13px 6px 6px;
  background: linear-gradient(90deg, var(--player-color) 48%, #efe2bc 48% 53%, var(--player-color-dark) 53%);
}

.player-arm {
  position: absolute;
  z-index: 1;
  top: 24px;
  width: 24px;
  height: 8px;
  border: 2px solid #17261d;
  border-radius: 999px;
  background: var(--player-color);
  transform-origin: center right;
}

.player-arm-left { left: 1px; transform: rotate(-22deg); }
.player-arm-right { right: 1px; transform: rotate(202deg); }

.opponent p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.north {
  left: 40%;
  top: 10px;
  transform: translateX(-50%);
}

.northwest {
  left: 30%;
  top: 10px;
  transform: translateX(-50%);
}

.northeast {
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
}

.west {
  left: 20%;
  top: 10px;
  transform: translateX(-50%);
}

.east {
  left: 60%;
  top: 10px;
  transform: translateX(-50%);
}

.southeast {
  left: 70%;
  top: 10px;
  bottom: auto;
  transform: translateX(-50%);
}

.south {
  z-index: 4;
  left: 80%;
  top: 10px;
  bottom: auto;
  transform: translateX(-50%);
}

.current-player h2 {
  background: var(--gold);
  color: #17261d;
}

.opponent[data-order="0"] { left: 20%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="1"] { left: 30%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="2"] { left: 40%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="3"] { left: 50%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="4"] { left: 60%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="5"] { left: 70%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="6"] { left: 80%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="7"] { left: 88%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="8"] { left: 94%; top: 10px; bottom: auto; transform: translateX(-50%); }
.opponent[data-order="9"] { left: 97%; top: 10px; bottom: auto; transform: translateX(-50%); }

.play-area[data-players="8"] .opponent,
.play-area[data-players="9"] .opponent,
.play-area[data-players="10"] .opponent { min-width: 62px; }

.center-table {
  position: absolute;
  left: 50%;
  top: 61%;
  width: min(1040px, calc(100% - 70px));
  min-height: 345px;
  transform: translate(-50%, -50%);
  padding: 16px;
  display: grid;
  grid-template-rows: auto minmax(205px, 1fr) auto;
  gap: 6px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(207, 159, 82, 0.08)),
    rgba(23, 38, 29, 0.9);
  backdrop-filter: none;
}

.trick-confetti {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 40%;
  width: 6px;
  height: 10px;
  border-radius: 2px;
  background: var(--burst-color);
  pointer-events: none;
  opacity: 0;
}

.trick-celebration .poker-player {
  animation: winnerBounce 650ms ease-in-out 2;
}

.trick-celebration .player-arm-right {
  animation: airPunch 360ms ease-out 3;
}

.trick-celebration .trick-confetti {
  animation: trickConfetti 1.2s ease-out forwards;
}

@keyframes winnerBounce {
  50% { transform: translateY(-10px) scale(1.08); }
}

@keyframes airPunch {
  50% { transform: translate(5px, -17px) rotate(245deg); }
}

@keyframes trickConfetti {
  10% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--burst-x), var(--burst-y)) rotate(480deg); }
}

.game-info-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(207, 159, 82, .35);
  overflow: hidden;
}

.trump-status {
  display: grid;
  justify-items: start;
  gap: 2px;
  min-width: 0;
}

#roundLabel { display: none; }

#leadLabel {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: auto;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 850;
}

.lead-suit {
  font-size: 3.75rem;
  line-height: 1;
  padding: 0 .1em;
  border-radius: .14em;
}

.lead-suit.red { color: #e13847; }
.lead-suit.black { background: #fff9ef; color: #111; }

#trumpLabel {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  color: var(--gold);
  font-size: 0.9rem;
  line-height: 1;
  text-align: center;
}

.trump-suit {
  display: inline-flex;
  align-items: center;
  gap: 0.18em;
}

.trump-icon {
  font-size: 3.525rem;
  font-weight: 900;
  line-height: 0.7;
  vertical-align: middle;
}

.trump-suit.black {
  color: #111111;
}

.trump-suit.red {
  color: #d0182d;
}

.turn-status {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  padding: 3px 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: none;
  color: #8ff0a7;
  text-align: left;
  box-shadow: none;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  clip-path: inset(0 100% 0 0);
  animation:
    breakingStatus 3.5s steps(42, end) infinite,
    statusColorCycle 14s steps(1, end) infinite;
}

.turn-status span,
.turn-status strong,
.turn-status em {
  display: inline;
  margin: 0 0 0 8px;
  color: inherit;
  font: 850 clamp(.87rem, 1.95vw, 1.17rem)/1.2 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

.turn-status span:first-child { margin-left: 0; }
.turn-status strong { font-size: clamp(1.0875rem, 2.4375vw, 1.4625rem); }

.opponent.active-turn .poker-player {
  filter: drop-shadow(0 0 8px #f4d35e);
  transform: scale(.9) translateY(-2px);
}

.opponent.active-turn h2 {
  background: #f4d35e;
  color: #17261d;
}

@keyframes breakingStatus {
  0% { clip-path: inset(0 100% 0 0); }
  71.429%, 100% { clip-path: inset(0 0 0 0); }
}

@keyframes statusColorCycle {
  0%, 24.999% { color: #75e28f; }
  25%, 49.999% { color: #ff6573; }
  50%, 74.999% { color: #72b7ff; }
  75%, 100% { color: #f4d35e; }
}

@media (prefers-reduced-motion: reduce) {
  .turn-status { clip-path: none; animation: none; }
}

.winner-banner {
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 8vw, 5.8rem);
  font-weight: 950;
  line-height: 0.92;
  text-align: center;
}

.trick-pile {
  position: relative;
  min-height: 170px;
}

.played-card {
  position: absolute;
}

.played-by {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: -22px;
  max-width: 96px;
  transform: translateX(-50%);
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid rgba(207,159,82,.65);
  border-radius: 999px;
  background: rgba(23,38,29,.94);
  color: #fff;
  font-size: .62rem;
  font-weight: 900;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.played-card[data-seat="You"] {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}

.played-card[data-seat="West"] {
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-8deg);
}

.played-card[data-seat="North"] {
  left: 50%;
  top: 0;
  transform: translateX(-50%) rotate(3deg);
}

.played-card[data-seat="Northwest"] {
  left: 24%;
  top: 12px;
  transform: translateX(-50%) rotate(-5deg);
}

.played-card[data-seat="Northeast"] {
  right: 24%;
  top: 12px;
  transform: translateX(50%) rotate(5deg);
}

.played-card[data-seat="East"] {
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(8deg);
}

.played-card[data-seat="Southeast"] {
  right: 20%;
  bottom: 0;
  transform: translateX(50%) rotate(7deg);
}

.message {
  display: none;
}

.controls {
  align-items: stretch;
}

.bid-panel {
  flex: 1;
  min-height: 78px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.bid-panel > span {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
}

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

.bid-buttons button,
.deal-button {
  border: 0;
  cursor: pointer;
  min-height: 48px;
  transition:
    transform 130ms ease,
    filter 130ms ease;
}

.bid-buttons button {
  min-width: 48px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 950;
}

.deal-button {
  min-width: 150px;
  padding: 0 18px;
  background: var(--gold);
  color: #1d160c;
  font-weight: 950;
}

.bid-buttons button:hover,
.deal-button:hover,
.card-button.playable:hover .card {
  transform: translateY(-3px);
  filter: brightness(1.04);
}

.hand {
  min-height: 190px;
  display: flex;
  justify-content: center;
  align-items: end;
  gap: clamp(6px, 0.9vw, 12px);
  padding: 8px 8px 0;
}

.card-button {
  border: 0;
  padding: 0;
  background: transparent;
}

.card {
  width: clamp(78px, 9vw, 112px);
  aspect-ratio: 0.7;
  border: 3px solid rgba(255, 253, 249, 0.96);
  border-radius: 8px;
  background:
    radial-gradient(circle at 80% 18%, rgba(207, 159, 82, 0.28), transparent 34%),
    linear-gradient(135deg, rgba(255, 253, 249, 0.98), rgba(243, 236, 218, 0.94) 48%, rgba(255, 253, 249, 0.92)),
    var(--paper);
  color: #111111;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 8px;
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(0, 0, 0, 0.18);
  user-select: none;
}

.card.red {
  color: #d0182d;
}

.card.back {
  background:
    radial-gradient(circle at 70% 24%, rgba(207, 159, 82, 0.72), transparent 34%),
    repeating-linear-gradient(45deg, #465943 0 7px, #17261d 7px 14px),
    #17261d;
  border: 5px solid var(--paper);
}

.card.playable {
  cursor: pointer;
}

.card-button.playable {
  cursor: pointer;
}

.card-button:disabled {
  cursor: default;
}

.card-button.dim .card {
  opacity: 0.74;
}

.rank {
  font-size: 1.45rem;
  font-weight: 950;
}

.pip {
  display: grid;
  place-items: center;
  font-size: clamp(2.4rem, 5.4vw, 4.2rem);
}

.suit {
  text-align: right;
  font-size: 1.42rem;
}

.mini-backs {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.mini-card {
  width: 20px;
  height: 30px;
  border-radius: 3px;
  border: 2px solid var(--paper);
  background:
    radial-gradient(circle at 70% 22%, rgba(207, 159, 82, 0.7), transparent 34%),
    repeating-linear-gradient(45deg, #465943 0 4px, #17261d 4px 8px);
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--cream, #f3ecda);
  }

  body.your-turn-alert::after { border-width:6px; }

  .table {
    width: 100%;
    max-width: 100vw;
    height: auto;
    min-height: 100dvh;
    grid-template-rows: auto auto auto auto;
    gap: 8px;
    padding: 10px;
    overflow-x: clip;
  }

  .rules-card {
    padding: 24px 20px;
  }

  .rules-card ol {
    font-size: 1rem;
  }

  .topbar:not(.hidden),
  .controls:not(.hidden),
  .lobby:not(.hidden) {
    display: grid;
    grid-template-columns: 1fr;
  }

  .score-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: none;
    gap: 5px;
  }

  .score-card {
    min-width: 0;
    min-height: 54px;
    padding: 7px 9px;
  }

  .score-card strong { font-size: 1.05rem; }

  .play-area {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 4px;
    padding: 7px 20px;
    overflow: hidden;
  }

  .opponent {
    position: static;
    min-width: 0;
    min-height: 44px;
    padding: 0;
    transform: none;
    overflow: hidden;
  }

  .opponent h2 { max-width: 48px; margin: -15px auto 0; padding: 1px 3px; font-size: .52rem; text-align: center; }
  .poker-player { width: 44px; height: 42px; transform: scale(.64); transform-origin: top center; }
  .opponent.active-turn .poker-player { transform: scale(.72) translateY(-1px); }
  .opponent p { font-size: .66rem; }
  .mini-backs { gap: 2px; margin-top: 4px; overflow: hidden; }
  .mini-card { flex: 0 0 10px; width: 10px; height: 15px; border-width: 1px; }

  .west { grid-column: 1; grid-row: 1; }
  .northwest { grid-column: 2; grid-row: 1; }
  .north { grid-column: 3; grid-row: 1; }
  .northeast { grid-column: 4; grid-row: 1; }
  .east { grid-column: 5; grid-row: 1; }
  .southeast { grid-column: 6; grid-row: 1; }
  .south { grid-column: 10; grid-row: 1; }
  .opponent[data-order] { left: auto; top: auto; bottom: auto; transform: none; }
  .opponent[data-order="0"] { grid-column: 1; grid-row: 1; }
  .opponent[data-order="1"] { grid-column: 2; grid-row: 1; }
  .opponent[data-order="2"] { grid-column: 3; grid-row: 1; }
  .opponent[data-order="3"] { grid-column: 4; grid-row: 1; }
  .opponent[data-order="4"] { grid-column: 5; grid-row: 1; }
  .opponent[data-order="5"] { grid-column: 6; grid-row: 1; }
  .opponent[data-order="6"] { grid-column: 7; grid-row: 1; }
  .opponent[data-order="7"] { grid-column: 8; grid-row: 1; }
  .opponent[data-order="8"] { grid-column: 9; grid-row: 1; }
  .opponent[data-order="9"] { grid-column: 10; grid-row: 1; }

  .center-table {
    position: relative;
    left: auto;
    top: auto;
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    min-height: 285px;
    padding: 10px;
    transform: none;
    grid-template-rows: auto minmax(205px, 1fr) auto;
  }

  .game-info-line { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 5px; min-height: 58px; padding: 2px 3px; }
  .trump-status { gap: 0; min-width: 0; }
  #trumpLabel { font-size: .58rem; white-space: nowrap; }
  .trump-icon { font-size: 2.55rem; }
  .trump-name { display: none; }
  #leadLabel { font-size: .58rem; white-space: nowrap; }
  .lead-suit { font-size: 3.225rem; }
  .turn-status { max-width: 100%; padding: 3px 0; overflow: hidden; white-space: normal; }
  .turn-status span,
  .turn-status strong,
  .turn-status em { margin-left: 3px; font-size: clamp(.72rem, 3vw, .9rem); }
  .turn-status strong { font-size: clamp(.9rem, 3.75vw, 1.125rem); }
  .trick-pile {
    min-height: 180px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: center;
    align-items: end;
    gap: 24px 4px;
    padding: 20px 2px 2px;
  }

  .played-card,
  .played-card[data-seat] {
    position: relative;
    inset: auto;
    display: grid;
    place-items: center;
    transform: none;
  }
  .judgement-board {
    position: static;
    grid-column: 1 / -1;
    grid-row: 6;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px 12px;
    padding: 9px;
  }

  .judgement-board.hidden { display: none; }
  .judgement-board h2 { grid-column: 1 / -1; }
  .judgement-row { font-size: .72rem; }
  .judgement-row strong { font-size: .78rem; }
  .judgement-stats { gap: 5px; }

  .bid-panel {
    grid-column: 1 / -1;
    grid-row: 5;
    display: grid;
    min-height: 0;
    gap: 8px;
  }

  .controls { gap: 6px; }
  .bid-buttons { gap: 5px; }
  .bid-buttons button { min-width: 42px; min-height: 42px; }
  .deal-button { min-height: 44px; width: 100%; }

  .hand {
    grid-column: 1 / -1;
    grid-row: 4;
    min-height: 138px;
    justify-content: flex-start;
    gap: 5px;
    padding: 8px 4px 12px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .hand .card-button {
    flex: 0 0 auto;
    scroll-snap-align: center;
  }

  .hand .card {
    width: clamp(66px, 21vw, 82px);
  }

  .hand .rank,
  .hand .suit { font-size: 1rem; }
  .hand .pip { font-size: 2rem; }

  .played-card .card {
    width: 56px;
  }

  .played-by { top:-18px; padding:2px 5px; font-size:.56rem; }

  .played-card .rank,
  .played-card .suit { font-size: .9rem; }
  .played-card .pip { font-size: 1.8rem; }

  .cover {
    min-height: calc(100dvh - 20px);
    padding: 92px 12px 24px;
    gap: 14px;
  }

  .player-auth {
    width: min(100%, 360px);
    padding: 12px;
    justify-self: center;
  }

  .player-auth label { width: 100%; }

  .cover label {
    width: min(240px, calc(100vw - 40px));
    justify-self: center;
    text-align: center;
  }

  .cover-actions {
    width: min(100%, 360px);
    justify-self: center;
    gap: 9px;
  }

  .cover-actions button { min-height: 62px; padding: 11px; font-size: clamp(1.15rem, 6vw, 1.55rem); }

  .cover input {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 10px;
    font-size: 0.9rem;
    text-align: center;
  }

  .cover h1 {
    font-size: clamp(2.8rem, 16vw, 5rem);
  }

  .leaderboard-button {
    top: 8px;
    right: 8px;
    padding: 8px 10px;
  }
  .leaderboard-button span { display: none; }
  .topbar.hidden,
  .play-area.hidden,
  .controls.hidden,
  .hand.hidden,
  .bid-panel.hidden { display: none; }
}
