/* WERSJA: v1.0 | ZMIANA: 2026-11-29: Wspólny styl stołu, kości 3D/SVG, tablicy wyników i responsywności gier kościanych (Kościany 1000, Poker Yatzy). */
.dice-app .game-layout {
  grid-template-rows: 46px 34px minmax(220px, 1fr) auto;
}

@media (max-width: 720px), (max-height: 760px) {
  .dice-app .game-layout {
    grid-template-rows: 40px 28px minmax(180px, 1fr) auto;
  }
}

.dice-setup-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  column-gap: 12px;
}

.dice-setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px 12px;
  margin-top: 10px;
}

.dice-setup-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: #e2f5e8;
}

.dice-setup-grid select,
.dice-setup-grid input[type="number"] {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(5, 26, 13, 0.72);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.dice-checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 10px;
}

.dice-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #e6f6ec;
  cursor: pointer;
}

.dice-checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #f59e0b;
}

.dice-app .felt.arena {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  min-height: 0;
  overflow: auto;
}

.dice-app .felt.arena > * {
  flex-shrink: 0;
}

/* Tablica graczy */
.dice-scoreboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
  width: 100%;
}

.dice-player-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #e8f5ec;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.dice-player-card.active {
  border-color: #fbbf24;
  background: rgba(15, 76, 36, 0.56);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.28);
}

.dice-player-card.winner {
  border-color: #34d399;
  background: rgba(6, 95, 70, 0.65);
}

.dice-player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dice-player-name {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dice-player-score {
  font-size: 18px;
  font-weight: 900;
  color: #fde68a;
  font-variant-numeric: tabular-nums;
}

.dice-player-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11px;
  color: #b7d7c2;
}

.dice-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ecfdf5;
  font-weight: 700;
}

.dice-badge.barrel {
  background: rgba(217, 119, 6, 0.45);
  border: 1px solid rgba(251, 191, 36, 0.55);
  color: #fef3c7;
}

.dice-badge.warn {
  background: rgba(185, 28, 28, 0.48);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fee2e2;
}

.dice-badge.ok {
  background: rgba(5, 150, 105, 0.45);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #d1fae5;
}

/* Strefa kości */
.dice-tray-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(16, 86, 42, 0.55), rgba(4, 28, 14, 0.52));
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.dice-tray-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #e8f5ec;
}

.dice-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fde68a;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dice-pill.hot {
  background: rgba(217, 119, 6, 0.72);
  border-color: #fde68a;
  color: #fffbeb;
}

.dice-pill.bust {
  background: rgba(153, 27, 27, 0.72);
  border-color: #fca5a5;
  color: #fecaca;
}

.dice-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 76px;
}

/* Pojedyncza kość */
.die-btn {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 6px;
  border-radius: 14px;
  border: 2px solid #cbd5e1;
  background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 65%, #dbe4ee 100%);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.38), inset 0 2px 3px rgba(255, 255, 255, 0.92);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
  touch-action: manipulation;
  user-select: none;
}

.die-btn:hover:not(:disabled) {
  transform: translateY(-3px);
}

.die-btn:disabled {
  cursor: default;
}

.die-btn.selected,
.die-btn.held {
  border-color: #f59e0b;
  transform: translateY(-7px);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.42), 0 0 0 3px rgba(251, 191, 36, 0.55);
  background: linear-gradient(145deg, #fffbeb 0%, #fef3c7 100%);
}

.die-btn.locked {
  width: 48px;
  height: 48px;
  padding: 5px;
  border-radius: 10px;
  border-color: #34d399;
  background: linear-gradient(145deg, #ecfdf5 0%, #d1fae5 100%);
  opacity: 0.92;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.28);
}

.die-btn.scoring-hint:not(.selected) {
  border-color: #38bdf8;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), 0 0 0 2px rgba(56, 189, 248, 0.45);
}

.die-btn.rolling {
  animation: diceRollShake 0.34s ease-out;
}

@keyframes diceRollShake {
  0% { transform: rotate(-12deg) scale(0.92); }
  35% { transform: rotate(10deg) scale(1.06); }
  70% { transform: rotate(-5deg) scale(0.98); }
  100% { transform: rotate(0deg) scale(1); }
}

.die-tag {
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 6px;
  border-radius: 999px;
  background: #d97706;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.die-face {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  align-items: center;
  justify-items: center;
  gap: 2px;
}

.die-pip {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #1e293b;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55);
}

.die-face[data-value="1"] .die-pip {
  width: 14px;
  height: 14px;
  background: #b91c1c;
}

.die-btn.locked .die-pip {
  width: 8px;
  height: 8px;
}

.die-btn.locked .die-face[data-value="1"] .die-pip {
  width: 10px;
  height: 10px;
}

.dice-locked-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 28px;
  font-size: 12px;
  color: #bbf7d0;
}

/* Panel sterowania na dole */
.dice-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(4, 24, 12, 0.88);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.dice-controls-panel .turn-status {
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #ecfdf5;
  min-height: 19px;
}

.dice-action-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.dice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease;
}

.dice-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.dice-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.dice-btn.roll {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: #4ade80;
}

.dice-btn.bank {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: #fbbf24;
}

.dice-btn.secondary {
  background: rgba(15, 23, 42, 0.56);
  border-color: rgba(148, 163, 184, 0.45);
}

/* Tabela kategorii Yatzy */
.yatzy-board-wrap {
  width: 100%;
  overflow-x: auto;
}

.yatzy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.32);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.yatzy-table th,
.yatzy-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.yatzy-table th:first-child,
.yatzy-table td:first-child {
  text-align: left;
  font-weight: 700;
  color: #e8f5ec;
}

.yatzy-table thead th {
  background: rgba(0, 0, 0, 0.45);
  color: #fde68a;
  font-weight: 800;
  font-size: 12px;
}

.yatzy-table tr.yatzy-section-row td {
  background: rgba(255, 255, 255, 0.08);
  color: #bbf7d0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 8px;
}

.yatzy-table tr.yatzy-summary-row td {
  background: rgba(15, 76, 36, 0.48);
  font-weight: 800;
  color: #fde68a;
}

.yatzy-table th.active-col,
.yatzy-table td.active-col {
  background: rgba(251, 191, 36, 0.08);
}

.yatzy-cell-btn {
  width: 100%;
  min-width: 56px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px dashed rgba(251, 191, 36, 0.55);
  background: rgba(217, 119, 6, 0.22);
  color: #fef3c7;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.yatzy-cell-btn:hover:not(:disabled) {
  background: rgba(217, 119, 6, 0.48);
  transform: scale(1.03);
}

.yatzy-cell-btn.zero {
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.42);
  color: #cbd5e1;
}

.yatzy-cell-btn.bonus-hand {
  border-color: #34d399;
  background: rgba(5, 150, 105, 0.36);
  color: #d1fae5;
}

.yatzy-scored {
  font-weight: 800;
  color: #fff;
}

.yatzy-scored.zero {
  color: #94a3b8;
  font-weight: 600;
}

.yatzy-scored.recent {
  color: #6ee7b7;
}

/* Szybka ściąga punktacji w 1000 */
.dice-cheat-sheet {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  color: #cde8d5;
}

.dice-cheat-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Modal podsumowania */
.dice-summary-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 12, 6, 0.78);
  display: grid;
  place-items: center;
  padding: 16px;
}

.dice-summary-backdrop[hidden] {
  display: none;
}

.dice-summary-card {
  width: min(440px, 100%);
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(160deg, #0b3a1c, #062110);
  border: 1px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.55);
  color: #ecfdf5;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dice-summary-card h2 {
  margin: 0;
  font-size: 20px;
  color: #fde68a;
}

.dice-summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dice-summary-list li {
  display: flex;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  font-weight: 700;
}

.dice-summary-list li.winner {
  background: rgba(5, 150, 105, 0.4);
  border: 1px solid rgba(52, 211, 153, 0.5);
  color: #fef3c7;
}

.dice-summary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

@media (max-width: 600px) {
  .die-btn {
    width: 54px;
    height: 54px;
    padding: 5px;
    border-radius: 12px;
  }
  .die-pip {
    width: 9px;
    height: 9px;
  }
  .die-face[data-value="1"] .die-pip {
    width: 12px;
    height: 12px;
  }
  .dice-row {
    gap: 8px;
    min-height: 64px;
  }
  .dice-btn {
    padding: 9px 12px;
    font-size: 13px;
  }
  .yatzy-table {
    font-size: 12px;
  }
  .yatzy-table th,
  .yatzy-table td {
    padding: 5px 5px;
  }
}
