:root {
  --felt-dark: #0a2e1c;
  --felt: #114b2e;
  --felt-light: #17633c;
  --felt-rim: #072015;
  --gold: #e6c36a;
  --cream: #f7f1e1;
  --ink: #1b140c;
  --suit-cervene: #c4122f;
  --suit-zelene: #1f7a3a;
  --suit-kule: #c9a227;
  --suit-zaludy: #6b3e1a;
  --card-ratio: 62 / 104;
  --table-scale: 1;
  --card-player-base: clamp(52px, min(16vw, 11dvh), 92px);
  --card-center-base: clamp(58px, min(14.5vw, 12dvh), 92px);
  --avatar-base: 64px;
  --medal-base: 18px;
  --card-player-w: var(--card-player-base);
  --card-center-w: var(--card-center-base);
  --card-opp-w: clamp(34px, min(calc(var(--card-player-base) * 0.58), 7.5dvh), 56px);
  /* Stejný portrét a stejné medaile pro všechny tři soupeře. */
  --avatar-size: var(--avatar-base);
  --medal-size: var(--medal-base);
  --card-w: var(--card-center-w);
  --card-h: calc(var(--card-center-w) * 104 / 62);
  --radius: 10px;
  /* Zakulacení shodné s rohy v obrázcích karet (620×1040 px, rádius ≈ 50 px). */
  --card-radius: 8.06% / 4.81%;
  --card-shadow: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
  --shadow: 0 8px 16px rgba(0, 0, 0, 0.38);
  --ui-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --dialog-btn-text: #f1d79e;
  --table-felt: url("assets/greenBackgroundFin.webp");
  --table-felt-tint: linear-gradient(rgba(0, 15, 8, 0.2), rgba(0, 15, 8, 0.2));
  --table-vignette: radial-gradient(circle at center, rgba(0, 0, 0, 0.05) 15%, rgba(0, 0, 0, 0.7) 100%);
  --table-felt-size: 420px auto;
}

html[data-table-theme="black"] {
  --felt-dark: #050505;
  --felt: #121212;
  --felt-light: #1c1c1c;
  --felt-rim: #000000;
  --table-felt: url("assets/blackBackgroundFin.webp");
  --table-felt-tint: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15));
  --table-vignette: radial-gradient(circle at center, rgba(255, 255, 255, 0.05) 10%, rgba(0, 0, 0, 0.75) 100%);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

html.is-booting,
html.is-booting body {
  background: #050505;
  background-image: none;
}

html.is-booting #table {
  display: none !important;
}

body {
  font-family: var(--ui-font);
  color: var(--cream);
  overscroll-behavior: none;
  background-color: var(--felt-dark);
  background-image: var(--table-vignette), var(--table-felt-tint), var(--table-felt);
  background-repeat: no-repeat, no-repeat, repeat;
  background-position: center, center, center;
  background-attachment: fixed, fixed, fixed;
  background-size: auto, auto, var(--table-felt-size);
}

@media (min-width: 768px) {
  :root {
    --table-felt-size: 320px auto;
  }
}

.table {
  --table-scale: 1;
  --card-player-floor: calc(clamp(80px, 12vh, 130px) * 62 / 104);
  --card-player-w: max(var(--card-player-floor), calc(var(--card-player-base) * var(--table-scale)));
  --card-center-w: calc(var(--card-center-base) * var(--table-scale));
  --card-height: calc(var(--card-center-w) * 104 / 62);
  --card-opp-w: clamp(
    calc(34px * var(--table-scale)),
    min(calc(var(--card-player-w) * 0.58), calc(7.5dvh * var(--table-scale))),
    calc(56px * var(--table-scale))
  );
  --avatar-size: calc(var(--avatar-base) * var(--table-scale));
  --medal-size: calc(var(--medal-base) * var(--table-scale));
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  gap: 0.35rem 0.5rem;
  padding: max(0.5rem, env(safe-area-inset-top)) max(0.85rem, env(safe-area-inset-right))
    max(0.45rem, env(safe-area-inset-bottom)) max(0.85rem, env(safe-area-inset-left));
  max-width: 1100px;
  margin: 0 auto;
}

.top-bar {
  position: fixed;
  top: max(0.55rem, env(safe-area-inset-top));
  left: max(0.7rem, env(safe-area-inset-left));
  right: max(0.7rem, env(safe-area-inset-right));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.game-title {
  display: none;
}

.top-leading {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  pointer-events: none;
}

.top-leading .icon-btn {
  pointer-events: auto;
}

.table-board {
  flex: 1 1 auto;
  flex-shrink: 1;
  min-height: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 0.4rem 0.6rem;
}

.subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.85rem;
  opacity: 0.8;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.standings {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 0.7rem;
  margin: 0.15rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.78rem;
}

.standings li {
  color: var(--gold);
}

.standings .playing {
  color: var(--cream);
  opacity: 0.8;
}

.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
}

.suit-overlay {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  pointer-events: none !important;
  text-align: center;
  filter: drop-shadow(0 0 28px currentColor);
  opacity: 1;
}

.suit-overlay.hidden {
  display: none;
}

.suit-overlay.is-fade {
  transition: opacity 0.4s ease;
}

.suit-overlay-pip {
  display: block;
  line-height: 0.9;
}

.suit-overlay-icon {
  display: block;
  width: min(32vw, 180px);
  height: min(32vw, 180px);
  object-fit: contain;
}

.suit-select-icon {
  height: 24px;
  width: auto;
  vertical-align: middle;
  margin-right: 8px;
  object-fit: contain;
}

.suit-inline-icon {
  height: 1.2em;
  width: auto;
  vertical-align: -0.2em;
  margin: 0 0.2em;
  object-fit: contain;
}

/* Velká medaile uprostřed stolu; po chvíli odletí k hráči. */
.medal-overlay {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 1105;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  transform-origin: center;
  pointer-events: none !important;
  opacity: 1;
  will-change: transform, opacity;
}

.medal-overlay.hidden {
  display: none;
}

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.22s ease, background 0.22s ease;
}

.image-lightbox.is-visible {
  opacity: 1;
  background: rgba(0, 0, 0, 0.72);
}

.image-lightbox.hidden {
  display: none;
}

.image-lightbox-photo {
  max-width: min(86vw, 440px);
  max-height: min(78vh, 540px);
  object-fit: contain;
  border: none;
  box-shadow: none;
  background: transparent;
  filter: drop-shadow(0 0 25px rgba(0, 0, 0, 0.8));
  cursor: pointer;
}

.image-lightbox.is-portrait .image-lightbox-photo {
  width: min(78vw, 420px);
  height: min(78vw, 420px);
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid #c5a059;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  filter: none;
}

.bot-avatar,
.medal-icon {
  cursor: pointer;
}

.medal-overlay-icon {
  display: block;
  width: min(32vw, 180px);
  height: min(32vw, 180px);
  object-fit: contain;
  filter: drop-shadow(0 0 26px rgba(230, 195, 106, 0.55)) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
}

/* Přeškrtnutí křížem. Jedna původní čára trvala 0,32 s, každá z těchto dvou tedy 0,16 s. */
.medal-strike {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  pointer-events: none;
}

.medal-strike-1 {
  clip-path: inset(0 100% 100% 0);
}

.medal-strike-2 {
  clip-path: inset(0 0 100% 100%);
}

.medal-overlay.is-revoked .medal-strike {
  opacity: 1;
}

.medal-overlay.is-revoked .medal-strike-1 {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.16s linear;
}

.medal-overlay.is-revoked .medal-strike-2 {
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.16s linear 0.16s;
}

.medal-overlay.is-revoked .medal-overlay-icon {
  filter: brightness(0.8) saturate(0.92) drop-shadow(0 0 26px rgba(230, 195, 106, 0.4)) drop-shadow(0 6px 14px rgba(0, 0, 0, 0.6));
  transition: filter 0.2s ease;
}

.medal-icon.is-returning {
  animation: medal-slide-back 0.35s ease;
}

@keyframes medal-slide-back {
  from { opacity: 0; transform: translateX(-8px) scale(0.72); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .medal-icon.is-returning {
    animation: none;
  }

  .medal-overlay.is-revoked .medal-strike-1,
  .medal-overlay.is-revoked .medal-strike-2 {
    transition: none;
  }
}

/* 1–2 vedle sebe, od 3. pevný překryv a růst. Botí strop je šířka sloupce, zahuštění až kolem 8.–10. medaile. */
.medal-strip {
  --medal-cascade: 8px;
  --medal-overlap: var(--medal-cascade);
  --medal-strip-max: max(var(--card-opp-w), calc(var(--medal-size) + 5 * (var(--medal-size) - var(--medal-cascade)) + 10px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  box-sizing: border-box;
  width: max-content;
  max-width: var(--medal-strip-max);
  height: calc(var(--medal-size) + 10px);
  padding: 3px 4px;
  border: 1px solid rgba(197, 160, 89, 0.4);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
  align-self: center;
  flex: none;
  overflow: hidden;
}

.medal-strip-loose {
  gap: 3px;
  width: max-content;
  max-width: none;
}

.medal-strip-tight .medal-icon + .medal-icon,
.medal-strip-dense .medal-icon + .medal-icon {
  margin-left: calc(var(--medal-overlap) * -1);
}

.medal-strip-dense {
  width: max-content;
  max-width: var(--medal-strip-max);
}

.identity .medal-strip,
.identity .medal-strip-tight,
.identity .medal-strip-dense {
  max-width: 100%;
}

.seat-south .medal-strip,
.seat-south .medal-strip-tight,
.seat-south .medal-strip-dense {
  position: static;
  left: auto;
  top: auto;
  z-index: 1;
  width: max-content;
  max-width: none;
  margin: 0;
  transform: none;
}

.medal-strip.is-empty {
  visibility: hidden;
}

.medal-icon {
  position: relative;
  display: block;
  flex: none;
  width: var(--medal-size);
  height: var(--medal-size);
  object-fit: contain;
  filter: drop-shadow(-2px 1px 2px rgba(0, 0, 0, 0.7));
}

.medal-icon.is-pending {
  visibility: hidden;
}

.medal-icon.is-landed {
  animation: medal-land 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes medal-land {
  0% {
    transform: scale(1.7);
    filter: drop-shadow(0 0 8px rgba(230, 195, 106, 0.95));
  }
  100% {
    transform: scale(1);
  }
}

.suit-overlay-name {
  display: none;
}

.fly-card {
  box-sizing: border-box;
  flex: none;
  pointer-events: none !important;
  min-width: 0;
  max-width: none;
  min-height: 0;
  max-height: none;
  transform-origin: center center;
  box-shadow: none;
  z-index: 1000;
  overflow: hidden;
}

.seat.is-done .seat-inner {
  opacity: 0.72;
}

.seat-place {
  margin: 0.2rem 0 0;
  text-align: center;
  color: var(--gold);
  font-weight: 700;
  font-size: 0.85rem;
}

.settings-btn {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  border: 1px solid rgba(230, 195, 106, 0.4);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  background: rgba(7, 32, 21, 0.82);
  color: var(--cream);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  touch-action: manipulation;
}

.icon-btn:not([hidden]) {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
}

.icon-btn[hidden] {
  display: none !important;
}

.fs-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

#fullscreen-btn .fs-exit {
  display: none;
}

#fullscreen-btn.is-active .fs-enter {
  display: none;
}

#fullscreen-btn.is-active .fs-exit {
  display: block;
}

.settings-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

body:has(#settings-dialog[open]) #settings-btn {
  visibility: hidden;
  pointer-events: none;
}

.seat-inner {
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  padding: 0.35rem 0.45rem;
  background: transparent;
  box-shadow: none;
  outline: none;
  isolation: isolate;
}

/* Záře aktivního hráče vychází z hrany displeje a leží pod obsahem stolu. */
body::before {
  content: "";
  position: fixed;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.28s ease;
}

body:has(.seat.is-turn):not(:has(.table.is-turbo))::before {
  opacity: 1;
}

body:has(.seat-north.is-turn)::before {
  inset: 0 0 auto 0;
  width: auto;
  height: 130px;
  background: radial-gradient(ellipse 50% 130px at 50% 0%, rgba(240, 200, 74, 0.28) 0%, transparent 100%);
}

body:has(.seat-south.is-turn)::before {
  inset: auto 0 0 0;
  width: auto;
  height: 130px;
  background: radial-gradient(ellipse 50% 130px at 50% 100%, rgba(240, 200, 74, 0.28) 0%, transparent 100%);
}

body:has(.seat-west.is-turn)::before {
  inset: 0 auto 0 0;
  width: 130px;
  height: auto;
  background: radial-gradient(ellipse 130px 50% at 0% 50%, rgba(240, 200, 74, 0.28) 0%, transparent 100%);
}

body:has(.seat-east.is-turn)::before {
  inset: 0 0 0 auto;
  width: 130px;
  height: auto;
  background: radial-gradient(ellipse 130px 50% at 100% 50%, rgba(240, 200, 74, 0.28) 0%, transparent 100%);
}

.seat-north,
.seat-south {
  display: flex;
  justify-content: center;
  min-height: 0;
}

.seat-south .seat-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 600px;
  height: 100%;
  margin-inline: auto;
  box-sizing: border-box;
  overflow: visible;
}

.seat-north .seat-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  max-width: 100%;
}

.seat-north {
  flex: 0 1 auto;
  height: auto;
  max-height: none;
  min-height: min-content;
  box-sizing: border-box;
}

.seat-west,
.seat-east {
  --side-w: max(calc(var(--card-opp-w) + 1rem), calc(var(--avatar-size) + 1.4rem), calc(var(--medal-size) * 5 + 3.2rem));
  flex: 0 0 var(--side-w);
  width: var(--side-w);
  max-width: var(--side-w);
  align-self: stretch;
  align-items: center;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Tři hráči nemají sever. Boční profily by jinak začínaly pod tlačítkem Nastavení. */
.table.players-3 .seat-west,
.table.players-3 .seat-east {
  padding-top: 3rem;
}

.seat-south {
  position: relative;
  z-index: 5;
  flex: 1 1 auto;
  flex-shrink: 1;
  width: 100%;
  min-height: 0;
  height: calc(min(28vh, 210px) * var(--table-scale, 1));
  max-height: calc(min(28vh, 210px) * var(--table-scale, 1));
  box-sizing: border-box;
  overflow: visible;
}

.seat-label {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

.seat-west .seat-label,
.seat-east .seat-label {
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 0.25rem;
}

/* Sloupec soupeře: jméno, portrét a medaile na jedné ose nad kartami. */
.identity {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.32rem;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 0.35rem;
  text-align: center;
}

.identity .seat-name {
  position: relative;
  justify-content: center;
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-transform: none;
}

.identity .seat-place {
  margin: 0;
}

.identity .medal-strip {
  margin: 0;
}

.seat-west .identity,
.seat-east .identity {
  width: 100%;
  max-width: 100%;
}

.seat-south .seat-medals {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.12rem;
  width: max-content;
  max-width: min(40%, 280px);
  transform: translateX(-50%);
  pointer-events: none;
}

.seat-south .seat-medals .seat-meta {
  text-align: center;
  line-height: 1.15;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.seat-south .seat-medals .medal-strip,
.seat-south .seat-medals .medal-icon {
  pointer-events: auto;
}

.seat-south .seat-medals .medal-strip {
  max-width: 100%;
}

.seat-south .medal-strip.is-empty {
  display: none;
}

/* Stejný obal portrétu pro lokálního hráče i soupeře. Záře tahu je jen vnější stín. */
.bot-avatar {
  display: block;
  flex: none;
  width: var(--avatar-size);
  height: var(--avatar-size);
  box-sizing: border-box;
  border: 1.5px solid #c5a059;
  border-radius: 30%;
  background: var(--cream);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  user-select: none;
}

.bot-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  border: 0;
  border-radius: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.seat.is-turn .bot-avatar {
  border-color: #facc15;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.85), 0 0 25px rgba(234, 179, 8, 0.45);
  animation: turn-avatar-breathe 2.4s ease-in-out infinite;
}

@keyframes turn-avatar-breathe {
  0%,
  100% {
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.85), 0 0 25px rgba(234, 179, 8, 0.45);
  }
  50% {
    box-shadow: 0 0 16px rgba(250, 204, 21, 1), 0 0 32px rgba(234, 179, 8, 0.62);
  }
}

@media (prefers-reduced-motion: reduce) {
  .seat.is-turn .bot-avatar {
    animation: none;
    border-color: #facc15;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.85), 0 0 25px rgba(234, 179, 8, 0.45);
  }
}

.seat-name {
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  text-transform: none;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.seat-meta {
  color: var(--gold);
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hand {
  position: relative;
  z-index: 2;
  display: flex;
  flex-shrink: 1;
  min-height: 0;
  justify-content: center;
  align-items: flex-end;
}

.seat-south .hand,
.seat-south .player-hand,
.seat-south .player-cards,
.seat-south .hand-cards {
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin-inline: auto;
  justify-content: center;
  align-items: flex-end;
  padding: calc(28px * var(--table-scale, 1)) calc(8px * var(--table-scale, 1)) calc(10px * var(--table-scale, 1));
  box-sizing: border-box;
  overflow: visible;
  z-index: 5;
}

.seat-south .hand-cards .card + .card,
.seat-south .player-cards .card + .card,
.seat-south .player-hand .card + .card {
  margin-left: -18px;
}

/* Prázdná ruka po dohrání drží výšku karet, aby boční hráči neskočili nahoru. */
.seat-north .hand {
  flex: none;
  min-height: calc(var(--card-opp-w) * 104 / 62);
  height: calc(var(--card-opp-w) * 104 / 62);
}

.seat-north .seat-meta {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.15rem);
  z-index: 3;
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: none;
}

.seat-north .card {
  margin-left: calc(var(--card-opp-w) * -0.52);
}

.seat-south .card {
  position: relative;
  margin-left: 0;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.hand .card:first-child {
  margin-left: 0;
}

.seat-west .seat-inner,
.seat-east .seat-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

.seat-west .side-hand,
.seat-east .side-hand {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(100%, 35vh);
  overflow: hidden;
}

.hand.side-hand {
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 0;
  max-height: min(100%, 35vh);
  overflow: hidden;
}

.side-hand .card {
  flex: none;
  flex-shrink: 0;
  width: var(--card-opp-w);
  height: calc(var(--card-opp-w) * 104 / 62);
  max-width: var(--card-opp-w);
  max-height: calc(var(--card-opp-w) * 104 / 62);
  aspect-ratio: var(--card-ratio);
  margin-left: 0;
  margin-top: calc(var(--card-opp-w) * 104 / 62 * -0.58);
}

.side-hand .card:first-child {
  margin-top: 0;
}

@media (hover: hover) and (pointer: fine) {
  .seat-south .hand .card.playable:hover,
  .seat-south .hand .card.playable:focus-visible {
    transform: translateY(-35px);
    z-index: 5;
  }
}

.seat-south .hand .card.is-raised,
.seat-south .hand .card.selected,
.seat-south .hand .card.active {
  transform: translateY(-35px);
  z-index: 5;
}

.seat-south .hand .card.playable,
.seat-south .hand .card.series-selected,
.seat-south .hand .card.unplayable {
  touch-action: none;
}

.seat-south .card.is-drag-source {
  opacity: 0.35;
}

.card.drag-ghost {
  z-index: 1000;
  transition: none;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.45));
}

.card.drag-ghost.unplayable {
  filter: brightness(0.75) drop-shadow(0 12px 18px rgba(0, 0, 0, 0.45));
}

.discard-pile.is-drop-target .card:last-child {
  outline: 3px solid var(--gold);
  outline-offset: 5px;
}

.seat-south .card.playable {
  cursor: pointer;
}

/* Jen ruka spodního hráče. Botí karty se tím nemění. */
.seat-south .player-hand .card {
  box-sizing: border-box;
  filter: none;
  box-shadow: none;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.seat-south .player-hand .card.playable {
  transform: translateY(-8px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
}

.seat-south .player-hand .card.is-raised,
.seat-south .player-hand .card.selected,
.seat-south .player-hand .card.active,
.seat-south .player-hand .card.series-selected {
  transform: translateY(-35px);
  z-index: 5;
}

@media (hover: hover) and (pointer: fine) {
  .seat-south .player-hand .card.playable:hover,
  .seat-south .player-hand .card.playable:focus-visible {
    transform: translateY(-35px);
    z-index: 5;
  }
}

/* Rychlík: karty vybrané do série jsou vysunuté a mají pořadové číslo. */
.seat-south .hand .card.series-selected {
  transform: translateY(-35px);
  z-index: 5;
}

.seat-south .card.series-selected::after {
  content: attr(data-order);
  position: absolute;
  top: 4px;
  left: 3px;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.2rem;
  border-radius: 999px;
  background: #f1d79e;
  color: #1c1208;
  font: 700 0.72rem/1 var(--ui-font, sans-serif);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.seat-south .card,
.draw-pile,
.suit-choice {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.seat-south .player-hand .card.unplayable {
  cursor: default;
  opacity: 1;
  filter: brightness(0.75);
  border: none;
  outline: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
  background: transparent;
  overflow: hidden;
  border-radius: var(--card-radius);
}

.seat-south .player-hand .card.unplayable .card-art {
  border: none;
  outline: none;
  box-shadow: none;
  filter: none;
  border-radius: var(--card-radius);
}

@keyframes card-refuse {
  0%,
  100% { translate: 0 0; }
  18% { translate: -7px 0; }
  36% { translate: 6px 0; }
  54% { translate: -4px 0; }
  72% { translate: 3px 0; }
}

.seat-south .player-hand .card.is-refused {
  animation: card-refuse 0.34s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  .seat-south .player-hand .card.is-refused {
    animation: none;
    filter: brightness(1.45);
  }
}

.table-center {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
}

.pile-row {
  z-index: 1;
  position: absolute;
  left: 50%;
  top: max(
    calc((var(--card-height) + 1.7rem) / 2 + 2px),
    min(48%, calc(100% - 12rem))
  );
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(16px, 3vw, 36px);
  height: calc(var(--card-height) + 1.7rem);
}

/* Tři hráči nemají horní sedadlo, proto by 48 % středu bylo výš než u 2 a 4 hráčů. */
.table.players-3 .pile-row {
  top: calc(50dvh - max(0.5rem, env(safe-area-inset-top)));
}

.status-slot {
  z-index: 4;
  position: absolute;
  left: 50%;
  top: auto;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 360px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.pile-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.draw-well {
  position: relative;
  width: var(--card-center-w);
  aspect-ratio: var(--card-ratio);
  height: auto;
  flex: none;
}

.deck-slot {
  position: absolute;
  inset: 0;
  z-index: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border-radius: var(--card-radius);
  background: rgba(0, 0, 0, 0.25);
  border: 2px dashed rgba(212, 175, 55, 0.35);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.deck-slot:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.draw-pile,
.discard-pile {
  padding: 0;
  width: var(--card-center-w);
  aspect-ratio: var(--card-ratio);
  height: auto;
}

.discard-pile {
  position: relative;
  overflow: visible;
}

.draw-well .draw-pile {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: auto;
  height: auto;
  border-radius: var(--card-radius);
  transform: none;
}

.discard-pile .card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  transform-origin: center center;
  transition: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
}

.draw-pile {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: none;
}

.draw-pile:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.draw-pile.empty,
.draw-pile.empty::before {
  content: none;
}

.draw-pile.is-empty {
  visibility: visible;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
}

.draw-pile.is-locked {
  pointer-events: none;
}

.draw-pile.is-must-draw:not(.is-empty),
.deck-slot.is-must-draw {
  border-style: solid;
  border-color: #facc15;
}

/* Širší klepnutí pod lízacím balíčkem. Karta v ruce a Stojím jsou nad ním. */
.draw-reach {
  position: absolute;
  z-index: 3;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.draw-reach[hidden] {
  display: none;
}

.draw-reach.is-locked {
  pointer-events: none;
  cursor: default;
}

/* Nad sloupcem protihráče, pod kartami v ruce. */
.draw-glow {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  border-radius: var(--card-radius);
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.85), 0 0 25px rgba(234, 179, 8, 0.45);
  animation: turn-avatar-breathe 2.4s ease-in-out infinite;
}

.draw-glow[hidden] {
  display: none;
}

/* Mimo sloupce, ať počet nesáhne na šířku sedadel ani na vějíř. */
.side-count {
  position: absolute;
  z-index: 4;
  margin: 0;
  pointer-events: none;
  transform: translateX(-50%);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  line-height: 1.1;
}

.side-count[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .draw-pile.is-must-draw:not(.is-empty),
  .deck-slot.is-must-draw,
  .draw-glow {
    animation: none;
  }
}

.draw-unders {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

.draw-unders .card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  transform-origin: center center;
  transition: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
}

.pile-caption {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  min-height: 1em;
  opacity: 0.75;
}

.status-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  width: max-content;
  max-width: min(100%, 340px);
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  box-sizing: border-box;
}

html[data-table-theme="black"] .status-panel {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.status-panel .is-idle {
  display: none;
}

#stand-btn:not(.is-idle) {
  visibility: visible;
  pointer-events: auto;
  position: relative;
  z-index: 6;
}

.status-text {
  margin: 0;
  height: auto;
  min-height: 0;
  max-height: none;
  font-size: clamp(0.78rem, 2vw, 0.92rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: 0.02em;
  white-space: pre-line;
  overflow: visible;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.status-text:empty {
  display: none;
}

.status-panel .action-btn {
  margin-top: 0;
  padding: 0.32rem 0.95rem;
}

.status-panel.is-compact {
  width: max-content;
  max-width: min(100%, 340px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.status-panel.is-compact .status-text {
  min-height: 0;
  font-size: 0.78rem;
  line-height: 1.15;
  font-weight: 700;
  white-space: nowrap;
}

.status-panel:not(.is-compact) .status-text {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9), 0 0 2px rgba(0, 0, 0, 1);
}

.status-panel.is-compact.is-empty {
  display: none;
}

.status-panel.is-compact .is-idle {
  display: none;
}

.status-dot {
  opacity: 0.7;
}

.hidden {
  display: none !important;
}

.action-btn {
  margin-top: 0.65rem;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  background: var(--gold);
  color: var(--felt-rim);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.action-btn.danger {
  background: #9a2b3f;
  color: #f7f1e1;
}

.action-btn.danger:focus-visible {
  outline-color: #f7d0d6;
}

.action-btn:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.modal-actions .action-btn {
  margin-top: 0.4rem;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  margin: auto;
  max-width: calc(100vw - 1.2rem);
}

.modal[open] {
  pointer-events: auto;
}

.modal:not([open]) {
  display: none !important;
  pointer-events: none !important;
}

.modal::backdrop {
  background: rgba(4, 16, 10, 0.72);
}

html[data-table-theme="black"] .settings-btn {
  background: rgba(8, 8, 8, 0.88);
}

html[data-table-theme="black"] .modal::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

html[data-table-theme="black"] .modal-card {
  background: #161616;
}

.play-update-card {
  width: min(88vw, 360px);
  text-align: center;
  border: 2px solid var(--gold);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.play-update-badge {
  width: 58px;
  height: 58px;
  margin: 0.15rem auto 0.85rem;
  border-radius: 50%;
  background: var(--gold);
  color: var(--felt-rim);
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-update-badge svg {
  width: 30px;
  height: 30px;
}

.play-update-card .modal-title {
  margin-bottom: 0.45rem;
  letter-spacing: 0.03em;
  font-size: 1.12rem;
}

.play-update-card p {
  margin-bottom: 0.35rem;
}

.play-update-actions {
  justify-content: stretch;
}

.play-update-actions .action-btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}

.modal-card {
  width: min(92vw, 440px);
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
  padding: 1.05rem 1.1rem 1.1rem;
  border: 1px solid rgba(230, 195, 106, 0.35);
  border-radius: 16px;
  background: #123d27;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
}

.settings-card {
  position: relative;
  max-height: 90dvh;
}

/* Safari na malém iPhonu po otevření dialogu posune viditelné okno.
   Dialog se proto přichytí na visualViewport, jinak karta zůstane nahoře a dole je černá plocha. */
#settings-dialog[open] {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding:
    max(0.6rem, env(safe-area-inset-top))
    max(0.6rem, env(safe-area-inset-right))
    max(0.6rem, env(safe-area-inset-bottom))
    max(0.6rem, env(safe-area-inset-left));
}

#settings-dialog.is-viewport-pinned .settings-card {
  max-height: 100%;
}

.menu-close {
  position: absolute;
  top: 0.62rem;
  right: 0.45rem;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--gold);
  cursor: pointer;
}

.menu-close svg {
  width: 1.2rem;
  height: 1.2rem;
}

.start-panel h2 {
  margin-top: 0;
  text-align: center;
}

.start-panel:not(.host-panel):not(.setup-panel):not(.tab-panel) {
  overflow-y: auto;
}

.tab-panel:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.tab-panel .panel-scroll {
  max-height: min(62dvh, 560px);
}

.tab-panel .modal-actions {
  flex-shrink: 0;
  margin-top: 0.3rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(230, 195, 106, 0.22);
}

.app-tabs {
  display: flex;
  flex-shrink: 0;
  gap: 0.25rem;
  margin-top: 0.45rem;
  padding-top: 0.15rem;
}

.app-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  flex: 1 1 0;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 0.48rem 0.12rem;
  background: transparent;
  color: rgba(243, 230, 192, 0.72);
  font: inherit;
  font-size: clamp(0.68rem, 2.5vw, 0.82rem);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.tab-icon {
  width: 0.95em;
  height: 0.95em;
  flex: none;
}

.app-tab.is-active {
  background: rgba(230, 195, 106, 0.18);
  color: var(--gold);
}

button.choice-chip {
  background: transparent;
  color: inherit;
  font: inherit;
}

.choice-chip.is-active {
  border-color: var(--gold);
  background: rgba(230, 195, 106, 0.16);
}

.rules-switch {
  margin: 0 0 0.85rem;
}

.rules-copy p,
.rules-copy li {
  font-size: 0.92rem;
  line-height: 1.45;
}

.rules-copy ul {
  margin: 0.2rem 0 0.4rem;
  padding-left: 0;
  list-style: none;
}

.rules-copy li {
  position: relative;
  padding-left: 1.05rem;
}

.rules-copy li::before {
  content: "";
  position: absolute;
  left: 0.08rem;
  top: 0.48em;
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 50%;
  background: currentColor;
}

.rules-copy li + li {
  margin-top: 0.45rem;
}

.rules-term {
  color: var(--gold);
  font-weight: 700;
}

.setup-panel:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.setup-panel .modal-actions {
  flex-shrink: 0;
  margin-top: 0.3rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(230, 195, 106, 0.22);
}

.action-btn.secondary {
  background: rgba(230, 195, 106, 0.14);
  color: var(--cream);
  box-shadow: inset 0 0 0 1.5px rgba(230, 195, 106, 0.9);
}

.menu-link {
  display: block;
  width: 100%;
  margin: 0.15rem 0 0.2rem;
  padding: 0.35rem 0.2rem 0.15rem;
  border: 0;
  background: none;
  color: rgba(243, 230, 192, 0.9);
  font: inherit;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.invite-box {
  margin: 0.35rem 0 0.2rem;
}

.invite-box .menu-btn {
  margin-top: 0.15rem;
}

.host-panel:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  overflow-x: visible;
}

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: visible;
  max-height: 60dvh;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #e6c36a #0d2c1c;
  scrollbar-width: thin;
}

.panel-scroll.can-scroll-more {
  box-shadow: inset 0 -2.4rem 1.5rem -1.15rem #123d27;
}

html[data-table-theme="black"] .panel-scroll.can-scroll-more {
  box-shadow: inset 0 -2.4rem 1.5rem -1.15rem #161616;
}

.panel-scroll::-webkit-scrollbar {
  width: 10px;
}

.panel-scroll::-webkit-scrollbar-track {
  background: #0d2c1c;
  border-radius: 999px;
}

.panel-scroll::-webkit-scrollbar-thumb {
  background: #e6c36a;
  border: 2px solid #0d2c1c;
  border-radius: 999px;
}

html[data-table-theme="black"] .panel-scroll {
  scrollbar-color: #e6c36a #0a0a0a;
}

html[data-table-theme="black"] .panel-scroll::-webkit-scrollbar-track {
  background: #0a0a0a;
}

html[data-table-theme="black"] .panel-scroll::-webkit-scrollbar-thumb {
  border-color: #0a0a0a;
}

#panel-settings .panel-scroll {
  padding-right: 0.55rem;
}

.host-panel .modal-actions {
  flex-shrink: 0;
  margin-top: 0.3rem;
  padding-top: 0.45rem;
  border-top: 1px solid rgba(230, 195, 106, 0.22);
}

.host-panel h2 {
  margin: 0 0 0.28rem;
  font-size: 1.12rem;
}

.host-panel .toggle-hint,
.host-panel p {
  margin: 0 0 0.35rem;
}

.host-panel .option-block {
  margin: 0 0 0.4rem;
  padding: 0.38rem 0.5rem 0.45rem;
}

.host-panel .qr-wrap,
.qr-wrap {
  display: block;
  max-width: 160px;
  width: 160px;
  margin: 10px auto;
  padding: 12px;
  background: #ffffff;
  border-radius: 10px;
  box-sizing: border-box;
  overflow: visible;
}

.host-panel .qr-wrap canvas,
.host-panel .qr-wrap img,
.host-panel .qr-wrap table,
.host-panel .qr-box,
.qr-wrap canvas,
.qr-wrap img,
.qr-wrap table,
.qr-box,
#qrcode,
#qrcode canvas,
#qrcode img,
#host-qr,
#host-qr canvas,
#host-qr img,
#host-qr table {
  display: block;
  margin: 0 auto;
  padding: 0;
  max-width: 100%;
  width: 100%;
  height: auto;
  box-sizing: border-box;
  overflow: visible;
  background: #ffffff;
}

.share-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.15rem 0 0.35rem;
}

.share-row .action-btn {
  flex: 1 1 0;
  margin-top: 0;
  min-height: 42px;
  font-size: 0.88rem;
  padding: 0.4rem 0.55rem;
}

.host-panel .wait-line {
  margin: 0 0 0.22rem;
  font-size: 0.78rem;
}

.host-panel .guest-list {
  margin: 0 0 0.3rem;
}

.action-btn.is-connected,
.action-btn.is-connected:disabled {
  background: #2f6f4a;
  color: #e9f7ee;
  opacity: 1;
  cursor: default;
  border: 1px solid rgba(167, 227, 188, 0.45);
}

.modal-card h2,
.modal-title {
  margin: 0 0 0.7rem;
  color: var(--gold);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.modal-card p {
  margin: 0 0 0.9rem;
  line-height: 1.4;
}

.option-block {
  border: 1px solid rgba(230, 195, 106, 0.22);
  border-radius: 12px;
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.8rem 0.85rem;
}

.option-block legend {
  padding: 0 0.35rem;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.speed-slider {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.speed-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  margin: 0.35rem 0 0;
  border: 0;
  border-radius: 999px;
  background: #1a1208;
  box-shadow: inset 0 0 0 1px rgba(230, 195, 106, 0.7);
  accent-color: var(--gold);
  cursor: pointer;
}

.speed-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #3a2a12;
  background: radial-gradient(circle at 35% 35%, #f7e7b0, #e6c36a 46%, #a6843c);
  box-shadow: 0 0 8px rgba(230, 195, 106, 0.7);
  cursor: pointer;
}

.speed-slider input[type="range"]::-moz-range-track {
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: #1a1208;
  box-shadow: inset 0 0 0 1px rgba(230, 195, 106, 0.7);
}

.speed-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #3a2a12;
  background: #e6c36a;
  box-shadow: 0 0 8px rgba(230, 195, 106, 0.7);
  cursor: pointer;
}

.speed-slider input[type="range"]:disabled {
  opacity: 0.45;
  cursor: default;
}

.speed-slider-labels {
  display: flex;
  justify-content: space-between;
  color: var(--gold);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.choice-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0.28rem;
  width: 100%;
}

.choice-chip {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.32rem 0.4rem;
  font-size: 0.82rem;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
}

.choice-chip:has(input:checked) {
  border-color: var(--gold);
  background: rgba(230, 195, 106, 0.16);
}

.choice-chip input {
  accent-color: var(--gold);
}

.bot-settings {
  display: grid;
  gap: 0.55rem;
}

.bot-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.bot-row select {
  font: inherit;
  color: var(--cream);
  background: #0d2c1c;
  border: 1px solid rgba(230, 195, 106, 0.35);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 12px;
  cursor: pointer;
}

.toggle-row > span:first-child {
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-transform: uppercase;
}

.toggle-wrap {
  position: relative;
  width: 44px;
  height: 24px;
  flex: none;
}

.toggle-wrap input {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-ui {
  display: block;
  width: 44px;
  height: 24px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid rgba(230, 195, 106, 0.45);
  background: rgba(0, 0, 0, 0.35);
  position: relative;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cream);
  transition: transform 0.16s ease, background 0.16s ease;
}

/* Zapnuto: stejná zlatá jako u aktivních voleb, v zelené i tmavé variantě stolu. */
.toggle-row input:checked + .toggle-ui {
  background: var(--gold);
  border-color: var(--gold);
}

.toggle-row input:checked + .toggle-ui::after {
  transform: translateX(20px);
  background: var(--ink);
}

.toggle-row input:focus-visible + .toggle-ui {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.toggle-hint {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  opacity: 0.85;
}

.privacy-note {
  margin: 0.9rem 0 0;
  text-align: center;
  font-size: 0.82rem;
}

.privacy-note a {
  color: #e6c36a;
}

.suit-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.suit-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 0.75rem 0.5rem;
  background: rgba(7, 32, 21, 0.45);
  color: var(--dialog-btn-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.suit-choice.suit-cervene,
.suit-choice.suit-zelene,
.suit-choice.suit-kule,
.suit-choice.suit-zaludy {
  color: var(--dialog-btn-text);
}

.suit-choice .pip {
  display: none;
}

.suit-choice .suit-select-icon {
  display: inline-block;
}

.suit-cancel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 0.85rem;
  border: 1px solid rgba(230, 195, 106, 0.28);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  background: rgba(12, 18, 16, 0.72);
  color: var(--dialog-btn-text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.suit-cancel-icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  display: block;
}

.suit-cancel-btn:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.result-card {
  text-align: center;
}

.result-table {
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
  text-align: left;
}

.result-table li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.1rem;
  border-bottom: 1px solid rgba(230, 195, 106, 0.18);
}

.result-table .result-who {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
}

.result-table .result-rank {
  color: var(--gold);
  font-weight: 700;
  flex: none;
}

.result-table .result-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-table .result-human {
  font-weight: 700;
}

.result-table .result-medal {
  width: 1.55rem;
  height: 1.55rem;
  object-fit: contain;
  flex: none;
}

.result-table .result-round {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: none;
  margin-left: 0.85rem;
}

.result-table .result-gained,
.result-table .result-total {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.result-table .result-total {
  min-width: 1.1rem;
  color: var(--cream);
  font-weight: 700;
}

.result-table .result-gained {
  min-width: 0;
  text-align: left;
  color: rgba(247, 241, 225, 0.55);
  font-size: 0.85rem;
  font-weight: 400;
}

.card {
  position: relative;
  width: var(--card-center-w);
  aspect-ratio: var(--card-ratio);
  height: auto;
  flex: none;
  border-radius: var(--card-radius);
  /* Stín sleduje průhledné rohy obrázku, ne obdélník prvku. */
  box-shadow: none;
  filter: var(--card-shadow);
  background: transparent;
  overflow: hidden;
  container-type: inline-size;
  container-name: card;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.card.draw-pile {
  transition: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.4));
}

.seat-south .card {
  width: var(--card-player-w);
  height: auto;
  aspect-ratio: var(--card-ratio);
}

.seat-north .card,
.side-hand .card {
  width: var(--card-opp-w);
}

.hand .card {
  flex: 0 0 auto;
  flex-shrink: 0;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.7));
}

.seat-south .hand,
.seat-south .player-hand,
.seat-south .player-cards,
.seat-south .hand-cards {
  justify-content: center !important;
}

.seat-north .hand .card {
  flex: 0 0 auto;
  width: var(--card-opp-w);
  height: calc(var(--card-opp-w) * 104 / 62);
  aspect-ratio: var(--card-ratio);
}

.card-face {
  background: transparent;
  color: var(--ink);
  border: 0;
  padding: 0;
}

.card.fly-card {
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.7));
  transition: none;
}

.replenish-flight {
  position: fixed;
  margin: 0;
  pointer-events: none;
}

.replenish-flip {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
}

.replenish-flight .replenish-face,
.replenish-flight .replenish-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 10px 14px rgba(0, 0, 0, 0.45);
}

.replenish-flight .replenish-back {
  transform: rotateY(180deg);
}

/* Podklad prázdného balíčku je vidět jen tehdy, když na něm neleží karta. */
.draw-well:has(.draw-pile:not(.is-empty)) .deck-slot {
  visibility: hidden;
}

/* Jednotné zakulacení karet, balíčku i podkladu (shodné s rohy v obrázcích). */
.card,
.card-back,
.card-face,
.deck,
.draw-pile,
.discard-pile,
.fly-card,
.deck-slot,
.card-placeholder,
.card img,
.card-art {
  border-radius: var(--card-radius);
}

.card,
.card-face,
.card-back,
.card img,
.deck,
.played-card,
.bot-card {
  border-radius: var(--card-radius) !important;
  overflow: hidden !important;
}

.card-art {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.card-corner {
  display: flex;
  flex-direction: column;
  line-height: 1;
  font-weight: 700;
}

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

.card-corner .pip {
  font-size: 0.85rem;
  font-size: 18cqi;
}

.card-center {
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-size: 40cqi;
  line-height: 1;
}

.card-name {
  text-align: center;
  font-size: 0.58rem;
  font-size: 11cqi;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.card-name span {
  display: block;
}

button.card {
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

button.card,
.seat-south .card,
.draw-pile {
  cursor: pointer;
}

.suit-cervene {
  color: var(--suit-cervene);
}

.suit-zelene {
  color: var(--suit-zelene);
}

.suit-kule {
  color: var(--suit-kule);
}

.suit-zaludy {
  color: var(--suit-zaludy);
}

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

.card-back::before {
  content: none;
}

@media (max-width: 760px) {
  :root {
    --card-player-base: clamp(48px, min(22vw, 10dvh), 78px);
    --card-center-base: clamp(54px, min(17vw, 11dvh), 78px);
    --avatar-base: 52px;
    --medal-base: 15px;
  }

  .table {
    gap: 0.25rem;
    padding: max(0.4rem, env(safe-area-inset-top)) max(0.55rem, env(safe-area-inset-right))
      max(0.35rem, env(safe-area-inset-bottom)) max(0.55rem, env(safe-area-inset-left));
  }

  .table.players-3 .pile-row {
    top: calc(50dvh - max(0.4rem, env(safe-area-inset-top)));
  }

  .seat-west,
  .seat-east {
    padding: 0.1rem 0.06rem;
  }

  .table.players-3 .seat-west,
  .table.players-3 .seat-east {
    padding-top: 3rem;
    padding-left: 0.4rem;
    padding-right: 0.4rem;
  }

  .identity .seat-name {
    font-size: 0.82rem;
  }

  .table-center {
    overflow: hidden;
  }

  .pile-row {
    gap: clamp(16px, 3vw, 36px);
  }

  .status-slot {
    width: min(100%, 340px);
  }

  .status-panel {
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 0;
  }

  .seat-south {
    flex: 1 1 auto;
    flex-shrink: 1;
    min-height: 0;
    height: calc(min(26vh, 180px) * var(--table-scale, 1));
    max-height: calc(min(26vh, 180px) * var(--table-scale, 1));
  }

  .seat-south .seat-inner,
  .seat-south .hand,
  .seat-south .player-hand,
  .seat-south .player-cards,
  .seat-south .hand-cards {
    max-width: 100%;
  }

  .seat-south .hand {
    justify-content: center;
    overflow: visible;
    padding: calc(24px * var(--table-scale, 1)) calc(4px * var(--table-scale, 1)) calc(8px * var(--table-scale, 1));
  }

  .seat-north .card {
    margin-left: calc(var(--card-opp-w) * -0.62);
  }
}

/* Úzký telefon: střed stolu má prioritu, lišta medailí ho neroztahuje. */
@media (max-width: 480px) {
  :root {
    --medal-base: 18px;
    --avatar-base: 46px;
    --card-center-base: clamp(48px, min(15vw, 12dvh), 65px);
  }

  .table.players-3 .table-board,
  .table.players-4 .table-board {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr);
    column-gap: 0.3rem;
    align-items: stretch;
  }

  .table.players-3 .seat-west,
  .table.players-3 .seat-east,
  .table.players-4 .seat-west,
  .table.players-4 .seat-east,
  .table.players-3 .table-center,
  .table.players-4 .table-center {
    width: auto;
    max-width: none;
    min-width: 0;
    flex: none;
  }

  .table.players-4 .seat-west,
  .table.players-4 .seat-east {
    padding: 0;
  }

  .table.players-3 .seat-west,
  .table.players-3 .seat-east {
    padding-top: 3rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }

  .seat-west .seat-inner,
  .seat-east .seat-inner,
  .seat-west .identity,
  .seat-east .identity {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .medal-strip {
    max-width: 100%;
    min-width: 0;
  }

  .medal-strip-loose {
    gap: 3px;
    width: max-content;
    max-width: 100%;
  }

  .identity .medal-strip,
  .identity .medal-strip-dense {
    max-width: 100%;
  }

  .seat-south .medal-strip,
  .seat-south .medal-strip-tight,
  .seat-south .medal-strip-dense {
    width: max-content;
    max-width: none;
  }

  .status-slot {
    left: 0;
    right: 0;
    width: 100%;
    max-width: none;
    transform: none;
    box-sizing: border-box;
    padding: 0 2px;
  }

  .status-panel {
    width: 100%;
    max-width: none;
  }

  .status-text {
    font-size: 0.85rem;
    line-height: 1.35;
    letter-spacing: 0;
  }

  .pile-row {
    gap: clamp(16px, 3vw, 36px);
    max-width: calc(100% - 8px);
  }

  .pile-stack {
    min-width: 0;
    overflow: visible;
  }

  .pile-caption {
    white-space: nowrap;
    letter-spacing: 0;
    text-align: center;
    font-size: 0.8rem;
    line-height: 1.2;
    padding: 0 0.2rem;
    overflow: visible;
  }
}

/* Široké okno od výšky 521 px: plynulé velikosti a širší boční sedadla. Nižší landscape je mobil. */
@media (aspect-ratio > 1) and (min-height: 521px) {
  :root {
    --card-player-base: clamp(52px, min(16vw, 11dvh), 92px);
    --card-center-base: clamp(58px, min(14.5vw, 12dvh), 92px);
    --avatar-base: 64px;
    --medal-base: 18px;
  }

  .seat-west,
  .seat-east {
    --side-w: max(
      calc(var(--card-opp-w) + 2.2rem),
      calc(var(--avatar-size) + 2.4rem),
      min(18vw, 210px)
    );
  }

  .seat-south {
    height: max(
      calc(min(28vh, 210px) * var(--table-scale, 1)),
      calc(clamp(80px, 12vh, 130px) + 2.4rem)
    );
    max-height: max(
      calc(min(28vh, 210px) * var(--table-scale, 1)),
      calc(clamp(80px, 12vh, 130px) + 2.4rem)
    );
  }
}

/* Jen nízký mobil na šířku. Okno vyšší než 520 px (notebook, desktop) sem nespadá. */
@media (orientation: landscape) and (max-height: 520px) {
  .table.players-3 .seat-west,
  .table.players-3 .seat-east,
  .table.players-4 .seat-west,
  .table.players-4 .seat-east,
  .seat-west,
  .seat-east {
    position: absolute;
    top: 44px;
    bottom: auto;
    transform: none;
    z-index: 3;
    flex: none;
    align-self: auto;
    width: max-content;
    max-width: 76px;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    --side-w: 76px;
    padding: 0;
  }

  .table.players-3 .seat-west,
  .table.players-4 .seat-west,
  .seat-west {
    left: 15px;
    right: auto;
  }

  .table.players-3 .seat-east,
  .table.players-4 .seat-east,
  .seat-east {
    left: auto;
    right: 15px;
  }

  .seat-north .bot-avatar,
  .seat-west .bot-avatar,
  .seat-east .bot-avatar {
    width: 40px;
    height: 40px;
  }

  .seat-west .seat-inner,
  .seat-east .seat-inner,
  .seat-west .identity,
  .seat-east .identity {
    height: auto;
    max-height: none;
    gap: 0.06rem;
    margin: 0;
    padding: 0;
  }

  .seat-north .identity .seat-name,
  .seat-west .identity .seat-name,
  .seat-east .identity .seat-name {
    font-size: 0.68rem;
    line-height: 1;
  }

  .seat-west .medal-strip,
  .seat-east .medal-strip {
    height: calc(var(--medal-size) + 2px);
    padding: 0 3px;
  }

  .seat-west .side-hand,
  .seat-east .side-hand,
  .hand.side-hand {
    max-height: min(100%, 30vh);
  }

  .seat-north {
    margin-bottom: 6px;
  }

  .seat-north .seat-inner {
    position: relative;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: max-content;
    max-width: calc(100% - 16px);
    height: auto;
    margin: 0;
    padding: 2px calc(var(--card-opp-w) + 6px) 0 0;
  }

  .seat-north .identity {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    width: max-content;
    min-width: max-content;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .seat-north .identity .bot-avatar {
    order: 1;
  }

  .seat-north .identity .seat-name {
    order: 2;
    margin: 0;
  }

  .seat-north .identity .medal-strip,
  .seat-north .medal-strip,
  .seat-north .medal-strip-tight,
  .seat-north .medal-strip-dense {
    order: 3;
    position: static;
    height: auto;
    min-height: var(--medal-size);
    max-width: none;
    overflow: visible;
    margin: 0;
    padding: 0 2px;
  }

  .seat-north .hand {
    position: absolute;
    left: calc(100% - var(--card-opp-w) - 6px);
    top: 50%;
    flex: none;
    width: max-content;
    height: auto;
    min-height: 0;
    margin: 0;
    transform: translateY(-50%);
    justify-content: flex-start;
  }

  .seat-south {
    position: relative;
    flex: 0 0 auto;
    height: 92px;
    max-height: 92px;
  }

  .seat-south .seat-medals {
    top: 0;
  }

  .seat-south .medal-strip,
  .seat-south .medal-strip-tight,
  .seat-south .medal-strip-dense {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    width: max-content;
    max-width: none;
    height: auto;
    min-height: var(--medal-size);
    overflow: visible;
    margin: 0;
  }

  .seat-south .hand,
  .seat-south .player-hand,
  .seat-south .player-cards,
  .seat-south .hand-cards {
    padding: 22px 8px 4px;
  }

  .status-text {
    margin: 6px 0;
  }

  .pile-row {
    top: max(
      calc((var(--card-height) + 1.7rem) / 2 + 14px),
      min(46%, calc(100% - 8rem))
    );
  }
}

@media (hover: none) {
  .seat-south .card.is-raised,
  .seat-south .card.selected,
  .seat-south .card.active {
    transform: translateY(-35px);
    z-index: 5;
  }
}

.seat-west .card,
.seat-east .card {
  flex: none !important;
  flex-grow: 0 !important;
  flex-shrink: 0 !important;
  flex-basis: auto !important;
  width: var(--card-opp-w) !important;
  height: calc(var(--card-opp-w) * 104 / 62) !important;
  min-height: calc(var(--card-opp-w) * 104 / 62) !important;
  max-width: var(--card-opp-w);
  max-height: calc(var(--card-opp-w) * 104 / 62);
  aspect-ratio: var(--card-ratio) !important;
}

.seat-south .hand {
  overflow: visible !important;
  overflow-x: visible !important;
  scrollbar-width: none;
}

.seat-south .seat-inner {
  max-height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: visible;
}

.seat-south .hand {
  flex: 1 1 auto;
  min-height: 0;
}

.seat-south .hand::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.menu-stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin: 0.4rem 0 1rem;
}

.menu-btn {
  width: 100%;
  margin-top: 0;
  min-height: 48px;
  font-size: 1.02rem;
}

.start-panel > h2 {
  flex-shrink: 0;
}

.home-title {
  text-align: center;
  text-transform: uppercase;
}

.settings-group-label {
  margin: 0.15rem 0 0.45rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#panel-settings.settings-split .panel-scroll {
  display: flex;
  flex-direction: column;
}

#panel-settings.settings-split .settings-now-group {
  order: 2;
}

#panel-settings.settings-split .settings-next-group {
  order: 3;
}

#panel-settings.settings-split .privacy-note {
  order: 4;
}

#panel-settings.settings-split .settings-next-group,
#panel-settings.settings-split .settings-now-group {
  margin-top: 0.85rem;
  padding-top: 0.95rem;
  border-top: 1px solid rgba(230, 195, 106, 0.72);
  background: none;
}

#panel-settings .settings-group-label {
  margin: 0 0 0.4rem;
}

#panel-settings .settings-group-label + .toggle-hint {
  margin: 0 0 1rem;
}

.host-code {
  text-align: center;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--gold);
}

.wait-line {
  text-align: center;
  font-weight: 700;
}

.guest-list {
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
}

.guest-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(230, 195, 106, 0.18);
}

.guest-list .is-host {
  font-weight: 700;
}

.error-line {
  min-height: 1.2em;
  color: #ffb4b4;
  font-size: 0.88rem;
}

.field-label {
  display: block;
  margin: 0.35rem 0 0.25rem;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
}

.text-input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.55rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid rgba(230, 195, 106, 0.35);
  border-radius: 10px;
  background: #0d2c1c;
  color: var(--cream);
  font: inherit;
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}

.text-input[type="search"]::-webkit-search-decoration,
.text-input[type="search"]::-webkit-search-cancel-button,
.text-input[type="search"]::-webkit-search-results-button,
.text-input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}

html[data-table-theme="black"] .text-input {
  background: #050505;
  border-color: rgba(230, 195, 106, 0.55);
  color: var(--cream);
}

.text-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

html[data-table-theme="black"] .text-input:focus {
  outline: none;
  border-color: rgba(230, 195, 106, 0.75);
  box-shadow: inset 0 0 0 1px rgba(230, 195, 106, 0.45);
}

.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.55rem;
}

.name-row .text-input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin-bottom: 0;
}

.board-head,
.board-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
}

#panel-board p.field-label {
  margin: 1.35rem 0 0.4rem;
}

dialog.is-board-wait {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  background: transparent;
}

dialog.is-board-wait::backdrop {
  background-color: var(--felt-dark);
  background-image: var(--table-vignette), var(--table-felt-tint), var(--table-felt);
  background-repeat: no-repeat, no-repeat, repeat;
  background-position: center, center, center;
  background-size: auto, auto, var(--table-felt-size);
}

body:has(dialog.is-board-wait) #table {
  visibility: hidden;
}

dialog.is-board-wait .settings-card {
  visibility: hidden;
}

.board-loading {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: none;
}

.board-spinner {
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid rgba(230, 195, 106, 0.28);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: board-spin 0.7s linear infinite;
}

@keyframes board-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .board-spinner {
    animation: none;
    border-color: var(--gold);
  }
}

.board-head {
  margin-top: 0.35rem;
  padding: 0 0.35rem 0.15rem;
  color: rgba(230, 195, 106, 0.8);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.board-list {
  margin: 0 0 0.4rem;
  padding: 0;
  list-style: none;
}

.board-list li {
  padding: 0.32rem 0.35rem;
  border-bottom: 1px solid rgba(230, 195, 106, 0.18);
}

.board-list li.is-me {
  background: rgba(230, 195, 106, 0.16);
  border-radius: 0.4rem;
}

.board-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.7rem;
  color: rgba(243, 230, 192, 0.72);
  font-size: 0.8rem;
}

.board-signout {
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--gold);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.result-board {
  min-height: 1.2rem;
  margin: 0.35rem 0 0;
  text-align: center;
  color: var(--gold);
}

.profile-pick {
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1.5px solid #c5a059;
  border-radius: 30%;
  overflow: hidden;
  background: #0d0d0d;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.profile-pick:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.profile-pick-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  pointer-events: none;
}

.profile-card {
  position: relative;
  width: min(92vw, 520px);
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px;
  overflow: auto;
  max-height: min(60vh, 420px);
  margin-top: 0.35rem;
  padding: 2px;
}

.profile-option {
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid rgba(197, 160, 89, 0.45);
  border-radius: 30%;
  overflow: hidden;
  background: #0d0d0d;
  cursor: pointer;
}

.profile-option img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  pointer-events: none;
}

.profile-option.is-selected {
  border-color: #facc15;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.55), 0 0 12px rgba(250, 204, 21, 0.45);
}

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

.profile-tile {
  position: relative;
  min-width: 0;
  -webkit-touch-callout: none;
  user-select: none;
}

.profile-zoom-btn {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #c5a059;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: var(--gold);
  cursor: pointer;
}

.profile-zoom-btn svg {
  width: 16px;
  height: 16px;
}

.profile-zoom-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.profile-zoom {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 1rem;
  background: rgba(6, 16, 10, 0.96);
}

.profile-zoom.hidden {
  display: none;
}

.profile-zoom-photo {
  width: min(68vw, 320px);
  height: min(68vw, 320px);
  object-fit: cover;
  object-position: center 20%;
  border: 2px solid #c5a059;
  border-radius: 18%;
  background: #0d0d0d;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}

.profile-zoom-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.profile-empty {
  grid-column: 1 / -1;
  margin: 0.4rem 0;
  color: var(--cream);
}

.scanner-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 0.35rem 0 0.6rem;
  overflow: hidden;
  border-radius: 12px;
  background: #07140d;
}

.scanner-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.turbo-banner {
  margin: 0;
  height: 0;
  min-height: 0;
  overflow: hidden;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(4, 16, 10, 0.72);
}

.pause-overlay.hidden {
  display: none !important;
}

.pause-card {
  width: min(92vw, 400px);
  padding: 1.2rem 1.25rem 1.3rem;
  border: 1px solid rgba(230, 195, 106, 0.35);
  border-radius: 16px;
  background: #123d27;
  text-align: center;
}

.pause-card h2 {
  margin: 0 0 0.6rem;
  color: var(--gold);
}

.table.is-turbo .fly-card {
  transition-duration: 40ms !important;
}
