/* 
 * DREAM_OS | IMMERSIVE PROTOCOL
 * V2.0 - DEFINITIVE EDITION
 */

:root {
  /* --- CYBERPUNK PALETTE --- */
  --bg-depth: #050505;
  --bg-panel: rgba(0, 20, 0, 0.6);
  --neon-primary: #00FF41;
  --neon-secondary: #008F11;
  --neon-alert: #FF003C;
  --text-primary: #e0e0e0;
  --text-dim: #888;

  /* --- SPACING & LAYOUT --- */
  --container-max: 800px;
  --space-unit: 1rem;

  /* --- TYPOGRAPHY --- */
  --font-stack: 'Courier New', Courier, monospace;
  --font-cn: 'Microsoft YaHei', 'SimHei', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* --- BASE --- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-depth);
  color: var(--neon-primary);
  font-family: var(--font-stack);
  overflow-x: hidden;
  line-height: 1.6;
  min-height: 100vh;
  cursor: crosshair;
  /* Fallback */
}

/* Custom Cursor support if browser allows */
@media (hover: hover) and (pointer: fine) {
  body {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2300FF41' stroke-width='1.5'%3E%3Cline x1='12' y1='4' x2='12' y2='20'/%3E%3Cline x1='4' y1='12' x2='20' y2='12'/%3E%3Ccircle cx='12' cy='12' r='8' stroke-dasharray='2 4'/%3E%3C/svg%3E") 12 12, crosshair;
  }
}

/* --- FX LAYERS --- */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
  background-size: 100% 4px, 6px 100%;
  pointer-events: none;
  z-index: 999;
  animation: scanlineScroll 10s linear infinite;
}

@keyframes scanlineScroll {
  0% {
    background-position: 0 0;
  }

  100% {
    background-position: 0 100%;
  }
}

.viginette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, transparent 60%, black 100%);
  pointer-events: none;
  z-index: 998;
  z-index: 998;
}

/* --- BOOT SCREEN (UPLINK) --- */
#boot-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-depth);
  color: var(--neon-primary);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-stack);
  font-size: 1.2rem;
  transition: opacity 0.5s ease-out;
  flex-direction: column;
}

.boot-content {
  text-align: center;
  width: 300px;
  max-width: 80%;
}

/* LOADER STYLES */
#loader-container {
  margin-bottom: 2rem;
  text-align: left;
  font-size: 0.8rem;
  font-family: var(--font-stack);
}

.loader-status {
  margin-bottom: 0.5rem;
  color: var(--neon-primary);
  opacity: 0.8;
}

.progress-bar-frame {
  width: 100%;
  height: 12px;
  border: 1px solid var(--neon-secondary);
  padding: 1px;
  margin-bottom: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  /* JS will animate this */
  background: var(--neon-primary);
  box-shadow: 0 0 8px var(--neon-primary);
  transition: width 0.1s linear;
}

/* Hide button initially */
#btn-init {
  display: none;
  opacity: 0;
  animation: fadeIn 1s forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}


/* --- LAYOUT --- */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 10;
}

/* --- HEADER --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--neon-secondary);
  font-size: 0.85rem;
  margin-bottom: 3rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.blink {
  animation: pulse 1.5s infinite;
  color: var(--neon-primary);
}

/* --- LANGUAGE SELECTOR --- */
.lang-selector {
  display: flex;
  gap: 1rem;
}

.lang-opt {
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.2s;
  user-select: none;
}

.lang-opt:hover {
  text-shadow: 0 0 8px var(--neon-primary);
  color: var(--neon-primary);
}

.lang-opt.active {
  color: var(--neon-primary);
  font-weight: bold;
  border-bottom: 1px solid var(--neon-primary);
}

/* --- TYPOGRAPHY --- */
h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  margin: 0;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
}

.subtitle {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: var(--text-primary);
  max-width: 600px;
}

.live-counter {
  margin-top: 1.5rem;
  font-family: var(--font-stack);
  font-size: 0.9rem;
  color: var(--neon-primary);
  text-shadow: 0 0 5px var(--neon-secondary);
  animation: pulse 3s infinite;
}


/* --- 3D EARTH --- */
#earth-container {
  width: 100%;
  height: 400px;
  position: relative;
  z-index: 5;
  margin: 2rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
  /* Allow glow to bleed if needed, or hidden if causing scroll */
}

/* Fallback for interaction */
mark {
  background: transparent;
  color: var(--neon-primary);
}

/* --- BUTTONS --- */
.actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.btn {
  padding: 1rem 2rem;
  border: 1px solid var(--neon-primary);
  background: transparent;
  color: var(--neon-primary);
  font-family: inherit;
  font-size: 0.9rem;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: var(--neon-primary);
  color: var(--bg-depth);
  box-shadow: 0 0 20px var(--neon-primary);
}

.btn-secondary {
  border-style: dashed;
  color: var(--text-primary);
  border-color: var(--text-dim);
}

.btn-secondary:hover {
  border-style: solid;
  border-color: var(--neon-primary);
  color: var(--neon-primary);
  background: transparent;
}

/* --- CA COPY SECTION --- */
.ca-display {
  margin-top: 1.5rem;
  font-family: var(--font-stack);
  font-size: 0.8rem;
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px dashed var(--text-dim);
  transition: all 0.3s;
  background: rgba(0, 0, 0, 0.3);
}

.ca-display:hover {
  color: var(--neon-primary);
  border-color: var(--neon-primary);
  background: rgba(0, 255, 65, 0.05);
}

.ca-icon {
  opacity: 0.7;
}

.copy-feedback {
  color: var(--neon-primary);
  font-size: 0.8rem;
  margin-left: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s;
}

.copy-feedback.visible {
  opacity: 1;
}

/* --- THE VAULT --- */
.vault-panel {
  margin-top: 4rem;
  background: var(--bg-panel);
  border: 1px solid var(--neon-secondary);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

/* Grid Effect inside Vault */
.vault-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 65, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 65, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  z-index: 0;
}

.vault-content {
  position: relative;
  z-index: 1;
}

.vault-header {
  border-bottom: 1px solid var(--text-dim);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  font-weight: bold;
  letter-spacing: 2px;
}

.redacted {
  background: var(--neon-primary);
  color: var(--neon-primary);
  user-select: none;
  padding: 0 4px;
  filter: blur(4px);
  transition: 0.4s;
}

.redacted:hover {
  background: transparent;
  color: var(--neon-primary);
  filter: blur(0);
}

/* --- EXPANSION GRID --- */
.expansion-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 4rem;
}

@media (max-width: 700px) {
  .expansion-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--neon-secondary);
  padding: 1.5rem;
  font-size: 0.9rem;
}

.panel-header {
  border-bottom: 1px solid var(--text-dim);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  font-weight: bold;
  color: var(--neon-primary);
}

/* --- METRICS --- */
.metric-row {
  margin-bottom: 1rem;
}

.metric-label {
  margin-bottom: 0.2rem;
  color: var(--text-primary);
}

.metric-bar-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: monospace;
}

.metric-bar {
  height: 10px;
  background: repeating-linear-gradient(90deg,
      var(--neon-primary),
      var(--neon-primary) 5px,
      transparent 5px,
      transparent 7px);
  box-shadow: 0 0 5px var(--neon-secondary);
}

.metric-stat {
  margin-top: 1.5rem;
  color: var(--text-dim);
  border-top: 1px dashed var(--text-dim);
  padding-top: 0.5rem;
}

/* --- TIMELINE --- */
.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.timeline-item {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--text-dim);
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 0;
  width: 7px;
  height: 7px;
  background: var(--bg-depth);
  border: 1px solid var(--text-dim);
}

.timeline-item.done::before {
  background: var(--neon-primary);
  border-color: var(--neon-primary);
}

.timeline-item.active::before {
  background: var(--neon-primary);
  box-shadow: 0 0 10px var(--neon-primary);
  animation: pulse 1s infinite;
}

.timeline-item .status {
  display: block;
  font-weight: bold;
  margin-bottom: 0.2rem;
}

.timeline-item.done .status {
  color: var(--neon-primary);
}

.timeline-item.active .status {
  color: var(--neon-alert);
}

.timeline-item .phase {
  color: var(--text-primary);
}

.timeline-item .detail {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

/* --- FOOTER --- */
/* --- PRO FOOTER (3 Columns) --- */
footer {
  margin-top: 6rem;
  padding: 4rem 2rem;
  background: rgba(0, 10, 0, 0.8);
  border-top: 1px solid var(--neon-secondary);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

.footer-col h4 {
  color: var(--neon-primary);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.8;
}

.footer-col ul {
  list-style: none;
  padding: 0;
}

.footer-col li {
  margin-bottom: 0.8rem;
}

.footer-col a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: color 0.3s;
}

.footer-col a:hover {
  color: var(--neon-primary);
}

.agent-sig {
  text-align: center;
  margin-top: 4rem;
  font-size: 0.8rem;
  color: var(--text-dim);
  opacity: 0.5;
  font-family: var(--font-stack);
}

/* --- ANIMATIONS --- */
@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

@keyframes rotateKey {
  from {
    transform: rotateY(0deg);
  }

  to {
    transform: rotateY(360deg);
  }
}

@keyframes floatKey {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-15px);
    /* INCREASED FLOAT RANGE */
  }
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 600px) {
  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  header {
    flex-direction: column;
    gap: 1rem;
  }

  /* Fallback for big titles on small screens */
  h1 {
    font-size: 2.5rem;
  }
}

/* --- CN FONT OVERRIDE --- */
body.lang-cn {
  font-family: var(--font-cn);
}