/* ==============================================
   РАСПИСНОЙ ПОКЕР — game.css
   v0.4 — Grid layout, убран 100dvh
   ============================================== */

/* ===================== HEADER ===================== */
#game-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: rgba(0,0,0,0.55);
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
}

#game-header .game-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-pill {
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
  padding: 3px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-pill .suit-icon { font-size: 1em; }
.badge-pill.trump-badge .suit-icon { color: var(--red-bright); }

/* ===================== КОРЕНЬ ИГРЫ ===================== */
#game-root {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ===================== GAME BODY ===================== */
#game-body {
  flex: 1;
  min-height: 0;
  /* Bootstrap .row уже flex; нам нужна растяжка по высоте */
  align-items: stretch;
}

/* ===================== СТОЛ ===================== */
#table-area {
  position: relative;
  background: radial-gradient(ellipse at center, var(--felt-light) 0%, var(--felt-dark) 100%);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ===================== GRID СТОЛА ===================== */
/*
  3 колонки × 2 строки:
    [бот-top-l]  [бот-top]    [бот-top-r]
    [бот-left]   [центр]      [бот-right]
  + полоса игрока на всю ширину снизу
*/
#table-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows:    1fr 2fr;
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
}

/* ===================== ПОЛОСА ИГРОКА ===================== */
#player-strip {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--card-h) + 16px);
}

.tg-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
}

.tg-top-left   { grid-column: 1; grid-row: 1; align-items: flex-start; justify-content: flex-start; align-self: start; }
.tg-top-center { grid-column: 2; grid-row: 1; align-items: flex-start; justify-content: center;     align-self: start; }
.tg-top-right  { grid-column: 3; grid-row: 1; align-items: flex-start; justify-content: flex-end;   align-self: start; }

.tg-mid-left   { grid-column: 1; grid-row: 2; align-items: center; justify-content: flex-start; }
.tg-mid-center { grid-column: 2; grid-row: 2; align-items: center; justify-content: center; }
.tg-mid-right  { grid-column: 3; grid-row: 2; align-items: center; justify-content: flex-end; }

/* Всё содержимое центра — компактный блок по середине */
#table-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-bottom: 0px;
}

.tg-bot-left   { display: none; }
.tg-bot-center { display: none; }
.tg-bot-right  { display: none; }

/* ===================== ЗОНЫ ИГРОКОВ ===================== */
.player-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.player-label {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--cream-dim);
  text-transform: uppercase;
}

.player-order {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: var(--gold);
}

/* ===================== СТОПКА КАРТ БОТА ===================== */
.bot-hand { position: relative; }

.bot-card-stack {
  position: relative;
  width: var(--card-w-sm);
  height: var(--card-h-sm);
}

.bot-card-stack .stack-layer {
  position: absolute;
  width: var(--card-w-sm);
  height: var(--card-h-sm);
  border-radius: 5px;
  background: var(--felt-mid);
  border: 1px solid var(--gold-dim);
  box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
}

.bot-card-stack .stack-layer:nth-child(1) { transform: rotate(-4deg) translate(-3px,-3px); }
.bot-card-stack .stack-layer:nth-child(2) { transform: rotate(-1.5deg) translate(-1px,-1px); }
.bot-card-stack .stack-layer:nth-child(3) { transform: rotate(0deg); }

/* ===================== БОТ: КАРТА + ИНФО ===================== */
.bot-info-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.bot-info-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ===================== ЦЕНТР СТОЛА ===================== */
/* #table-center = .tg-mid-center, flex-column уже через .tg-cell */

/* Карты в бою */
#trick-area {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  min-height: calc(var(--card-h) + 20px);
  min-width: 200px;
}

#trick-area:empty {
  min-height: calc(var(--card-h) + 20px);
  padding: 8px;
}

#trick-area .trick-card {
  margin-left: -8px;
  transition: transform 0.3s var(--ease-card);
}
#trick-area .trick-card:first-child { margin-left: 0; }

/* ===================== КОЗЫРЬ ===================== */
.trump-display {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--cream-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.trump-display .trump-suit {
  color: var(--red-bright);
  font-size: 1.2em;
}

.trump-card-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* ===================== ЛОГО РАУНДА ===================== */
#game-log {
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  padding: 5px 18px;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--cream-dim);
  white-space: nowrap;
  pointer-events: none;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================== РУКА ИГРОКА ===================== */

#player-cards {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap;
}

#player-cards .card {
  width: var(--card-w);
  height: var(--card-h);
}

/* ===================== САЙДБАР ===================== */
#score-panel {
  padding: 10px 12px;
  background: var(--ui-bg);
  border-left: 1px solid var(--ui-border);
  backdrop-filter: blur(6px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
#score-panel::-webkit-scrollbar { display: none; }

#score-panel .score-title {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 8px;
  text-align: center;
  border-bottom: 1px solid var(--ui-border);
  padding-bottom: 6px;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.score-row .score-name {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--cream-dim);
}

.score-row .score-val {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 36px;
  text-align: right;
}

.score-row.you .score-name {
  color: var(--cream);
  font-weight: 600;
}

/* ===================== ЗАКАЗ / СТАТУС ИГРОКА ===================== */
#player-order-panel {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  width: 100%;
}

.order-label {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--cream-dim);
  text-align: right;
}

.order-value {
  font-family: var(--font-ui);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--cream);
  line-height: 1;
}

.order-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: nowrap;
  width: 100%;
}

#btn-dark-row {
  margin-top: 4px;
  width: 100%;
  display: flex;
}

#btn-dark-row .btn-ghost {
  width: 100%;
  text-align: center;
}

.btn-counter {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  color: var(--cream);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}

.btn-counter:hover {
  border-color: var(--gold);
  background: rgba(201,153,58,0.15);
}

/* ===================== МАРКЕР ХОДА ===================== */
.current-player {
  color: var(--gold-light) !important;
  text-shadow: 0 0 8px var(--gold-glow);
}

.current-player-zone { outline: none; box-shadow: none; }

.lead-marker {
  color: var(--gold-light);
  font-size: 0.7em;
  margin-right: 3px;
  animation: lead-pulse 1s ease-in-out infinite;
}

@keyframes lead-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ===================== ЗАКАЗ / ВЗЯТО У БОТОВ ===================== */
.bt-col { display: flex; flex-direction: column; gap: 2px; }

.bt-line {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

.bt-label { color: var(--cream-dim); font-size: 0.75rem; min-width: 38px; }
.bt-val   { color: var(--cream); font-weight: 600; min-width: 14px; }

/* ===================== SCORE INFO ===================== */
.score-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.score-info-label {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  color: var(--cream-dim);
  letter-spacing: 0.06em;
}

.score-info-val {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--cream);
}

.score-divider {
  height: 1px;
  background: var(--ui-border);
  margin: 6px 0;
}

/* ===================== АНИМАЦИИ ===================== */
@keyframes deal-in {
  from { opacity: 0; transform: translateY(-20px) scale(0.9) rotate(-5deg); }
  to   { opacity: 1; transform: translateY(0)    scale(1)   rotate(0deg);  }
}

@keyframes score-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

@keyframes log-flash {
  0%   { opacity: 0.4; }
  100% { opacity: 1; }
}

.deal-animate {
  animation: deal-in 0.35s var(--ease-card) both;
}

/* ===================== ТЁМНАЯ КАРТА ===================== */
.dark-card {
  filter: brightness(0.5) sepia(0.3);
  border: 2px solid var(--gold-dim) !important;
}

/* ===================== ВЗЯТКИ (точки) ===================== */
.tricks-taken-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  max-width: 80px;
  justify-content: center;
}

.trick-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 4px var(--gold-glow);
}

.trick-dot.pending {
  background: transparent;
  border: 1px solid var(--gold-dim);
}

/* ===================== ДЖОКЕР ===================== */
.joker-badge {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 0.85rem;
  color: var(--gold-light);
  text-shadow: 0 0 6px var(--gold-glow);
  line-height: 1;
  pointer-events: none;
}

.joker-info-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--gold-light);
  letter-spacing: 0.08em;
  margin-top: 4px;
  text-align: center;
}

/* ===================== ДИАЛОГ ДЖОКЕРА ===================== */
.joker-dialog {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
}

.joker-dialog.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.joker-dialog-inner {
  background: rgba(5, 18, 10, 0.97);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 260px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.joker-dialog-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--gold-light);
  text-align: center;
  margin-bottom: 2px;
}

.joker-section { display: flex; flex-direction: column; gap: 6px; }

.joker-section-label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.joker-divider { height: 1px; background: var(--ui-border); }

.joker-suit-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.joker-senior-row { display: flex; flex-direction: column; gap: 6px; }
.joker-sm-btns    { display: flex; gap: 6px; }

.btn-suit {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.btn-suit:hover, .btn-suit.active {
  background: rgba(201,153,58,0.2);
  border-color: var(--gold);
}

.btn-joker-mode {
  flex: 1;
  padding: 7px 10px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  color: var(--cream-dim);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.btn-joker-mode:hover:not(:disabled) {
  background: rgba(201,153,58,0.2);
  border-color: var(--gold);
  color: var(--cream);
}

.btn-joker-mode:disabled { opacity: 0.35; cursor: not-allowed; }

.joker-cancel { font-size: 0.75rem; text-align: center; padding: 4px; }

.joker-mode-label {
  position: absolute;
  bottom: 3px;
  left: 0; right: 0;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.58rem;
  color: var(--gold-light);
  background: rgba(0,0,0,0.6);
  padding: 1px 0;
  letter-spacing: 0.05em;
}

/* ===================== ТЁМНАЯ: КНОПКИ ===================== */
.btn-ghost.active {
  border-color: var(--gold);
  color: var(--gold-light);
  background: rgba(201,153,58,0.15);
}

.btn-ghost:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ===================== ПОПАП ИТОГОВ КОНА ===================== */
.round-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 50;
  pointer-events: none;
}

.round-popup.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.game-end-popup { pointer-events: auto !important; opacity: 0; }

.popup-inner {
  background: rgba(5, 20, 10, 0.95);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 24px 32px;
  min-width: 280px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8), 0 0 0 1px rgba(201,153,58,0.2);
  text-align: center;
  backdrop-filter: blur(12px);
}

.popup-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--gold-light);
  margin-bottom: 16px;
  font-style: italic;
}

.popup-winner {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--score-pos);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.popup-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.popup-table th {
  color: var(--gold-dim);
  font-weight: 400;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  border-bottom: 1px solid var(--ui-border);
  text-transform: uppercase;
  font-size: 0.7rem;
}

.popup-table td {
  color: var(--cream-dim);
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.popup-table .winner-row td {
  color: var(--cream);
  font-weight: 600;
}

/* ===================== ТАБЛИЦА РОЗЫГРЫША ===================== */
.trump-badge {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.trump-badge:hover {
  background: var(--ui-border);
  border-color: var(--gold-dim);
}

.score-history-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
  padding: 12px;
}
.score-history-modal.visible { opacity: 1; }

.score-history-inner {
  background: var(--felt-dark, #1a2a1a);
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}

.score-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
}

.score-history-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-light);
  letter-spacing: 0.04em;
}

.score-history-close {
  background: none;
  border: none;
  color: var(--cream-dim);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
}
.score-history-close:hover { color: var(--cream); }

.score-history-scroll {
  overflow-y: auto;
  overflow-x: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.score-history-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.82rem;
}

.score-history-table thead th {
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.7);
  color: var(--cream-dim);
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  text-align: center;
  border-bottom: 1px solid var(--ui-border);
  white-space: nowrap;
}

.score-history-table thead th:first-child { text-align: left; }

.score-history-table tbody td {
  padding: 6px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  white-space: nowrap;
}

.hist-round-col {
  text-align: left !important;
  color: var(--cream-dim);
  font-size: 0.78rem;
}

.hist-cards {
  margin-left: 4px;
  color: var(--cream-dim);
  opacity: 0.6;
  font-size: 0.72rem;
}

.hist-total-row td {
  background: rgba(255,255,255,0.04);
  font-weight: 600;
  font-size: 0.8rem;
  border-bottom: 2px solid var(--ui-border) !important;
}

.total-cell { font-weight: 700 !important; }

.score-history-table .pos-score { color: var(--green-bright, #4caf50); }
.score-history-table .neg-score { color: var(--red-bright, #e53935); }
.score-history-table .score-neu { color: var(--cream-dim); }

/* ===================== СТАРТОВЫЙ ЭКРАН ===================== */
#setup-screen {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  background: radial-gradient(ellipse at 40% 40%, var(--felt-light), var(--felt-dark) 70%);
}

.setup-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 2.1rem;
  color: var(--gold-light);
  margin: 0 0 4px;
  line-height: 1.1;
}

.setup-subtitle {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  color: var(--cream-dim);
  text-transform: uppercase;
  margin-bottom: 0;
}

.setup-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--gold-dim);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.btn-option {
  padding: 11px 4px;
  background: transparent;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--cream-dim);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-option:hover {
  border-color: var(--gold-dim);
  color: var(--cream);
}

.btn-option.active {
  background: rgba(201,153,58,0.15);
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-start {
  padding: 14px;
  background: linear-gradient(135deg, #b8862a, var(--gold-light));
  border: none;
  border-radius: 10px;
  color: #1a2a10;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  box-shadow: 0 4px 24px rgba(201,153,58,0.35);
}

.btn-start:hover  { opacity: 0.92; transform: translateY(-1px); }
.btn-start:active { transform: translateY(0); }

.btn-continue {
  padding: 14px;
  background: transparent;
  border: 2px solid var(--gold-light);
  border-radius: 10px;
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  touch-action: manipulation;
  user-select: none;
}
.btn-continue:hover  { opacity: 0.85; transform: translateY(-1px); }
.btn-continue:active { transform: translateY(0); }

/* ===================== АДАПТИВ ИГРЫ ===================== */

/* Маленький экран: уменьшаем карты и шрифты */
@media (max-height: 480px) and (orientation: landscape) {
  :root {
    --card-w:    44px;
    --card-h:    62px;
    --card-w-sm: 32px;
    --card-h-sm: 46px;
  }

  #game-header { padding: 4px 10px; }
  #game-header .game-title { font-size: 1rem; }
  .badge-pill { font-size: 0.7rem; padding: 2px 8px; }

  #score-panel  { padding: 5px 6px 8px 6px; }
  #score-inline { display: none; }

  .score-row .score-name { font-size: 0.65rem; }
  .score-row .score-val  { font-size: 0.72rem; min-width: 28px; }
  .score-info-label      { font-size: 0.6rem; }
  .score-info-val        { font-size: 0.72rem; }
  .order-value           { font-size: 1.2rem; }
  .btn-counter           { width: 24px; height: 24px; font-size: 1rem; }
  .btn-ghost             { font-size: 0.72rem; padding: 3px 8px; }
  .btn-gold              { font-size: 0.75rem; padding: 4px 10px; }

  .bt-line    { font-size: 0.7rem; }
  .bt-label   { font-size: 0.65rem; min-width: 32px; }

  #game-log { font-size: 0.65rem; padding: 3px 10px; }

  #table-grid {
    grid-template-rows: minmax(60px, auto) minmax(0, 1fr);
  }

  #player-strip { padding: 0px 8px 8px 8px; min-height: calc(var(--card-h) + 20px); }
  #player-cards { gap: 4px; }
}

/* Очень маленький экран */
@media (max-height: 360px) and (orientation: landscape) {
  :root {
    --card-w:    36px;
    --card-h:    52px;
    --card-w-sm: 26px;
    --card-h-sm: 38px;
  }

  .score-row .score-name { font-size: 0.58rem; }
  .score-row .score-val  { font-size: 0.65rem; }
  .order-value           { font-size: 1rem; }
  .btn-counter           { width: 20px; height: 20px; font-size: 0.9rem; }
  .score-divider         { margin: 3px 0; }

  #table-grid {
    grid-template-rows: minmax(50px, auto) minmax(0, 1fr);
  }

  #player-strip { padding: 3px 6px; min-height: calc(var(--card-h) + 8px); }
  #player-cards { gap: 3px; }
  }
}

/* Десктоп: побольше карты */
@media (min-width: 992px) {
  html { font-size: 17px; }
  :root {
    --card-w:    72px;
    --card-h:    100px;
    --card-w-sm: 54px;
    --card-h-sm: 76px;
  }
}

@media (min-width: 1200px) {
  html { font-size: 18px; }
  :root {
    --card-w:    80px;
    --card-h:    112px;
    --card-w-sm: 60px;
    --card-h-sm: 84px;
  }
}

@media (min-width: 1400px) {
  html { font-size: 20px; }
  :root {
    --card-w:    90px;
    --card-h:    126px;
    --card-w-sm: 68px;
    --card-h-sm: 95px;
  }
}

/* score-inline скрыт на десктопе */
#score-inline { display: none; }

/* Мобильная таблица истории */
@media (max-width: 480px) {
  .score-history-inner { max-height: 90vh; border-radius: 10px; }
  .score-history-table { font-size: 0.76rem; }
  .score-history-table thead th,
  .score-history-table tbody td { padding: 5px 8px; }
}

/* ===================== АДАПТИВ СТАРТОВОГО ЭКРАНА ===================== */

/* md: 768–991px */
@media (max-width: 991px) {
  .setup-title        { font-size: 1.7rem; }
  .btn-option         { padding: 8px 4px; font-size: 0.85rem; }
  .btn-start,
  .btn-continue       { padding: 11px; font-size: 0.83rem; }
}

/* sm: 576–767px */
@media (max-width: 767px) {
  .setup-title        { font-size: 1.4rem; }
  .setup-subtitle     { font-size: 0.6rem; }
  .setup-label        { font-size: 0.6rem; margin-bottom: 5px; }
  .btn-option         { padding: 6px 4px; font-size: 0.8rem; }
  .btn-start,
  .btn-continue       { padding: 9px; font-size: 0.78rem; }
}

/* xs: <576px */
@media (max-width: 575px) {
  .setup-title        { font-size: 1.15rem; }
  .setup-subtitle     { font-size: 0.55rem; }
  .setup-label        { font-size: 0.55rem; margin-bottom: 4px; }
  .btn-option         { padding: 5px 3px; font-size: 0.75rem; }
  .btn-start,
  .btn-continue       { padding: 7px; font-size: 0.72rem; letter-spacing: 0.12em; }
}
