/**
 * Commercial Game CSS Architecture
 * High-end neon aesthetic with glassmorphism, micro-animations, and responsive layout.
 */

:root {
  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'Share Tech Mono', monospace;

  /* Harmonious Cyber/Arcade Palette */
  --bg-color: #06060f;
  --panel-bg: rgba(13, 13, 29, 0.75);
  --border-color: #1a1a35;
  
  /* Neon Colors */
  --neon-cyan: #00e5ff;
  --neon-pink: #ff007f;
  --neon-green: #39ff14;
  --neon-gold: #ffd700;
  --neon-red: #ff3131;
  --text-color: #e0e0ff;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: var(--font-mono);
  font-size: 16px;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

/* ==================== CRT & HARDWARE ==================== */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%);
  background-size: 100% 4px;
  z-index: 9999;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.crt-overlay.disabled { opacity: 0; }

.arcade-cabinet {
  width: 100%;
  max-width: 1200px;
  background: #111122;
  border: 4px solid #000;
  border-radius: 20px;
  box-shadow: 0 0 0 10px #22223c, 0 20px 40px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.cabinet-header {
  text-align: center;
  padding: 10px 0 20px 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
}

.header-neon {
  font-family: var(--font-pixel);
  font-size: 1.5rem;
  color: #fff;
  text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 20px var(--neon-cyan), 0 0 40px var(--neon-cyan), 0 0 80px var(--neon-cyan);
  margin-bottom: 8px;
}

.header-subtitle {
  font-size: 1rem;
  color: var(--neon-pink);
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 10px var(--neon-pink);
}

/* ==================== SCREENS & STAGES ==================== */
.arcade-screen {
  flex-grow: 1;
  background-color: #000;
  border-radius: 12px;
  border: 8px solid #080811;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.9);
  position: relative;
  overflow: hidden;
  min-height: 700px;
}

.screen-content-wrapper {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  padding: 20px;
  overflow-y: auto;
}

.screen-stage {
  display: none;
  animation: fade-in 0.5s ease-out forwards;
}

.screen-stage.active { display: block; }

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== TITLE SCREEN (STAGE 1) ==================== */
.title-screen-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 600px;
  text-align: center;
}

.logo-container {
  margin-bottom: 40px;
}

.game-logo {
  font-family: var(--font-pixel);
  font-size: 3.5rem;
  line-height: 1.2;
  color: #fff;
  text-shadow: 0 0 10px var(--neon-cyan), 0 0 30px var(--neon-cyan), 0 0 60px var(--neon-cyan);
  margin-bottom: 10px;
  animation: float 4s ease-in-out infinite;
}

.logo-subtitle {
  font-size: 4.5rem;
  color: var(--neon-pink);
  text-shadow: 0 0 10px var(--neon-pink), 0 0 30px var(--neon-pink), 0 0 60px var(--neon-pink);
}

.version-tag {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--neon-gold);
  letter-spacing: 6px;
  margin-top: 15px;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.model-selection-area {
  margin-bottom: 40px;
  background: rgba(0,0,0,0.4);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(0, 229, 255, 0.2);
}

.model-label {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: #888;
  margin-bottom: 15px;
}

.model-select {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid var(--neon-cyan);
  color: var(--neon-cyan);
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  padding: 15px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 350px;
}

.model-select:focus {
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
}

.btn-play-massive {
  background: transparent;
  border: 3px solid var(--neon-green);
  color: var(--neon-green);
  font-family: var(--font-pixel);
  font-size: 1.5rem;
  padding: 20px 40px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  box-shadow: 0 0 15px rgba(57, 255, 20, 0.2), inset 0 0 15px rgba(57, 255, 20, 0.2);
}

.btn-play-massive:hover {
  background: var(--neon-green);
  color: #000;
  box-shadow: 0 0 30px rgba(57, 255, 20, 0.6), inset 0 0 20px rgba(57, 255, 20, 0.6);
  transform: scale(1.05);
}

.play-icon { margin-right: 15px; }

/* ==================== ROLE GRID SELECTION ==================== */
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.role-card {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.role-card:hover {
  border-color: var(--char-color, var(--neon-pink));
  transform: translateY(-8px);
  box-shadow: 0 15px 30px var(--char-color, rgba(255, 0, 127, 0.3));
  background: rgba(0, 0, 0, 0.8);
}

.role-name {
  font-family: var(--font-pixel);
  font-size: 1rem;
  color: #fff;
  margin-bottom: 10px;
}

.role-badge {
  font-size: 0.9rem;
  color: var(--neon-cyan);
  text-transform: uppercase;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

.role-desc {
  font-size: 1rem;
  color: #9090b0;
  line-height: 1.5;
}

/* ==================== MAIN GAMEPLAY SCREEN ==================== */
.gameplay-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.visual-panel {
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(0,0,0,0.6);
  border-bottom: 2px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 8px 8px 0 0;
}

.room-title {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  color: var(--neon-cyan);
  text-transform: uppercase;
}

.header-status-area {
  display: flex;
  align-items: center;
  gap: 15px;
}

.fps-counter {
  font-size: 0.9rem;
  color: #555577;
}

.save-indicator {
  width: 12px; height: 12px;
  background: var(--neon-green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--neon-green);
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
}
.save-indicator.active { opacity: 1; transform: scale(1); }

.canvas-container {
  background-color: #050505;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  height: 400px;
}

canvas { width: 100%; height: 100%; image-rendering: pixelated; }

.location-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background-color: rgba(0,0,0,0.4);
}

.tab-btn {
  background-color: transparent;
  border: none;
  border-right: 1px solid var(--border-color);
  color: #707090;
  cursor: pointer;
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  padding: 15px 5px;
  outline: none;
  transition: all 0.2s ease;
}
.tab-btn:last-child { border-right: none; }
.tab-btn:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.tab-btn.active {
  background-color: var(--panel-bg);
  color: var(--neon-cyan);
  border-bottom: 3px solid var(--neon-cyan);
  box-shadow: inset 0 -5px 10px rgba(0, 229, 255, 0.1);
}

/* ==================== STATUS & METERS PANEL ==================== */
.status-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.section-title {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  color: var(--neon-pink);
  margin-bottom: 15px;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
  text-transform: uppercase;
}

.meter-bar-container { margin-bottom: 15px; }
.meter-header {
  display: flex; justify-content: space-between;
  font-size: 0.9rem; color: #b0b0d0; margin-bottom: 6px;
}
.meter-track {
  height: 12px; background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--border-color); border-radius: 6px; overflow: hidden;
}
.meter-fill {
  height: 100%; border-radius: 6px; position: relative;
  box-shadow: 0 0 10px currentColor; transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.meter-fill::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 6px; height: 100%; border-radius: 0 5px 5px 0;
  background: rgba(255, 255, 255, 0.8); filter: blur(2px);
}

.bar-happiness { background: var(--neon-green); color: rgba(57, 255, 20, 0.6); }
.bar-scifi { background: var(--neon-cyan); color: rgba(0, 229, 255, 0.6); }
.bar-superpowers { background: var(--neon-gold); color: rgba(255, 215, 0, 0.6); }
.bar-dystopia { background: var(--neon-red); color: rgba(255, 49, 49, 0.6); }

/* ==================== TELEMETRY GRID ==================== */
.telemetry-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  background: rgba(0,0,0,0.6); padding: 12px; border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.15);
  font-family: var(--font-mono); font-size: 0.8rem; color: #888;
}
.accent-cyan { color: var(--neon-cyan); font-weight: bold; }
.accent-pink { color: var(--neon-pink); font-weight: bold; }
.accent-dim { color: #aaa; }

/* ==================== NPC LIST ==================== */
.npc-list { display: flex; flex-direction: column; gap: 10px; max-height: 200px; overflow-y: auto; }
.npc-row {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border-color);
  border-radius: 6px; padding: 10px 12px; transition: all 0.2s ease;
  animation: npc-slide-in 0.3s ease-out forwards;
}
.npc-row:hover { border-color: var(--neon-cyan); background: rgba(0, 229, 255, 0.08); }
.npc-info { display: flex; align-items: center; gap: 10px; }
.npc-avatar-indicator { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.npc-name { font-family: var(--font-pixel); font-size: 0.7rem; color: #fff; }
.npc-emote { font-size: 0.9rem; color: #6a6a8c; font-style: italic; }
.npc-relation-container { display: flex; align-items: center; gap: 8px; }
.relation-label { color: #555577; font-size: 0.9rem; }
.relation-value { font-family: var(--font-pixel); font-size: 0.6rem; color: var(--neon-green); }

@keyframes npc-slide-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

/* ==================== CONSOLE LOGS & INPUT ==================== */
.console-panel { display: flex; flex-direction: column; height: 280px; }
.console-logs {
  flex-grow: 1; background: rgba(0, 0, 0, 0.7);
  border: 2px solid var(--border-color); border-radius: 8px;
  padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; margin-bottom: 15px;
  font-size: 1.2rem; line-height: 1.5;
}

.log-entry { animation: log-fade-in 0.25s ease-out forwards; }
@keyframes log-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.log-entry.system { color: #6678a3; font-style: italic; }
.log-entry.narrative { color: #d8bfd8; border-left: 3px solid var(--neon-pink); padding-left: 12px; background: rgba(255, 0, 127, 0.03); }
.log-entry.action-log { color: var(--neon-gold); font-style: italic; border-left: 3px solid var(--neon-gold); padding-left: 12px; background: rgba(255, 215, 0, 0.03); }

.log-entry.character {
  display: flex; flex-direction: column; background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255,255,255,0.05); padding: 10px 12px; border-radius: 6px;
}
.log-entry.player {
  display: flex; flex-direction: column;
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.08), rgba(0, 229, 255, 0.02));
  border: 1px solid rgba(0, 229, 255, 0.15); border-left: 4px solid var(--neon-cyan);
  padding: 10px 12px; border-radius: 6px;
}
.log-sender { font-family: var(--font-pixel); font-size: 0.65rem; margin-bottom: 6px; }
.log-msg { color: #f0f0ff; }

/* Thinking Indicator */
.thinking-indicator { display: flex; align-items: center; gap: 8px; color: var(--neon-cyan) !important; font-style: normal !important; animation: thinking-pulse 1.5s ease-in-out infinite; }
@keyframes thinking-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
.thinking-dots { display: inline-flex; align-items: baseline; }
.dot-anim { animation: dot-bounce 1.4s ease-in-out infinite; display: inline-block; }
.dot-anim:nth-child(2) { animation-delay: 0.2s; }
.dot-anim:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-bounce { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

/* Input Terminal */
.console-input-area { position: relative; display: flex; flex-direction: column; gap: 12px; }
.mode-select { display: flex; gap: 10px; }
.mode-btn {
  background: rgba(0, 0, 0, 0.6); border: 2px solid var(--border-color); border-radius: 6px;
  color: #777; cursor: pointer; font-family: var(--font-pixel); font-size: 0.7rem; padding: 12px 20px;
  transition: all 0.2s ease;
}
.mode-btn.active { border-color: var(--neon-cyan); color: #000; background: var(--neon-cyan); box-shadow: 0 0 15px rgba(0, 229, 255, 0.4); }
.input-form { display: flex; gap: 12px; }
.input-form input {
  flex-grow: 1; background: rgba(0, 0, 0, 0.8); border: 2px solid var(--border-color); border-radius: 6px;
  color: #fff; font-family: var(--font-mono); font-size: 1.4rem; padding: 16px; outline: none; transition: all 0.3s ease;
}
.input-form input::placeholder { color: #555577; font-style: italic; }
.input-form input:focus { border-color: var(--neon-cyan); box-shadow: 0 0 15px rgba(0, 229, 255, 0.4); }
.input-form input:disabled { opacity: 0.5; cursor: not-allowed; background: rgba(0, 0, 0, 0.95); }

/* Buttons */
.btn {
  font-family: var(--font-pixel); font-size: 0.7rem; cursor: pointer; padding: 15px 25px;
  border-radius: 6px; transition: all 0.2s ease; text-transform: uppercase;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--neon-cyan); color: #000; border: 2px solid var(--neon-cyan); }
.btn-primary:hover { box-shadow: 0 0 20px rgba(0, 229, 255, 0.6); transform: translateY(-2px); }
.btn-secondary { background: transparent; color: #aaa; border: 2px solid #555; }
.btn-secondary:hover { color: #fff; border-color: #888; }
.btn-danger { background: transparent; color: var(--neon-red); border: 2px solid var(--neon-red); }
.btn-danger:hover { background: var(--neon-red); color: #000; box-shadow: 0 0 15px var(--neon-red); }
.btn-small { font-size: 0.6rem; padding: 8px 12px; }

/* ==================== INVENTORY ==================== */
.inventory-section { background: rgba(0, 0, 0, 0.5); border: 2px solid var(--border-color); border-radius: 8px; padding: 15px; }
.inventory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; background: rgba(0, 0, 0, 0.7); border: 1px solid var(--border-color); border-radius: 6px; padding: 10px; min-height: 80px; }
.inventory-item { background: rgba(255,255,255,0.02); border: 2px dashed rgba(255,255,255,0.1); border-radius: 6px; aspect-ratio: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; transition: all 0.2s ease; position: relative; font-family: var(--font-mono); font-size: 0.8rem; color: #8080a0; }
.inventory-item:hover { border-color: var(--neon-cyan); background: rgba(0, 229, 255, 0.08); color: #fff; }
.inventory-item.active { border-style: solid; border-color: var(--neon-pink); background: rgba(255, 0, 127, 0.1); color: #fff; box-shadow: 0 0 10px rgba(255, 0, 127, 0.3); }
.item-qty { position: absolute; top: 4px; right: 4px; background: var(--neon-cyan); color: #000; font-family: var(--font-pixel); font-size: 0.5rem; padding: 3px 5px; border-radius: 4px; }
.item-icon { font-size: 1.5rem; margin-bottom: 4px; }
.item-label { font-size: 0.7rem; text-transform: uppercase; }
.crafting-controls { margin-top: 15px; display: flex; gap: 10px; justify-content: space-between; }

/* ==================== TV MINIGAME ==================== */
.minigame-card { max-width: 650px; margin: 0 auto; padding: 25px; }
.minigame-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--border-color); padding-bottom: 15px; margin-bottom: 20px; }
.minigame-score { font-family: var(--font-pixel); font-size: 1rem; color: var(--neon-pink); }
.minigame-canvas-wrapper { background: #000; border: 4px solid #111; border-radius: 8px; display: flex; justify-content: center; align-items: center; margin-bottom: 20px; overflow: hidden; }
#minigameCanvas { width: 100%; max-width: 480px; height: 260px; image-rendering: pixelated; }
.help-text { text-align: center; font-size: 0.95rem; line-height: 1.5; color: #707090; margin-bottom: 20px; }

/* ==================== GLASSMORPHISM & UTILS ==================== */
.glass {
  background: var(--panel-bg);
  border: 2px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 20px;
}

.action-row { display: flex; justify-content: center; gap: 20px; margin-top: 15px; }

.cabinet-footer {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 2px solid var(--border-color); padding-top: 20px; margin-top: 20px;
}
.footer-btn {
  background: rgba(0,0,0,0.6); border: 1px solid var(--border-color); color: #888;
  font-family: var(--font-pixel); font-size: 0.6rem; padding: 12px 16px; border-radius: 6px;
  cursor: pointer; transition: all 0.2s ease; margin-right: 10px;
}
.footer-btn:hover { color: #fff; border-color: var(--neon-cyan); }
.footer-btn span { color: var(--neon-green); }
.coin-slot { font-family: var(--font-pixel); font-size: 0.8rem; color: var(--neon-pink); text-align: center; animation: blink 1.5s infinite; letter-spacing: 2px; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.5); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #333355; }
