:root {
  color: #f5f7fb;
  background: #0b0d13;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #0b0d13;
  --panel: rgba(18, 22, 32, 0.82);
  --panel-strong: rgba(19, 24, 35, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f5f7fb;
  --muted: #aeb8c8;
  --dim: #748094;
  --accent: #8068f3;
  --accent-strong: #9b87ff;
  --live: #79e2ad;
  --gold: #f2c96d;
  --danger: #e25465;
  --card: #fbfcff;
  --radius: 8px;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.34);
  --fast: 130ms ease;
  --medium: 230ms cubic-bezier(0.2, 0.8, 0.2, 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(ellipse at 50% 42%, rgba(44, 110, 87, 0.32), transparent 38rem),
    linear-gradient(135deg, #080a10 0%, #111722 52%, #090c13 100%);
}

.boot-shell {
  place-items: center;
}

.boot-panel {
  width: min(440px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  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(248px, 38vh, 286px);
  --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(13, 17, 25, 0.88), rgba(6, 9, 15, 0.96)),
    #101821;
}

.table-felt {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--radius) + 4px);
  background:
    radial-gradient(ellipse at center, rgba(47, 126, 96, 0.54), rgba(19, 41, 42, 0.8) 45%, rgba(7, 10, 16, 0.98) 74%),
    linear-gradient(135deg, rgba(128, 104, 243, 0.14), transparent 44%);
  box-shadow:
    inset 0 0 120px rgba(0, 0, 0, 0.52),
    inset 0 0 0 1px rgba(121, 226, 173, 0.06);
}

.table-texture {
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border-radius: calc(var(--radius) + 4px);
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 12px),
    linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.04), transparent);
  opacity: 0.42;
}

.player-seat,
.current-player-dock,
.latest-move,
.player-hand-panel,
.game-log,
.modal-panel {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.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: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: #252f43;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.table-hud button {
  background: rgba(37, 47, 67, 0.84);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.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: 9px;
  min-height: 68px;
  padding: 9px;
  border-radius: var(--radius);
}

.player-seat::after,
.current-player-dock::after {
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) + 2px);
  content: "";
  pointer-events: none;
}

.player-seat.active,
.current-player-dock.active {
  border-color: rgba(121, 226, 173, 0.5);
  background: rgba(22, 51, 43, 0.82);
}

.player-seat.active::after,
.current-player-dock.active::after {
  animation: activePulse 1.8s ease-in-out infinite;
  border-color: rgba(121, 226, 173, 0.55);
  box-shadow: 0 0 30px rgba(121, 226, 173, 0.22);
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  background:
    linear-gradient(135deg, #8068f3, #4d3b99),
    #8068f3;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 0 18px rgba(128, 104, 243, 0.28);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.current {
  background:
    linear-gradient(135deg, #79e2ad, #348c69),
    #348c69;
  color: #07120e;
}

.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: 52px;
  height: 30px;
}

.card-backs span {
  position: absolute;
  top: 0;
  width: 22px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.09), transparent),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 5px),
    linear-gradient(135deg, #3c2f78, #161827);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.26);
}

.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(121, 226, 173, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(18, 42, 35, 0.9), rgba(14, 18, 28, 0.88)),
    rgba(18, 22, 32, 0.9);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.32),
    0 0 34px rgba(121, 226, 173, 0.12);
}

.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-color: rgba(155, 135, 255, 0.54);
  background:
    linear-gradient(180deg, #8d76ff, #6750d9),
    var(--accent);
  box-shadow: 0 12px 26px rgba(128, 104, 243, 0.28);
}

.latest-move {
  display: grid;
  width: min(100%, 430px);
  min-height: 140px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(27, 32, 46, 0.9), rgba(15, 18, 28, 0.86)),
    rgba(18, 22, 32, 0.9);
}

.latest-move.latest-play {
  animation: latestReveal 260ms ease both;
}

.latest-play h2,
.latest-pass h2 {
  min-width: 72px;
  max-width: 100%;
  overflow: visible;
  padding: 4px 9px;
  border: 1px solid rgba(155, 135, 255, 0.24);
  border-radius: 999px;
  background: rgba(128, 104, 243, 0.16);
  color: #e6e0ff;
  font-size: 0.86rem;
  text-align: center;
  text-overflow: clip;
}

.played-cards {
  display: flex;
  min-height: var(--mini-card-height);
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.mini-card {
  display: grid;
  width: var(--mini-card-width);
  height: var(--mini-card-height);
  align-content: space-between;
  padding: 7px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 7px;
  background: var(--card);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  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);
}

.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 var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.055);
}

.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(121, 226, 173, 0.42);
  border-radius: var(--radius);
  background: rgba(14, 43, 35, 0.92);
  box-shadow: 0 0 34px rgba(121, 226, 173, 0.2);
  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-color: rgba(155, 135, 255, 0.54);
  background:
    linear-gradient(180deg, #8d76ff, #6750d9),
    var(--accent);
  box-shadow: 0 12px 26px rgba(128, 104, 243, 0.24);
}

.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: 8px;
  overflow: visible;
  padding: 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  pointer-events: none;
}

.hand-strip {
  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 {
  min-width: 120px;
  margin-right: auto;
}

.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) + 20px);
  align-items: end;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 12px 5px;
  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: 8px;
  border: 2px solid transparent;
  background: var(--card);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  text-align: left;
  transition:
    transform var(--medium),
    border-color var(--fast),
    box-shadow var(--fast),
    filter var(--fast);
}

.card + .card {
  margin-left: clamp(-11px, -0.7vw, -6px);
}

.card:hover:not(:disabled) {
  filter: brightness(1.03);
  transform: translateY(-5px);
}

.card strong {
  font-size: 1.08rem;
  line-height: 1;
}

.card span {
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1;
}

.card.selected,
.card.selected:hover {
  border-color: var(--accent-strong);
  box-shadow:
    0 0 0 3px rgba(155, 135, 255, 0.24),
    0 0 24px rgba(155, 135, 255, 0.36),
    0 16px 30px rgba(0, 0, 0, 0.38);
  transform: translateY(-14px);
}

.red {
  color: #c52d46;
}

.black {
  color: #1c2430;
}

.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;
}

.turn-timer {
  position: relative;
  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-color: rgba(155, 135, 255, 0.54);
  background:
    linear-gradient(180deg, #8d76ff, #6750d9),
    var(--accent);
  box-shadow: 0 12px 26px rgba(128, 104, 243, 0.28);
}

.action-bar small {
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  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: 226px;
    --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: 18px;
  }

  .seat-left,
  .seat-right {
    top: 104px;
  }

  .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: 8px;
    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(4, minmax(0, 1fr));
    gap: 6px;
  }

  .action-bar button {
    min-width: 0;
    padding-inline: 7px;
  }

  .action-bar .primary {
    grid-column: span 2;
  }
}

@media (max-width: 520px) {
  .table-board {
    --seat-width: 126px;
    --hand-height: 272px;
    --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,
  .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(4, minmax(0, 1fr));
    width: 100%;
  }

  .action-bar .primary {
    grid-column: span 2;
  }

  .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(218px, 37vh, 238px);
    --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: 16px;
  }

  .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 (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);
  }
}
