/**
 * hud-turn.css - Turn Timer, Dice Shaker, Production Summary, and Build Action Buttons
 */

/* Left Sidebar (Status, Dice, Building Desk) */
.hud-left {
  grid-area: left;
  width: auto;
  min-width: 0;
  background: oklch(0.165 0.012 264 / 0.86);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
  z-index: 20;
  overflow-y: auto;
}

#view-game.view-screen.active {
  position: relative;
}

.hud-left-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.btn-end-turn {
  margin-top: 0;
  padding: 10px 14px;
  font-weight: 700;
  min-height: 42px;
  font-size: 14px;
  background: linear-gradient(135deg, oklch(0.32 0.09 145 / 0.9), oklch(0.24 0.07 145 / 0.9));
  border: 1px solid oklch(0.55 0.14 145 / 0.6);
  color: #ecfdf5;
  box-shadow: 0 4px 14px oklch(0 0 0 / 0.25);
  transition: all var(--transition-fast);
}

.btn-end-turn:hover:not(:disabled) {
  background: linear-gradient(135deg, oklch(0.38 0.11 145 / 0.95), oklch(0.28 0.08 145 / 0.95));
  border-color: oklch(0.65 0.16 145 / 0.8);
  box-shadow: 0 6px 18px oklch(0.4 0.14 145 / 0.4);
  transform: translateY(-1px);
}

.btn-end-turn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

.dice-container .btn-end-turn {
  margin-top: 0;
  width: 100%;
}

.board-container-fill {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.hud-overlay-toggle {
  display: none;
}

.hud-sidebar-backdrop {
  display: none;
}

.turn-banner {
  background: oklch(1 0 0 / 0.035);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.turn-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.turn-commander {
  font-size: 16px;
  font-weight: 700;
  margin: 3px 0;
  color: var(--gold-primary);
}

.turn-timer-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  margin-top: 4px;
}

.turn-timer-bar .timer-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 13px;
  color: #38bdf8;
  font-weight: 700;
  transition: color 0.3s ease;
}

.turn-timer-bar .timer-header .ico {
  font-size: 14px;
}

.timer-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.timer-progress-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #06b6d4);
  transition: width 1s linear, background 0.3s ease;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}

/* Color states based on percentage */
.turn-timer-bar.timer-normal .timer-progress-fill {
  background: linear-gradient(90deg, #10b981, #38bdf8);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.turn-timer-bar.timer-normal .timer-header {
  color: #38bdf8;
}

.turn-timer-bar.timer-warning .timer-progress-fill {
  background: linear-gradient(90deg, #f59e0b, #eab308);
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
}

.turn-timer-bar.timer-warning .timer-header {
  color: #facc15;
}

.turn-timer-bar.timer-critical .timer-progress-fill {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.7);
}

.turn-timer-bar.timer-critical .timer-header {
  color: #f87171;
}

/* Low-time pulsing warning */
.turn-timer-bar.timer-pulse {
  animation: timerPulseCritical 0.8s ease-in-out infinite alternate;
}

@keyframes timerPulseCritical {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }

  100% {
    transform: scale(1.02);
    filter: brightness(1.25) drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
  }
}

/* Infinite / No limit mode */
.turn-timer-bar.timer-infinite .timer-progress-track {
  display: none;
}

.turn-timer-bar.timer-infinite .timer-header {
  color: var(--text-secondary, #94a3b8);
  font-size: 15px;
}

/* Dice Shaker Area */
.dice-container {
  background: oklch(0 0 0 / 0.22);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dice-cubes {
  display: flex;
  gap: 12px;
}

.die {
  width: 42px;
  height: 42px;
  min-width: 42px;
  min-height: 42px;
  background: linear-gradient(180deg, oklch(0.98 0.005 90), oklch(0.9 0.01 90));
  border-radius: 9px;
  border: 1.5px solid oklch(0.82 0.02 90);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 750;
  color: oklch(0.18 0.02 264);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box;
  user-select: none;
}

.die.has-pips {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  grid-template-rows: repeat(3, 1fr) !important;
  padding: 5px !important;
}

.die .pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  justify-self: center;
  align-self: center;
}

/* Die 1: Warm Ivory Tabletop Die */
.die.die-ivory {
  background: radial-gradient(circle at 35% 30%, #fffdfa 0%, #f7f3eb 55%, #ded8cb 100%);
  border: 1.5px solid #c9c2b3;
  color: #1e293b;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.9);
}

.die.die-ivory .pip {
  background: radial-gradient(circle at 35% 35%, #334155 0%, #1e293b 70%, #0f172a 100%);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6), 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* Die 2: Deep Crimson / Red Acrylic Tabletop Die */
.die.die-red {
  background: radial-gradient(circle at 35% 30%, #f87171 0%, #dc2626 50%, #991b1b 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.6);
}

.die.die-red .pip {
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, #f1f5f9 60%, #cbd5e1 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(0, 0, 0, 0.15);
}

.die.rolling {
  animation: tumbleDie 0.18s linear infinite;
}

@keyframes tumbleDie {
  0% {
    transform: rotate(-12deg) translateY(-1px);
  }

  50% {
    transform: rotate(14deg) translateY(2px);
  }

  100% {
    transform: rotate(-12deg) translateY(-1px);
  }
}

.die.die-seven {
  box-shadow: 0 0 0 2px var(--crimson-accent), 0 6px 12px oklch(0 0 0 / 0.35);
  animation: dieSevenFlash 0.65s ease;
}

@keyframes dieSevenFlash {

  0%,
  100% {
    filter: none;
  }

  50% {
    filter: saturate(1.4);
    background: oklch(0.72 0.18 25);
    color: oklch(0.98 0.02 25);
  }
}

@media (prefers-reduced-motion: reduce) {

  .die.rolling,
  .die.die-seven {
    animation: none;
  }
}

/* Dice Production Summary */
.dice-production-summary {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 24px;
}

.dice-production-summary:empty {
  display: none;
}

.dice-prod-card {
  width: 100%;
  border-radius: var(--radius-sm, 8px);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: diceProdPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes diceProdPop {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.dice-prod-card-gained {
  background: oklch(0.25 0.08 155 / 0.45);
  border: 1px solid oklch(0.65 0.18 155 / 0.6);
  box-shadow: 0 0 14px oklch(0.65 0.18 155 / 0.3);
}

.dice-prod-card-none {
  background: oklch(0.2 0.02 260 / 0.35);
  border: 1px solid oklch(1 0 0 / 0.12);
}

.dice-prod-card-robber {
  background: oklch(0.25 0.1 25 / 0.45);
  border: 1px solid oklch(0.65 0.2 25 / 0.6);
  box-shadow: 0 0 14px oklch(0.65 0.2 25 / 0.3);
}

.dice-prod-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: oklch(0.85 0.12 155);
}

.dice-prod-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.dice-prod-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  color: #ffffff;
  box-shadow: 0 2px 6px oklch(0 0 0 / 0.3);
}

.dice-prod-chip.chip-wood { background: #1e4a38; border: 1px solid #34d399; }
.dice-prod-chip.chip-brick { background: #7f1d1d; border: 1px solid #f87171; }
.dice-prod-chip.chip-wool { background: #15803d; border: 1px solid #4ade80; }
.dice-prod-chip.chip-wheat { background: #854d0e; border: 1px solid #facc15; }
.dice-prod-chip.chip-ore { background: #334155; border: 1px solid #94a3b8; }
.dice-prod-chip.chip-cloth { background: #5b21b6; border: 1px solid #c084fc; }
.dice-prod-chip.chip-coin { background: #a16207; border: 1px solid #fbbf24; }
.dice-prod-chip.chip-paper { background: #115e59; border: 1px solid #2dd4bf; }

.dice-prod-none-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
}

.dice-prod-robber-badge {
  font-size: 12px;
  font-weight: 700;
  color: oklch(0.88 0.16 25);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
}

/* Build Action Buttons (Right Sidebar) */
.hud-build-actions-wrapper {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: oklch(1 0 0 / 0.015);
  flex-shrink: 0;
}

.build-actions-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.btn-build-action {
  background: oklch(1 0 0 / 0.035);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 550;
  transition: all var(--transition-fast);
  min-width: 0;
}

.btn-build-action:hover:not(:disabled) {
  border-color: oklch(1 0 0 / 0.16);
  background: oklch(1 0 0 / 0.06);
}

.btn-build-action.btn-primary {
  background: var(--gold-subtle);
  border: 1px solid oklch(0.78 0.145 72 / 0.45);
  color: var(--gold-primary);
  box-shadow: none;
}

.btn-build-action.has-discount {
  border-color: oklch(0.78 0.145 72 / 0.55);
  box-shadow: 0 0 10px oklch(0.78 0.145 72 / 0.22);
}

.btn-build-action.has-discount .cost-pill {
  border-color: oklch(0.78 0.145 72 / 0.6);
  font-weight: 700;
}

.btn-build-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.build-cost-pills {
  display: flex;
  gap: 2.5px;
  flex-shrink: 0;
}

.build-action-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.build-action-label .ico {
  font-size: 15px;
  opacity: 0.9;
  flex-shrink: 0;
}

.cost-pill {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1.5px 4.5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #ffffff;
  flex-shrink: 0;
}

.cost-pill .ico {
  font-size: 12px;
}

.cost-pill.pill-wood {
  background: var(--res-wood);
}

.cost-pill.pill-brick {
  background: var(--res-brick);
}

.cost-pill.pill-wool {
  background: var(--res-wool);
}

.cost-pill.pill-wheat {
  background: var(--res-wheat);
}

.cost-pill.pill-ore {
  background: var(--res-ore);
}


.dice-sum-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}

.dice-sum-value {
  color: var(--gold-primary);
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

