/* ==========================================================================
   <!DOCTYPE Human> | Rebellion System
   style.css — Full CRT / Neon / Retro-Futuristic Theme
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700;800&family=Press+Start+2P&family=Share+Tech+Mono&display=swap");

/* ─── 1. ROOT VARIABLES (Single Source of Truth) ───────────────────────── */
:root {
  /* Color Palette */
  --neon-green: #00ff88;
  --neon-green2: #00dd55;
  --neon-blue: #00aaff;
  --neon-cyan: #00ffff;
  --neon-red: #ff2244;
  --neon-yellow: #ffdd00;

  /* Backgrounds */
  --bg-dark: #000000;
  --bg-panel: rgba(0, 12, 0, 0.85);
  --bg-monitor: #0a0a0a;

  /* Borders */
  --border-green: rgba(0, 255, 136, 0.5);
  --border-blue: rgba(0, 170, 255, 0.5);

  /* Typography */
  --terminal-font: "JetBrains Mono", "Share Tech Mono", monospace;
  --title-font: "Press Start 2P", monospace;

  /* Glow Effects */
  --glow-green: 0 0 8px #00ff88, 0 0 20px rgba(0, 255, 136, 0.4);
  --glow-blue: 0 0 8px #00aaff, 0 0 20px rgba(0, 170, 255, 0.4);
  --glow-red: 0 0 8px #ff2244, 0 0 20px rgba(255, 34, 68, 0.4);
}

/* ─── 2. RESET & BASE ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  color: #ccc;
  font-family: var(--terminal-font);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  cursor: crosshair;
}

::selection {
  background: var(--neon-green);
  color: #000;
}

/* Global Scrollbar */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: #000;
}
::-webkit-scrollbar-thumb {
  background: var(--neon-green);
  border-radius: 2px;
}

/* ─── 3. GLOBAL EFFECTS (Matrix & CRT) ─────────────────────────────────── */

/* Matrix Rain Canvas */
#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.45;
  pointer-events: none;
}

/* CRT Scanlines */
.crt-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.18) 2px,
    rgba(0, 0, 0, 0.18) 4px
  );
  pointer-events: none;
  z-index: 200;
  animation: scanMove 8s linear infinite;
}

/* CRT Vignette */
.crt-vignette {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.55) 80%,
    rgba(0, 0, 0, 0.9) 100%
  );
  pointer-events: none;
  z-index: 201;
}

/* CRT Flicker */
.crt-flicker {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 202;
  animation: flicker 0.15s infinite;
  opacity: 0;
}

/* ─── 4. LAYOUT COMPONENTS ─────────────────────────────────────────────── */

.ui-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 20px 20px 30px;
  width: 100%;
  max-width: 1100px;
}

/* Header & Title Section */
.site-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-green);
  position: relative;
}

.header-top-bar {
  display: flex;
  gap: 24px;
  font-size: 0.68rem;
  color: rgba(0, 255, 136, 0.6);
  letter-spacing: 2px;
}

.sys-tag {
  display: flex;
  align-items: center;
  gap: 5px;
}
.sys-tag i {
  font-size: 0.6rem;
}

.title-block {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  justify-content: center;
}

.title-decoration {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.title-decoration.left {
  justify-content: flex-end;
}
.title-decoration.right {
  justify-content: flex-start;
}

.deco-line {
  height: 2px;
  flex: 1;
  max-width: 120px;
  background: linear-gradient(to right, transparent, var(--neon-green));
}
.title-decoration.right .deco-line {
  background: linear-gradient(to left, transparent, var(--neon-green));
}

.deco-bracket {
  font-family: var(--title-font);
  font-size: 1.6rem;
  color: var(--neon-green);
  text-shadow: var(--glow-green);
  line-height: 1;
}

.title-center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.pre-title {
  font-family: var(--terminal-font);
  font-size: 0.65rem;
  color: rgba(0, 170, 255, 0.7);
  letter-spacing: 3px;
}

.sub-title {
  font-family: var(--terminal-font);
  font-size: 0.7rem;
  letter-spacing: 5px;
  color: rgba(0, 170, 255, 0.8);
  text-transform: uppercase;
}

.version-tag {
  color: var(--neon-yellow);
  font-size: 0.6rem;
  border: 1px solid var(--neon-yellow);
  padding: 1px 6px;
  margin-left: 8px;
  animation: glowPulse 2s ease-in-out infinite alternate;
}

/* Glitch Title Main Effect */
h1.glitch {
  font-family: var(--title-font);
  font-size: clamp(1.1rem, 3vw, 2.2rem);
  color: var(--neon-green);
  text-shadow:
    2px 0 var(--neon-blue),
    -2px 0 var(--neon-red),
    var(--glow-green);
  position: relative;
  display: inline-block;
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: 2px;
  animation: glitchMain 5s infinite;
}

h1.glitch::before,
h1.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
}

h1.glitch::before {
  color: var(--neon-blue);
  clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
  animation: glitchTop 3s infinite;
  text-shadow: none;
}

h1.glitch::after {
  color: var(--neon-red);
  clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
  animation: glitchBot 4s infinite;
  text-shadow: none;
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.72rem;
  color: rgba(0, 255, 136, 0.7);
  letter-spacing: 1px;
  flex-wrap: wrap;
  justify-content: center;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.status-item i {
  font-size: 0.65rem;
  color: var(--neon-blue);
}
.status-value {
  color: var(--neon-blue);
}
.status-value.neon-green {
  color: var(--neon-green);
  text-shadow: var(--glow-green);
}
.status-divider {
  color: rgba(255, 255, 255, 0.2);
}

/* ─── 5. GAME MONITOR WRAPPER ──────────────────────────────────────────── */

.game-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.monitor-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.monitor-bezel {
  background: linear-gradient(145deg, #1a1a1a, #0a0a0a, #111);
  border: 3px solid #222;
  border-radius: 10px 10px 6px 6px;
  padding: 10px;
  box-shadow:
    0 0 0 1px #333,
    0 0 40px rgba(0, 255, 136, 0.2),
    0 0 80px rgba(0, 255, 136, 0.1),
    inset 0 0 20px rgba(0, 0, 0, 0.8);
  position: relative;
}

/* Monitor Headers & Indicators */
.monitor-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 8px;
  font-size: 0.65rem;
  color: rgba(0, 255, 136, 0.5);
  font-family: var(--terminal-font);
}

.monitor-dots {
  display: flex;
  gap: 6px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 4px currentColor;
}
.dot-red {
  background: #ff5f57;
  color: #ff5f57;
}
.dot-yellow {
  background: #febc2e;
  color: #febc2e;
}
.dot-green {
  background: #28c840;
  color: #28c840;
}

.monitor-label {
  font-size: 0.6rem;
  letter-spacing: 2px;
}

.monitor-icons {
  display: flex;
  gap: 10px;
  font-size: 0.7rem;
  cursor: pointer;
}
.monitor-icons i:hover {
  color: var(--neon-green);
}

.fa-spin-custom {
  animation: spin 4s linear infinite;
}

/* Game Canvas Inner Container */
.screen-glow-wrapper {
  position: relative;
  line-height: 0;
}

.screen-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(0, 0, 0, 0.25) 3px,
    rgba(0, 0, 0, 0.25) 4px
  );
  pointer-events: none;
  z-index: 5;
}

.monitor-glare {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0%,
    transparent 40%,
    transparent 80%,
    rgba(0, 0, 0, 0.15) 100%
  );
  pointer-events: none;
  z-index: 6;
  border-radius: 2px;
}

#gameCanvas {
  display: block;
  background: #000;
  border: 2px solid var(--neon-green);
  box-shadow:
    0 0 10px var(--neon-green),
    0 0 30px rgba(0, 255, 136, 0.3),
    inset 0 0 30px rgba(0, 0, 0, 0.8);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 2px;
  position: relative;
  z-index: 1;
  max-width: 100%;
}

/* Monitor Bottom HUD */
.monitor-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 4px;
  font-size: 0.62rem;
  color: rgba(0, 255, 136, 0.5);
  font-family: var(--terminal-font);
}

.fps-counter {
  color: var(--neon-green);
}
.coord-display {
  color: rgba(0, 170, 255, 0.7);
}
.hp-fill {
  color: var(--neon-red);
  letter-spacing: -1px;
}

/* Monitor Stand */
.monitor-neck {
  width: 60px;
  height: 24px;
  background: linear-gradient(to bottom, #1a1a1a, #111);
  border-left: 2px solid #222;
  border-right: 2px solid #222;
  margin: 0 auto;
}

.monitor-base {
  width: 160px;
  height: 12px;
  background: linear-gradient(145deg, #1a1a1a, #0d0d0d);
  border: 2px solid #222;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

/* ─── 6. SIDE PANELS & LOGS ────────────────────────────────────────────── */

.side-panels {
  display: flex;
  gap: 16px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.side-panel {
  flex: 1;
  min-width: 220px;
  max-width: 340px;
  background: var(--bg-panel);
  border: 1px solid var(--border-green);
  border-radius: 4px;
  padding: 12px;
  font-size: 0.72rem;
  box-shadow: 0 0 15px rgba(0, 255, 136, 0.08);
}

.panel-title {
  font-size: 0.62rem;
  color: var(--neon-green);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-green);
  padding-bottom: 6px;
}

.panel-divider {
  height: 1px;
  background: var(--border-green);
  margin: 10px 0;
  opacity: 0.4;
}

/* Stat Bars */
.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.62rem;
}
.stat-label {
  width: 60px;
  color: rgba(0, 255, 136, 0.6);
  letter-spacing: 1px;
  flex-shrink: 0;
}
.stat-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.stat-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease;
}
.stat-fill.red {
  background: var(--neon-red);
  box-shadow: 0 0 6px var(--neon-red);
}
.stat-fill.green {
  background: var(--neon-green);
  box-shadow: 0 0 6px var(--neon-green);
}
.stat-fill.blue {
  background: var(--neon-blue);
  box-shadow: 0 0 6px var(--neon-blue);
}

.stat-val {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.6rem;
  width: 28px;
  text-align: right;
}

/* Combat Log System */
.combat-log {
  max-height: 100px;
  overflow-y: auto;
  font-size: 0.63rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}
.combat-log::-webkit-scrollbar {
  width: 3px;
}
.combat-log::-webkit-scrollbar-track {
  background: transparent;
}
.combat-log::-webkit-scrollbar-thumb {
  background: var(--neon-green);
  border-radius: 2px;
}

.log-item {
  padding: 2px 0;
}
.log-item.success {
  color: var(--neon-green);
}
.log-item.warning {
  color: var(--neon-yellow);
}
.log-item.info {
  color: var(--neon-blue);
}
.log-item.danger {
  color: var(--neon-red);
}

/* Controls UI */
.controls-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.key-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.5);
}
kbd {
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid var(--neon-green);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: var(--terminal-font);
  font-size: 0.58rem;
  color: var(--neon-green);
  box-shadow: 0 2px 0 rgba(0, 255, 136, 0.3);
  white-space: nowrap;
}

/* ─── 7. MODALS & POPUPS ───────────────────────────────────────────────── */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

/* Physical Sticky Note Simulation */
.paper-note {
  background-color: #fdf8c7 !important; /* Worn yellow paper background */

  /* Mathematical trick to draw the grid pattern */
  background-image:
    linear-gradient(#89c4c1 1px, transparent 1px),
    linear-gradient(90deg, #89c4c1 1px, transparent 1px) !important;
  background-size: 20px 20px !important;
  color: #000033 !important; /* Deep blue ballpoint pen ink */

  width: 320px !important;
  min-height: 250px;
  padding: 40px 25px 25px 25px !important;
  border-radius: 2px !important;
  border: none !important;
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.8) !important;

  font-family: "Caveat", cursive, sans-serif !important;
  font-size: 1.8rem !important;
  transform: rotate(-3deg); /* Slightly tilted for realism */
  position: relative;
}

.tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 120px;
  height: 35px;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  border-left: 2px dashed rgba(255, 255, 255, 0.3);
  border-right: 2px dashed rgba(255, 255, 255, 0.3);
  z-index: 2;
}

.paper-note .close {
  position: absolute;
  top: 10px;
  right: 15px;
  color: #cc0000; /* Red ink for the close button */
  font-family: sans-serif;
  font-size: 24px;
  z-index: 3;
}

.paper-body {
  line-height: 1.1;
}

.close {
  cursor: pointer;
  transition: color 0.2s;
}
.close:hover {
  color: var(--neon-red);
}

/* ─── 8. BOTTOM TERMINAL ───────────────────────────────────────────────── */

.terminal-logs {
  width: 100%;
  max-width: 860px;
  background: rgba(0, 8, 0, 0.9);
  border: 1px solid var(--border-green);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.1);
}

.terminal-header-bar {
  background: rgba(0, 255, 136, 0.08);
  border-bottom: 1px solid var(--border-green);
  padding: 5px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.62rem;
  color: var(--neon-green);
  letter-spacing: 2px;
}

.log-entries {
  padding: 10px 12px;
  max-height: 90px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.log-entries::-webkit-scrollbar {
  width: 3px;
}
.log-entries::-webkit-scrollbar-thumb {
  background: var(--neon-green);
}

.log-entry {
  font-size: 0.7rem;
  color: rgba(0, 200, 80, 0.8);
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.log-entry.new-entry {
  animation: fadeSlideIn 0.3s ease;
}

.log-time {
  color: rgba(0, 255, 136, 0.35);
  font-size: 0.62rem;
  flex-shrink: 0;
}

.log-tag {
  font-weight: bold;
  font-size: 0.62rem;
  flex-shrink: 0;
  padding: 0 4px;
  border-radius: 2px;
}

.info-tag {
  color: var(--neon-blue);
  border: 1px solid var(--neon-blue);
  background: rgba(0, 170, 255, 0.08);
}
.ok-tag {
  color: var(--neon-green);
  border: 1px solid var(--neon-green);
  background: rgba(0, 255, 136, 0.08);
}
.warn-tag {
  color: var(--neon-yellow);
  border: 1px solid var(--neon-yellow);
  background: rgba(255, 221, 0, 0.08);
}
.err-tag {
  color: var(--neon-red);
  border: 1px solid var(--neon-red);
  background: rgba(255, 34, 68, 0.08);
}
.neon-green {
  color: var(--neon-green);
}

.terminal-prompt {
  padding: 6px 12px;
  border-top: 1px solid rgba(0, 255, 136, 0.15);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  gap: 2px;
}
.prompt-user {
  color: var(--neon-green);
}
.prompt-sep {
  color: rgba(255, 255, 255, 0.3);
}
.prompt-path {
  color: var(--neon-blue);
}
.prompt-dollar {
  color: rgba(255, 255, 255, 0.5);
  margin: 0 6px;
}

/* ─── 9. SHARED ANIMATIONS ─────────────────────────────────────────────── */

.blink-text {
  animation: blink 1s step-end infinite;
}
.cursor {
  animation: blink 1s step-end infinite;
  color: var(--neon-green);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes glowPulse {
  from {
    box-shadow: 0 0 4px currentColor;
  }
  to {
    box-shadow:
      0 0 12px currentColor,
      0 0 20px currentColor;
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scanSlide {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── 10. MEDIA QUERIES (Responsive Design) ────────────────────────────── */

@media (max-width: 860px) {
  h1.glitch {
    font-size: 1rem;
  }

  #gameCanvas {
    width: 100%;
    height: auto;
  }

  .terminal-logs,
  .side-panels {
    max-width: 98vw;
  }

  .side-panel {
    min-width: 160px;
  }
  .monitor-base {
    width: 100px;
  }
}
