:root {
  color-scheme: light;
  --bg: #0f1312;
  --bar: #11171b;
  --bar-2: #182027;
  --surface: #f3f6f7;
  --surface-strong: #ffffff;
  --surface-soft: #e8eef1;
  --ink: #15202a;
  --muted: #65727f;
  --line: #d4dee6;
  --line-strong: #b9c7d2;
  --felt: #176a4f;
  --felt-deep: #0e4739;
  --rail: #7c4f32;
  --accent: #2368b5;
  --accent-strong: #174e91;
  --danger: #b8313d;
  --danger-strong: #8e1f2b;
  --gold: #d9ad52;
  --gold-soft: #f4dfad;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  scrollbar-gutter: stable;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-y: auto;
  color: var(--ink);
  background:
    linear-gradient(180deg, #0f1416 0, #101412 45%, #171411 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 2.35rem;
  border: 0;
  border-radius: 7px;
  padding: 0.55rem 0.8rem;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: var(--accent-strong);
}

button:disabled {
  cursor: default;
  opacity: 0.48;
}

input {
  width: 8rem;
  min-height: 2.35rem;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0.48rem 0.62rem;
  color: var(--ink);
  background: #fff;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(9rem, auto) auto minmax(16rem, 1fr);
  gap: 0.8rem 1rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  background: rgba(17, 23, 27, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
}

.primary-nav {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.nav-link {
  display: inline-flex;
  min-height: 2.3rem;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  padding: 0.46rem 0.75rem;
  color: #dce6ec;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
}

.nav-link:hover {
  border-color: rgba(217, 173, 82, 0.52);
}

.nav-link.active {
  border-color: transparent;
  color: #1b170f;
  background: var(--gold);
}

.auth-panel {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.auth-status {
  max-width: 15rem;
  overflow: hidden;
  color: var(--gold-soft);
  font-size: 0.86rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-panel input {
  width: 8.25rem;
  border-color: rgba(255, 255, 255, 0.18);
}

.auth-message {
  flex: 1 0 100%;
  min-height: 1rem;
  color: #ffb9c0;
  font-size: 0.8rem;
  line-height: 1.2;
  text-align: right;
}

.table-page {
  display: grid;
  gap: 1rem;
  align-content: start;
  padding: 1rem;
}

.table-toolbar {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.78rem;
  color: #edf4f7;
  background: rgba(24, 32, 39, 0.92);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.table-state {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.status {
  min-width: 0;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-id {
  min-height: 1rem;
  overflow: hidden;
  color: #aebbc5;
  font-size: 0.8rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blind-info {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-top: 0.18rem;
  overflow: visible;
  color: var(--gold-soft);
  font-size: 0.82rem;
  font-weight: 850;
}

.blind-summary {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blind-info:focus-visible {
  outline: 2px solid rgba(244, 223, 173, 0.82);
  outline-offset: 3px;
}

.blind-hud {
  position: absolute;
  left: 0;
  top: calc(100% + 0.5rem);
  z-index: 80;
  width: max-content;
  min-width: 17rem;
  max-width: min(24rem, calc(100vw - 2rem));
  border: 1px solid rgba(244, 223, 173, 0.42);
  border-radius: 8px;
  padding: 0.65rem;
  opacity: 0;
  color: #edf4f7;
  background: rgba(8, 13, 18, 0.97);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  transform: translateY(0.2rem);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.blind-info:hover .blind-hud,
.blind-info:focus .blind-hud,
.blind-info:focus-within .blind-hud {
  opacity: 1;
  transform: translateY(0);
}

.blind-hud table {
  width: 100%;
  border-collapse: collapse;
}

.blind-hud th,
.blind-hud td {
  padding: 0.28rem 0.38rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.76rem;
  text-align: right;
  white-space: nowrap;
}

.blind-hud th:first-child,
.blind-hud td:first-child,
.blind-hud th:nth-child(2),
.blind-hud td:nth-child(2) {
  text-align: left;
}

.blind-hud th {
  color: #aebbc5;
  font-weight: 800;
}

.blind-hud tr.current td {
  color: var(--gold-soft);
  font-weight: 900;
  background: rgba(217, 173, 82, 0.12);
}

.blind-next {
  padding: 0.5rem 0.38rem 0;
  color: #c8d4dc;
  font-size: 0.76rem;
  font-weight: 650;
}

.new-game-button {
  flex: 0 0 auto;
  color: #1b170f;
  background: var(--gold);
  font-weight: 850;
}

.new-game-button:hover:not(:disabled) {
  background: #e2b95e;
}

.table-toolbar label {
  display: grid;
  gap: 0.25rem;
  color: #d8e3e9;
  font-size: 0.78rem;
  font-weight: 750;
}

.blind-inputs {
  display: flex;
  gap: 0.35rem;
}

.blind-inputs input {
  width: 4.5rem;
}

.play-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 28rem);
  gap: 1rem;
  align-items: start;
}

.table-wrap {
  min-width: 0;
}

.table-felt {
  position: relative;
  min-height: 34rem;
  height: min(64vh, 43rem);
  border: 14px solid var(--rail);
  border-radius: 999px / 64%;
  background:
    radial-gradient(ellipse at center, rgba(255, 255, 255, 0.13), transparent 38%),
    repeating-linear-gradient(
      115deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 10px
    ),
    linear-gradient(145deg, var(--felt), var(--felt-deep));
  box-shadow:
    inset 0 0 0 8px rgba(255, 255, 255, 0.08),
    var(--shadow);
  overflow: visible;
}

.board-strip {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  display: grid;
  gap: 0.75rem;
  justify-items: center;
  transform: translate(-50%, -50%);
}

.pot {
  min-width: 5.5rem;
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  color: #1d160b;
  background: var(--gold);
  font-weight: 900;
  text-align: center;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22);
}

.board {
  display: flex;
  gap: 0.45rem;
  min-height: 5.3rem;
  align-items: center;
}

.card {
  position: relative;
  display: grid;
  place-items: center;
  width: 3.75rem;
  height: 5.15rem;
  overflow: hidden;
  border: 1px solid #c9d0d5;
  border-radius: 8px;
  color: #202933;
  background: #fff;
  font-size: 1.28rem;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.23);
}

.card.red {
  color: #bd2434;
}

.card.back {
  color: transparent;
  border-color: #7da3c6;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18) 25%, transparent 25%) 0 0 / 14px 14px,
    linear-gradient(225deg, rgba(255, 255, 255, 0.18) 25%, transparent 25%) 0 0 / 14px 14px,
    #255f94;
}

.community-card.newly-dealt {
  animation: community-card-deal 720ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: var(--deal-delay, 0ms);
  transform-origin: center bottom;
  will-change: opacity, transform;
}

.community-card.newly-dealt::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18) 25%, transparent 25%) 0 0 / 14px 14px,
    linear-gradient(225deg, rgba(255, 255, 255, 0.18) 25%, transparent 25%) 0 0 / 14px 14px,
    #255f94;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
  animation: community-card-flip 720ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
  animation-delay: var(--deal-delay, 0ms);
  content: "";
  pointer-events: none;
}

@keyframes community-card-deal {
  0% {
    opacity: 0;
    transform: translateY(-1.35rem) scale(0.88) rotate(-4deg);
  }

  45% {
    opacity: 1;
    transform: translateY(0.1rem) scale(1.04) rotate(1deg);
  }

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

@keyframes community-card-flip {
  0%,
  42% {
    opacity: 1;
    transform: rotateY(0deg);
  }

  72% {
    opacity: 1;
    transform: rotateY(90deg);
  }

  100% {
    opacity: 0;
    transform: rotateY(90deg);
  }
}

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

.seat {
  position: absolute;
  display: grid;
  gap: 0.34rem;
  width: 13.4rem;
  min-height: 7.4rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 0.62rem 0.62rem 1.55rem;
  color: #f7fbff;
  background: rgba(13, 25, 31, 0.9);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.seat.actor {
  border-color: var(--gold);
  outline: 3px solid rgba(217, 173, 82, 0.92);
  box-shadow:
    0 0 0 6px rgba(217, 173, 82, 0.22),
    0 16px 36px rgba(0, 0, 0, 0.34);
}

.seat.actor::after {
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(217, 173, 82, 0.72);
  border-radius: 12px;
  animation: actor-pulse 1s ease-in-out infinite;
  content: "";
  pointer-events: none;
}

.seat.all-in {
  border-color: rgba(239, 83, 64, 0.98);
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 205, 92, 0.28), transparent 34%),
    radial-gradient(circle at 18% 88%, rgba(239, 83, 64, 0.3), transparent 38%),
    rgba(17, 24, 29, 0.95);
  box-shadow:
    0 0 0 3px rgba(239, 83, 64, 0.28),
    0 0 30px rgba(239, 83, 64, 0.36),
    0 18px 38px rgba(0, 0, 0, 0.42);
}

.seat.all-in::before {
  position: absolute;
  inset: -10px;
  border: 2px solid rgba(255, 209, 102, 0.82);
  border-radius: 14px;
  animation: all-in-shockwave 1.15s ease-out infinite;
  content: "";
  pointer-events: none;
}

.seat.all-in .seat-name {
  color: #fff5d8;
  text-shadow: 0 0 12px rgba(255, 209, 102, 0.42);
}

.seat.all-in .seat-investment.active {
  border-color: rgba(255, 239, 184, 0.98);
  color: #220d09;
  background: linear-gradient(180deg, #ffe6a3 0%, #ef5340 100%);
  box-shadow:
    0 0 0 3px rgba(239, 83, 64, 0.26),
    0 0 18px rgba(255, 209, 102, 0.32);
}

@keyframes actor-pulse {
  0%,
  100% {
    opacity: 0.34;
  }

  50% {
    opacity: 1;
  }
}

@keyframes all-in-shockwave {
  0% {
    opacity: 0.92;
    transform: scale(0.98);
  }

  72%,
  100% {
    opacity: 0;
    transform: scale(1.09);
  }
}

.seat.folded {
  opacity: 0.58;
}

.seat.out {
  opacity: 0.38;
}

.seat:nth-child(1) {
  left: 50%;
  bottom: 3.5%;
  transform: translateX(-50%);
}

.seat:nth-child(2) {
  left: 6%;
  bottom: 17%;
}

.seat:nth-child(3) {
  left: 6%;
  top: 17%;
}

.seat:nth-child(4) {
  left: 50%;
  top: 4%;
  transform: translateX(-50%);
}

.seat:nth-child(5) {
  right: 6%;
  top: 17%;
}

.seat:nth-child(6) {
  right: 6%;
  bottom: 17%;
}

.seat-top {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  min-width: 0;
}

.seat-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roles {
  display: flex;
  flex: 0 0 auto;
  gap: 0.25rem;
  margin-left: auto;
}

.role {
  border-radius: 999px;
  padding: 0.12rem 0.35rem;
  color: #1d160b;
  background: var(--gold);
  font-size: 0.68rem;
  font-weight: 900;
}

.all-in-badge {
  border-radius: 999px;
  padding: 0.12rem 0.38rem;
  color: #fff7d6;
  background: #d33d33;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.22) inset,
    0 0 14px rgba(239, 83, 64, 0.45);
  font-size: 0.66rem;
  font-weight: 950;
  white-space: nowrap;
  animation: all-in-badge-pulse 820ms ease-in-out infinite;
}

@keyframes all-in-badge-pulse {
  0%,
  100% {
    filter: brightness(1);
    transform: translateY(0);
  }

  50% {
    filter: brightness(1.22);
    transform: translateY(-1px);
  }
}

.seat-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 0;
  color: #d6e3ea;
  font-size: 0.8rem;
}

.seat-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  min-width: 0;
  color: #d6e3ea;
  font-size: 0.8rem;
}

.seat-foot > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat-investment {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 0.22rem;
  align-items: baseline;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.16rem 0.46rem;
  color: #b9cbd5;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  font-size: 0.74rem;
  font-weight: 850;
  line-height: 1.1;
}

.seat-investment.active {
  border-color: rgba(244, 223, 173, 0.72);
  color: #21180b;
  background: linear-gradient(180deg, #f4dfad 0%, #d9ad52 100%);
  box-shadow:
    0 0 0 2px rgba(217, 173, 82, 0.18),
    0 6px 14px rgba(0, 0, 0, 0.22);
}

.seat-investment.changed {
  animation: seat-investment-pop 900ms ease-out both;
}

.investment-label {
  opacity: 0.82;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.seat-investment strong {
  font-size: 0.86rem;
  font-weight: 950;
}

@keyframes seat-investment-pop {
  0% {
    transform: scale(0.94);
  }

  35% {
    box-shadow:
      0 0 0 6px rgba(244, 223, 173, 0.32),
      0 8px 18px rgba(0, 0, 0, 0.28);
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

.hole {
  display: flex;
  gap: 0.35rem;
}

.hole .card {
  width: 2.55rem;
  height: 3.5rem;
  border-radius: 6px;
  font-size: 1rem;
  box-shadow: none;
}

.seat-stats {
  position: absolute;
  right: 0.62rem;
  bottom: 0.52rem;
  z-index: 5;
  max-width: calc(100% - 1.24rem);
  overflow: visible;
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seat:hover,
.seat:focus-within {
  z-index: 9;
}

.seat-stats:focus-visible {
  outline: 2px solid rgba(244, 223, 173, 0.82);
  outline-offset: 3px;
}

.stats-summary {
  display: block;
  width: 100%;
  min-height: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: right;
  text-overflow: ellipsis;
  cursor: default;
}

.stats-summary:hover:not(:disabled) {
  background: transparent;
}

.stats-hud {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.45rem);
  display: grid;
  gap: 0.24rem;
  width: max-content;
  min-width: 11.8rem;
  max-width: 14rem;
  border: 1px solid rgba(244, 223, 173, 0.45);
  border-radius: 8px;
  padding: 0.58rem 0.65rem;
  opacity: 0;
  color: #f7fbff;
  background: rgba(8, 13, 18, 0.97);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  text-align: left;
  transform: translateY(0.25rem);
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.seat-stats:hover .stats-hud,
.seat-stats:focus .stats-hud,
.seat-stats:focus-within .stats-hud {
  opacity: 1;
  transform: translateY(0);
}

.stats-hud-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: baseline;
  color: #cad9e2;
  font-size: 0.72rem;
  font-weight: 650;
}

.stats-hud-row strong {
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.lower-panel {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.actions,
.log-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.actions {
  display: grid;
  gap: 0.7rem;
  align-content: start;
  padding: 0.9rem;
}

.actions-header,
.log-header {
  display: flex;
  justify-content: space-between;
  color: var(--ink);
  font-weight: 900;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sizing-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  min-height: 2.35rem;
}

.sizing-button {
  min-height: 2.2rem;
  padding: 0.42rem 0.68rem;
  color: #18222b;
  background: #dbe7ee;
  font-size: 0.85rem;
  font-weight: 850;
}

.sizing-button:hover:not(:disabled) {
  color: #10171d;
  background: #c8dae5;
}

.action-buttons button[data-kind="fold"] {
  background: var(--danger);
}

.action-buttons button[data-kind="fold"]:hover:not(:disabled) {
  background: var(--danger-strong);
}

.action-buttons button[data-kind="all-in"] {
  background: var(--danger-strong);
}

.action-buttons button[data-kind="take-control"] {
  color: #1d160b;
  background: var(--gold);
  font-weight: 850;
}

.raise-row {
  display: flex;
  gap: 0.5rem;
}

.raise-row input {
  flex: 1;
  width: auto;
}

.muted {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.log-panel {
  display: grid;
  grid-template-rows: auto minmax(12rem, 18rem);
  min-width: 0;
}

.log-header {
  padding: 0.85rem 0.9rem 0;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  padding: 0.8rem 0.9rem 0.9rem;
  overflow: auto;
}

.log-line {
  border-bottom: 1px solid #dde5eb;
  padding-bottom: 0.38rem;
  color: #27313b;
  font-size: 0.9rem;
  line-height: 1.35;
}

.history-page,
.ranking-page {
  display: grid;
  gap: 1rem;
  align-content: start;
  padding: 1rem;
}

.history-page[hidden],
.ranking-page[hidden] {
  display: none;
}

.history-header,
.ranking-header {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 1rem;
  color: #edf4f7;
  background: rgba(24, 32, 39, 0.92);
}

.history-titlebar,
.ranking-titlebar {
  display: grid;
  gap: 0.35rem;
}

.history-header h2,
.ranking-header h2 {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 900;
}

.history-status,
.ranking-status {
  margin: 0;
  color: #b7c4ce;
  font-size: 0.88rem;
}

.history-status[hidden],
.ranking-status[hidden] {
  display: none;
}

.history-status[data-kind="error"],
.ranking-status[data-kind="error"] {
  color: #ffb9c0;
}

.history-list,
.ranking-list {
  display: grid;
  gap: 0.7rem;
}

.history-row,
.history-empty,
.ranking-row,
.ranking-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.95rem 1rem;
  background: var(--surface-strong);
}

.history-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.28rem 0.9rem;
  align-items: center;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.history-row:hover,
.history-row:focus-visible {
  border-color: rgba(217, 173, 82, 0.72);
  box-shadow: 0 10px 24px rgba(17, 23, 27, 0.1);
  transform: translateY(-1px);
}

.history-row:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.history-row.current {
  border-color: rgba(217, 173, 82, 0.82);
}

.history-empty {
  color: var(--muted);
  text-align: center;
}

.ranking-row {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  gap: 0.85rem;
  align-items: center;
}

.ranking-rank {
  color: var(--muted);
  font-weight: 900;
}

.ranking-name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-mangoes {
  color: #174e91;
  font-weight: 900;
  white-space: nowrap;
}

.ranking-empty {
  color: var(--muted);
  text-align: center;
}

.history-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
  color: var(--ink);
  font-weight: 900;
}

.history-title > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-badge {
  border-radius: 999px;
  padding: 0.12rem 0.46rem;
  color: #1d160b;
  background: var(--gold);
  font-size: 0.72rem;
  font-weight: 900;
}

.history-meta {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.88rem;
}

.history-open {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  color: #174e91;
  background: #e5eef8;
  font-size: 0.82rem;
  font-weight: 850;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .community-card.newly-dealt::after {
    opacity: 0;
  }
}

@media (max-width: 1120px) {
  .play-grid {
    grid-template-columns: 1fr;
  }

  .lower-panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .log-panel {
    grid-template-rows: auto minmax(10rem, 16rem);
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .primary-nav,
  .auth-panel {
    justify-content: start;
  }

  .auth-panel input {
    flex: 1 1 8rem;
    min-width: 0;
  }

  .auth-message {
    text-align: left;
  }

  .table-page,
  .history-page,
  .ranking-page {
    padding: 0.7rem;
  }

  .table-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .blind-hud {
    position: fixed;
    right: 0.75rem;
    left: 0.75rem;
    top: auto;
    bottom: 0.75rem;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .table-felt {
    min-height: 46rem;
    height: auto;
    border-width: 8px;
    border-radius: 28px;
  }

  .seat {
    width: calc(50% - 1rem);
    min-height: 7.35rem;
  }

  .seat:nth-child(1) {
    left: 50%;
    bottom: 0.9rem;
    width: min(18rem, calc(100% - 2rem));
    transform: translateX(-50%);
  }

  .seat:nth-child(2) {
    left: 0.8rem;
    bottom: 10.8rem;
  }

  .seat:nth-child(3) {
    left: 0.8rem;
    top: 10.8rem;
  }

  .seat:nth-child(4) {
    left: 50%;
    top: 0.9rem;
    width: min(18rem, calc(100% - 2rem));
    transform: translateX(-50%);
  }

  .seat:nth-child(5) {
    right: 0.8rem;
    top: 10.8rem;
  }

  .seat:nth-child(6) {
    right: 0.8rem;
    bottom: 10.8rem;
  }

  .board-strip {
    top: 50%;
  }

  .card {
    width: 3rem;
    height: 4.2rem;
  }

  .lower-panel {
    grid-template-columns: 1fr;
  }

  .stats-hud {
    position: fixed;
    right: 0.75rem;
    bottom: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    width: auto;
    min-width: 0;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 0.7rem;
  }

  .table-toolbar {
    grid-template-columns: 1fr;
  }

  .new-game-button {
    justify-self: start;
  }

  .table-felt {
    min-height: 50rem;
  }

  .board {
    gap: 0.28rem;
  }

  .card {
    width: 2.45rem;
    height: 3.55rem;
    border-radius: 7px;
    font-size: 1rem;
  }

  .hole .card {
    width: 2.2rem;
    height: 3rem;
  }

  .seat {
    width: calc(50% - 0.8rem);
    padding: 0.55rem 0.55rem 1.5rem;
  }

  .seat:nth-child(2),
  .seat:nth-child(3) {
    left: 0.55rem;
  }

  .seat:nth-child(5),
  .seat:nth-child(6) {
    right: 0.55rem;
  }

  .raise-row {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .history-row {
    grid-template-columns: 1fr;
  }

  .history-meta,
  .history-open {
    grid-column: 1;
  }

  .history-open {
    grid-row: auto;
    justify-self: start;
  }

  .ranking-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .ranking-mangoes {
    grid-column: 2;
  }
}
