/* =============================================================================
   RESET & BASE STYLES
   ============================================================================= */
:root {
  --bg-color: #05060a;
  --panel-bg: rgba(10, 12, 22, 0.7);
  --border-cyan: rgba(0, 240, 255, 0.2);
  --border-cyan-active: rgba(0, 240, 255, 0.7);
  --neon-cyan: #00f0ff;
  --neon-pink: #ff0055;
  --neon-green: #00ff66;
  --neon-yellow: #ffff00;
  --neon-orange: #ff5500;
  
  --font-title: 'Orbitron', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --tile-size: 140px;
}

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

body {
  background-color: var(--bg-color);
  color: #e2e8f0;
  font-family: var(--font-body);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* Neon text utility classes */
.neon-text-blue {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px var(--neon-cyan);
}

/* =============================================================================
   CYBER DECORATIONS (Scanlines & Grid)
   ============================================================================= */
.cyber-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(to right, rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
  z-index: 0;
  pointer-events: none;
}

.cyber-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  z-index: 100;
  pointer-events: none;
  opacity: 0.35;
}

/* =============================================================================
   GLASS PANEL DESIGN SYSTEM
   ============================================================================= */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-cyan);
  border-radius: 8px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(0, 240, 255, 0.35);
  box-shadow: 0 8px 32px 0 rgba(0, 240, 255, 0.05);
}

/* Buttons */
.cyber-btn {
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 12px 24px;
  border: 1px solid transparent;
  background: rgba(10, 12, 22, 0.8);
  color: #fff;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
}

.cyber-btn.green {
  border-color: var(--neon-green);
  box-shadow: inset 0 0 10px rgba(0, 255, 102, 0.15), 0 0 10px rgba(0, 255, 102, 0.1);
  color: var(--neon-green);
}
.cyber-btn.green:hover {
  background: var(--neon-green);
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 102, 0.4);
}

.cyber-btn.blue {
  border-color: var(--neon-cyan);
  box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.15), 0 0 10px rgba(0, 240, 255, 0.1);
  color: var(--neon-cyan);
}
.cyber-btn.blue:hover {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.cyber-btn.red {
  border-color: var(--neon-pink);
  box-shadow: inset 0 0 10px rgba(255, 0, 85, 0.15), 0 0 10px rgba(255, 0, 85, 0.1);
  color: var(--neon-pink);
}
.cyber-btn.red:hover {
  background: var(--neon-pink);
  color: #fff;
  box-shadow: 0 0 20px rgba(255, 0, 85, 0.4);
}

.cyber-btn.outline {
  background: transparent;
}
.cyber-btn.outline:hover {
  color: #000 !important;
}

.cyber-btn.disabled, .cyber-btn:disabled {
  border-color: #4a5568 !important;
  color: #4a5568 !important;
  cursor: not-allowed;
  background: rgba(10, 12, 22, 0.5) !important;
  box-shadow: none !important;
}

/* =============================================================================
   SCREENS & LOBBY UI
   ============================================================================= */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.screen.active {
  display: flex;
}

/* Start screen */
.main-panel {
  width: 650px;
  padding: 40px;
  border-left: 4px solid var(--neon-cyan);
}

.glitch-container {
  text-align: center;
  margin-bottom: 40px;
}

.cyber-title {
  font-family: var(--font-title);
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 0.15em;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
  position: relative;
}

.subtitle {
  font-family: var(--font-title);
  font-size: 0.75rem;
  color: var(--neon-pink);
  letter-spacing: 0.3em;
  margin-top: 5px;
}

.form-container {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-family: var(--font-title);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.1em;
}

.input-group input, .input-group-row input {
  background: rgba(5, 6, 10, 0.8);
  border: 1px solid var(--border-cyan);
  border-radius: 4px;
  color: #fff;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

.input-group input:focus, .input-group-row input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.action-boxes {
  display: flex;
  margin-top: 15px;
  gap: 20px;
}

.action-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-box h3 {
  font-family: var(--font-title);
  font-size: 1rem;
  color: #fff;
}

.action-box p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
}

.input-group-row {
  display: flex;
  gap: 10px;
}

.input-group-row input {
  flex: 1;
  text-transform: uppercase;
  font-family: var(--font-title);
  letter-spacing: 0.1em;
}

.border-left {
  border-left: 1px solid rgba(0, 240, 255, 0.15);
  padding-left: 20px;
}

/* Lobby screen */
.lobby-panel {
  width: 900px;
  padding: 40px;
  border-left: 4px solid var(--neon-pink);
}

.lobby-panel h2 {
  font-family: var(--font-title);
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.lobby-desc {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 30px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 40px;
}

.lobby-section h3 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.1em;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.15);
  padding-bottom: 5px;
}

.runner-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.runner-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 15px;
  background: rgba(5, 6, 10, 0.5);
  border-radius: 4px;
  border-left: 3px solid transparent;
}

.runner-item .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neon-green);
  box-shadow: 0 0 10px var(--neon-green);
}

.runner-item .name {
  font-family: var(--font-title);
  font-size: 0.95rem;
}

.console-box {
  background: #05060a;
  border: 1px solid rgba(0, 240, 255, 0.1);
  border-radius: 4px;
  padding: 15px;
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--neon-green);
  height: 200px;
  overflow-y: auto;
  line-height: 1.6;
}

.lobby-actions {
  display: flex;
  justify-content: flex-end;
}

/* =============================================================================
   GAME INTERFACE & SIDEBARS
   ============================================================================= */
#game-screen {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.game-sidebar {
  position: absolute;
  top: 15px;
  bottom: 15px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.left-sidebar {
  left: 15px;
  width: 300px;
}

.right-sidebar {
  right: 15px;
  width: 320px;
}

.brand-section {
  border-bottom: 2px solid var(--neon-pink);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.brand-title {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
}

.brand-status {
  font-family: var(--font-title);
  font-size: 0.65rem;
  color: var(--neon-cyan);
  letter-spacing: 0.25em;
  margin-top: 3px;
}

.scoreboard-section h3, .log-section h3, .tile-preview-section h3, 
.deck-section h3, .turn-section h3 {
  font-family: var(--font-title);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.scoreboard-section {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
}

.scores-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-score-card {
  padding: 10px 12px;
  background: rgba(5, 6, 10, 0.5);
  border-radius: 4px;
  border-left: 4px solid var(--border-cyan);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.player-score-card.active-turn {
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
  background: rgba(0, 240, 255, 0.05);
}

.player-score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-score-row .name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.9rem;
}

.player-score-row .score {
  font-family: var(--font-title);
  font-weight: 800;
  color: var(--neon-cyan);
  font-size: 1rem;
}

.player-meeples-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.meeple-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 5px currentColor;
}

.log-section {
  height: 250px;
  margin-bottom: 20px;
}

.game-console {
  height: calc(100% - 25px);
  color: #718096;
}

.action-footer {
  margin-top: auto;
}

.action-footer button {
  width: 100%;
}

/* =============================================================================
   PREVIEW PANEL
   ============================================================================= */
.tile-preview-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 25px;
}

.preview-wrapper {
  width: 160px;
  height: 160px;
  background: #000;
  border: 1px solid var(--border-cyan);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
  position: relative;
  box-shadow: inset 0 0 15px rgba(0, 240, 255, 0.05);
}

.current-tile-container {
  width: var(--tile-size);
  height: var(--tile-size);
  cursor: grab;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.current-tile-container:active {
  cursor: grabbing;
}

.preview-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 10px;
}

.rotate-btn {
  background: rgba(10, 12, 22, 0.9);
  border: 1px solid var(--border-cyan);
  color: var(--neon-cyan);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
}

.rotate-btn:hover {
  background: var(--neon-cyan);
  color: #000;
  box-shadow: 0 0 15px var(--neon-cyan);
}

.preview-hint {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  line-height: 1.3;
}

.deck-section {
  margin-bottom: 25px;
}

.deck-counter-wrapper {
  background: rgba(5, 6, 10, 0.5);
  border-radius: 4px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 15px;
  border-left: 3px solid var(--neon-pink);
}

.deck-number {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--neon-pink);
}

.deck-label {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

.turn-player-box {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--neon-cyan);
  border-radius: 4px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
  animation: pulse 1.5s infinite;
}

#turn-player-name {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 0.95rem;
}

/* =============================================================================
   INFINITE BOARD VIEWPORT
   ============================================================================= */
.board-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
}

.board-viewport:active {
  cursor: grabbing;
}

.game-board {
  position: absolute;
  width: 20000px;
  height: 20000px;
  /* Origin centered */
  left: -10000px;
  top: -10000px;
  transform-origin: center center;
  transform: translate(0, 0) scale(1);
  will-change: transform;
}

/* Tile styling on board */
.board-tile {
  position: absolute;
  width: var(--tile-size);
  height: var(--tile-size);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
  transform-origin: center center;
  background-color: #000;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: box-shadow 0.3s ease;
}

/* Valid placement spot */
.placement-spot {
  position: absolute;
  width: var(--tile-size);
  height: var(--tile-size);
  border: 2px dashed var(--neon-green);
  background: rgba(0, 255, 102, 0.05);
  cursor: pointer;
  box-shadow: inset 0 0 10px rgba(0, 255, 102, 0.1);
  transition: all 0.2s ease;
}

.placement-spot:hover {
  background: rgba(0, 255, 102, 0.2);
  border-color: #fff;
  box-shadow: 0 0 15px var(--neon-green);
}

/* SVG Tile Design */
.tile-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.drag-helper {
  position: absolute;
  width: var(--tile-size);
  height: var(--tile-size);
  pointer-events: none;
  z-index: 100;
  display: none;
  opacity: 0.85;
  box-shadow: 0 0 20px var(--neon-cyan);
}

/* Meeple/Daemon marker on placed tiles */
.meeple-marker {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px currentColor;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-family: var(--font-title);
  color: #fff;
  font-weight: 900;
}

/* =============================================================================
   POPUP OVERLAYS & FAQ MODALS
   ============================================================================= */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 6, 10, 0.85);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
}

.overlay.active {
  display: flex;
}

.popup-panel {
  width: 480px;
  padding: 30px;
  text-align: center;
  border-left: 4px solid var(--neon-cyan);
}

.popup-panel h2 {
  font-family: var(--font-title);
  margin-bottom: 10px;
}

.popup-panel p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 20px;
}

.meeple-preview-area {
  width: 220px;
  height: 220px;
  background: #000;
  border: 1px solid var(--border-cyan);
  border-radius: 8px;
  margin: 0 auto 25px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 20px rgba(0, 240, 255, 0.08);
}

.meeple-tile-preview {
  width: 180px;
  height: 180px;
  position: relative;
}

.meeple-tile-preview .tile-svg {
  width: 100%;
  height: 100%;
}

.meeple-hotspot {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.15);
  border: 1px dashed var(--neon-cyan);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 100;
}

.meeple-hotspot:hover {
  background: var(--neon-cyan);
  border-color: #fff;
  box-shadow: 0 0 15px var(--neon-cyan);
  transform: translate(-50%, -50%) scale(1.3);
}

.meeple-hotspot::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.meeple-actions {
  display: flex;
  justify-content: center;
}

/* FAQ panel */
.help-panel {
  width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-left: 4px solid var(--neon-cyan);
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.1);
}

.help-header h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  letter-spacing: 0.05em;
}

.close-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close-btn:hover {
  color: var(--neon-pink);
}

.help-body {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
}

.help-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 10px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-title);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: var(--neon-cyan);
  border-bottom: 2px solid var(--neon-cyan);
}

.tab-content {
  display: none;
  line-height: 1.6;
}

.tab-content.active {
  display: block;
}

.tab-content h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  margin-bottom: 15px;
  color: #fff;
}

.tab-content h4 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  margin: 20px 0 10px;
  color: var(--neon-pink);
}

.tab-content ol, .tab-content ul {
  padding-left: 20px;
  margin-bottom: 15px;
}

.tab-content li {
  margin-bottom: 10px;
}

.help-structure-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.help-item {
  background: rgba(5, 6, 10, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  padding: 15px;
}

.neon-badge {
  display: inline-block;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 2px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}

.neon-badge.green {
  border-color: var(--neon-green);
  color: var(--neon-green);
}
.neon-badge.pink {
  border-color: var(--neon-pink);
  color: var(--neon-pink);
}
.neon-badge.blue {
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.help-item p {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  font-size: 0.85rem;
}

.help-table th, .help-table td {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.help-table th {
  font-family: var(--font-title);
  background: rgba(5, 6, 10, 0.5);
}

/* Gameover panel */
.gameover-panel {
  width: 550px;
  border-left: 4px solid var(--neon-green);
}

.glitch-title {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  color: var(--neon-green);
  margin-bottom: 10px;
}

.system-breach-desc {
  margin-bottom: 25px;
}

.final-scores-box {
  background: rgba(5, 6, 10, 0.6);
  border: 1px solid rgba(0, 255, 102, 0.1);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 30px;
}

.final-scores-box ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.final-scores-box li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.final-scores-box li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.final-scores-box .rank {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.1rem;
}

.final-scores-box .name {
  font-family: var(--font-title);
  font-weight: 600;
}

.final-scores-box .score {
  font-family: var(--font-title);
  font-weight: 900;
  color: var(--neon-cyan);
}

/* =============================================================================
   ANIMATIONS & KEYFRAMES
   ============================================================================= */
@keyframes pulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.5);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(0, 240, 255, 0);
  }
  100% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(0, 240, 255, 0);
  }
}

/* Custom scrollbars for chrome */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #05060a;
}

::-webkit-scrollbar-thumb {
  background: var(--border-cyan);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--neon-cyan);
}
