/* Quoridor 3D Game Styles (Extends CineAHO Sandbox Theme) */

:root {
  /* HSL Colors */
  --hue-purple: 270;
  --hue-blue: 210;
  --hue-green: 145;
  --hue-gold: 45;
  --hue-red: 350;
  --hue-cyan: 190;

  /* Theme Core (Default: Dark Mode) */
  --bg-color: #060913;
  --bg-grid: rgba(255, 255, 255, 0.015);
  
  --panel-bg: rgba(14, 20, 38, 0.65);
  --panel-border: rgba(255, 255, 255, 0.06);
  --panel-hover-border: rgba(168, 85, 247, 0.35);
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dark: #475569;
  
  /* Gradation Accents */
  --grad-purple: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  --grad-blue: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --grad-cyan: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  --grad-green: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --grad-gold: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  --grad-red: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  
  --neon-glow: 0 0 30px rgba(168, 85, 247, 0.25);
  --neon-border-glow: 0 0 15px rgba(168, 85, 247, 0.35);

  --font-main: 'Noto Sans KR', 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
  
  --accent-color: #a855f7;
  --accent-color-hover: #c084fc;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-color: #f8fafc;
  --bg-grid: rgba(15, 23, 42, 0.02);
  
  --panel-bg: rgba(255, 255, 255, 0.8);
  --panel-border: rgba(15, 23, 42, 0.08);
  --panel-hover-border: rgba(168, 85, 247, 0.4);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dark: #cbd5e1;
  
  --neon-glow: 0 0 30px rgba(168, 85, 247, 0.12);
  --shadow-card: 0 12px 40px 0 rgba(15, 23, 42, 0.06);
}

/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background-color 0.5s ease, color 0.3s ease;
}

/* Grid Background */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
  pointer-events: none;
}

/* Ambient Glow Orbs */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(160px);
  z-index: -3;
  pointer-events: none;
  opacity: 0.25;
  transition: opacity 0.5s ease;
}

.bg-glow-purple {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #7e22ce 0%, transparent 70%);
  top: -200px;
  left: 10%;
}

.bg-glow-blue {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, #2563eb 0%, transparent 70%);
  top: 20%;
  right: 5%;
}

[data-theme="light"] .bg-glow {
  opacity: 0.1;
}

/* Header Styles */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  margin: 1rem 1.5rem 0 1.5rem;
  border-radius: 50px;
  transition: var(--transition-smooth);
}

.glass-header {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

.logo-circle {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(168, 85, 247, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-text {
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.logo-text span {
  color: var(--accent-color);
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-back-home {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-back-home:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-theme {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 30px;
  padding: 0.5rem 1rem;
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-theme:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
}

[data-theme="light"] .btn-back-home,
[data-theme="light"] .btn-theme {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.08);
}

/* Glass Panel common styles */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
}

/* Layout App Container */
.app-container {
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* --- Game Lobby Card --- */
.lobby-card {
  padding: 2.25rem 2rem;
  max-width: 750px;
  margin: 1.5rem auto;
}

.lobby-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.lobby-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.icon-accent {
  color: var(--accent-color);
  font-size: 1.5rem;
}

.lobby-section {
  margin-bottom: 1.5rem;
}

.lobby-section h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.player-count-buttons {
  display: flex;
  gap: 1rem;
}

.btn-count-toggle {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  padding: 1rem;
  border-radius: 12px;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  transition: var(--transition-smooth);
}

.btn-count-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-color);
}

.btn-count-toggle.active {
  background: rgba(168, 85, 247, 0.12);
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.15);
}

/* Player Slots Configuration Grid */
.slots-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 600px) {
  .slots-container {
    grid-template-columns: 1fr;
  }
}

.slot-item {
  padding: 1.25rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.slot-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
}

.slot-color-badge {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 10px currentColor;
}

.slot-controls {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 0.2rem;
  border: 1px solid var(--panel-border);
}

.slot-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
}

.slot-btn.active {
  background: var(--accent-color);
  color: #fff;
  box-shadow: 0 2px 6px rgba(168, 85, 247, 0.3);
}

.lobby-actions {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 1.5rem;
}

.btn-start {
  background: var(--grad-purple);
  color: #fff;
  padding: 0.9rem 2.5rem;
  font-size: 1.05rem;
  border-radius: 50px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.3);
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(168, 85, 247, 0.45);
}

/* --- In-Game Layout --- */
.game-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-1 {
  gap: 1rem;
}

/* Left HUD Info Cards */
.turn-card {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.turn-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-color);
  box-shadow: 0 0 12px var(--accent-color);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(168, 85, 247, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 85, 247, 0); }
}

#turn-timer {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.players-dashboard {
  padding: 1.25rem 1.5rem;
}

.players-dashboard h3,
.controls-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.5rem;
  color: var(--text-muted);
}

.player-list-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hud-player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--panel-border);
  transition: var(--transition-smooth);
}

.hud-player-item.active {
  border-color: var(--accent-color);
  background: rgba(168, 85, 247, 0.06);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.08) inset;
}

.hud-player-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hud-player-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.hud-player-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.hud-player-type {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.4rem;
}

.hud-player-walls {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-color);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.hud-player-walls.empty {
  color: var(--text-dark);
}

/* Controls Grid Card */
.controls-card {
  padding: 1.25rem 1.5rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.btn-control {
  width: 100%;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.65rem 1rem;
  font-size: 0.8rem;
  justify-content: flex-start;
  gap: 0.6rem;
}

.btn-control:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--accent-color);
}

.btn-control.active {
  border-color: var(--accent-color);
  background: rgba(168, 85, 247, 0.1);
  color: var(--accent-color-hover);
}

.btn-danger {
  border-color: rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: #f43f5e;
  color: #f43f5e;
}

.ai-speed-controller {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ai-speed-controller input[type="range"] {
  accent-color: var(--accent-color);
  width: 100%;
  cursor: pointer;
}

/* --- Center 3D Board Panel --- */
.board-3d-scene-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  min-height: 620px;
}

.scene-instructions {
  position: absolute;
  top: 1rem;
  left: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 10;
  pointer-events: none;
}

/* 3D Scene Viewport */
.scene-3d {
  perspective: 1200px;
  width: 100%;
  height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
}

.scene-3d:active {
  cursor: grabbing;
}

.board-3d-wrapper {
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

/* The actual 3D Quoridor wooden board block */
.board-3d {
  position: relative;
  width: 460px;
  height: 460px;
  background: #5c2422; /* Richer, lighter Mahogany wood top */
  border-radius: 8px;
  transform-style: preserve-3d;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.8), inset 0 0 30px rgba(0,0,0,0.5);
  border: 1.5px solid #3d1413;
}

/* Thickness of the wooden board */
.board-side {
  position: absolute;
  background: #3a1514; /* Rich dark sides */
  transform-style: preserve-3d;
  border: 1px solid rgba(0,0,0,0.4);
}

.board-front {
  bottom: 0;
  left: 0;
  width: 460px;
  height: 24px;
  transform: rotateX(-90deg);
  transform-origin: bottom;
}

.board-back {
  top: 0;
  left: 0;
  width: 460px;
  height: 24px;
  transform: rotateX(90deg);
  transform-origin: top;
}

.board-left {
  top: 0;
  left: 0;
  width: 24px;
  height: 460px;
  transform: rotateY(-90deg);
  transform-origin: left;
}

.board-right {
  top: 0;
  right: 0;
  width: 24px;
  height: 460px;
  transform: rotateY(90deg);
  transform-origin: right;
}

.board-bottom {
  width: 460px;
  height: 460px;
  background: #190505;
  transform: translateZ(-24px);
}

/* Board Grid: 9x9 */
.board-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  height: 100%;
  padding: 16px;
  gap: 8px; /* The wall grooves width */
  transform-style: preserve-3d;
  transform: translateZ(1px); /* Lay on top of board base */
}

/* Individual Tiles */
.tile {
  background: #1f1f1f; /* Lighter ebony tiles to contrast dark grooves */
  border-radius: 4px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.9), 0 2px 4px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-style: preserve-3d;
  transform: translateZ(2.5px); /* Pop up slightly more */
  border: 1px solid rgba(255,255,255,0.04); /* Subtly defined tile edges */
}

.tile:hover {
  background: rgba(168, 85, 247, 0.35);
  transform: translateZ(5px);
  border-color: rgba(168, 85, 247, 0.5);
}

.tile.valid-move {
  background: rgba(16, 185, 129, 0.4) !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5) inset, 0 0 20px rgba(16, 185, 129, 0.4) !important;
  border: 2px solid #10b981 !important;
  transform: translateZ(6.5px) !important; /* Stand up noticeably */
}

.tile.valid-move:hover {
  background: rgba(16, 185, 129, 0.55) !important;
  transform: translateZ(8.5px) !important;
}

/* Player Start/Goal highlight zones */
.tile.start-white { border-bottom: 3px solid #ffffff; box-shadow: 0 3px 6px rgba(255,255,255,0.45); }
.tile.start-black { border-top: 3px solid #18181b; box-shadow: 0 -3px 6px rgba(24,24,27,0.5); }
.tile.start-yellow { border-left: 3px solid #eab308; box-shadow: -3px 0 6px rgba(234,179,8,0.4); }
.tile.start-blue { border-right: 3px solid #2563eb; box-shadow: 3px 0 6px rgba(37,99,235,0.4); }

/* Container elements inside board */
.board-wall-previews,
.board-placed-walls,
.board-pawns {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  pointer-events: none;
}

/* Standing Pawns in 3D */
.pawn-3d {
  position: absolute;
  transform-style: preserve-3d;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  pointer-events: none;
}

/* 3D stacked layered structures for Pawn shape - Taller and wider for visibility */
.pawn-slice {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  background: currentColor;
  transform-style: preserve-3d;
  pointer-events: none;
  border: 0.5px solid rgba(255, 255, 255, 0.15); /* Specular lighting border */
}

.base-slice {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.body-slice {
  border-color: rgba(255, 255, 255, 0.08);
}

.head-slice {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
}

/* Glow ring under pawn */
.pawn-ring {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid currentColor;
  margin-left: -6px;
  margin-top: -6px;
  transform: translateZ(1.5px);
  opacity: 0.95;
  filter: blur(2px);
  box-shadow: 0 0 15px currentColor;
  animation: breathe 2s ease-in-out infinite alternate;
}

@keyframes breathe {
  0% { transform: translateZ(1px) scale(0.95); opacity: 0.5; }
  100% { transform: translateZ(1px) scale(1.05); opacity: 0.9; }
}

/* Player Color Styles mapping */
.color-white { color: #ffffff !important; }
.color-black { color: #b1b1b7 !important; } /* Visible text color for Black player HUD */
.color-yellow { color: #eab308 !important; }
.color-blue { color: #3b82f6 !important; }

/* 3D Walls placement */
.wall-3d {
  position: absolute;
  transform-style: preserve-3d;
  transition: transform 0.2s ease, opacity 0.2s;
  pointer-events: none; /* Let clicks pass through grid */
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

/* Preview guide state */
.wall-3d.preview {
  opacity: 0.65;
  filter: brightness(1.3) drop-shadow(0 0 8px currentColor);
}

.wall-3d.invalid-preview .wall-face {
  background: linear-gradient(to bottom, #ef4444, #b91c1c) !important;
  border-color: #991b1b !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.7) !important;
}

/* Constructing 3D Cube faces for Walls - Honey Pine Wood Gradient */
.wall-face {
  position: absolute;
  background: linear-gradient(to bottom, #f59e0b, #d97706);
  border: 1px solid #b45309;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.35), 0 0 5px rgba(245, 158, 11, 0.2);
}

/* Wall Thickness height is 38px (taller and more visible) */
.wall-top {
  width: 100%;
  height: 100%;
  transform: translateZ(38px);
  background: #fbbf24;
  border: 1px solid #f59e0b;
}

.wall-front {
  width: 100%;
  height: 38px;
  transform: rotateX(-90deg);
  transform-origin: bottom;
  bottom: 0;
}

.wall-back {
  width: 100%;
  height: 38px;
  transform: rotateX(90deg);
  transform-origin: top;
  top: 0;
}

.wall-left {
  width: 38px;
  height: 100%;
  transform: rotateY(-90deg);
  transform-origin: left;
  left: 0;
}

.wall-right {
  width: 38px;
  height: 100%;
  transform: rotateY(90deg);
  transform-origin: right;
  right: 0;
}

/* Player-specific 3D Wall Colors for Quoridor */
/* Player 1 (White) Wall - Clean White wood style */
.player-wall-0 .wall-face {
  background: linear-gradient(to bottom, #ffffff, #f4f4f5);
  border-color: #d4d4d8;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.15), 0 0 5px rgba(255, 255, 255, 0.3);
}
.player-wall-0 .wall-top {
  background: #ffffff;
  border-color: #e4e4e7;
}

/* Player 2 (Black) Wall - Slate Ebony wood style */
.player-wall-1 .wall-face {
  background: linear-gradient(to bottom, #27272a, #09090b);
  border-color: #18181b;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 5px rgba(24, 24, 27, 0.4);
}
.player-wall-1 .wall-top {
  background: #1f1f23;
  border-color: #27272a;
}

/* Player 3 (Yellow) Wall - Honey Pine wood style */
.player-wall-2 .wall-face {
  background: linear-gradient(to bottom, #fbbf24, #b45309);
  border-color: #92400e;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.35), 0 0 5px rgba(251, 191, 36, 0.2);
}
.player-wall-2 .wall-top {
  background: #fbbf24;
  border-color: #f59e0b;
}

/* Player 4 (Blue) Wall - Royal Cobalt wood style */
.player-wall-3 .wall-face {
  background: linear-gradient(to bottom, #3b82f6, #1d4ed8);
  border-color: #1e3a8a;
  box-shadow: inset 0 0 8px rgba(0,0,0,0.35), 0 0 5px rgba(59, 130, 246, 0.2);
}
.player-wall-3 .wall-top {
  background: #3b82f6;
  border-color: #2563eb;
}

/* Unplaced wall rack indicator HUD at bottom of scene */
.hud-walls-rack {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1rem;
  width: 100%;
  border-top: 1px solid var(--panel-border);
  padding-top: 1rem;
  z-index: 10;
}

.rack-player-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.rack-player-label {
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rack-blocks {
  display: flex;
  gap: 3px;
}

.rack-block-item {
  width: 6px;
  height: 16px;
  background: #facc15;
  border: 1px solid #ca8a04;
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

.rack-block-item.used {
  opacity: 0.15;
  transform: scaleY(0.5);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 9, 19, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.rules-card {
  padding: 2.25rem 2rem;
  width: 90%;
  max-width: 600px;
  border: 1px solid var(--panel-border);
  animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.winner-card {
  padding: 2.5rem;
  width: 90%;
  max-width: 450px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.modal-header i {
  color: var(--accent-color);
}

.modal-body {
  overflow-y: auto;
  flex-grow: 1;
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  line-height: 1.6;
}

.modal-body h4 {
  color: var(--text-main);
  font-weight: 700;
  margin-top: 0.5rem;
}

.modal-body ul, .modal-body ol {
  padding-left: 1.25rem;
}

.modal-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

.winner-icon {
  width: 64px;
  height: 64px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

.winner-title {
  font-size: 1.45rem;
  font-weight: 800;
}

.winner-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.winner-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
}

.winner-actions button {
  flex: 1;
}

/* Footer styling */
.main-footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--panel-border);
  margin-top: auto;
}
