/* ==========================================================================
   FOLIOFORGE — THE FORGE RUN 3D
   Master Cyber Game Stylesheet — Responsive from 320px to 4K
   ========================================================================== */

:root {
  --bg-dark: #05070a;
  --bg-panel: rgba(14, 18, 26, 0.88);
  --border-cyan: rgba(0, 210, 255, 0.4);
  --border-orange: rgba(255, 90, 26, 0.5);
  --glow-cyan: #00d2ff;
  --glow-orange: #ff5a1a;
  --text-main: #f0f4f8;
  --text-muted: #8c96a5;
  --font-mono: ui-monospace, Menlo, Monaco, Consolas, "Courier New", monospace;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-display);
  position: fixed;
  inset: 0;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-dark);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   LOADING SCREEN WITH ANIMATED 3D CYBER RING
   ========================================================================== */
#loading-screen {
  position: absolute;
  inset: 0;
  background: #040609;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loader-spinner {
  width: 64px;
  height: 64px;
  border: 3px solid rgba(255, 90, 26, 0.2);
  border-top-color: var(--glow-orange);
  border-right-color: var(--glow-cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 24px rgba(255, 90, 26, 0.4);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ==========================================================================
   IN-GAME HUD (Top, Bottom, Boss Bar, Toasts)
   ========================================================================== */
.ui-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.interactive {
  pointer-events: auto;
}

/* Top HUD */
.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
  gap: 12px;
}

.hud-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-badge-group {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-orange);
  padding: 6px 16px;
  border-radius: 30px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.hud-brand {
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.1vw, 13px);
  font-weight: 900;
  letter-spacing: 2px;
  color: #ffffff;
}

.hud-brand span {
  color: var(--glow-orange);
  text-shadow: 0 0 10px var(--glow-orange);
}

.hud-stat {
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.1vw, 12px);
  font-weight: 700;
  color: var(--text-main);
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 5px;
}

.hud-stat-icon {
  color: var(--glow-orange);
}

.world-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--glow-cyan);
  background: rgba(0, 210, 255, 0.1);
  border: 1px solid var(--border-cyan);
  padding: 4px 12px;
  border-radius: 20px;
  align-self: flex-start;
  backdrop-filter: blur(8px);
}

/* Boss HUD (Top Center) */
#boss-hud {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(90%, 460px);
  margin: 0 auto;
}

.boss-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ff3344;
  text-shadow: 0 0 12px rgba(255, 50, 70, 0.8);
}

.boss-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(10, 12, 18, 0.9);
  border: 1.5px solid rgba(255, 50, 70, 0.6);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 16px rgba(255, 50, 70, 0.4);
}

#boss-hp-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff1144, #ff6600);
  transition: width 0.15s ease-out;
}

/* Top Right Buttons */
.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hud-btn-circle {
  width: 42px;
  height: 42px;
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
  font-size: 16px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.hud-btn-circle:hover {
  transform: scale(1.08);
  border-color: var(--glow-orange);
  color: var(--glow-orange);
}

/* Bottom Left Health & Energy */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

.hud-player-vitals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: clamp(140px, 18vw, 220px);
}

.vital-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.vital-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.vital-bar {
  width: 100%;
  height: 8px;
  background: rgba(14, 18, 26, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

#health-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #00d2ff, #00ffff);
  box-shadow: 0 0 10px #00d2ff;
  transition: width 0.2s ease-out;
}

#energy-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff5a1a, #ffaa00);
  box-shadow: 0 0 10px #ff5a1a;
  transition: width 0.15s ease-out;
}

/* Keyboard hint badge on desktop */
.keyboard-hints {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-panel);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 14px;
  border-radius: 8px;
  line-height: 1.6;
}

.keyboard-hints kbd {
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  color: #ffffff;
  font-weight: 700;
}

@media (max-width: 900px) {
  .keyboard-hints {
    display: none;
  }
}

/* Notification Toasts */
#hud-notify {
  position: absolute;
  top: max(80px, calc(env(safe-area-inset-top) + 70px));
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(10, 12, 18, 0.95);
  border: 1.5px solid var(--glow-orange);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9), 0 0 20px rgba(255, 90, 26, 0.4);
  padding: 10px 24px;
  border-radius: 40px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: clamp(11.5px, 1.2vw, 14px);
  font-weight: 800;
  letter-spacing: 1.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  z-index: 30;
}

#hud-notify.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Interaction Prompt */
#interact-prompt {
  position: absolute;
  bottom: clamp(90px, 16vh, 140px);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-panel);
  border: 1.5px solid var(--glow-orange);
  box-shadow: 0 0 20px rgba(255, 90, 26, 0.5);
  padding: 8px 18px;
  border-radius: 30px;
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 25;
}

#interact-prompt.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.key-badge {
  background: var(--glow-orange);
  color: #000000;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 900;
}

/* ==========================================================================
   VIRTUAL TOUCH CONTROLS (Mobile & Tablet)
   ========================================================================== */
.touch-layer {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 22;
}

@media (pointer: coarse), (max-width: 900px) {
  .touch-layer {
    display: block;
  }
}

#touch-joystick-area {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: max(20px, env(safe-area-inset-left));
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
}

#touch-joystick-knob {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--glow-orange);
  box-shadow: 0 0 16px var(--glow-orange);
  pointer-events: none;
  transform: translate(0px, 0px);
}

#touch-camera-area {
  position: absolute;
  top: 60px;
  bottom: 120px;
  left: 0;
  right: 0;
  pointer-events: auto;
  touch-action: none;
}

.touch-action-cluster {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom));
  right: max(20px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 14px;
  pointer-events: auto;
}

.touch-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--bg-panel);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  touch-action: none;
}

.touch-btn:active {
  transform: scale(0.92);
  border-color: var(--glow-orange);
  background: rgba(255, 90, 26, 0.3);
}

.touch-btn-attack {
  border-color: var(--glow-cyan);
  color: var(--glow-cyan);
}

.touch-btn-heavy {
  border-color: var(--glow-orange);
  color: var(--glow-orange);
}

/* ==========================================================================
   MODALS (Main Menu, Pause, Settings, How to Play, Core Unlocked, Victory)
   ========================================================================== */
.game-modal {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 8, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.game-modal.active {
  display: flex;
  opacity: 1;
}

.modal-card {
  background: rgba(14, 18, 26, 0.96);
  border: 1px solid var(--border-orange);
  border-radius: 20px;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: clamp(24px, 4vw, 36px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 90, 26, 0.2);
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: center;
}

.modal-tag {
  display: inline-flex;
  align-self: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--glow-orange);
  text-transform: uppercase;
  padding: 4px 14px;
  background: rgba(255, 90, 26, 0.12);
  border: 1px solid var(--border-orange);
  border-radius: 40px;
}

.modal-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  line-height: 1.15;
}

.modal-title span {
  color: var(--glow-orange);
  text-shadow: 0 0 16px var(--glow-orange);
}

.modal-desc {
  font-size: clamp(13.5px, 1.2vw, 15px);
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  width: 100%;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--glow-orange);
  border: none;
  border-radius: 50px;
  color: #ffffff !important;
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-decoration: none !important;
  box-shadow: 0 8px 24px rgba(255, 90, 26, 0.45);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: #ff7033;
  box-shadow: 0 12px 30px rgba(255, 90, 26, 0.65);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  color: var(--text-main) !important;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-ghost:hover {
  border-color: var(--glow-orange);
  color: #ffffff !important;
  background: rgba(255, 90, 26, 0.12);
}

/* Service capabilities grid */
.service-caps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  text-align: left;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: clamp(11.5px, 1vw, 13px);
  color: var(--text-main);
}

@media (max-width: 480px) {
  .service-caps-grid {
    grid-template-columns: 1fr;
  }
}

.service-caps-grid div::before {
  content: "◆";
  color: var(--glow-orange);
  margin-right: 6px;
}

/* Settings Row */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-main);
}

.settings-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 3px;
  gap: 4px;
}

.toggle-opt {
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.toggle-opt.active {
  background: var(--glow-orange);
  color: #000000;
}

/* Screen Fade Overlay */
#screen-fade-overlay {
  position: absolute;
  inset: 0;
  background: #000000;
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#screen-fade-overlay.active {
  opacity: 1;
}

/* Final Reveal Typography */
.reveal-artist {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 900;
  letter-spacing: 6px;
  color: #ffffff;
  text-transform: uppercase;
  text-shadow: 0 0 24px rgba(255, 90, 26, 0.8);
}

.reveal-creed {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.5vw, 18px);
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--glow-cyan);
  text-shadow: 0 0 12px var(--glow-cyan);
  margin: 6px 0;
}
