/* ==========================================================================
   AI CRAFT: CYBER FORGE - DESIGN SYSTEM & STYLESHEET
   Aesthetics: Cyberpunk Arcade, Glowing Neon Accents, Glassmorphism, Retro Synth
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-dark: #080914;
  --bg-card: rgba(16, 20, 42, 0.75);
  --bg-card-hover: rgba(26, 32, 64, 0.85);
  --glass-border: rgba(0, 240, 255, 0.25);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
  
  /* Cyber Neons */
  --neon-cyan: #00f0ff;
  --neon-pink: #ff007f;
  --neon-purple: #9d00ff;
  --neon-green: #00ff66;
  --neon-amber: #ffaa00;
  --neon-red: #ff3366;

  /* Text Colors */
  --text-main: #f0f4f8;
  --text-muted: #8c9ba5;
  --text-bright: #ffffff;
  
  /* Typography */
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-code: 'JetBrains Mono', monospace;

  /* Transitions */
  --ease-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.text-cyan { color: var(--neon-cyan); }
.text-purple { color: var(--neon-purple); }
.text-amber { color: var(--neon-amber); }
.text-green { color: var(--neon-green); }
.text-pink { color: var(--neon-pink); }


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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
}

#app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Glassmorphism Panel */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
  transition: var(--ease-fast);
}

.glass-panel:hover {
  border-color: rgba(0, 240, 255, 0.45);
}

/* Glowing Neon Text */
.neon-glow-cyan {
  text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px rgba(0, 240, 255, 0.4);
  color: var(--neon-cyan);
}
.neon-glow-pink {
  text-shadow: 0 0 10px var(--neon-pink), 0 0 20px rgba(255, 0, 127, 0.4);
  color: var(--neon-pink);
}
.neon-glow-purple {
  text-shadow: 0 0 10px var(--neon-purple), 0 0 20px rgba(157, 0, 255, 0.4);
  color: var(--neon-purple);
}
.neon-glow-green {
  text-shadow: 0 0 10px var(--neon-green), 0 0 20px rgba(0, 255, 102, 0.4);
  color: var(--neon-green);
}

/* Navbar */
.cyber-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  margin: 1rem 1.5rem 0.5rem 1.5rem;
  z-index: 100;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 1px;
}

.brand-title i {
  font-size: 1.6rem;
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 8px var(--neon-cyan));
}

.nav-links {
  display: flex;
  gap: 0.5rem;
  background: rgba(8, 10, 20, 0.6);
  padding: 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--ease-fast);
}

.nav-btn:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(157, 0, 255, 0.2));
  color: var(--neon-cyan);
  border: 1px solid var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

.user-stats-bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.level-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--neon-amber);
  background: rgba(255, 170, 0, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  border: 1px solid var(--neon-amber);
}

.xp-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 140px;
}

.xp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.xp-bar-outer {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.xp-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  box-shadow: 0 0 8px var(--neon-cyan);
  transition: width 0.4s ease;
}

.action-controls {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--ease-fast);
}

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

/* View Section Handling */
.main-viewport {
  flex: 1;
  padding: 1rem 1.5rem 1.5rem 1.5rem;
  position: relative;
}

.game-view {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.game-view.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Career Mode UI */
.career-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  height: calc(100vh - 120px);
}

.mission-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding: 1.25rem;
}

.sidebar-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--neon-cyan);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.chapter-card {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: var(--ease-bounce);
  position: relative;
  overflow: hidden;
}

.chapter-card:hover {
  background: rgba(0, 240, 255, 0.05);
  border-color: rgba(0, 240, 255, 0.3);
}

.chapter-card.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(157, 0, 255, 0.15));
  border-color: var(--neon-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.2);
}

.chapter-card.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.chapter-num {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--neon-pink);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.chapter-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.chapter-status {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.85rem;
}

.mission-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  padding: 1.5rem;
}

/* Dialog Box */
.dialog-box {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 1.25rem;
  align-items: center;
  background: linear-gradient(135deg, rgba(16, 20, 42, 0.9), rgba(30, 15, 50, 0.9));
  border: 1px solid var(--neon-purple);
  box-shadow: 0 0 20px rgba(157, 0, 255, 0.2);
  border-radius: 16px;
  padding: 1.25rem;
}

.dialog-avatar {
  width: 75px;
  height: 75px;
  border-radius: 50%;
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 12px var(--neon-cyan);
  object-fit: cover;
}

.dialog-speaker {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--neon-cyan);
  letter-spacing: 1px;
  margin-bottom: 0.25rem;
}

.dialog-text {
  font-size: 1.05rem;
  line-height: 1.5;
}

/* Task Workspace Card */
.task-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
}

.task-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text-bright);
}

.task-reward {
  font-weight: 700;
  color: var(--neon-amber);
  background: rgba(255, 170, 0, 0.1);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--neon-amber);
}

.task-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Interactive Playground Widgets */
.playground-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.input-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.input-field-group label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--neon-cyan);
  display: flex;
  justify-content: space-between;
}

.cyber-textarea, .cyber-input {
  background: rgba(8, 10, 20, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-bright);
  font-family: var(--font-code);
  font-size: 0.9rem;
  padding: 0.75rem;
  border-radius: 8px;
  resize: vertical;
  outline: none;
  transition: var(--ease-fast);
}

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

.cyber-slider {
  width: 100%;
  accent-color: var(--neon-cyan);
  cursor: pointer;
}

/* Output Monitor Console */
.output-console {
  background: #04050a;
  border: 1px solid rgba(0, 240, 255, 0.2);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-family: var(--font-code);
  position: relative;
  overflow: hidden;
}

.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.5rem;
}

.console-output {
  color: var(--neon-green);
  font-size: 0.9rem;
  min-height: 140px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
}

/* Action Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--ease-bounce);
}

.btn-neon-cyan {
  background: linear-gradient(135deg, #00f0ff, #0088ff);
  color: #000;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}
.btn-neon-cyan:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.7);
}

.btn-neon-pink {
  background: linear-gradient(135deg, #ff007f, #b000ff);
  color: #fff;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}
.btn-neon-pink:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(255, 0, 127, 0.7);
}

.btn-danger-glow {
  background: rgba(255, 51, 102, 0.15);
  color: var(--neon-red);
  border: 1px solid var(--neon-red);
}
.btn-danger-glow:hover {
  background: var(--neon-red);
  color: #fff;
  box-shadow: 0 0 15px var(--neon-red);
}

/* Node Studio Workflow Builder */
.node-studio-layout {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 1rem;
  height: calc(100vh - 120px);
}

.studio-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
}

.node-canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(20, 25, 55, 0.6) 0%, rgba(8, 9, 20, 0.95) 100%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
}

#node-canvas-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.node-element {
  position: absolute;
  width: 220px;
  background: rgba(16, 20, 42, 0.9);
  border: 1px solid var(--neon-cyan);
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
  padding: 0.85rem;
  cursor: move;
  z-index: 10;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.node-element.selected {
  border-color: var(--neon-pink);
  box-shadow: 0 0 20px var(--neon-pink);
}

.node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--neon-cyan);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.4rem;
  margin-bottom: 0.6rem;
}

.node-body {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.node-port {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--neon-cyan);
  border: 2px solid #000;
  box-shadow: 0 0 8px var(--neon-cyan);
  cursor: pointer;
  position: absolute;
  transition: transform 0.2s ease;
}

.node-port:hover {
  transform: scale(1.3);
}

.node-port.input-port {
  left: -7px;
  top: 50%;
  transform: translateY(-50%);
}

.node-port.output-port {
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
}

/* Data Lab Mini-Game */
.data-lab-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  min-height: 75vh;
  max-width: 800px;
  margin: 0 auto;
}

.swipe-card {
  width: 320px;
  height: 380px;
  border: 2px solid var(--neon-purple);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(20, 25, 55, 0.95), rgba(40, 15, 60, 0.95));
  box-shadow: 0 0 25px rgba(157, 0, 255, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  position: relative;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.swipe-card img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px var(--neon-cyan));
}

.swipe-actions {
  display: flex;
  gap: 1.5rem;
  width: 100%;
}

.swipe-btn {
  flex: 1;
  padding: 1rem;
  border-radius: 14px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  border: none;
  cursor: pointer;
}

.swipe-left {
  background: rgba(255, 51, 102, 0.2);
  color: var(--neon-red);
  border: 1px solid var(--neon-red);
}

.swipe-right {
  background: rgba(0, 255, 102, 0.2);
  color: var(--neon-green);
  border: 1px solid var(--neon-green);
}

/* Codex & Tech Tree */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.codex-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.codex-icon {
  font-size: 2rem;
  color: var(--neon-cyan);
}

.codex-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.codex-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 1000;
}

.toast {
  background: rgba(16, 20, 42, 0.95);
  border: 1px solid var(--neon-cyan);
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  color: var(--text-bright);
  font-weight: 600;
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.3);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal Dialog */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 5, 10, 0.8);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: grid;
  place-items: center;
}

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

.modal-box {
  width: 90%;
  max-width: 540px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-color: var(--neon-purple);
  box-shadow: 0 0 30px rgba(157, 0, 255, 0.3);
}

/* Guided Onboarding Tutorial Overlay */
.tutorial-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 5, 12, 0.75);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: grid;
  place-items: center;
}

.tutorial-card {
  width: 90%;
  max-width: 520px;
  padding: 1.75rem;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.4);
  animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}


.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-display);
  color: var(--neon-cyan);
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.setting-group select, .setting-group input {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-bright);
  padding: 0.6rem;
  border-radius: 8px;
  outline: none;
}

/* ==========================================================================
   MOBILE & MULTI-DEVICE RESPONSIVE MEDIA QUERIES
   Targeting: iPhone SE (375px), iPhone 14 (390px), Pixel/Galaxy (412px), Tablets (768px)
   ========================================================================== */

@media (max-width: 900px) {
  .cyber-navbar {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    padding: 0.75rem;
    margin: 0.5rem;
  }

  .nav-links {
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.4rem;
    justify-content: flex-start;
  }

  .user-stats-bar {
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .career-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .mission-sidebar {
    max-height: 250px;
  }

  .playground-grid {
    grid-template-columns: 1fr;
  }

  .main-viewport {
    padding: 0.5rem;
  }

  .swipe-card {
    width: 90%;
    max-width: 340px;
  }
}

@media (max-width: 480px) {
  .brand-title {
    font-size: 1.1rem;
  }

  .nav-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  .task-title {
    font-size: 1rem;
  }

  .dialog-box {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .dialog-avatar {
    margin: 0 auto;
  }
}

