/* Elementary Game Stylesheet - Modern Glassmorphism & Classic 90s Pixel Retro */

:root {
  /* Modern Theme Variables */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-header: rgba(15, 23, 42, 0.9);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-amber: #f59e0b;
  
  --border-color: rgba(255, 255, 255, 0.1);
  --border-highlight: #38bdf8;
  
  --font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', monospace;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --glass-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --glow-shadow: 0 0 20px rgba(56, 189, 248, 0.4);
}

/* Retro 90s Pixel Theme (Windows 3.1 / DOS) */
body.theme-retro {
  --bg-primary: #008080; /* Windows 95 teal / niebieska ramka */
  --bg-secondary: #c0c0c0;
  --bg-card: #c0c0c0;
  --bg-header: #000080;
  
  --text-main: #000000;
  --text-muted: #404040;
  
  --accent-cyan: #00ffff;
  --accent-blue: #0000ff;
  --accent-purple: #800080;
  --accent-green: #008000;
  --accent-red: #ff0000;
  --accent-amber: #ffff00;
  
  --border-color: #808080;
  --border-highlight: #0000ff;
  
  --font-family: 'Press Start 2P', monospace, sans-serif;
  --font-mono: 'Press Start 2P', monospace, sans-serif;
  
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  
  --glass-shadow: none;
  --glow-shadow: none;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  padding: 12px;
}

/* Header */
.game-header {
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  box-shadow: var(--glass-shadow);
}

body.theme-retro .game-header {
  border: 3px inset #ffffff;
  color: #ffffff;
}

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

.brand-icon {
  font-size: 1.8rem;
}

.brand h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

body.theme-retro .brand h1 {
  background: none;
  -webkit-text-fill-color: #ffffff;
  font-size: 1.1rem;
}

.brand-badge {
  font-size: 0.65rem;
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-weight: 700;
}

body.theme-retro .brand-badge {
  background: #ffff00;
  color: #000;
  border: 1px solid #000;
  border-radius: 0;
}

/* Controls & Buttons */
.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.select-btn {
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

body.theme-retro .select-btn {
  background: #ffffff;
  color: #000;
  border: 2px inset #808080;
  font-size: 0.75rem;
}

.btn {
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

body.theme-retro .btn {
  background: #c0c0c0;
  color: #000;
  border: 2px outset #ffffff;
  font-size: 0.7rem;
}

body.theme-retro .btn:active {
  border: 2px inset #ffffff;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent-cyan);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  color: #ffffff;
  border: none;
}

body.theme-retro .btn-primary {
  background: #000080;
  color: #ffffff;
  border: 2px outset #ffffff;
}

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border: none;
}

body.theme-retro .btn-warning {
  background: #ff8000;
  color: #000;
}

.btn-icon {
  padding: 8px 12px;
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

body.theme-retro .timer-display {
  background: #000000;
  color: #00ff00;
  border: 2px inset #808080;
  font-size: 0.8rem;
}

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

.action-buttons .btn {
  background: rgba(15, 23, 42, 0.6);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 10px;
  min-width: 38px;
  height: 38px;
  font-size: 1.05rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  position: relative;
}

.action-buttons .btn:hover {
  background: #1e293b;
  border-color: #38bdf8;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.25);
}

.action-buttons .btn-warning {
  background: rgba(217, 119, 6, 0.25);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.6);
}

.action-buttons .btn-warning:hover {
  background: rgba(245, 158, 11, 0.45);
  color: #ffffff;
  border-color: #f59e0b;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

body.theme-retro .action-buttons .btn {
  background: #c0c0c0;
  color: #000000;
  border: 2px outset #ffffff;
  font-size: 0.8rem;
  min-width: 32px;
  height: 32px;
  padding: 2px 6px;
  box-shadow: none;
}

body.theme-retro .action-buttons .btn:hover {
  background: #ffffff;
  border: 2px outset #ffffff;
}

body.theme-retro .action-buttons .btn:active {
  border: 2px inset #ffffff;
}

/* Main Layout */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 16px;
  flex: 1;
}

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

/* Board Section */
.board-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--glass-shadow);
  overflow-x: auto;
}

body.theme-retro .board-section {
  background: #000000;
  border: 4px ridge #00ffff;
}

.board-header-cols {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
}

body.theme-retro .board-header-cols {
  color: #ffff00;
  font-size: 0.7rem;
}

.col-header {
  background: rgba(0, 0, 0, 0.2);
  padding: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

body.theme-retro .col-header {
  background: #000080;
  color: #ffffff;
  border: 1px solid #ffffff;
}

/* Logic Board Grid */
.logic-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.board-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  align-items: center;
}

.category-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

body.theme-retro .category-label {
  background: #c0c0c0;
  color: #000000;
  border: 2px outset #ffffff;
  font-size: 0.65rem;
}

/* Cell Container */
.board-cell {
  aspect-ratio: 1.1 / 1;
  min-height: 80px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
  position: relative;
  transition: all 0.2s ease;
}

/* Subtle Vertical Zebra Striping for alternating columns (2, 4, 6) */
.board-cell:nth-child(even) {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(71, 85, 105, 0.8);
}

body.theme-retro .board-cell {
  background: #000000;
  border: 2px inset #808080;
}

body.theme-retro .board-cell:nth-child(even) {
  background: #111126;
}

.board-cell.highlight-row {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.15);
}

.board-cell.highlight-target {
  border-color: var(--accent-amber);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
  transform: scale(1.03);
}

.candidate-item.highlight-candidate {
  outline: 2px solid #f59e0b;
  background: rgba(245, 158, 11, 0.35);
  border-radius: 4px;
  animation: pulse-cand 1.2s infinite alternate;
}

@keyframes pulse-cand {
  0% { transform: scale(1); box-shadow: 0 0 4px rgba(245, 158, 11, 0.6); }
  100% { transform: scale(1.15); box-shadow: 0 0 12px rgba(245, 158, 11, 0.95); }
}

/* Candidates 3x2 Grid */
.candidates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
  height: 100%;
  width: 100%;
}

.candidate-item {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: transform 0.1s ease, opacity 0.15s ease;
  background: rgba(255, 255, 255, 0.03);
}

.candidate-item:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
  z-index: 2;
}

.candidate-item.eliminated {
  opacity: 0.15;
  filter: grayscale(100%);
  pointer-events: auto;
}

.candidate-item.eliminated::after {
  content: '❌';
  position: absolute;
  font-size: 0.8rem;
  color: var(--accent-red);
}

/* Confirmed Cell */
.confirmed-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  background: rgba(16, 185, 129, 0.15);
  border: 2px solid var(--accent-green);
  border-radius: var(--radius-sm);
  cursor: pointer;
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.theme-retro .confirmed-cell {
  background: #0000ff;
  border: 2px ridge #ffff00;
}

.confirmed-cell .icon-svg {
  width: 70%;
  height: 70%;
}

@keyframes popIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Mobile Toggle Bar */
.mobile-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.btn-toggle {
  opacity: 0.6;
}

.btn-toggle.active {
  opacity: 1;
  border-color: var(--accent-cyan);
  background: var(--accent-blue);
  color: #fff;
}

/* Clues Section */
.clues-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--glass-shadow);
}

body.theme-retro .clues-section {
  background: #c0c0c0;
  border: 4px ridge #00ffff;
  color: #000000;
}

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

.clues-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

body.theme-retro .clues-header h2 {
  font-size: 0.8rem;
}

.clues-count-badge {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

body.theme-retro .clues-count-badge {
  background: #000080;
  color: #ffffff;
  border-radius: 0;
}

.clues-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  padding-right: 4px;
}

/* Visual Clue Card */
.clue-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  min-height: 56px;
}

body.theme-retro .clue-card {
  background: #ffffff;
  border: 2px inset #808080;
}

.clue-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.2);
}

.clue-card.satisfied {
  opacity: 0.35;
  filter: grayscale(80%);
}

.clue-card.satisfied::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 4px;
  color: var(--accent-green);
  font-weight: bold;
  font-size: 0.95rem;
}

.clue-card.highlighted {
  border-color: var(--accent-amber);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
}

/* Clue Visual Layouts */
.clue-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
}

.clue-visual.vertical {
  flex-direction: column;
}

.clue-icon-box {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
}

body.theme-retro .clue-icon-box {
  background: #c0c0c0;
  border: 1px solid #000;
}

.clue-rel-symbol {
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--accent-cyan);
}

body.theme-retro .clue-rel-symbol {
  color: #ff0000;
}

.icon-svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Toast / Hint Dialog */
.hint-toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 41, 59, 0.95);
  border: 2px solid var(--accent-amber);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), var(--glow-shadow);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 100;
  max-width: 600px;
  width: 90%;
  animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.theme-retro .hint-toast {
  background: #ffff00;
  color: #000;
  border: 3px double #000;
  border-radius: 0;
  font-size: 0.75rem;
}

.hint-toast.hidden {
  display: none;
}

.hint-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.hint-badge {
  background: var(--accent-amber);
  color: #000;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.75rem;
}

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

/* 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: 1000;
  padding: 16px;
}

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

.modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}

body.theme-retro .modal-card {
  background: #c0c0c0;
  border: 4px outset #ffffff;
  color: #000;
  border-radius: 0;
}

.win-card {
  text-align: center;
  border-color: var(--accent-cyan);
}

.win-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.win-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.stat-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.theme-retro .stat-box {
  background: #ffffff;
  border: 2px inset #808080;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

body.theme-retro .stat-value {
  color: #000080;
  font-size: 0.9rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.rules-card {
  max-width: 650px;
}

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

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

.modal-body p {
  margin-bottom: 10px;
  line-height: 1.5;
  font-size: 0.95rem;
}

.modal-body h3 {
  margin: 14px 0 6px 0;
  color: var(--accent-cyan);
}

body.theme-retro .modal-body h3 {
  color: #000080;
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 12px;
  line-height: 1.5;
  font-size: 0.9rem;
}

/* Footer Status Bar */
.game-footer {
  margin-top: 12px;
  background: var(--bg-header);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

body.theme-retro .game-footer {
  background: #c0c0c0;
  border: 2px inset #808080;
  color: #000000;
  font-size: 0.7rem;
}

/* 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);
}
