/* --------------------------------------------------
   GLOBAL RESET + CUSTOM CURSOR
-------------------------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Consolas, monospace;
}

/* Hide default cursor — animated crosshair is handled by JS */
body {
  cursor: none;
}

/* Clickable elements — crosshair JS handles visual; no system cursor needed */
#clickHint, a, button {
  cursor: none;
}

/* --------------------------------------------------
   ANIMATED CROSSHAIR CURSOR
-------------------------------------------------- */
#crosshair {
  position: fixed;
  width: 32px;
  height: 32px;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
  mix-blend-mode: screen;   /* black pixels become transparent over any bg */
  will-change: left, top;
  opacity: 0;               /* hidden until first mouse move */
  transition: opacity .15s;
}

/* Hide crosshair on pure-touch devices (they have no persistent cursor) */
@media (hover: none) {
  #crosshair { display: none; }
  body, #clickHint, a, button { cursor: auto; }
}

/* --------------------------------------------------
   PAGE + SCROLL
-------------------------------------------------- */
html, body {
  background: #000;
  color: #00ff66;
  overflow-x: hidden;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar { display: none; }
html, body { scrollbar-width: none; -ms-overflow-style: none; }

/* --------------------------------------------------
   MATRIX BACKGROUND
-------------------------------------------------- */
#matrix {
  position: fixed;
  inset: 0;
  z-index: 0;
}

/* --------------------------------------------------
   TERMINAL TEXT
-------------------------------------------------- */
#terminal {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 10;
  color: #8b0000;
  font-size: clamp(14px, 2vw, 18px);
  text-shadow: 0 0 6px #8b0000;
  white-space: pre;
  transition: opacity .35s;
}

/* --------------------------------------------------
   WELCOME BOX
-------------------------------------------------- */
#welcomeBox {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: clamp(20px, 4vw, 32px) clamp(30px, 6vw, 50px);
  border-radius: 40px;
  border: 1px solid rgba(0,255,102,.45);
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(8px);
  text-align: center;
  font-size: clamp(18px, 4vw, 26px);
  text-shadow: 0 0 12px #00ff66;
  opacity: 0;
  pointer-events: none;
  transition: opacity .7s;
  z-index: 8;
}

/* --------------------------------------------------
   SCROLL HINT
-------------------------------------------------- */
#scrollHint {
  position: fixed;
  bottom: clamp(60px, 10vw, 80px);
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity .28s;
  z-index: 8;
  font-size: clamp(12px, 2vw, 16px);
  white-space: nowrap;
  pointer-events: none;
}

/* --------------------------------------------------
   PAGE CONTENT
-------------------------------------------------- */
#page {
  position: relative;
  z-index: 1;
}

#spacer {
  height: 120vh;
}

#aboutBox {
  max-width: 900px;
  margin: 0 auto 160px;
  padding: clamp(26px, 5vw, 46px);
  border-radius: 40px;
  border: 1px solid rgba(0,255,102,.45);
  background: rgba(0,0,0,.75);
  text-align: center;
  line-height: 1.7;
  font-size: clamp(16px, 3vw, 20px);
  text-shadow: 0 0 10px #00ff66;
  opacity: 0;
  transition: opacity .6s;
}

/* --------------------------------------------------
   AUDIO CLICK HINT
-------------------------------------------------- */
#clickHint {
  position: fixed;
  bottom: clamp(14px, 3vw, 26px);
  left: 50%;
  transform: translateX(-50%);
  opacity: 0.7;
  z-index: 20;
  color: #00ff66;
  font-size: clamp(11px, 2vw, 16px);
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
}

/* --------------------------------------------------
   MUTE TOGGLE BUTTON
-------------------------------------------------- */
#muteBtn {
  position: fixed;
  bottom: clamp(14px, 3vw, 24px);
  left: clamp(14px, 3vw, 20px);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(38px, 6vw, 46px);
  height: clamp(38px, 6vw, 46px);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(0, 255, 102, 0.45);
  border-radius: 50%;
  backdrop-filter: blur(6px);
  cursor: none;
  transition: background 0.2s, box-shadow 0.2s;
  padding: 0;
}

#muteBtn:hover {
  background: rgba(0, 255, 102, 0.12);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.3);
}

#muteBtn svg {
  display: block;
  width: clamp(16px, 2.5vw, 22px);
  height: clamp(16px, 2.5vw, 22px);
}

/* --------------------------------------------------
   NAV ARROW
-------------------------------------------------- */
#navArrow {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: clamp(32px, 5vw, 42px);
  height: clamp(48px, 8vw, 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(0, 255, 102, 0.45);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: #00ff66;
  font-size: clamp(14px, 2.5vw, 20px);
  cursor: none;
  backdrop-filter: blur(6px);
  /* opacity + pointer-events controlled by JS */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, background 0.2s, box-shadow 0.2s, right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

#navArrow.visible {
  opacity: 1;
  pointer-events: auto;
}

#navArrow:hover {
  background: rgba(0, 255, 102, 0.1);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.25);
}

#navArrow.open {
  transform: translateY(-50%) scaleX(-1);
}

/* --------------------------------------------------
   SLIDE-IN NAVBAR  — full-height right panel
-------------------------------------------------- */
#navbar {
  position: fixed;
  top: 0;
  right: -220px;
  width: clamp(160px, 28vw, 220px);
  height: 100%;
  z-index: 29;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  border-left: 1px solid rgba(0, 255, 102, 0.4);
  backdrop-filter: blur(10px);
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

#navbar.open {
  right: 0;
}

.nav-item {
  display: block;
  padding: clamp(14px, 2.5vw, 20px) clamp(20px, 4vw, 32px);
  color: #00ff66;
  text-decoration: none;
  font-family: Consolas, monospace;
  font-size: clamp(13px, 2vw, 16px);
  letter-spacing: 0.08em;
  text-shadow: 0 0 8px rgba(0, 255, 102, 0.5);
  border-bottom: 1px solid rgba(0, 255, 102, 0.15);
  transition: background 0.18s, text-shadow 0.18s, letter-spacing 0.18s, padding-left 0.18s;
  cursor: none;
  white-space: nowrap;
}

.nav-item:last-child {
  border-bottom: none;
}

.nav-item:hover {
  background: rgba(0, 255, 102, 0.1);
  text-shadow: 0 0 14px #00ff66;
  letter-spacing: 0.14em;
  padding-left: clamp(26px, 5vw, 40px);
}

/* --------------------------------------------------
   RESPONSIVE — small screens (≤ 480px)
-------------------------------------------------- */
@media (max-width: 480px) {
  #aboutBox {
    margin: 0 clamp(12px, 4vw, 20px) 80px;
    border-radius: 20px;
  }

  #welcomeBox {
    border-radius: 20px;
    max-width: 88vw;
  }

  /* Navbar takes less width on very small screens */
  #navbar {
    width: 75vw;
    right: -75vw;
  }
  #navbar.open {
    right: 0;
  }

  /* Nav arrow slightly smaller on phones */
  #navArrow {
    width: 28px;
    height: 44px;
    font-size: 13px;
  }

  /* Mute button pushed up slightly so it clears the click hint text */
  #muteBtn {
    bottom: 64px;
  }
}

/* --------------------------------------------------
   RESPONSIVE — medium screens (481–768px)
-------------------------------------------------- */
@media (min-width: 481px) and (max-width: 768px) {
  #navbar {
    width: 50vw;
    right: -50vw;
  }
  #navbar.open {
    right: 0;
  }
}

/* --------------------------------------------------
   PAGE TRANSITION OVERLAY
-------------------------------------------------- */
#pageTransition {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
}
#pageTransition.fade-out {
  opacity: 1;
  pointer-events: all;
}

/* page enter animation — body fades in on load */
body {
  animation: pageEnter 0.65s ease forwards;
}
@keyframes pageEnter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* active nav item highlight */
.nav-item.active {
  background: rgba(0, 255, 102, 0.08);
  text-shadow: 0 0 16px #00ff66;
  border-left: 2px solid #00ff66;
}

/* --------------------------------------------------
   CHANGELOG ARROW (left side) — mirrors #navArrow
-------------------------------------------------- */
#changelogArrow {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: clamp(32px, 5vw, 42px);
  height: clamp(48px, 8vw, 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(0, 255, 102, 0.45);
  border-left: none;
  border-radius: 0 8px 8px 0;
  color: #00ff66;
  font-size: clamp(14px, 2.5vw, 20px);
  cursor: none;
  backdrop-filter: blur(6px);
  transition: background 0.2s, box-shadow 0.2s, left 0.35s cubic-bezier(0.4,0,0.2,1);
  user-select: none;
}

#changelogArrow:hover {
  background: rgba(0, 255, 102, 0.1);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.25);
}

/* Arrow flips to point left when panel is open */
#changelogArrow.open {
  left: clamp(200px, 32vw, 260px);
  transform: translateY(-50%) scaleX(-1);
}

/* Tooltip on hover */
#changelogArrow .cl-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) scaleX(1); /* undo parent scaleX if open */
  background: rgba(0,0,0,0.9);
  border: 1px solid rgba(0,255,102,0.35);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(0,255,102,0.8);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
#changelogArrow:hover .cl-tooltip { opacity: 1; }
#changelogArrow.open .cl-tooltip  { opacity: 0 !important; }

/* --------------------------------------------------
   CHANGELOG PANEL — mirrors #navbar (left side)
-------------------------------------------------- */
#changelog-panel {
  position: fixed;
  top: 0;
  left: -260px;
  width: clamp(200px, 32vw, 260px);
  height: 100%;
  z-index: 29;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.92);
  border-right: 1px solid rgba(0, 255, 102, 0.4);
  backdrop-filter: blur(10px);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

#changelog-panel.open { left: 0; }

.cl-panel-header {
  padding: clamp(20px,3.5vw,28px) clamp(16px,3vw,24px) clamp(12px,2vw,16px);
  border-bottom: 1px solid rgba(0,255,102,0.18);
  flex-shrink: 0;
}

.cl-panel-sys {
  font-size: 9px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(0,255,102,0.4);
  margin-bottom: 6px;
}

.cl-panel-title {
  font-size: clamp(13px,2vw,15px);
  letter-spacing: 0.1em;
  color: #00ff66;
  text-shadow: 0 0 10px rgba(0,255,102,0.5);
}

.cl-panel-inner {
  flex: 1;
  overflow-y: auto;
  padding: clamp(12px,2vw,16px) clamp(14px,2.5vw,20px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px,1.8vw,14px);
  scrollbar-width: thin;
  scrollbar-color: rgba(0,255,102,0.28) transparent;
}

.cl-panel-inner::-webkit-scrollbar { width: 3px; }
.cl-panel-inner::-webkit-scrollbar-track { background: transparent; }
.cl-panel-inner::-webkit-scrollbar-thumb { background: rgba(0,255,102,0.28); border-radius: 2px; }

.cl-entry {
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(0,255,102,0.2);
  border-radius: 4px;
  padding: clamp(9px,1.5vw,12px) clamp(10px,1.8vw,14px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.cl-ts  { font-size: 8px; letter-spacing: .15em; color: rgba(0,255,102,.38); text-transform: uppercase; }
.cl-tag { font-size: 8px; letter-spacing: .18em; color: rgba(0,255,102,.55); text-transform: uppercase; font-style: italic; }
.cl-msg { font-size: clamp(10px,1.5vw,12px); letter-spacing: .04em; color: rgba(0,255,102,.82); line-height: 1.6; text-shadow: 0 0 6px rgba(0,255,102,.15); }

/* Responsive */
@media (max-width: 480px) {
  #changelog-panel { width: 80vw; left: -80vw; }
  #changelogArrow.open { left: 80vw; }
  #changelogArrow { width: 28px; height: 44px; font-size: 13px; }
  #changelogArrow .cl-tooltip { display: none; }
}
@media (min-width: 481px) and (max-width: 768px) {
  #changelog-panel { width: 55vw; left: -55vw; }
  #changelogArrow.open { left: 55vw; }
}
