/* ==========================================================================
   STÓŁ — widok rozgrywki. Wyłącznie struktura; kolory ze skórki.
   Plansza jest wpisana w dostępne miejsce przez aspect-ratio, więc układ
   trzyma się na telefonie i na 4K bez skryptu liczącego piksele.
   ========================================================================== */

.table-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(14px, 2vw, 26px);
  align-items: start;
  padding: clamp(14px, 2.5vw, 26px) clamp(10px, 3vw, 28px) 40px;
  max-width: 1220px;
  margin: 0 auto;
}

/* Kolumna z planszą: plansza, panel gry i podajnik zawsze jedno pod drugim. */
.table-main { display: grid; gap: 10px; align-content: start; }

/* Na wąskim ekranie plansza zostaje na górze — panel z ustawieniami zjeżdża
   pod nią, żeby nie spychać gry poniżej pierwszego ekranu.
   Marginesy schodzą wtedy do minimum: na telefonie każdy piksel szerokości
   to większe pole do trafienia palcem. */
@media (max-width: 900px) {
  .table-view {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px 6px 28px;
    gap: 10px;
  }
  .felt { padding: 6px; border-radius: var(--r-md); }
  .board-slot { width: 100%; }

  /* Gracze obok siebie, a nie jeden pod drugim — inaczej stan partii
     i przyciski wypadają poniżej ekranu. */
  .table-side__seats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
  }
  .seat { padding: 8px 10px; gap: 9px; min-width: 0; }
  .seat > div { min-width: 0; }
  .seat__name, .seat__role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .seat__ava { width: 34px; height: 34px; font-size: 15px; }
  .seat__clock { font-size: 16px; }
  .status { padding: 10px 12px; min-height: 0; }
  .log__body { max-height: 104px; }
  .chat__log { height: 150px; }

  /* Pasek górny musi zmieścić się w JEDNEJ linii — inaczej zjada
     kilkadziesiąt pikseli wysokości planszy. */
  .chip--wide { display: none; }
  .topbar { gap: 8px; padding: 6px 8px; }
  .brand__logo { height: 26px; }
}

/* --------------------------------------------------------------- stół */
.felt {
  position: relative;
  border-radius: var(--r-lg);
  padding: clamp(10px, 2.2vw, 26px);
  background: var(--felt-bg);
  box-shadow: var(--sh-3), var(--felt-inset);
  border: var(--felt-frame-width) solid transparent;
  border-image: var(--felt-frame) 1;
}
.felt::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  mix-blend-mode: overlay;
  background-image: var(--noise);
}

.board-slot {
  position: relative;
  width: min(100%, 74vh);
  margin: 0 auto;
  aspect-ratio: var(--board-ratio, 1);
}

/* Stół sieciowy przed pierwszym ruchem: plansza to tylko podgląd pozycji
   startowej, więc przygaszamy ją, żeby nikt nie próbował nią grać. */
.felt[data-waiting="tak"] .grid-board { opacity: .5; filter: saturate(.7); }

/* Tło planszy: linie łączące pola (młynek, chińczyk). Leży POD siatką
   i nie łapie kliknięć. Gra dostarcza je jako SVG w meta.boardBg. */
.board-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: var(--r-sm);
  overflow: hidden;
}
.board-bg svg { width: 100%; height: 100%; display: block; }

/* Warstwa NAD siatką — linie, które muszą być widoczne mimo tła pól
   (np. grubsze linie kwadratów w sudoku). Też nie łapie kliknięć. */
.board-fg {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: var(--r-sm);
  overflow: hidden;
}
.board-fg svg { width: 100%; height: 100%; display: block; }

/* --------------------------------------------------------------- plansza */
.grid-board {
  z-index: 1;
  position: absolute;
  inset: 0;
  display: grid;
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--board-shadow);
  touch-action: manipulation;
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.cell--light { background: var(--cell-light); }
.cell--dark  { background: var(--cell-dark); }
.cell--plain { background: var(--cell-plain); box-shadow: var(--cell-plain-line); }
.cell--void  { background: transparent; }

/* Pola „papierowe" — sudoku i saper wyglądają lepiej na jasnym arkuszu
   niż na zielonym suknie. Barwa idzie ze skórki, przyciemnienie jest wspólne. */
.cell--paper  { background: var(--cell-light); }
.cell--paper2 { background: var(--cell-light); box-shadow: inset 0 0 0 99px rgba(0,0,0,.1); }
.cell--raised {
  background: var(--cell-light);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.85), inset -3px -3px 0 rgba(0,0,0,.22);
}

/* Pole z otworem (Połącz 4): płyta z wyciętą, zacienioną dziurą. */
.cell--hole { background: var(--hole-plate); }
.cell--hole::after {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background: var(--hole-inner);
  box-shadow: inset 0 3px 6px rgba(0,0,0,.8), inset 0 -2px 3px rgba(255,255,255,.12);
}
.cell--hole > * { position: relative; z-index: 1; }
.cell--hole[data-hl]::before { z-index: 2; }

/* podświetlenia */
.cell[data-hl="move"]::before {
  content: "";
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--hl-move);
  box-shadow: 0 0 0 3px var(--hl-move-ring);
  animation: pop .18s ease-out;
}
.cell[data-hl="capture"]::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 4px solid var(--hl-capture);
  animation: pop .18s ease-out;
}
.cell[data-hl="sel"]  { box-shadow: inset 0 0 0 4px var(--hl-sel); }
.cell[data-hl="last"] { box-shadow: inset 0 0 0 4px var(--hl-last); }

/* Plansze bez pól (młynek, chińczyk) grają na PUNKTACH połączonych liniami.
   Obrys prostokątnego pola wyglądałby tam jak kwadrat znikąd — więc na takich
   planszach zaznaczenie i ostatni ruch dostają obrączkę wokół kamienia. */
.cell--void[data-hl="sel"],
.cell--void[data-hl="last"] { box-shadow: none; }
.cell--void[data-hl="sel"]::after,
.cell--void[data-hl="last"]::after {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 3px solid var(--hl-last);
  pointer-events: none;
}
.cell--void[data-hl="sel"]::after { border-color: var(--hl-sel); }
.cell[data-hl="win"]  { animation: winpulse 1s ease-in-out infinite; }
.cell[data-hl="bad"]  { box-shadow: inset 0 0 0 4px var(--warn); }
.cell.is-playable { cursor: pointer; }

@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes winpulse {
  0%, 100% { box-shadow: inset 0 0 0 4px var(--hl-win); }
  50%      { box-shadow: inset 0 0 0 4px transparent; }
}

/* --------------------------------------------------------------- bierki */
.piece {
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  transition: transform .18s cubic-bezier(.2,.7,.3,1), filter .18s ease;
  animation: drop .22s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes drop { from { transform: translateY(-14px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.piece--light  { background: var(--piece-light);  box-shadow: var(--piece-ring-light), var(--piece-shadow), inset 0 -4px 8px rgba(0,0,0,.2), inset 0 3px 5px rgba(255,255,255,.7); }
.piece--dark   { background: var(--piece-dark);   box-shadow: var(--piece-ring-dark),  var(--piece-shadow), inset 0 -4px 8px rgba(0,0,0,.5), inset 0 3px 5px rgba(255,255,255,.28); }
.piece--red    { background: var(--piece-red);    box-shadow: var(--piece-shadow), inset 0 -4px 8px rgba(0,0,0,.35), inset 0 3px 5px rgba(255,255,255,.45); }
.piece--yellow { background: var(--piece-yellow); box-shadow: var(--piece-shadow), inset 0 -4px 8px rgba(0,0,0,.32), inset 0 3px 5px rgba(255,255,255,.5); }
.piece--blue   { background: var(--piece-blue);   box-shadow: var(--piece-shadow), inset 0 -4px 8px rgba(0,0,0,.32), inset 0 3px 5px rgba(255,255,255,.5); }
.piece--green  { background: var(--piece-green);  box-shadow: var(--piece-shadow), inset 0 -4px 8px rgba(0,0,0,.32), inset 0 3px 5px rgba(255,255,255,.5); }

.piece--sm { width: 56%; }
.piece--sel { transform: scale(1.08); filter: brightness(1.14); }
.piece--ghost { opacity: .35; }

/* damka — korona wytłoczona w bierce */
.piece--king::after {
  content: "";
  position: absolute;
  inset: 26%;
  background: var(--crown-color);
  -webkit-mask: var(--crown) center/contain no-repeat;
  mask: var(--crown) center/contain no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.55));
}

/* etykieta w środku bierki (np. numer pionka w chińczyku) */
.piece__tag {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: .8em;
  color: rgba(255,255,255,.9);
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}

/* Statki: woda, kadłub, trafienia i pudła. */
.cell--water {
  background: linear-gradient(160deg, #2b6f8c 0%, #1c4e63 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.ship {
  position: absolute;
  inset: 14%;
  border-radius: 22%;
  background: linear-gradient(160deg, #d7dee6 0%, #94a3b1 100%);
  box-shadow: var(--sh-1), inset 0 -2px 3px rgba(0,0,0,.2);
}
.ship--sunk { background: linear-gradient(160deg, #808d99 0%, #454f59 100%); }
.shot {
  position: absolute;
  width: 40%;
  aspect-ratio: 1;
  border-radius: 50%;
  animation: pop .18s ease-out;
}
.shot--miss {
  background: rgba(255,255,255,.6);
  box-shadow: 0 0 0 3px rgba(255,255,255,.18);
}
.shot--hit {
  background: radial-gradient(circle at 35% 30%, #ffb3ba 0%, #e2465a 55%, #8c1526 100%);
  box-shadow: 0 0 10px rgba(226,70,90,.75);
}

/* Znacznik stanu na stole (Makao: kara, żądanie, kolor). */
.tag {
  display: inline-block;
  margin: 2px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--chip-bg);
  border: 1px solid var(--chip-bd);
  color: var(--tx-1);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.tag--warn { background: var(--warn); color: #fff; border-color: transparent; }

/* Kupka kart z licznikiem (Wojna, Makao). */
.pile-stack { position: relative; display: grid; place-items: center; }
.pile-count {
  position: absolute;
  bottom: -6px;
  right: -6px;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--accent-grad);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--sh-1);
}

/* Kropki i kwadraty: kropka, kreska, zdobyte pole. */
.dot-mark {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #3c3226;
  box-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.edge {
  border-radius: 999px;
  background: rgba(120,105,80,.16);
  transition: background .16s ease, transform .12s ease;
}
.edge--h { width: 96%; height: 30%; }
.edge--v { width: 30%; height: 96%; }
.edge--on { box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.cell.is-playable:hover .edge { background: rgba(120,105,80,.42); transform: scale(1.06); }
.boxmark {
  width: 76%;
  height: 76%;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: min(3.4vw, 20px);
  font-weight: 800;
  color: #fff;
  animation: pop .2s ease-out;
}
.boxmark--red { background: rgba(226,70,90,.85); }
.boxmark--blue { background: rgba(88,182,255,.85); }

/* Kostka do gry — oczka układane w siatce 3×3. */
.die {
  width: 46%;
  aspect-ratio: 1;
  border-radius: 14%;
  background: linear-gradient(160deg, #fffdf7 0%, #ece4d2 100%);
  box-shadow: var(--sh-3), inset 0 -6px 12px rgba(0,0,0,.14), inset 0 4px 6px rgba(255,255,255,.8);
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 11%;
  animation: rolldie .32s cubic-bezier(.2,.9,.3,1) both;
}
.die__pip {
  width: 74%;
  aspect-ratio: 1;
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a545e 0%, #1a2027 60%, #05080b 100%);
  box-shadow: inset 0 -1px 2px rgba(255,255,255,.25);
}
.die--lost { background: linear-gradient(160deg, #ffe0e4 0%, #f3a8b1 100%); }
.die--empty {
  grid-template: 1fr / 1fr;
  place-items: center;
  font-family: var(--font-display);
  font-size: min(9vw, 52px);
  color: #a89a84;
  animation: none;
}
@keyframes rolldie {
  0%   { transform: rotate(-14deg) scale(.86); opacity: .4; }
  60%  { transform: rotate(6deg) scale(1.04); opacity: 1; }
  100% { transform: none; }
}

/* Zapałka (Nim) — łebek na górze, drewno pod spodem. */
.match {
  width: 22%;
  height: 74%;
  border-radius: 999px;
  background: linear-gradient(180deg, #e8c169 0%, #c9a227 40%, #a07f14 100%);
  box-shadow: var(--sh-1), inset -2px 0 3px rgba(0,0,0,.25);
  position: relative;
  animation: drop .2s cubic-bezier(.2,.9,.3,1) both;
  transition: transform .14s ease, filter .14s ease;
}
.match::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -6%;
  transform: translateX(-50%);
  width: 190%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #ff9aa4 0%, #e2465a 45%, #9c1f2e 100%);
  box-shadow: var(--sh-1);
}
.match--hot { transform: translateY(-6%) scale(1.06); filter: brightness(1.15); }

/* --------------------------------------------------------------- figury i znaki */
.mark { width: 64%; height: 64%; animation: drop .22s cubic-bezier(.2,.9,.3,1) both; }
.mark--x { color: var(--warn); }
.mark--o { color: var(--info); }
.mark path, .mark circle { fill: none; stroke: currentColor; stroke-width: 3.4; stroke-linecap: round; }

/* Figury szachowe: jeden zestaw ścieżek, kolor z klasy. */
.figure { width: 84%; height: 84%; animation: drop .2s cubic-bezier(.2,.9,.3,1) both; }
.figure--light path { fill: #fdfaf2; stroke: #2b2118; stroke-width: 4; stroke-linejoin: round; }
.figure--dark  path { fill: #2b323b; stroke: #05080b; stroke-width: 4; stroke-linejoin: round; }

/* 2048: kafelek wypełnia pole, kolor rośnie z wartością. */
.tile {
  position: absolute;
  inset: 6%;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  box-shadow: var(--sh-1);
  animation: drop .16s cubic-bezier(.2,.9,.3,1) both;
}
.tile__n { font-family: var(--font-display); font-weight: 800; font-size: min(6.5vw, 34px); line-height: 1; }
.tile__n--sm { font-size: min(5vw, 28px); }
.tile__n--xs { font-size: min(4vw, 22px); }
.tile--pop { animation: tilepop .18s ease-out both; }
@keyframes tilepop { 0% { transform: scale(.82); } 60% { transform: scale(1.09); } 100% { transform: scale(1); } }
.tile--2 { background: #eee4da; color: #776e65; }
.tile--4 { background: #ede0c8; color: #776e65; }
.tile--8 { background: #f2b179; color: #f9f6f2; }
.tile--16 { background: #f59563; color: #f9f6f2; }
.tile--32 { background: #f67c5f; color: #f9f6f2; }
.tile--64 { background: #f65e3b; color: #f9f6f2; }
.tile--128 { background: #edcf72; color: #f9f6f2; }
.tile--256 { background: #edcc61; color: #f9f6f2; }
.tile--512 { background: #edc850; color: #f9f6f2; }
.tile--1024 { background: #edc53f; color: #f9f6f2; }
.tile--2048 { background: #edc22e; color: #f9f6f2; }

/* Saper: flaga i mina */
.flag {
  font-size: min(4.5vw, 24px);
  line-height: 1;
  color: var(--warn);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.3));
  animation: pop .16s ease-out;
}
.mine {
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #5a646f 0%, #1a2027 60%, #05080b 100%);
  box-shadow: 0 0 0 3px rgba(0,0,0,.25);
  position: relative;
}
.mine::after {
  content: "";
  position: absolute;
  inset: -28%;
  background:
    linear-gradient(0deg, transparent 46%, #1a2027 46%, #1a2027 54%, transparent 54%),
    linear-gradient(90deg, transparent 46%, #1a2027 46%, #1a2027 54%, transparent 54%),
    linear-gradient(45deg, transparent 47%, #1a2027 47%, #1a2027 53%, transparent 53%),
    linear-gradient(-45deg, transparent 47%, #1a2027 47%, #1a2027 53%, transparent 53%);
  z-index: -1;
}

/* Napis na polu. Pola planszy są jasne w KAŻDEJ skórce, więc atrament
   jest ciemny na stałe — inaczej w ciemnym motywie zniknąłby na papierze. */
.num {
  font-family: var(--font-display);
  font-size: min(5vw, 26px);
  line-height: 1;
  color: #2b2118;
}
.num--fixed { font-weight: 700; color: #2b2118; }
.num--user { color: #1f6091; font-weight: 600; }
.num--bad { color: #b3382f; font-weight: 600; }

/* --------------------------------------------------------------- panel boczny */
.table-side { display: grid; gap: 12px; }
.table-side__seats { display: grid; gap: 8px; }

.seat {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--panel-bg);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.seat--turn { border-color: var(--accent); box-shadow: var(--glow); }
.seat--win  { border-color: var(--ok); }
.seat--out  { opacity: .5; }

.seat__ava {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #0b1117;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), var(--sh-1);
  flex: 0 0 auto;
}
.seat__name { font-weight: 600; font-size: 14.5px; }
.seat__role { color: var(--tx-3); font-size: 12.5px; margin-top: 1px; }
.seat__score { margin-left: auto; font-family: var(--font-display); font-size: 20px; color: var(--accent); }

/* Zegar przy graczu — cyfry o stałej szerokości, żeby nie skakał co sekundę. */
.seat__clock {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  color: var(--tx-1);
}
.seat__clock[data-low="true"] { color: var(--warn); }
.seat + .seat { margin-top: 0; }

.status {
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-1);
  font-size: 14px;
  line-height: 1.5;
  color: var(--tx-2);
  min-height: 58px;
}
.status b { color: var(--tx-1); }

.controls { display: flex; gap: 8px; flex-wrap: wrap; }

/* Nagłówek panelu bocznego — daje ustawieniom i zapisowi partii tytuł,
   dzięki czemu kolumna nie jest ciągiem nieopisanych prostokątów. */
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--tx-3);
}

.setup-panel .setup { padding: 14px; }
.setup-panel .setup__row + .setup__row {
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.log { overflow: hidden; }
.log__count { font-size: 11px; letter-spacing: 0; text-transform: none; color: var(--tx-3); }
.log__body {
  max-height: 190px;
  overflow-y: auto;
  padding: 6px 6px 8px;
  font-size: 12.5px;
  line-height: 1.6;
  scrollbar-width: thin;
}
.log__empty { padding: 10px 8px; color: var(--tx-3); font-style: italic; }
.log__row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  color: var(--tx-2);
}
/* Delikatne pasy — oko trzyma się wiersza przy dłuższej partii. */
.log__row:nth-child(odd) { background: var(--bg-1); }
.log__row:last-child { color: var(--tx-1); font-weight: 600; }
.log__no {
  color: var(--tx-3);
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.log__txt { word-break: break-word; }

/* --------------------------------------------------------------- koniec gry */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--scrim);
  backdrop-filter: blur(3px);
  z-index: 5;
  animation: rise .3s ease-out both;
}
.overlay__card {
  text-align: center;
  padding: 26px 34px;
  border-radius: var(--r-lg);
  background: var(--panel-bg);
  border: 1px solid var(--line);
  box-shadow: var(--sh-3);
  max-width: 88%;
}
.overlay__title { font-size: clamp(20px, 3.4vw, 28px); margin-bottom: 6px; }
.overlay__sub { color: var(--tx-2); font-size: 14px; margin-bottom: 18px; }
.overlay__btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* --------------------------------------------------------------- panel gry */
/* Dodatkowy wybór, o który prosi gra: cyfra w sudoku, figura przy promocji,
   kierunek w 2048. Leży POD planszą — na telefonie kolumna boczna jest
   poniżej ekranu i gracz po prostu by go nie znalazł. */
.gpanel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--panel-bg);
}
.gpanel__label { font-size: 12.5px; color: var(--tx-3); }
.gpanel__opts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.gpanel__btn {
  width: 52px;
  height: 52px;
  padding: 4px;
  justify-content: center;
}
.gpanel__btn span { display: block; width: 100%; line-height: 1; }

/* --------------------------------------------------------------- czat */
.chat {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-1);
}
.chat__log {
  height: 210px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.5;
  color: var(--tx-2);
  scrollbar-width: thin;
  display: grid;
  align-content: start;
  gap: 3px;
}
.chat__msg { word-break: break-word; }
.chat__msg b { color: var(--accent); font-weight: 650; }
.chat__msg--sys { color: var(--tx-3); font-style: italic; }
.chat__form { display: flex; gap: 6px; }
.chat__input {
  flex: 1;
  min-width: 0;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-0);
  color: var(--tx-1);
  font: inherit;
  font-size: 14px;
}
.chat__input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.chat__note {
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--bg-0);
  border: 1px dashed var(--line);
  color: var(--tx-3);
  font-size: 12.5px;
  line-height: 1.5;
}
.status__warn { color: var(--warn); }

/* --------------------------------------------------------------- ustawienia */
.setup { display: grid; gap: 12px; }
.setup__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setup__label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--tx-3);
  width: 100%;
}

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: var(--r-pill);
  background: var(--bg-0);
  border: 1px solid var(--line);
}
.seg { flex-wrap: wrap; }
.seg button {
  border: 0;
  background: transparent;
  padding: 8px 15px;
  border-radius: var(--r-pill);
  font-size: 13px;
  cursor: pointer;
  color: var(--tx-2);
  transition: background .16s ease, color .16s ease;
}
.seg button:hover { background: var(--bg-3); color: var(--tx-1); }
.seg button[aria-pressed="true"] {
  background: var(--accent-grad);
  color: var(--on-accent);
  font-weight: 650;
}

/* --------------------------------------------------------------- karty */
.hand {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding: 10px;
  border-radius: var(--r-lg);
  background: var(--panel-bg);
  border: 1px solid var(--line);
}
.tray__item {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}
.tray__item[disabled] { cursor: not-allowed; }
.tray__item[disabled] .card { opacity: .38; filter: grayscale(.8); }
.tray__item[disabled] .card:hover { transform: none; box-shadow: var(--sh-2); }
.card {
  width: clamp(46px, 9vw, 64px);
  aspect-ratio: 5 / 7;
  border-radius: var(--r-sm);
  background: var(--card-face);
  border: 1px solid var(--card-bd);
  box-shadow: var(--sh-2);
  position: relative;
  cursor: pointer;
  transition: transform .16s cubic-bezier(.2,.7,.3,1), box-shadow .16s ease;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  line-height: 1.05;
  user-select: none;
  animation: drop .2s cubic-bezier(.2,.9,.3,1) both;
}
.card:hover { transform: translateY(-9px); box-shadow: var(--sh-3); }
.card--red { color: var(--card-red); }
.card--black { color: var(--card-black); }
.card--back { background: var(--card-back); color: transparent; }
.card--dim { opacity: .38; filter: grayscale(.8); cursor: not-allowed; }
.card--dim:hover { transform: none; }
.card--sel { transform: translateY(-12px); box-shadow: var(--sh-3), 0 0 0 2px var(--accent); }
.card__r { font-size: clamp(15px, 3.4vw, 21px); }
.card__s { font-size: clamp(13px, 3vw, 19px); }
.card__corner {
  position: absolute;
  top: 3px; left: 4px;
  font-size: clamp(9px, 1.8vw, 12px);
  opacity: .8;
}
.pile {
  display: grid;
  place-items: center;
  gap: 8px;
  grid-auto-flow: column;
}
