/* Карточки игроков */
.player-card {
  flex: 1;
  background: var(--bg-card);
  padding: 10px 14px;
  border-radius: 6px;
  border: 2px solid transparent;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.player-card.active {
  border-color: var(--border-gold);
  background: var(--bg-card-active);
}

.player-name {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.score {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.score-max {
  font-size: 14px;
  color: var(--text-score-max);
  font-weight: normal;
}

.turn-stats {
  margin-top: 4px;
  background: transparent;
  padding: 0;
  border: none;
}

.stat-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.stat-group:last-child { margin-bottom: 0; }
.stat-label { font-size: 12px; color: var(--text-score-max); }
.stat-value { font-size: 16px; color: #e6c894; font-weight: bold; }

/* Игровой стол */
.table {
  background: var(--bg-table);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
  gap: 14px;
  position: relative;
}

.dice-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-title-green);
  margin-bottom: 10px;
  font-weight: 600;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.status-message {
  font-size: 14px;
  color: var(--text-main);
  text-align: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.3;
}

.die-info-panel {
  width: 100%;
  height: 74px;
  min-height: 74px;
  max-height: 96px;
  background: var(--bg-info-panel);
  border: 1px solid var(--border-info);
  border-radius: 6px;
  padding: 6px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-y: auto; /* Если текст очень длинный, появится аккуратный скролл */
}

.die-info-title {
  font-weight: bold;
  font-size: 15px;
  color: var(--text-gold);
  margin-bottom: 3px;
}

.die-info-desc {
  font-size: 13px;
  color: #c0d8c6;
}

/* Кости (Dice) */
.dice-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.die {
  width: 48px;
  height: 48px;
  background: linear-gradient(145deg, #ffffff 0%, #ebd3e0 0%, #f3eee3 40%, #d8ceb9 100%);
  color: #1a1a1a;
  font-size: 1.4rem;
  font-weight: bold;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border-die);
  box-shadow: 
    0 4px 8px rgba(0, 0, 0, 0.4),
    inset 0 -4px 4px rgba(0, 0, 0, 0.15),
    inset 0 2px 2px rgba(255, 255, 255, 0.9);
  transition: transform 0.2s ease, box-shadow 0.2s, opacity 0.2s;
}

.player-section .die:hover:not(.locked) {
  transform: translateY(-3px);
  box-shadow: 
    0 6px 12px rgba(0, 0, 0, 0.45),
    inset 0 -4px 4px rgba(0, 0, 0, 0.15),
    inset 0 2px 2px rgba(255, 255, 255, 1);
}

.die.selected {
  outline: 3px solid #f39c12;
  outline-offset: 1px;
  transform: translateY(-6px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6), 0 0 10px #f39c12;
}

.die.locked {
  opacity: 0.55;
  filter: grayscale(35%);
  cursor: not-allowed;
}

.player-section .die.locked { transform: translateY(16px); }
.ai-section .die.locked { transform: translateY(-16px); }

@keyframes dice-shake {
  0% { transform: rotate(0deg) scale(1); }
  20% { transform: rotate(-12deg) translate(-4px, -4px) scale(1.05); }
  40% { transform: rotate(10deg) translate(4px, 2px) scale(1.05); }
  60% { transform: rotate(-8deg) translate(-2px, 3px); }
  80% { transform: rotate(5deg) translate(2px, -1px); }
  100% { transform: rotate(0deg) translate(0, 0) scale(1); }
}

.shake { animation: dice-shake 0.4s ease-in-out; }

/* Точки на костях (Pips) */
.die.val-1, .die.val-2, .die.val-3, .die.val-4, .die.val-5, .die.val-6 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 5px;
}

.pip {
  width: 9px;
  height: 9px;
  background-color: #2b1d0c;
  border-radius: 50%;
  align-self: center;
  justify-self: center;
  box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.4);
}

.die.val-1 .pip:nth-child(1) { grid-column: 2; grid-row: 2; }
.die.val-2 .pip:nth-child(1) { grid-column: 3; grid-row: 1; }
.die.val-2 .pip:nth-child(2) { grid-column: 1; grid-row: 3; }
.die.val-3 .pip:nth-child(1) { grid-column: 3; grid-row: 1; }
.die.val-3 .pip:nth-child(2) { grid-column: 2; grid-row: 2; }
.die.val-3 .pip:nth-child(3) { grid-column: 1; grid-row: 3; }
.die.val-4 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.die.val-4 .pip:nth-child(2) { grid-column: 3; grid-row: 1; }
.die.val-4 .pip:nth-child(3) { grid-column: 1; grid-row: 3; }
.die.val-4 .pip:nth-child(4) { grid-column: 3; grid-row: 3; }
.die.val-5 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.die.val-5 .pip:nth-child(2) { grid-column: 3; grid-row: 1; }
.die.val-5 .pip:nth-child(3) { grid-column: 2; grid-row: 2; }
.die.val-5 .pip:nth-child(4) { grid-column: 1; grid-row: 3; }
.die.val-5 .pip:nth-child(5) { grid-column: 3; grid-row: 3; }
.die.val-6 .pip:nth-child(1) { grid-column: 1; grid-row: 1; }
.die.val-6 .pip:nth-child(2) { grid-column: 3; grid-row: 1; }
.die.val-6 .pip:nth-child(3) { grid-column: 1; grid-row: 2; }
.die.val-6 .pip:nth-child(4) { grid-column: 3; grid-row: 2; }
.die.val-6 .pip:nth-child(5) { grid-column: 1; grid-row: 3; }
.die.val-6 .pip:nth-child(6) { grid-column: 3; grid-row: 3; }

/* Лог игры и кнопки */
.game-log {
  background: var(--bg-log);
  border: 1px solid var(--border-log);
  border-radius: 8px;
  padding: 10px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.controls {
  display: flex;
  gap: 8px;
}

.btn {
  flex: 1;
  padding: 12px 10px;
  font-size: 14px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  min-height: 44px;
  transition: background 0.2s, opacity 0.2s, transform 0.1s;
}

.btn:active:not(:disabled) { transform: scale(0.98); }
.btn-primary { background: var(--btn-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--btn-primary-hover); }
.btn-warning { background: var(--btn-warning); color: #fff; }
.btn-warning:hover:not(:disabled) { background: var(--btn-warning-hover); }
.btn-success { background: var(--btn-success); color: #fff; }
.btn-success:hover:not(:disabled) { background: var(--btn-success-hover); }
.btn-info { background: var(--btn-info); color: var(--border-gold); border: 1px solid #7a5831; }
.btn-info:hover:not(:disabled) { background: var(--btn-info-hover); color: #fff; }

#btn-start-game {
  margin-top: 28px;
  margin-bottom: 12px;
  min-width: 200px;
}

#btn-install-pwa {
  margin-top: 0;
  max-width: 260px;
}

.btn-icon {
  flex: 0 0 44px;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled {
  background: #2a2a2a;
  color: #555;
  border: 1px solid #444;
  cursor: not-allowed;
}

.rules-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  background: var(--bg-card);
  border-radius: 6px;
  overflow: hidden;
}

.rules-table th, .rules-table td {
  border: 1px solid var(--border-main);
  padding: 8px 10px;
  text-align: left;
}

.rules-table th {
  background: var(--border-log);
  color: var(--text-gold);
}