/* Mastermind: Codebreaker - Modern, Tactile & Sci-Fi Graphics */

:root {
  /* Common Palette Peg Colors */
  --peg-red: #ef4444;
  --peg-red-light: #fca5a5;
  --peg-red-dark: #991b1b;
  --peg-red-glow: rgba(239, 68, 68, 0.6);

  --peg-green: #10b981;
  --peg-green-light: #6ee7b7;
  --peg-green-dark: #065f46;
  --peg-green-glow: rgba(16, 185, 129, 0.6);

  --peg-blue: #3b82f6;
  --peg-blue-light: #93c5fd;
  --peg-blue-dark: #1e40af;
  --peg-blue-glow: rgba(59, 130, 246, 0.6);

  --peg-yellow: #f59e0b;
  --peg-yellow-light: #fde68a;
  --peg-yellow-dark: #92400e;
  --peg-yellow-glow: rgba(245, 158, 11, 0.6);

  --peg-purple: #a855f7;
  --peg-purple-light: #e9d5ff;
  --peg-purple-dark: #6b21a8;
  --peg-purple-glow: rgba(168, 85, 247, 0.6);

  --peg-cyan: #06b6d4;
  --peg-cyan-light: #a5f3fc;
  --peg-cyan-dark: #155e75;
  --peg-cyan-glow: rgba(6, 182, 212, 0.6);

  --peg-orange: #f97316;
  --peg-orange-light: #fed7aa;
  --peg-orange-dark: #9a3412;
  --peg-orange-glow: rgba(249, 115, 22, 0.6);

  --peg-white: #f8fafc;
  --peg-white-light: #ffffff;
  --peg-white-dark: #64748b;
  --peg-white-glow: rgba(255, 255, 255, 0.6);
}

/* ============================================================================
   1. THEME: CYBER VAULT (Default)
   ============================================================================ */
body.theme-cyber {
  --bg-main: #090d16;
  --bg-gradient: radial-gradient(circle at 50% 20%, #151e33 0%, #080c14 100%);
  --bg-card: rgba(17, 24, 39, 0.85);
  --bg-header: rgba(11, 17, 32, 0.95);
  --border-color: rgba(56, 189, 248, 0.2);
  --border-glow: #06b6d4;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-cyan: #06b6d4;
  --accent-magenta: #ec4899;
  --accent-amber: #f59e0b;
  --socket-bg: #0b1120;
  --socket-border: rgba(56, 189, 248, 0.3);
  --shutter-bg: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e293b 100%);
  --font-family: 'Outfit', system-ui, sans-serif;
  --board-shadow: 0 15px 40px -10px rgba(0, 0, 0, 0.8);
}

/* ============================================================================
   2. THEME: CLASSIC WOOD (Tactile Deluxe Board)
   ============================================================================ */
body.theme-wood {
  --bg-main: #1f140e;
  --bg-gradient: radial-gradient(circle at 50% 30%, #3e2417 0%, #1a0f0a 100%);
  --bg-card: #2a1a12;
  --bg-header: rgba(35, 20, 14, 0.95);
  --border-color: rgba(217, 119, 6, 0.3);
  --border-glow: #d97706;
  --text-main: #fef3c7;
  --text-muted: #d97706;
  --accent-cyan: #fbbf24;
  --accent-magenta: #f87171;
  --accent-amber: #d97706;
  --socket-bg: #140b06;
  --socket-border: #452416;
  --shutter-bg: linear-gradient(135deg, #452416 0%, #2a160d 50%, #452416 100%);
  --font-family: 'Cinzel', serif, system-ui;
  --board-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
}

/* ============================================================================
   3. THEME: SYNTHWAVE NEON (80s Arcade)
   ============================================================================ */
body.theme-neon {
  --bg-main: #0d061a;
  --bg-gradient: radial-gradient(circle at 50% 20%, #260d45 0%, #0a0314 100%);
  --bg-card: rgba(28, 14, 48, 0.85);
  --bg-header: rgba(20, 8, 36, 0.95);
  --border-color: rgba(236, 72, 153, 0.35);
  --border-glow: #f43f5e;
  --text-main: #ffffff;
  --text-muted: #c084fc;
  --accent-cyan: #22d3ee;
  --accent-magenta: #f43f5e;
  --accent-amber: #fbbf24;
  --socket-bg: #130624;
  --socket-border: rgba(236, 72, 153, 0.4);
  --shutter-bg: linear-gradient(135deg, #3b0764 0%, #1e0538 50%, #3b0764 100%);
  --font-family: 'Outfit', system-ui, sans-serif;
  --board-shadow: 0 0 40px rgba(244, 63, 94, 0.25);
}

/* Global Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: var(--font-family);
  background: var(--bg-main);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Subtle background cyber grid */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-size: 40px 40px;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  pointer-events: none;
  z-index: 0;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* Header */
.game-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-shield-icon {
  width: 42px;
  height: 42px;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid var(--border-glow);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.vault-icon {
  font-size: 1.4rem;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 12px var(--border-glow);
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent-cyan);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-btn {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.select-btn:hover {
  border-color: var(--border-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  outline: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 100%);
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.55);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-glow);
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px;
  font-size: 1.1rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--border-glow);
  transform: translateY(-1px);
}

.btn-icon.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Layout */
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 40px 16px;
  flex: 1;
}

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

/* ============================================================================
   BOARD COLUMN
   ============================================================================ */
.board-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  width: 100%;
}

/* Vault (Secret Code Shield) */
.vault-container {
  width: 100%;
  max-width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px 18px;
  box-shadow: var(--board-shadow);
  position: relative;
  overflow: hidden;
}

.vault-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.vault-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
  animation: pulse-red 1.5s infinite alternate;
}

.status-led.unlocked {
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  animation: pulse-green 1.5s infinite alternate;
}

@keyframes pulse-red {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

@keyframes pulse-green {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

.status-label {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.timer-badge {
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.vault-box {
  background: rgba(0, 0, 0, 0.5);
  border: 2px inset var(--socket-border);
  border-radius: 10px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Sliding Shutter */
.vault-shutter {
  position: absolute;
  inset: 0;
  background: var(--shutter-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1), 0 4px 15px rgba(0, 0, 0, 0.6);
}

.vault-shutter.open {
  transform: translateY(-105%);
}

.shutter-lock {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 18px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.lock-glyph {
  font-size: 1.2rem;
  animation: lock-bob 2s ease-in-out infinite alternate;
}

@keyframes lock-bob {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

.lock-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text-main);
}

.secret-pegs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
}

/* ============================================================================
   DECODING GRID
   ============================================================================ */
.grid-card {
  width: 100%;
  max-width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: var(--board-shadow);
  backdrop-filter: blur(10px);
}

.decoding-grid {
  display: flex;
  flex-direction: column-reverse; /* Row 1 at bottom, Row 10/12 at top */
  gap: 8px;
}

/* Guess Row */
.guess-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 6px 14px;
  transition: all 0.25s ease;
  position: relative;
  min-height: 54px;
}

.guess-row.active {
  background: rgba(6, 182, 212, 0.08);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.guess-row.active::before {
  content: '▶';
  position: absolute;
  left: -14px;
  font-size: 0.75rem;
  color: var(--accent-cyan);
  animation: pointer-bob 1s ease-in-out infinite alternate;
}

@keyframes pointer-bob {
  0% { transform: translateX(0); }
  100% { transform: translateX(3px); }
}

.guess-row.evaluated {
  opacity: 0.9;
}

.row-index {
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 28px;
}

.guess-row.active .row-index {
  color: var(--accent-cyan);
  font-weight: 900;
}

/* Sockets Row */
.row-sockets {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex: 1;
}

/* Peg Socket (Concave Hole) */
.peg-socket {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--socket-bg);
  border: 2px solid var(--socket-border);
  box-shadow: inset 2px 3px 6px rgba(0, 0, 0, 0.9), 0 1px 1px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: all 0.2s ease;
  position: relative;
}

.guess-row.active .peg-socket {
  cursor: pointer;
}

.guess-row.active .peg-socket:hover {
  border-color: var(--accent-cyan);
  transform: scale(1.05);
}

.guess-row.active .peg-socket.focused {
  border-color: var(--accent-amber);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.6), inset 2px 3px 6px rgba(0, 0, 0, 0.9);
}

/* 3D Glossy Marble / Enamel Peg */
.peg {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  position: relative;
  animation: pop-in 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 
    inset -2px -4px 6px rgba(0, 0, 0, 0.6),
    inset 2px 3px 4px rgba(255, 255, 255, 0.7),
    0 4px 10px rgba(0, 0, 0, 0.5);
  transition: transform 0.15s ease;
}

.peg:hover {
  transform: scale(1.08);
}

@keyframes pop-in {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Specific Peg Colors (Realistic 3D Spheres) */
.peg[data-color="0"] { background: radial-gradient(circle at 35% 30%, var(--peg-red-light) 0%, var(--peg-red) 45%, var(--peg-red-dark) 100%); }
.peg[data-color="1"] { background: radial-gradient(circle at 35% 30%, var(--peg-green-light) 0%, var(--peg-green) 45%, var(--peg-green-dark) 100%); }
.peg[data-color="2"] { background: radial-gradient(circle at 35% 30%, var(--peg-blue-light) 0%, var(--peg-blue) 45%, var(--peg-blue-dark) 100%); }
.peg[data-color="3"] { background: radial-gradient(circle at 35% 30%, var(--peg-yellow-light) 0%, var(--peg-yellow) 45%, var(--peg-yellow-dark) 100%); }
.peg[data-color="4"] { background: radial-gradient(circle at 35% 30%, var(--peg-purple-light) 0%, var(--peg-purple) 45%, var(--peg-purple-dark) 100%); }
.peg[data-color="5"] { background: radial-gradient(circle at 35% 30%, var(--peg-cyan-light) 0%, var(--peg-cyan) 45%, var(--peg-cyan-dark) 100%); }
.peg[data-color="6"] { background: radial-gradient(circle at 35% 30%, var(--peg-orange-light) 0%, var(--peg-orange) 45%, var(--peg-orange-dark) 100%); }
.peg[data-color="7"] { background: radial-gradient(circle at 35% 30%, var(--peg-white-light) 0%, var(--peg-white) 45%, var(--peg-white-dark) 100%); }

/* Feedback Pins Grid */
.feedback-box {
  width: 58px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--socket-border);
  border-radius: 8px;
  padding: 5px 6px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  justify-items: center;
  align-items: center;
}

.feedback-box.slots-5 {
  width: 72px;
  grid-template-columns: repeat(3, 1fr);
}

.pin-socket {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #080c14;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-sample {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Exact Match Pin (Glossy Obsidian Black) */
.pin-black {
  background: radial-gradient(circle at 35% 30%, #64748b 0%, #1e293b 35%, #000000 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.9), inset 1px 1px 2px rgba(255, 255, 255, 0.9);
  animation: pin-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Partial Match Pin (White Pearl) */
.pin-white {
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #cbd5e1 50%, #475569 100%);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.7), inset 1px 1px 2px rgba(255, 255, 255, 1);
  animation: pin-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pin-empty {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.2);
}

@keyframes pin-pop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Scanline Sweep on Check */
.guess-row.scanning::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 30px;
  background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
  animation: scanline 0.6s ease-in-out;
  pointer-events: none;
}

@keyframes scanline {
  0% { left: 0%; opacity: 0; }
  50% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

/* ============================================================================
   PALETTE & CONTROLS DOCK (Bottom)
   ============================================================================ */
.palette-container {
  width: 100%;
  max-width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: var(--board-shadow);
  backdrop-filter: blur(10px);
}

.palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.palette-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: var(--border-glow);
}

.palette-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.color-palette {
  display: flex;
  align-items: center;
  gap: 10px;
}

.palette-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.palette-item .peg {
  width: 42px;
  height: 42px;
  cursor: pointer;
}

.palette-item:hover .peg {
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.6);
}

.palette-key {
  font-family: 'Fira Code', monospace;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.btn-submit {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: #fff;
  padding: 10px 20px;
  font-size: 0.9rem;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
  flex-direction: column;
  gap: 2px;
}

.btn-submit:not(:disabled):hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
  transform: translateY(-2px);
}

.btn-submit:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(80%);
}

.key-hint {
  font-size: 0.65rem;
  opacity: 0.7;
}

/* ============================================================================
   SIDEBAR: DETECTIVE'S NOTEBOOK
   ============================================================================ */
.notebook-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.notebook-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--board-shadow);
  backdrop-filter: blur(10px);
}

.notebook-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.notebook-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-text-sm {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}

.btn-text-sm:hover {
  color: var(--accent-cyan);
}

.notebook-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 14px;
}

.notebook-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: 8px;
}

.note-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-peg {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

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

.note-toggles {
  display: flex;
  gap: 4px;
}

.btn-note-toggle {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-note-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-note-toggle.active-yes {
  background: rgba(16, 185, 129, 0.3);
  border-color: #10b981;
  color: #10b981;
  font-weight: bold;
}

.btn-note-toggle.active-no {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #ef4444;
  font-weight: bold;
}

.btn-note-toggle.active-unknown {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #f59e0b;
}

/* Legend Box */
.legend-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend-header {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  line-height: 1.3;
}

/* Logic Tip */
.logic-tip-box {
  background: rgba(6, 182, 212, 0.08);
  border-left: 3px solid var(--accent-cyan);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.tip-badge {
  display: block;
  font-weight: 800;
  font-size: 0.7rem;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

/* ============================================================================
   MODALS
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
  border-radius: 16px;
  padding: 24px;
  max-width: 520px;
  width: 100%;
  position: relative;
  animation: modal-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-pop {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

/* Result Modal */
.result-card {
  text-align: center;
}

.result-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
}

.result-badge.win {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid #10b981;
  color: #10b981;
}

.result-badge.loss {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid #ef4444;
  color: #ef4444;
}

.result-card h2 {
  font-size: 1.6rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.result-secret-display {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  margin: 16px 0;
}

.result-secret-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.modal-secret-pegs {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 24px 0;
}

.stat-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  padding: 10px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-family: 'Fira Code', monospace;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1rem;
  width: 100%;
}

/* Stats Modal Overview */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.stat-cell {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 4px;
  text-align: center;
}

.st-num {
  display: block;
  font-family: 'Fira Code', monospace;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--accent-cyan);
}

.st-txt {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.chart-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-muted);
}

.guess-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.chart-lbl {
  width: 24px;
  font-family: 'Fira Code', monospace;
  font-weight: bold;
}

.chart-bar-bg {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  height: 22px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  background: var(--accent-cyan);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 0.75rem;
  font-weight: bold;
  color: #000;
  min-width: 24px;
}

/* Rules Modal */
.rules-card {
  max-width: 620px;
  max-height: 85vh;
  overflow-y: auto;
}

.rules-content h3 {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-cyan);
  margin: 16px 0 6px 0;
}

.rules-content p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-main);
  margin-bottom: 8px;
}

.rule-feedback-demo {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
}

.demo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
}

.alert-box {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--accent-amber);
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 10px 0;
}

.rules-content ul {
  padding-left: 18px;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* Link powrotu do listy gier (integracja z serwisem). */
.brand-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  color: var(--accent-cyan, #22d3ee);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.brand-back:hover {
  background: rgba(34, 211, 238, 0.12);
}
