:root {
  color: #f5f7fb;
  background: #05060b;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #05060b;
  --panel: rgba(10, 14, 23, 0.48);
  --panel-strong: rgba(15, 20, 32, 0.72);
  --panel-soft: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f7fb;
  --muted: #a2b0c4;
  --dim: #6a778c;
  --accent: #785df3;
  --accent-strong: #9880ff;
  --accent-glow: rgba(120, 93, 243, 0.4);
  --live: #10b981;
  --live-glow: rgba(16, 185, 129, 0.35);
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.35);
  --danger: #ef4444;
  --card: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
  --radius: 12px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --fast: 150ms ease;
  --medium: 250ms cubic-bezier(0.25, 1, 0.5, 1);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
select {
  border: 0;
  border-radius: var(--radius);
}

button {
  cursor: pointer;
  transition:
    transform var(--fast),
    border-color var(--fast),
    background var(--fast),
    box-shadow var(--fast),
    color var(--fast),
    opacity var(--fast);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

h1,
h2,
h3,
p,
dl,
ol,
ul {
  margin: 0;
}

.app-shell {
  display: grid;
  width: 100%;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: clamp(8px, 1.6vh, 14px);
  background:
    radial-gradient(circle at 80% 20%, rgba(120, 93, 243, 0.12), transparent 45rem),
    radial-gradient(circle at 20% 80%, rgba(16, 185, 129, 0.08), transparent 45rem),
    linear-gradient(135deg, #05070c 0%, #0d121e 50%, #06080e 100%);
}

.boot-shell {
  place-items: center;
}

.boot-panel {
  width: min(440px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(15, 20, 32, 0.6);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  padding: 24px;
}

.boot-panel h1 {
  margin-top: 8px;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 850;
  line-height: 1.1;
}

.boot-panel p:last-child {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.game-layout,
.table-zone,
.table-board {
  min-width: 0;
  min-height: 0;
}

.game-layout {
  display: grid;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(6, 9, 15, 0.72);
  box-shadow: var(--shadow);
}

.table-zone {
  display: grid;
  overflow: hidden;
}

.table-board {
  --hud-height: 0px;
  --hand-height: clamp(320px, 45vh, 380px);
  --seat-width: clamp(188px, 24vw, 306px);
  --card-width: clamp(46px, 5vw, 64px);
  --card-height: calc(var(--card-width) * 1.43);
  --mini-card-width: clamp(38px, 4.2vw, 54px);
  --mini-card-height: calc(var(--mini-card-width) * 1.42);
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: calc(var(--radius) - 1px);
  background:
    linear-gradient(180deg, rgba(8, 11, 18, 0.9), rgba(5, 7, 11, 0.97)),
    #05080e;
}

.table-felt {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(ellipse at 50% 50%, rgba(6, 78, 59, 0.45) 0%, rgba(4, 47, 38, 0.6) 60%, #06090f 100%),
    linear-gradient(135deg, rgba(120, 93, 243, 0.1) 0%, transparent 50%);
  box-shadow:
    inset 0 0 140px rgba(0, 0, 0, 0.95),
    inset 0 0 30px rgba(16, 185, 129, 0.04),
    0 8px 32px rgba(0, 0, 0, 0.5);
}

.table-texture {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border-radius: calc(var(--radius) + 4px);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.012) 0px, rgba(255, 255, 255, 0.012) 1px, transparent 1px, transparent 10px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.012) 0px, rgba(255, 255, 255, 0.012) 1px, transparent 1px, transparent 10px),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
  opacity: 0.5;
}

.player-seat,
.current-player-dock,
.latest-move,
.player-hand-panel,
.game-log,
.modal-panel {
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(13, 17, 28, 0.45);
  box-shadow:
    0 8px 32px 0 rgba(0, 0, 0, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px) saturate(110%);
  -webkit-backdrop-filter: blur(24px) saturate(110%);
}

.table-hud {
  position: absolute;
  z-index: 8;
  top: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  pointer-events: auto;
}

.turn-pill,
.status-chip {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.065);
  color: #dce5f1;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.status-chip.status-live,
.turn-pill.live {
  border-color: rgba(121, 226, 173, 0.48);
  background: rgba(33, 116, 80, 0.24);
  color: var(--live);
}

.status-chip.status-thinking,
.turn-pill.thinking {
  border-color: rgba(242, 201, 109, 0.44);
  background: rgba(124, 91, 31, 0.22);
  color: var(--gold);
}

.status-chip.status-complete,
.turn-pill.complete {
  border-color: rgba(155, 135, 255, 0.48);
  background: rgba(93, 73, 184, 0.22);
  color: #dcd5ff;
}

.table-hud button,
.action-bar button,
.lobby-actions button,
.game-over-banner button,
.menu-actions button,
.modal-header button,
.panel-heading button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all var(--fast);
  backdrop-filter: blur(8px);
}

.table-hud button:hover,
.action-bar button:hover,
.lobby-actions button:hover,
.game-over-banner button:hover,
.menu-actions button:hover,
.modal-header button:hover,
.panel-heading button:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.table-hud button {
  background: rgba(13, 17, 28, 0.6);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
}

.table-hud button:last-child {
  width: 38px;
  padding-inline: 0;
  font-size: 1rem;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--live);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  text-transform: uppercase;
}

.table-placeholder {
  position: absolute;
  inset: calc(var(--hud-height) + 32px) 18px var(--hand-height);
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
}

.placeholder-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid rgba(155, 135, 255, 0.46);
  border-radius: 50%;
  background: rgba(128, 104, 243, 0.18);
  color: #e6e0ff;
  font-size: 1.22rem;
  font-weight: 900;
  box-shadow: 0 0 28px rgba(128, 104, 243, 0.24);
}

.table-placeholder h2 {
  font-size: 1.08rem;
}

.table-placeholder p {
  max-width: 360px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.seat-slot {
  position: absolute;
  z-index: 3;
  width: var(--seat-width);
}

.seat-top {
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
}

.seat-left {
  top: 43%;
  left: 24px;
  transform: translateY(-50%);
}

.seat-right {
  top: 43%;
  right: 24px;
  transform: translateY(-50%);
}

.player-seat {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(135deg, rgba(20, 28, 48, 0.22) 0%, rgba(10, 14, 24, 0.48) 100%);
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(24px) saturate(110%);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.player-seat:hover {
  border-color: rgba(152, 128, 255, 0.2);
  transform: translateY(-2px);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.45),
    0 0 15px rgba(120, 93, 243, 0.05);
}

.player-seat::after,
.current-player-dock::after {
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-radius: calc(20px + 2px);
  content: "";
  pointer-events: none;
}

.player-seat.active,
.current-player-dock.active {
  border-color: rgba(16, 185, 129, 0.45);
  background: rgba(6, 78, 59, 0.28);
  box-shadow:
    0 0 25px rgba(16, 185, 129, 0.25),
    inset 0 1px 2px rgba(255, 255, 255, 0.08);
}

.player-seat.active::after,
.current-player-dock.active::after {
  animation: activePulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.2);
}

.player-seat.winner {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(120, 80, 10, 0.22);
  box-shadow:
    0 0 25px rgba(245, 158, 11, 0.25),
    inset 0 1px 2px rgba(255, 255, 255, 0.08);
}

.player-seat.thinking {
  border-color: rgba(245, 158, 11, 0.35);
  box-shadow:
    0 0 18px rgba(245, 158, 11, 0.18),
    inset 0 1px 2px rgba(255, 255, 255, 0.08);
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  overflow: hidden;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  background: linear-gradient(135deg, #785df3 0%, #4f39b3 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all var(--fast);
}

.player-seat.active .avatar {
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.player-seat.winner .avatar {
  border-color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6);
}

.avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.avatar.current {
  background: linear-gradient(135deg, #10b981 0%, #047857 100%);
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
  color: #fff;
}

.seat-copy {
  min-width: 0;
}

.player-seat h2,
.current-player-dock h2,
.latest-move h2,
.modal-panel h2,
.hand-header h2 {
  color: var(--text);
  overflow: hidden;
  font-size: 0.92rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-seat p,
.current-player-dock span,
.latest-move p {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.current-player-status {
  display: none;
  white-space: nowrap;
}

.card-count {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  font-size: 0.82rem;
}

.card-backs {
  position: relative;
  width: 54px;
  height: 32px;
  margin-inline: 6px;
}

.card-backs span {
  position: absolute;
  top: 0;
  width: 22px;
  height: 32px;
  border: 1px solid rgba(120, 93, 243, 0.35);
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, transparent 100%),
    repeating-radial-gradient(circle at center, rgba(120, 93, 243, 0.2) 0px, transparent 6px),
    linear-gradient(135deg, #4f39b3 0%, #1a0f44 100%);
  box-shadow:
    2px 2px 6px rgba(0, 0, 0, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.15);
  transition: all 0.25s ease;
}

.card-backs span:nth-child(1) { left: 0px; transform: rotate(-8deg); }
.card-backs span:nth-child(2) { left: 8px; transform: rotate(-4deg); }
.card-backs span:nth-child(3) { left: 16px; transform: rotate(0deg); }
.card-backs span:nth-child(4) { left: 24px; transform: rotate(4deg); }
.card-backs span:nth-child(5) { left: 32px; transform: rotate(8deg); }

.card-backs span:nth-child(1) {
  left: 0;
}

.card-backs span:nth-child(2) {
  left: 7px;
}

.card-backs span:nth-child(3) {
  left: 14px;
}

.card-backs span:nth-child(4) {
  left: 21px;
}

.card-backs span:nth-child(5) {
  left: 28px;
}

.empty-seat {
  display: grid;
  width: 100%;
  min-height: 62px;
  place-items: center;
  gap: 6px;
  padding: 9px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  color: var(--dim);
  font-size: 0.76rem;
  font-weight: 800;
  text-align: center;
  transition:
    border-color var(--fast),
    background var(--fast),
    color var(--fast),
    transform var(--fast);
}

.empty-seat:hover:not(:disabled) {
  border-color: rgba(121, 226, 173, 0.44);
  background: rgba(33, 116, 80, 0.18);
  color: #dff8ea;
  transform: translateY(-1px);
}

.empty-seat:disabled {
  cursor: default;
  opacity: 0.68;
}

.empty-seat span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}

.table-center {
  position: absolute;
  top: 44.5%;
  left: 50%;
  z-index: 2;
  display: grid;
  width: min(430px, calc(100% - 560px));
  align-content: center;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  text-align: center;
  transform: translate(-50%, -50%);
}

.lobby-center {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(100%, 430px);
}

.lobby-card {
  display: grid;
  width: 100%;
  min-height: 148px;
  align-content: center;
  justify-items: center;
  gap: 9px;
  padding: 16px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(10, 36, 28, 0.75) 0%, rgba(13, 17, 28, 0.6) 100%);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.45),
    0 0 34px rgba(16, 185, 129, 0.08);
  backdrop-filter: blur(20px);
}

.lobby-card h2 {
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.12;
}

.lobby-card p:not(.eyebrow) {
  max-width: 300px;
  color: #d4deed;
  font-size: 0.8rem;
  font-weight: 720;
  line-height: 1.38;
}

.lobby-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 3px;
}

.lobby-actions .primary {
  min-width: 104px;
  border: 1px solid rgba(152, 128, 255, 0.4);
  background: linear-gradient(135deg, #785df3 0%, #5b3ce3 100%) !important;
  box-shadow:
    0 6px 20px var(--accent-glow),
    0 2px 4px rgba(0, 0, 0, 0.2);
}

.latest-move {
  display: grid;
  width: min(100%, 430px);
  min-height: 160px;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(22, 29, 44, 0.55) 0%, rgba(12, 15, 24, 0.65) 100%);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.65),
    0 0 30px rgba(120, 93, 243, 0.12);
  backdrop-filter: blur(24px) saturate(110%);
}

.latest-move.latest-play {
  animation: latestReveal 260ms ease both;
}

.latest-play h2,
.latest-pass h2 {
  min-width: 80px;
  max-width: 100%;
  overflow: visible;
  padding: 5px 16px;
  border: 1px solid rgba(152, 128, 255, 0.35);
  border-radius: 999px;
  background: rgba(120, 93, 243, 0.18);
  color: #e6e0ff;
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(120, 93, 243, 0.25);
  text-overflow: clip;
}

.played-cards {
  display: flex;
  min-height: var(--mini-card-height);
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 4px;
}

.mini-card {
  display: grid;
  width: var(--mini-card-width);
  height: var(--mini-card-height);
  align-content: space-between;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 7px;
  background: linear-gradient(135deg, #ffffff 0%, #edf0f5 100%);
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.2);
  text-align: left;
}

.latest-play .mini-card {
  animation: cardReveal 220ms ease both;
  animation-delay: calc(var(--reveal-index) * 45ms);
}

.mini-card strong {
  font-size: 0.98rem;
  line-height: 1;
}

.mini-card span {
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1;
}

.trick-helper {
  max-width: 440px;
  color: #d4deed;
  font-size: 0.8rem;
  font-weight: 760;
  line-height: 1.35;
}

.current-player-dock {
  position: absolute;
  z-index: 8;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: min(390px, 32vw);
  min-width: 326px;
  min-height: 72px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 17, 28, 0.55);
}

.current-player-identity {
  min-width: 0;
}

.current-player-dock dl {
  display: grid;
  grid-template-columns: 62px 104px;
  gap: 7px;
}

.current-player-dock dl div {
  display: grid;
  min-width: 0;
  min-height: 46px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 7px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.current-player-dock dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
  line-height: 1;
  text-transform: uppercase;
}

.current-player-dock dd {
  display: grid;
  width: 100%;
  max-width: 100%;
  margin: 0;
  place-items: center;
  color: var(--text);
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-over-banner {
  position: absolute;
  top: 24px;
  right: 22px;
  z-index: 7;
  display: grid;
  width: min(270px, calc(100% - 44px));
  gap: 5px;
  padding: 14px 15px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius);
  background: rgba(8, 47, 37, 0.75);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.5),
    0 0 25px rgba(16, 185, 129, 0.15);
  backdrop-filter: blur(16px);
  animation: bannerIn 280ms ease both;
}

.game-over-banner h2 {
  font-size: 1.05rem;
}

.game-over-banner p:not(.eyebrow) {
  color: #cce8d9;
  font-size: 0.78rem;
  line-height: 1.35;
}

.game-over-banner button {
  justify-self: start;
  margin-top: 4px;
  border: 1px solid rgba(152, 128, 255, 0.4);
  background: linear-gradient(135deg, #785df3 0%, #5b3ce3 100%) !important;
  box-shadow:
    0 4px 12px var(--accent-glow),
    0 1px 2px rgba(0, 0, 0, 0.2);
}

.game-log {
  position: absolute;
  z-index: 8;
  bottom: 22px;
  left: 22px;
  display: grid;
  width: min(270px, 28vw);
  max-height: 148px;
  gap: 7px;
  overflow: hidden;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(11, 14, 22, 0.76);
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.3);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.panel-heading button {
  min-height: 24px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 0.66rem;
}

.game-log ol {
  display: grid;
  gap: 6px;
  overflow: auto;
  padding: 0;
  list-style: none;
  scrollbar-width: thin;
}

.game-log li,
.log-empty {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: #cfdae9;
  font-size: 0.74rem;
  line-height: 1.32;
}

.log-dot {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 12px rgba(155, 135, 255, 0.52);
}

.player-hand-panel {
  position: absolute;
  z-index: 6;
  right: clamp(14px, 5vw, 88px);
  bottom: clamp(12px, 2vh, 20px);
  left: clamp(14px, 5vw, 88px);
  display: grid;
  height: var(--hand-height);
  grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center;
  gap: 24px;
  overflow: visible;
  padding: 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}

.hand-strip {
  position: relative;
  display: grid;
  width: min(100%, 920px);
  min-width: 0;
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  gap: 7px;
  pointer-events: auto;
}

.hand-header {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.hand-header > div:first-child:not(.hand-player) {
  min-width: 120px;
  margin-right: auto;
}

.hand-player {
  display: inline-flex;
  max-width: min(100%, 260px);
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(12, 16, 24, 0.62);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.24);
}

.hand-player > div {
  min-width: 0;
}

.hand-player .eyebrow {
  margin-bottom: 1px;
  font-size: 0.58rem;
}

.hand-header > select {
  flex: 0 1 168px;
}

.hand-header .hand-status {
  min-width: 120px;
  justify-content: flex-end;
  margin-left: auto;
}

select {
  min-width: 168px;
  max-width: 100%;
  min-height: 34px;
  padding: 7px 28px 7px 9px;
  border: 1px solid var(--border);
  background: #202839;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
}

.hand-status {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.hand-status strong {
  color: var(--text);
  font-size: 1rem;
}

.hand {
  display: flex;
  width: min-content;
  max-width: 100%;
  min-height: calc(var(--card-height) + 50px);
  align-items: end;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 30px 24px 10px;
  scrollbar-width: thin;
}

.card {
  display: grid;
  flex: 0 0 var(--card-width);
  width: var(--card-width);
  height: var(--card-height);
  align-content: space-between;
  padding: clamp(6px, 1.2vw, 9px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.15);
  text-align: left;
  user-select: none;
  --rotation: calc((var(--card-offset) - 6) * 1.5deg);
  --translation-y: calc((var(--card-offset) - 6) * (var(--card-offset) - 6) * 0.18px);
  transform: rotate(var(--rotation)) translateY(var(--translation-y));
  transition:
    transform var(--medium),
    border-color var(--fast),
    box-shadow var(--fast),
    filter var(--fast);
}

.card + .card {
  margin-left: clamp(-15px, -1.1vw, -10px);
}

.card:hover:not(:disabled) {
  filter: brightness(1.02);
  transform: rotate(var(--rotation)) translateY(calc(var(--translation-y) - 16px)) scale(1.06);
  z-index: 15;
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 0 10px rgba(255, 255, 255, 0.2);
}

.card strong {
  font-size: 1.08rem;
  line-height: 1;
}

.card span {
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1;
}

.card.selected {
  border-color: var(--accent-strong);
  box-shadow:
    0 0 0 2px rgba(152, 128, 255, 0.4),
    0 0 20px var(--accent-glow),
    0 12px 28px rgba(0, 0, 0, 0.45);
  transform: rotate(var(--rotation)) translateY(calc(var(--translation-y) - 24px));
  z-index: 10;
}

.card.selected:hover {
  transform: rotate(var(--rotation)) translateY(calc(var(--translation-y) - 30px)) scale(1.06);
  z-index: 15;
}

.red {
  color: #c52d46;
}

.black {
  color: #1a222d;
}

.empty-state {
  align-self: center;
  width: min(360px, calc(100vw - 48px));
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
}

.action-dock {
  display: grid;
  width: min(100%, 620px);
  min-width: 0;
  justify-items: center;
  align-content: start;
  gap: 6px;
  text-align: center;
  pointer-events: auto;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  row-gap: 12px;
  width: 100%;
}

.hand-strip > .turn-timer {
  position: absolute;
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
}

.turn-timer {
  display: grid;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-items: center;
  border-radius: 50%;
  background:
    conic-gradient(#f2c96d var(--timer-angle), rgba(242, 201, 109, 0.16) 0),
    rgba(124, 91, 31, 0.18);
  color: #f8e3a1;
  font-size: 0.86rem;
  font-weight: 850;
  box-shadow: 0 0 18px rgba(242, 201, 109, 0.16);
}

.turn-timer::before {
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: rgba(16, 19, 28, 0.95);
  content: "";
}

.turn-timer strong {
  position: relative;
  z-index: 1;
  color: #fff2bf;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.turn-timer.urgent {
  background:
    conic-gradient(#e25465 var(--timer-angle), rgba(226, 84, 101, 0.18) 0),
    rgba(120, 38, 49, 0.28);
  color: #ffd3d8;
  box-shadow: 0 0 18px rgba(226, 84, 101, 0.24);
}

.action-bar .primary {
  min-width: 146px;
}

.action-bar .primary {
  border: 1px solid rgba(152, 128, 255, 0.4);
  background: linear-gradient(135deg, #785df3 0%, #5b3ce3 100%) !important;
  box-shadow:
    0 6px 20px var(--accent-glow),
    0 2px 4px rgba(0, 0, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 800;
}

.action-bar .primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #9880ff 0%, #785df3 100%) !important;
  box-shadow:
    0 8px 24px rgba(120, 93, 243, 0.6),
    0 0 15px var(--accent-glow);
  transform: translateY(-2px);
}

.action-bar button:not(.primary) {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.action-bar button:not(.primary):hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.action-bar small {
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 900;
}

.round-complete-note {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(155, 135, 255, 0.38);
  border-radius: var(--radius);
  background: rgba(93, 73, 184, 0.18);
  color: #dcd5ff;
  font-size: 0.78rem;
  font-weight: 900;
}

.selection-hint,
.message {
  min-height: 19px;
  width: 100%;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-hint {
  color: #d5deec;
}

.message {
  color: var(--gold);
}

.modal-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.56);
}

.modal-panel {
  display: grid;
  width: min(420px, 100%);
  max-height: min(560px, calc(100dvh - 40px));
  gap: 14px;
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(24, 29, 42, 0.98), rgba(13, 16, 25, 0.98)),
    var(--panel-strong);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header button {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.rules-list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
  color: #d0dae8;
  font-size: 0.82rem;
  line-height: 1.45;
}

.menu-actions {
  display: grid;
  gap: 9px;
}

.menu-actions button {
  justify-content: flex-start;
  min-height: 40px;
}

.menu-actions .danger {
  border-color: rgba(226, 84, 101, 0.42);
  background: rgba(117, 36, 49, 0.92);
}

.thinking-dots {
  display: inline-flex;
  gap: 3px;
}

.thinking-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: thinkingDot 1s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes activePulse {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }

  50% {
    opacity: 1;
    transform: scale(1.018);
  }
}

@keyframes latestReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(14px) rotate(-7deg);
  }

  to {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes bannerIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes thinkingDot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 980px) {
  .table-board {
    --seat-width: clamp(166px, 23vw, 220px);
    --card-width: clamp(43px, 5vw, 56px);
  }

  .table-center {
    width: min(430px, calc(100% - 420px));
  }

  .current-player-dock {
    width: min(350px, calc(100% - 24px));
    min-width: 310px;
  }

  .game-log {
    width: min(240px, 27vw);
  }

  .card-backs {
    display: none;
  }

  .player-seat {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }


}

@media (max-width: 760px) {
  .app-shell {
    padding: 6px;
  }

  .table-board {
    --hand-height: clamp(340px, 45vh, 400px);
    --seat-width: clamp(136px, 29vw, 178px);
    --card-width: clamp(40px, 8.2vw, 48px);
    --mini-card-width: clamp(33px, 7vw, 42px);
  }

  .table-hud {
    top: 10px;
    right: 10px;
    gap: 7px;
  }

  .seat-top {
    top: 68px;
  }

  .seat-left,
  .seat-right {
    top: 180px;
  }

  .seat-left {
    left: 12px;
  }

  .seat-right {
    right: 12px;
  }

  .table-center {
    top: 46%;
    width: min(430px, calc(100% - 26px));
  }

  .latest-move {
    min-height: 104px;
    padding: 11px;
  }

  .current-player-dock {
    right: 12px;
    bottom: 12px;
    width: min(290px, calc(100% - 26px));
    min-width: 0;
  }

  .current-player-dock dl {
    display: none;
  }

  .current-player-status {
    display: inline;
  }

  .game-log {
    bottom: 12px;
    left: 12px;
    width: min(248px, calc(58% - 12px));
    max-height: 96px;
  }

  .game-log ol {
    max-height: 48px;
  }

  .game-over-banner {
    top: 14px;
    right: 12px;
  }

  .player-hand-panel {
    right: 8px;
    bottom: 8px;
    left: 8px;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 18px;
    padding: 9px;
  }

  .hand-header {
    align-items: center;
  }

  .hand {
    min-height: calc(var(--card-height) + 22px);
    padding-top: 12px;
  }

  .action-dock {
    gap: 6px;
  }

  .action-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    row-gap: 10px;
    width: 100%;
  }

  .action-bar button {
    min-width: 0;
    padding-inline: 7px;
  }
}

@media (max-width: 520px) {
  .table-board {
    --seat-width: 126px;
    --hand-height: 320px;
    --card-width: 39px;
  }

  .player-seat {
    min-height: 56px;
    gap: 7px;
    padding: 7px;
  }

  .avatar {
    width: 30px;
    height: 30px;
    font-size: 0.78rem;
  }

  .player-seat h2,
  .current-player-dock h2,
  .latest-move h2,
  .hand-header h2 {
    font-size: 0.82rem;
  }

  .player-seat p,
  .current-player-dock span,
  .latest-move p,
  .trick-helper,
  .selection-hint,
  .message {
    font-size: 0.7rem;
  }

  .card-count {
    min-width: 24px;
    height: 24px;
    font-size: 0.72rem;
  }

  .table-center {
    top: 43%;
    width: min(430px, calc(100% - 18px));
  }

  .latest-move {
    min-height: 112px;
  }

  .played-cards {
    gap: 4px;
  }

  .current-player-dock {
    display: none;
  }

  .game-log {
    display: none;
  }

  .hand-header {
    align-items: stretch;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .hand-header > div:first-child:not(.hand-player),
  .hand-header .hand-status {
    min-width: 0;
    margin: 0;
  }

  select {
    flex: 1 1 100%;
    width: 100%;
    min-height: 32px;
  }

  .card {
    padding: 6px;
  }

  .card + .card {
    margin-left: -12px;
  }

  .card strong {
    font-size: 0.94rem;
  }

  .card span {
    font-size: 1.02rem;
  }

  .action-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .action-bar button {
    min-height: 32px;
    gap: 5px;
    padding: 7px 5px;
    font-size: 0.68rem;
  }

  .selection-hint,
  .message {
    min-height: 15px;
    white-space: normal;
  }

  .modal-backdrop {
    padding: 12px;
  }
}

@media (max-height: 620px) {
  .table-board {
    --hand-height: clamp(260px, 42vh, 290px);
    --card-width: clamp(40px, 4.6vw, 54px);
    --mini-card-width: clamp(34px, 3.6vw, 46px);
  }

  .table-hud {
    top: 12px;
    right: 12px;
  }

  .table-center {
    top: 44%;
    width: min(430px, calc(100% - 26px));
  }

  .latest-move {
    min-height: 94px;
    padding: 10px;
  }

  .seat-top {
    top: 58px;
  }

  .player-seat {
    min-height: 58px;
    padding: 7px;
  }

  .current-player-dock {
    bottom: 14px;
  }

  .current-player-dock {
    min-height: 58px;
  }

  .game-log {
    bottom: 14px;
    max-height: 104px;
  }

  .hand {
    min-height: calc(var(--card-height) + 20px);
    padding-top: 10px;
  }

  .player-hand-panel {
    padding: 9px;
  }

  .action-bar {
    width: auto;
  }
}

@media (max-width: 760px) and (max-height: 620px) {
  .table-board {
    --hand-height: clamp(320px, 50vh, 350px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .card.selected,
  .card.selected:hover {
    transform: translateY(-8px);
  }
}
