/* ==========================================================================
   STRATEGERY // TACTICAL HEXAGONAL CONQUEST
   High-contrast, immersive tabletop game design
   ========================================================================== */

:root {
  --bg-deep: #05050d;
  --bg-panel: rgba(8, 12, 22, 0.90);
  --bg-panel-hover: rgba(16, 24, 42, 0.96);
  --border-light: rgba(0, 240, 255, 0.16);
  --border-cyan: rgba(0, 240, 255, 0.45);
  --accent-cyan: #00f0ff;
  --accent-gold: #ffb700;
  --accent-red: #ff0055;
  --accent-green: #00ff66;
  --accent-purple: #b026ff;
  --accent-pink: #ff007f;
  --text-main: #f0f6fc;
  --text-dim: #8b9bb4;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Share Tech Mono', 'Consolas', monospace;
  --font-display: 'Chakra Petch', 'Inter', sans-serif;
  --glow-cyan: 0 0 16px rgba(0, 240, 255, 0.55);
  --glow-pink: 0 0 16px rgba(255, 0, 127, 0.55);
  --glow-gold: 0 0 20px rgba(255, 183, 0, 0.55);
  --glow-green: 0 0 16px rgba(0, 255, 102, 0.55);
}

strong, b {
  font-weight: 800;
  color: inherit;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
}

/* ==========================================================================
   GAME VIEWPORT & CANVAS
   ========================================================================== */
.game-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.canvas-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Screen edge vignette */
.screen-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.88);
}

/* CRT Scanlines Retro Screen Overlay */
.crt-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.28) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 85, 0.025),
    rgba(0, 255, 102, 0.015),
    rgba(0, 240, 255, 0.025)
  );
  background-size: 100% 3px, 6px 100%;
  opacity: 0.65;
}

/* ==========================================================================
   RESUME GAME BANNER
   ========================================================================== */
.resume-save-banner {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: linear-gradient(135deg, rgba(8, 20, 38, 0.96) 0%, rgba(3, 12, 24, 0.99) 100%);
  border: 1.5px solid var(--accent-cyan);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 12px 36px rgba(0, 0, 0, 0.85);
  border-radius: 12px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(14px);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #ffffff;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  0% { transform: translate(-50%, -20px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}

/* ==========================================================================
   TOP TACTICAL HUD
   ========================================================================== */
.top-hud {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.top-hud > * {
  pointer-events: auto;
}

.top-hud-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* Quick Controls Toolbar */
.top-controls-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-tactical {
  background: linear-gradient(135deg, rgba(8, 20, 38, 0.94) 0%, rgba(3, 12, 24, 0.98) 100%);
  border: 1.5px solid var(--accent-cyan);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 6px 18px rgba(0, 0, 0, 0.7);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}

.btn-tactical::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.22), transparent);
  transition: left 0.6s ease;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn-tactical:hover:not(:disabled)::before {
    left: 100%;
  }

  .btn-tactical:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.22) 0%, rgba(8, 28, 50, 0.96) 100%);
    border-color: #67e8f9;
    transform: translateY(-2px);
    box-shadow: 0 0 22px rgba(0, 240, 255, 0.65), 0 10px 24px rgba(0, 0, 0, 0.85);
    color: #ffffff;
  }
}

.btn-tactical:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.4), 0 4px 10px rgba(0, 0, 0, 0.8);
}

.btn-tactical:focus:not(:focus-visible) {
  outline: none;
  transform: none;
}

.btn-tactical.is-muted {
  opacity: 0.6;
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-dim);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   BOTTOM COMMAND DECK
   ========================================================================== */
.bottom-command-deck {
  position: absolute;
  bottom: 14px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.bottom-command-deck > * {
  pointer-events: auto;
}

/* Left: Selection Inspector & Mode Buttons */
.command-deck-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.action-context-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, rgba(8, 20, 38, 0.75) 0%, rgba(8, 20, 38, 0.25) 75%, transparent 100%);
  backdrop-filter: blur(8px);
  border: none;
  box-shadow: none;
  border-radius: 6px;
  padding: 6px 14px 6px 6px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: var(--accent-cyan);
  font-family: var(--font-display);
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

.action-context-prompt strong {
  color: #ffffff;
  font-weight: 900;
}

.prompt-pulse-dot {
  color: inherit;
  font-size: 12px;
  animation: promptBlink 1.4s infinite ease-in-out;
}

@keyframes promptBlink {
  0%, 100% { opacity: 1; transform: scale(1.15); filter: drop-shadow(0 0 6px currentColor); }
  50% { opacity: 0.25; transform: scale(0.85); filter: none; }
}

/* Right: End Turn Button - Tactical Cybernetic Command Interface */
.btn-end-turn {
  background: linear-gradient(135deg, rgba(8, 20, 38, 0.94) 0%, rgba(3, 12, 24, 0.98) 100%);
  border: 1.5px solid var(--accent-cyan);
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 8px 24px rgba(0, 0, 0, 0.7);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}

.btn-end-turn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.22), transparent);
  transition: left 0.6s ease;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn-end-turn:hover:not(:disabled)::before {
    left: 100%;
  }

  .btn-end-turn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.22) 0%, rgba(8, 28, 50, 0.96) 100%);
    border-color: #67e8f9;
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.65), 0 12px 30px rgba(0, 0, 0, 0.85);
    color: #ffffff;
  }

  .btn-end-turn.is-placement:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(255, 183, 0, 0.22) 0%, rgba(32, 24, 8, 0.96) 100%);
    border-color: #fde047;
    box-shadow: 0 0 28px rgba(255, 183, 0, 0.7), 0 12px 30px rgba(0, 0, 0, 0.85);
  }
}

.btn-end-turn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.8);
}

.btn-end-turn:focus:not(:focus-visible) {
  outline: none;
  transform: none;
}

.btn-end-turn.is-placement {
  border-color: var(--accent-gold);
  box-shadow: 0 0 20px rgba(255, 183, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 8px 24px rgba(0, 0, 0, 0.7);
}

.btn-end-turn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(10, 16, 26, 0.65);
  box-shadow: none;
  filter: grayscale(0.8);
}

.end-turn-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.45);
  color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.5);
  transition: all 0.2s ease;
}

.btn-end-turn.is-placement .end-turn-badge {
  background: rgba(255, 183, 0, 0.18);
  border-color: rgba(255, 183, 0, 0.5);
  color: var(--accent-gold);
  box-shadow: 0 0 8px rgba(255, 183, 0, 0.3);
  text-shadow: 0 0 6px rgba(255, 183, 0, 0.5);
}

/* ==========================================================================
   COMBAT SHOWDOWN OVERLAY
   ========================================================================== */
.combat-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 7, 18, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.combat-card {
  background: linear-gradient(135deg, rgba(8, 20, 38, 0.96) 0%, rgba(3, 12, 24, 0.99) 100%);
  border: 1.5px solid var(--accent-cyan);
  border-radius: 16px;
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 24px 60px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  width: 100%;
  max-width: 360px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-height: 88vh;
  overflow-y: auto;
  animation: combatPop 0.25s ease-out;
}

.combat-card-simple {
  max-width: 360px;
}

@keyframes combatPop {
  0% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

.combat-header {
  text-align: center;
  width: 100%;
}

.combat-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.combat-round-tracker {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.35);
  padding: 3px 14px;
  border-radius: 20px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.combat-duel-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 240px;
  margin: 6px auto;
}

.combat-duel-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.duel-col {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
}

.duel-vs {
  font-size: 13px;
  font-weight: 900;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  width: 32px;
  text-align: center;
  user-select: none;
}

.duel-vs-empty {
  opacity: 0.3;
}

.tactical-die {
  width: 42px;
  height: 42px;
  background: #f8fafc;
  color: #0f172a;
  border: 2px solid #cbd5e1;
  border-radius: 9px;
  font-size: 19px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

.tactical-die.rolling-die {
  animation: diceRollShake 0.1s infinite alternate;
}

@keyframes diceRollShake {
  0% { transform: scale(0.96) rotate(-3deg); }
  100% { transform: scale(1.04) rotate(3deg); }
}

.tactical-die.landed-die {
  animation: diceLand 0.18s ease-out;
}

@keyframes diceLand {
  0% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.tactical-die.die-won {
  border-color: #00ff66 !important;
  background: #f0fdf4;
  color: #14532d;
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.7);
}

.tactical-die.die-lost {
  border-color: #ef4444 !important;
  background: #fee2e2;
  color: #991b1b;
  text-decoration: line-through;
  opacity: 0.65;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.35);
}

.tactical-die.die-tie {
  border-color: #f97316 !important;
  background: #fff7ed;
  color: #9a3412;
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.7);
}

.tactical-die.die-reserve {
  border-color: rgba(0, 240, 255, 0.5) !important;
  background: #f1f5f9;
  color: #475569;
  opacity: 0.85;
}

.tactical-die.die-empty {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.15) !important;
  color: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

.combat-result-banner {
  text-align: center;
  width: 100%;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.2px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
}

.combat-result-banner.banner-victory {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--accent-green);
  color: #6ee7b7;
}

.combat-result-banner.banner-defeat {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--accent-red);
  color: #fca5a5;
}

.btn-combat-close {
  width: 100%;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #00f0ff, #0088ff);
  color: #030712;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.45);
  transition: all 0.2s ease;
  animation: combatBtnPulse 1.8s infinite alternate;
}

@media (hover: hover) and (pointer: fine) {
  .btn-combat-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.75);
  }
}

.btn-combat-close:active {
  transform: translateY(1px) scale(0.99);
}

@keyframes combatBtnPulse {
  0% { box-shadow: 0 0 12px rgba(0, 240, 255, 0.4); }
  100% { box-shadow: 0 0 26px rgba(0, 240, 255, 0.8); }
}

/* ==========================================================================
   MODALS (Setup, Rules, Game Over)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(3, 7, 18, 0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: linear-gradient(135deg, rgba(8, 20, 38, 0.96) 0%, rgba(3, 12, 24, 0.99) 100%);
  border: 1.5px solid var(--accent-cyan);
  border-radius: 16px;
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 24px 60px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 240, 255, 0.4) rgba(8, 20, 38, 0.8);
}

.modal-card::-webkit-scrollbar {
  width: 6px;
}
.modal-card::-webkit-scrollbar-track {
  background: rgba(8, 20, 38, 0.8);
}
.modal-card::-webkit-scrollbar-thumb {
  background: rgba(0, 240, 255, 0.4);
  border-radius: 3px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1.5px solid rgba(0, 240, 255, 0.22);
  padding-bottom: 14px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 14px rgba(0, 240, 255, 0.45);
}

.modal-subtitle {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
  padding: 4px;
  transition: all 0.2s ease;
}
.btn-close-modal:hover {
  color: var(--accent-cyan);
  text-shadow: 0 0 10px var(--accent-cyan);
  transform: scale(1.1);
}

/* Form inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
  text-transform: uppercase;
}

.form-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: #ffffff;
  transition: opacity 0.2s ease;
  user-select: none;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.input-tactical, .select-tactical {
  background: linear-gradient(135deg, rgba(12, 26, 48, 0.85) 0%, rgba(6, 16, 32, 0.95) 100%);
  border: 1.5px solid rgba(0, 240, 255, 0.3);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.8px;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.5);
}

.input-tactical:focus, .select-tactical:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(0, 240, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Player setup row */
.setup-players-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.setup-player-row {
  display: grid;
  grid-template-columns: 24px 1fr 1fr;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(12, 26, 48, 0.6) 0%, rgba(6, 16, 32, 0.75) 100%);
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.setup-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 240, 255, 0.15);
}

.btn-primary-action {
  background: linear-gradient(135deg, rgba(8, 20, 38, 0.94) 0%, rgba(3, 12, 24, 0.98) 100%);
  border: 1.5px solid var(--accent-cyan);
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 8px 24px rgba(0, 0, 0, 0.7);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}

.btn-primary-action::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.22), transparent);
  transition: left 0.6s ease;
  pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary-action:hover:not(:disabled)::before {
    left: 100%;
  }

  .btn-primary-action:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.22) 0%, rgba(8, 28, 50, 0.96) 100%);
    border-color: #67e8f9;
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.65), 0 12px 30px rgba(0, 0, 0, 0.85);
    color: #ffffff;
  }
}

.btn-primary-action:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4), 0 4px 12px rgba(0, 0, 0, 0.8);
}

.btn-primary-action:focus:not(:focus-visible) {
  outline: none;
  transform: none;
}

.btn-secondary-action {
  background: linear-gradient(135deg, rgba(8, 20, 38, 0.75) 0%, rgba(3, 12, 24, 0.88) 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: var(--text-dim);
  padding: 10px 22px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn-secondary-action:hover {
    border-color: rgba(255, 255, 255, 0.45);
    color: #ffffff;
    background: linear-gradient(135deg, rgba(16, 32, 56, 0.85) 0%, rgba(8, 20, 38, 0.95) 100%);
    transform: translateY(-1px);
  }
}

.btn-secondary-action:active {
  transform: translateY(1px);
}

.btn-secondary-action:focus:not(:focus-visible) {
  outline: none;
  transform: none;
}

/* Game Over Actions with icons above text */
.game-over-actions {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 16px;
  width: 100%;
}

.btn-game-over-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  min-width: 130px;
  max-width: 220px;
  padding: 12px 18px;
  text-align: center;
  line-height: 1.25;
  border-radius: 12px;
}

.btn-game-over-action .btn-action-icon {
  font-size: 24px;
  margin-bottom: 2px;
  line-height: 1;
  display: block;
}

.btn-game-over-action .btn-action-text {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  display: block;
  white-space: nowrap;
}

.btn-game-over-action .btn-action-subtext {
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.75;
  letter-spacing: 0.4px;
  display: block;
  white-space: nowrap;
}

/* Rules content */
.rules-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-main);
  line-height: 1.6;
}

.rules-section-title {
  font-size: 13.5px;
  font-weight: 900;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.rules-callout {
  background: rgba(56, 189, 248, 0.1);
  border-left: 3px solid var(--accent-cyan);
  padding: 10px 14px;
  border-radius: 6px;
}

/* Virtual Tactical Console Feed */
.tactical-console-container,
.tactical-toast-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;
  z-index: 100;
  max-width: min(360px, calc(100vw - 28px));
  align-self: flex-end;
}

.console-msg-item,
.tactical-toast {
  background: linear-gradient(90deg, rgba(8, 20, 38, 0.94) 0%, rgba(3, 10, 20, 0.97) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 2.5px solid var(--accent-cyan);
  border-radius: 4px;
  padding: 6px 11px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: #ffffff;
  display: flex;
  align-items: baseline;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75), 0 0 10px rgba(0, 240, 255, 0.12);
  backdrop-filter: blur(8px);
  pointer-events: none;
  user-select: none;
  animation: consoleSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.25s ease, transform 0.25s ease;
  word-break: break-word;
}

@keyframes consoleSlideIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.console-prompt {
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 11.5px;
  flex-shrink: 0;
  text-shadow: 0 0 6px currentColor;
}

.console-tag {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.8px;
  flex-shrink: 0;
}

.console-type-info .console-tag {
  color: var(--accent-cyan);
}
.console-type-info {
  border-left-color: var(--accent-cyan);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75), 0 0 10px rgba(0, 240, 255, 0.15);
}

.console-type-success .console-tag,
.console-type-success .console-prompt {
  color: var(--accent-green);
}
.console-type-success {
  border-left-color: var(--accent-green);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75), 0 0 10px rgba(0, 255, 102, 0.15);
}

.console-type-warn .console-tag,
.console-type-warn .console-prompt {
  color: var(--accent-gold);
}
.console-type-warn {
  border-left-color: var(--accent-gold);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75), 0 0 10px rgba(255, 183, 0, 0.15);
}

.console-type-danger .console-tag,
.console-type-danger .console-prompt {
  color: var(--accent-red);
}
.console-type-danger {
  border-left-color: var(--accent-red);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.75), 0 0 10px rgba(255, 0, 85, 0.15);
}

.console-text {
  color: #e2e8f0;
  font-weight: 600;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .top-hud {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 6px;
  }

  .top-hud-bar {
    gap: 6px;
    justify-content: flex-end;
  }

  .top-controls-bar {
    gap: 6px;
    flex-shrink: 0;
  }

  .top-controls-bar .btn-tactical {
    width: auto;
    min-width: 36px;
    height: 32px;
    padding: 0 9px;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    border-radius: 8px;
    white-space: nowrap;
  }

  /* Virtual Tactical Console Feed on Mobile */
  .tactical-console-container,
  .tactical-toast-container {
    gap: 3px;
    max-width: min(290px, calc(100vw - 16px));
  }

  .console-msg-item,
  .tactical-toast {
    padding: 4px 8px;
    font-size: 10px;
    letter-spacing: 0.3px;
    border-radius: 3px;
    line-height: 1.3;
  }

  .console-tag {
    font-size: 8.5px;
  }

  /* Prevent sticky hover transforms/elevation on touch devices */
  .btn-tactical,
  .btn-end-turn,
  .btn-primary-action,
  .btn-secondary-action {
    -webkit-tap-highlight-color: transparent;
  }

  .btn-tactical:hover:not(:active),
  .btn-end-turn:hover:not(:active),
  .btn-primary-action:hover:not(:active),
  .btn-secondary-action:hover:not(:active) {
    transform: none;
  }

  /* Bottom Command Deck */
  .bottom-command-deck {
    bottom: 8px;
    left: 8px;
    right: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .command-deck-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  .action-context-prompt {
    font-size: 11px;
    padding: 6px 10px;
    letter-spacing: 0.8px;
    width: 100%;
    justify-content: center;
    text-align: center;
    background: rgba(8, 20, 38, 0.65);
    border: none;
    box-shadow: none;
    border-radius: 6px;
  }

  .btn-end-turn {
    width: 100%;
    height: 44px;
    justify-content: center;
    padding: 0 16px;
    font-size: 13.5px;
    border-radius: 12px;
    letter-spacing: 1.2px;
  }

  /* Combat Modal */
  .combat-card {
    padding: 16px 18px;
    gap: 12px;
    max-width: 310px;
    width: 90vw;
  }

  .combat-title {
    font-size: 14px;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
  }

  .combat-duel-rows {
    gap: 8px;
    max-width: 220px;
  }

  .combat-duel-row {
    gap: 12px;
  }

  .duel-col {
    width: 38px;
  }

  .duel-vs {
    font-size: 11px;
    width: 24px;
  }

  .tactical-die {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .combat-round-tracker {
    font-size: 10px;
    padding: 3px 10px;
    margin-top: 4px;
  }

  .combat-result-banner {
    font-size: 12px;
    padding: 8px 10px;
  }

  .btn-combat-close {
    padding: 10px 14px;
    font-size: 12px;
    letter-spacing: 1.2px;
  }

  /* Modals */
  .modal-box {
    max-height: 90vh;
    padding: 18px;
    width: 95vw;
  }

  .setup-player-row {
    grid-template-columns: 20px 1fr 1fr;
    gap: 6px;
    padding: 6px 8px;
  }

  .input-tactical, .select-tactical {
    padding: 7px 8px;
    font-size: 11px;
  }

  .modal-card {
    padding: 18px 14px;
    border-radius: 16px;
    gap: 14px;
  }

  .game-over-actions {
    gap: 10px;
    margin-top: 4px;
  }

  .btn-game-over-action {
    padding: 10px 8px;
    min-width: 0;
    max-width: none;
    border-radius: 10px;
  }

  .btn-game-over-action .btn-action-icon {
    font-size: 20px;
    margin-bottom: 2px;
  }

  .btn-game-over-action .btn-action-text {
    font-size: 12px;
    letter-spacing: 0.5px;
  }

  .btn-game-over-action .btn-action-subtext {
    font-size: 9.5px;
    letter-spacing: 0.2px;
  }
}
