/* =========================================
   ANJAL.EXE · THE RECRUIT'S JOURNEY
   Theme: Arcade · RPG · Cyber HUD
   ========================================= */

:root {
  --bg-0: #03050a;
  --bg-1: #070a14;
  --bg-2: #0b1022;
  --panel: rgba(8, 12, 24, 0.78);
  --panel-b: rgba(0, 255, 136, 0.18);
  --ink-0: #e8ffe8;
  --ink-1: #8fb6a3;
  --ink-2: #4f6e5f;
  --green: #00ff88;
  --green-d: #00cc6a;
  --pink: #ff3df0;
  --cyan: #7cf5ff;
  --yellow: #ffdd33;
  --orange: #ff8844;
  --red: #ff3b5c;
  --violet: #b47cff;

  --tier-s: #ffcc00;
  --tier-a: #ff3df0;
  --tier-b: #7cf5ff;

  --rarity-legendary: #ffaa00;
  --rarity-epic: #c75fff;
  --rarity-rare: #3d9bff;
  --rarity-uncommon: #3df081;

  --arcade: 'Press Start 2P', 'Courier New', monospace;
  --mono: 'JetBrains Mono', monospace;
  --body: 'Space Grotesk', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--body);
  overflow: hidden;
  cursor: none;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { background: none; border: none; color: inherit; cursor: none; font: inherit; }

::selection { background: var(--green); color: var(--bg-0); }

/* ---------- 3D Canvas ---------- */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ---------- CRT overlays ---------- */
.crt { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

.scanlines {
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.6;
  mix-blend-mode: overlay;
}

.vignette {
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.75) 100%);
}

.glitch-layer {
  background: transparent;
  opacity: 0;
  transition: opacity 0.1s ease;
}

.glitch-layer.active {
  opacity: 1;
  background:
    linear-gradient(90deg, transparent 49%, rgba(255, 61, 240, 0.4) 50%, transparent 51%),
    linear-gradient(90deg, transparent 39%, rgba(0, 255, 136, 0.3) 40%, transparent 41%);
  animation: glitch 0.2s steps(3) infinite;
}

@keyframes glitch {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-4px, 2px); }
  66% { transform: translate(3px, -1px); }
  100% { transform: translate(0, 0); }
}

/* ---------- Custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  top: 0; left: 0;
  transform: translate(-50%, -50%);
}

.cursor-dot {
  width: 4px;
  height: 4px;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.cursor-ring {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--green);
  transition: width 0.25s, height 0.25s, background 0.25s;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.4);
}

.cursor-ring.hover {
  width: 44px;
  height: 44px;
  background: rgba(0, 255, 136, 0.08);
  border-color: var(--pink);
  box-shadow: 0 0 20px rgba(255, 61, 240, 0.5);
}

@media (pointer: coarse), (max-width: 820px) {
  .cursor-dot, .cursor-ring { display: none; }
  body { cursor: auto; }
  button, a, .item-slot, .story-node { cursor: pointer; }
}

/* ---------- Toast stack ---------- */
.toast-stack {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 280px;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--green);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--green);
  backdrop-filter: blur(10px);
  transform: translateX(120%);
  opacity: 0;
  animation: toast-in 0.4s ease forwards, toast-out 0.4s ease 2.8s forwards;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast .t-icon {
  font-size: 14px;
}

.toast .t-label {
  color: var(--ink-1);
  font-size: 9px;
  letter-spacing: 2px;
}

.toast .t-main {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

@keyframes toast-in {
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateX(120%); opacity: 0; }
}

/* ---------- XP floats ---------- */
.xp-float-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 400;
}

.xp-pop {
  position: absolute;
  font-family: var(--arcade);
  font-size: 14px;
  color: var(--yellow);
  text-shadow: 0 0 10px var(--yellow), 2px 2px 0 rgba(0, 0, 0, 0.8);
  animation: xp-rise 1.4s ease-out forwards;
  pointer-events: none;
}

@keyframes xp-rise {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -80px) scale(1); }
}

/* ===================================================
   SCREENS (start, map) — full-screen overlays
   =================================================== */
.screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  backdrop-filter: blur(6px);
  background: radial-gradient(ellipse at center, rgba(3, 5, 10, 0.4), rgba(3, 5, 10, 0.9));
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------- START SCREEN ---------- */
.start-screen {
  z-index: 350;
}

.start-inner {
  text-align: center;
  max-width: 640px;
  padding: 48px 40px;
  background: var(--panel);
  border: 2px solid var(--green);
  box-shadow:
    0 0 60px rgba(0, 255, 136, 0.35),
    inset 0 0 40px rgba(0, 255, 136, 0.05);
  backdrop-filter: blur(14px);
  position: relative;
}

.start-inner::before,
.start-inner::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--green);
}

.start-inner::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.start-inner::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.arcade-tag {
  font-family: var(--arcade);
  font-size: 10px;
  color: var(--yellow);
  letter-spacing: 2px;
  margin-bottom: 30px;
  animation: blink-slow 1.2s ease-in-out infinite;
  text-shadow: 0 0 10px var(--yellow);
}

@keyframes blink-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.arcade-title {
  font-family: var(--arcade);
  font-size: clamp(28px, 6vw, 52px);
  letter-spacing: 2px;
  line-height: 1.3;
  margin-bottom: 16px;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.8);
}

.glow-green {
  color: var(--green);
  text-shadow: 0 0 20px var(--green), 4px 4px 0 rgba(0, 0, 0, 0.8);
}

.glow-pink {
  color: var(--pink);
  text-shadow: 0 0 20px var(--pink), 4px 4px 0 rgba(0, 0, 0, 0.8);
}

.arcade-sub {
  font-family: var(--arcade);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 3px;
  margin-bottom: 32px;
}

.arcade-desc {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 2;
  color: var(--ink-0);
  margin-bottom: 36px;
}

.arcade-desc .hl {
  color: var(--green);
  display: inline-block;
  margin-top: 6px;
}

.start-btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 18px 36px;
  background: var(--green);
  color: var(--bg-0);
  font-family: var(--arcade);
  font-size: 16px;
  letter-spacing: 2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow:
    0 0 30px rgba(0, 255, 136, 0.5),
    4px 4px 0 rgba(0, 0, 0, 0.8);
  animation: pulse-glow 2s ease-in-out infinite;
}

.start-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow:
    0 0 40px rgba(0, 255, 136, 0.7),
    6px 6px 0 rgba(0, 0, 0, 0.8);
}

.start-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.5), 2px 2px 0 rgba(0, 0, 0, 0.8);
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 30px rgba(0, 255, 136, 0.5), 4px 4px 0 rgba(0, 0, 0, 0.8); }
  50% { box-shadow: 0 0 50px rgba(0, 255, 136, 0.8), 4px 4px 0 rgba(0, 0, 0, 0.8); }
}

.start-arrow { font-size: 18px; }

.start-keys {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-1);
  letter-spacing: 1px;
}

kbd {
  display: inline-block;
  padding: 3px 8px;
  margin: 0 2px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--green);
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid var(--green);
  box-shadow: 0 2px 0 var(--green);
  letter-spacing: 0;
}

.high-score {
  margin-top: 32px;
  padding: 16px;
  border-top: 1px dashed rgba(0, 255, 136, 0.3);
  font-family: var(--arcade);
  font-size: 9px;
  letter-spacing: 2px;
}

.hs-row {
  display: flex;
  justify-content: space-between;
  color: var(--ink-1);
  margin-bottom: 6px;
}

.hs-row:first-child span:last-child { color: var(--yellow); }
.hs-row:last-child span:last-child { color: var(--pink); }

/* ===================================================
   HUD (top bar)
   =================================================== */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 14px 28px;
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: 24px;
  background: linear-gradient(180deg, rgba(3, 5, 10, 0.92), rgba(3, 5, 10, 0.7));
  border-bottom: 1px solid var(--panel-b);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.hud.active {
  opacity: 1;
  transform: translateY(0);
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hud-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--arcade);
  font-size: 10px;
  color: var(--green);
  letter-spacing: 2px;
}

.hl-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: blink-slow 1s ease-in-out infinite;
}

.hud-level {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 2px;
  padding: 4px 10px;
  background: rgba(124, 245, 255, 0.08);
  border: 1px solid rgba(124, 245, 255, 0.3);
}

.hud-center {
  display: flex;
  justify-content: center;
}

.progress-track {
  position: relative;
  width: 100%;
  max-width: 540px;
  height: 8px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid var(--panel-b);
}

.progress-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--pink));
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.6);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-nodes {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}

.p-node {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--green);
  background: var(--bg-0);
  transform: rotate(45deg);
  transition: background 0.3s, box-shadow 0.3s;
  cursor: none;
  position: relative;
}

.p-node.active {
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.p-node.current {
  background: var(--pink);
  border-color: var(--pink);
  box-shadow: 0 0 18px var(--pink);
  animation: pulse-node 1s ease-in-out infinite;
}

@keyframes pulse-node {
  0%, 100% { transform: rotate(45deg) scale(1); }
  50% { transform: rotate(45deg) scale(1.2); }
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: flex-end;
}

.hud-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--ink-1);
}

.hs-label {
  color: var(--green);
  font-weight: 700;
}

.hs-bar {
  display: inline-block;
  width: 70px;
  height: 6px;
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.3);
  position: relative;
}

.hs-bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  box-shadow: 0 0 6px var(--green);
}

.hs-value {
  font-family: var(--arcade);
  font-size: 10px;
  color: var(--yellow);
  text-shadow: 0 0 6px rgba(255, 221, 51, 0.5);
}

.hud-btn {
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--green);
  border: 1px solid var(--green);
  background: rgba(0, 255, 136, 0.05);
  transition: background 0.2s;
}

.hud-btn:hover { background: rgba(0, 255, 136, 0.18); }

@media (max-width: 900px) {
  .hud { grid-template-columns: 1fr; gap: 8px; padding: 10px 16px; }
  .hud-right { justify-content: space-between; }
  .hud-center { order: 3; }
}

/* ===================================================
   GAME MAIN AREA
   =================================================== */
.game {
  position: relative;
  z-index: 10;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  padding-top: 72px;
}

.level {
  position: absolute;
  top: 72px;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 1400px;
  padding: 32px 40px 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateX(40px);
  transition: opacity 0.5s ease, transform 0.5s ease, visibility 0.5s;
}

.level.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateX(0);
}

.level.exit {
  transform: translateX(-50%) translateX(-40px);
}

/* custom scrollbar in level */
.level::-webkit-scrollbar { width: 6px; }
.level::-webkit-scrollbar-track { background: rgba(0, 255, 136, 0.05); }
.level::-webkit-scrollbar-thumb { background: var(--green); }

/* ---------- Level badge ---------- */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid var(--green);
  width: fit-content;
  font-family: var(--arcade);
  font-size: 12px;
  letter-spacing: 2px;
  box-shadow: 3px 3px 0 rgba(0, 255, 136, 0.3);
}

.lb-num {
  color: var(--yellow);
  text-shadow: 0 0 8px var(--yellow);
}

.lb-label {
  color: var(--green);
}

.level-badge.final-badge {
  background: rgba(255, 61, 240, 0.1);
  border-color: var(--pink);
  box-shadow: 3px 3px 0 rgba(255, 61, 240, 0.3);
}

.level-badge.final-badge .lb-label { color: var(--pink); }

/* ---------- Dialog box ---------- */
.dialog-box {
  padding: 0;
  background: var(--panel);
  border: 2px solid var(--green);
  box-shadow:
    0 0 30px rgba(0, 255, 136, 0.15),
    inset 0 0 20px rgba(0, 255, 136, 0.04);
  backdrop-filter: blur(10px);
  max-width: 920px;
}

.dialog-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(0, 255, 136, 0.12);
  border-bottom: 1px solid rgba(0, 255, 136, 0.3);
  font-family: var(--arcade);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--green);
}

.dh-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: blink-slow 1s ease-in-out infinite;
}

.dialog-content {
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.9;
  color: var(--ink-0);
  min-height: 28px;
}

/* ---------- Character Card (Level 1) ---------- */
.character-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--panel-b);
  backdrop-filter: blur(10px);
  max-width: 920px;
}

.char-portrait {
  position: relative;
}

.portrait-frame {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid var(--green);
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(0, 255, 136, 0.3),
    inset 0 0 20px rgba(0, 0, 0, 0.6);
}

.portrait-frame::before,
.portrait-frame::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--yellow);
  z-index: 2;
}

.portrait-frame::before { top: 6px; left: 6px; border-right: none; border-bottom: none; }
.portrait-frame::after { bottom: 6px; right: 6px; border-left: none; border-top: none; }

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.1) contrast(1.1);
}

.char-level {
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--arcade);
  font-size: 10px;
  padding: 6px 14px;
  background: var(--yellow);
  color: var(--bg-0);
  letter-spacing: 2px;
  box-shadow: 0 0 15px rgba(255, 221, 51, 0.5), 2px 2px 0 rgba(0, 0, 0, 0.8);
  z-index: 3;
}

.char-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.char-name {
  font-family: var(--arcade);
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--green);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
  line-height: 1.3;
}

.char-name span {
  color: var(--pink);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}

.char-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 2px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(0, 255, 136, 0.2);
}

.stat-grid.single { grid-template-columns: 1fr; max-width: 320px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat-box {
  position: relative;
  padding: 12px 14px 10px;
  background: rgba(0, 255, 136, 0.04);
  border: 1px solid rgba(0, 255, 136, 0.25);
  overflow: hidden;
  transition: border-color 0.25s ease;
}

.stat-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--green), var(--yellow));
  box-shadow: 0 0 8px var(--green);
}

.stat-box:hover {
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.2);
}

.sb-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--ink-1);
  font-weight: 700;
  margin-bottom: 4px;
}

.sb-value {
  font-family: var(--arcade);
  font-size: 22px;
  color: var(--green);
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.5), 2px 2px 0 rgba(0, 0, 0, 0.7);
  line-height: 1.2;
  margin-bottom: 8px;
}

.sb-pips {
  display: flex;
  gap: 3px;
  height: 8px;
}

.sb-pips::before {
  content: '';
  display: block;
  flex: 1;
  background:
    linear-gradient(90deg, var(--green) 0%, var(--green) var(--w), rgba(0, 255, 136, 0.1) var(--w), rgba(0, 255, 136, 0.1) 100%);
  background-size: 4px 100%, 100% 100%;
  background-repeat: repeat-x, no-repeat;
  mask: repeating-linear-gradient(90deg, black 0 3px, transparent 3px 5px);
  -webkit-mask: repeating-linear-gradient(90deg, black 0 3px, transparent 3px 5px);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.stat-box.animate .sb-pips::before {
  opacity: 1;
}

.char-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 255, 136, 0.2);
}

.char-tags span {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  background: rgba(124, 245, 255, 0.08);
  border: 1px solid rgba(124, 245, 255, 0.3);
  color: var(--cyan);
  letter-spacing: 1px;
}

@media (max-width: 820px) {
  .character-card { grid-template-columns: 1fr; }
}

/* ---------- Story nodes (Level 2) ---------- */
.story-nodes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 1100px;
}

.story-node {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--panel-b);
  backdrop-filter: blur(10px);
  cursor: none;
  position: relative;
  transition: all 0.3s ease;
  opacity: 0.5;
  filter: grayscale(0.6);
}

.story-node.revealed {
  opacity: 1;
  filter: grayscale(0);
  border-color: var(--green);
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.story-node:hover {
  transform: translateY(-3px);
  border-color: var(--green);
}

.story-node::before {
  content: '▸ CLICK TO REVEAL';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--arcade);
  font-size: 10px;
  color: var(--yellow);
  letter-spacing: 2px;
  background: var(--bg-0);
  padding: 8px 14px;
  border: 1px solid var(--yellow);
  text-shadow: 0 0 8px var(--yellow);
  z-index: 2;
  animation: blink-slow 1.2s ease-in-out infinite;
  pointer-events: none;
}

.story-node.revealed::before { display: none; }

.story-node.revealed > * { opacity: 1; }

.story-node > * {
  opacity: 0.2;
  transition: opacity 0.4s;
}

.sn-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
}

.sn-num {
  font-family: var(--arcade);
  font-size: 16px;
  color: var(--pink);
  text-shadow: 0 0 8px var(--pink);
}

.sn-year {
  color: var(--ink-1);
  padding: 2px 6px;
  background: rgba(124, 245, 255, 0.08);
  border: 1px solid rgba(124, 245, 255, 0.3);
  color: var(--cyan);
}

.sn-xp {
  margin-left: auto;
  color: var(--yellow);
  font-weight: 700;
}

.story-node h3 {
  font-family: var(--arcade);
  font-size: 14px;
  color: var(--green);
  letter-spacing: 2px;
  margin-bottom: 10px;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
}

.story-node p {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.8;
  color: var(--ink-0);
}

@media (max-width: 820px) {
  .story-nodes { grid-template-columns: 1fr; }
}

/* ---------- Skill grid (Level 3) ---------- */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 1100px;
}

.skill-cell {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--panel-b);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: all 0.25s ease;
  cursor: none;
}

.skill-cell:hover {
  transform: translateY(-3px);
  border-color: var(--green);
  box-shadow: 0 6px 20px rgba(0, 255, 136, 0.2);
}

.skill-cell[data-tier="S"] { border-color: rgba(255, 204, 0, 0.4); }
.skill-cell[data-tier="A"] { border-color: rgba(255, 61, 240, 0.4); }
.skill-cell[data-tier="B"] { border-color: rgba(124, 245, 255, 0.4); }

.sc-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-0);
}

.sc-bar {
  height: 4px;
  background: rgba(0, 255, 136, 0.1);
  position: relative;
  overflow: hidden;
}

.sc-bar div {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 0;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: width 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sc-bar.animate div { width: var(--w); }

@media (max-width: 900px) {
  .skill-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .skill-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Inventory grid (Level 4) ---------- */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 1100px;
}

.item-slot {
  padding: 0;
  background: var(--panel);
  border: 2px solid var(--panel-b);
  overflow: hidden;
  position: relative;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  text-align: left;
  cursor: none;
}

.item-slot.legendary { border-color: var(--rarity-legendary); }
.item-slot.epic { border-color: var(--rarity-epic); }
.item-slot.rare { border-color: var(--rarity-rare); }
.item-slot.uncommon { border-color: var(--rarity-uncommon); }

.item-slot:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 255, 136, 0.2);
}

.item-slot.legendary:hover { box-shadow: 0 12px 40px rgba(255, 170, 0, 0.4); }
.item-slot.epic:hover { box-shadow: 0 12px 40px rgba(199, 95, 255, 0.4); }

.item-rarity {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  font-family: var(--arcade);
  font-size: 8px;
  letter-spacing: 2px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid;
  backdrop-filter: blur(4px);
}

.item-slot.legendary .item-rarity { color: var(--rarity-legendary); border-color: var(--rarity-legendary); text-shadow: 0 0 6px var(--rarity-legendary); }
.item-slot.epic .item-rarity { color: var(--rarity-epic); border-color: var(--rarity-epic); }
.item-slot.rare .item-rarity { color: var(--rarity-rare); border-color: var(--rarity-rare); }
.item-slot.uncommon .item-rarity { color: var(--rarity-uncommon); border-color: var(--rarity-uncommon); }

.item-thumb {
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background: var(--bg-1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.item-slot:hover .item-thumb img { transform: scale(1.08); }

.item-thumb .pixel-svg {
  width: 50%;
  color: var(--green);
}

.thumb-core {
  font-family: var(--arcade);
  font-size: 28px;
  color: var(--rarity-legendary);
  letter-spacing: 3px;
  text-shadow: 0 0 20px var(--rarity-legendary);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 170, 0, 0.3), transparent 60%),
    linear-gradient(135deg, #1a1020, #2a0a1a);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rcds-thumb {
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.08), rgba(255, 61, 240, 0.08));
}

.item-name {
  padding: 12px 14px 4px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-0);
}

.item-type {
  padding: 0 14px 14px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-1);
  letter-spacing: 2px;
}

@media (max-width: 900px) {
  .inventory-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .inventory-grid { grid-template-columns: 1fr; }
}

/* ---------- Quest log (Level 5) ---------- */
.quest-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1100px;
}

.quest {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-b);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.quest {
  cursor: none;
  position: relative;
}

.quest::after {
  content: '◉ CLICK TO CLAIM +250 COIN';
  position: absolute;
  top: 8px;
  right: 14px;
  font-family: var(--arcade);
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--yellow);
  text-shadow: 0 0 6px var(--yellow);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  animation: blink-slow 1.4s ease-in-out infinite;
}

.quest:hover::after { opacity: 1; }

.quest:hover {
  transform: translateX(4px);
  border-color: var(--green);
}

.quest.claimed {
  border-color: var(--yellow);
  box-shadow: 0 0 20px rgba(255, 221, 51, 0.15);
}

.quest.claimed::after {
  content: '✓ CLAIMED';
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
  opacity: 1;
  animation: none;
}

.quest.active { border-color: var(--yellow); box-shadow: 0 0 20px rgba(255, 221, 51, 0.15); }

.quest-status {
  font-family: var(--arcade);
  font-size: 9px;
  letter-spacing: 2px;
  padding: 5px 10px;
  width: fit-content;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid;
  text-align: center;
}

.quest.active .quest-status {
  color: var(--yellow);
  border-color: var(--yellow);
  text-shadow: 0 0 6px var(--yellow);
  animation: blink-slow 1.2s ease-in-out infinite;
}

.quest.completed .quest-status {
  color: var(--green);
  border-color: var(--green);
}

.quest-img {
  height: 90px;
  overflow: hidden;
  border: 1px solid var(--panel-b);
}

.quest-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) brightness(0.9);
}

.quest-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-0);
  margin-bottom: 2px;
}

.quest-issuer {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 1px;
}

.quest-date {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-1);
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.quest-objectives {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quest-objectives li {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-0);
  line-height: 1.6;
}

.quest-objectives li:first-letter { color: var(--green); }

.quest-reward {
  font-family: var(--arcade);
  font-size: 12px;
  color: var(--yellow);
  text-shadow: 0 0 8px var(--yellow);
  text-align: center;
  padding: 10px 14px;
  background: rgba(255, 221, 51, 0.08);
  border: 1px solid rgba(255, 221, 51, 0.4);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .quest {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .quest-img { height: 160px; }
  .quest-reward { justify-self: start; }
}

/* ---------- Guild grid (Level 6) ---------- */
.guild-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 180px;
  gap: 12px;
  max-width: 1200px;
}

.guild-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--panel-b);
  transition: all 0.3s ease;
}

.guild-card.gc-tall { grid-row: span 2; }
.guild-card.gc-wide { grid-column: span 2; }

.guild-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) brightness(0.85) contrast(1.05);
  transition: transform 0.6s ease, filter 0.4s ease;
}

.guild-card:hover {
  border-color: var(--green);
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0, 255, 136, 0.2);
}

.guild-card:hover img {
  transform: scale(1.08);
  filter: saturate(1.1) brightness(1);
}

.guild-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(3, 5, 10, 0.92), transparent 55%);
  z-index: 1;
  pointer-events: none;
}

.guild-card figcaption {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gc-tag {
  font-family: var(--arcade);
  font-size: 7px;
  letter-spacing: 2px;
  color: var(--green);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--green);
  padding: 3px 6px;
  width: fit-content;
}

.gc-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink-0);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

@media (max-width: 900px) {
  .guild-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 150px; }
}

/* ---------- Final level ---------- */
.final-banner {
  text-align: center;
  padding: 32px;
  background: linear-gradient(135deg, rgba(255, 61, 240, 0.08), rgba(0, 255, 136, 0.08));
  border: 2px solid var(--pink);
  box-shadow: 0 0 40px rgba(255, 61, 240, 0.25);
}

.fb-title {
  font-family: var(--arcade);
  font-size: clamp(32px, 6vw, 56px);
  color: var(--yellow);
  letter-spacing: 6px;
  text-shadow: 4px 4px 0 rgba(255, 61, 240, 0.6), 0 0 30px rgba(255, 221, 51, 0.6);
  margin-bottom: 10px;
  animation: banner-flash 2s ease-in-out infinite;
}

@keyframes banner-flash {
  0%, 100% { text-shadow: 4px 4px 0 rgba(255, 61, 240, 0.6), 0 0 30px rgba(255, 221, 51, 0.6); }
  50% { text-shadow: 4px 4px 0 rgba(0, 255, 136, 0.6), 0 0 50px rgba(255, 221, 51, 0.9); }
}

.fb-sub {
  font-family: var(--mono);
  color: var(--cyan);
  letter-spacing: 3px;
  margin-bottom: 14px;
  font-size: 13px;
}

.fb-score {
  font-family: var(--arcade);
  font-size: 14px;
  color: var(--green);
  letter-spacing: 2px;
}

.abilities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 1000px;
}

.ability {
  padding: 20px;
  background: var(--panel);
  border: 2px solid var(--panel-b);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  position: relative;
}

.ability:hover {
  border-color: var(--green);
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgba(0, 255, 136, 0.25);
}

.ab-icon {
  font-size: 28px;
  color: var(--green);
  text-shadow: 0 0 12px var(--green);
  font-weight: 900;
  margin-bottom: 8px;
  font-family: var(--arcade);
}

.ab-name {
  font-family: var(--arcade);
  font-size: 12px;
  color: var(--green);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

.ab-stat {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-0);
  word-break: break-all;
}

.ab-cost {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--yellow);
  letter-spacing: 2px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 221, 51, 0.3);
}

@media (max-width: 820px) {
  .abilities { grid-template-columns: 1fr; }
}

.credits {
  padding: 14px 18px;
  border-top: 1px dashed rgba(0, 255, 136, 0.3);
  border-bottom: 1px dashed rgba(0, 255, 136, 0.3);
  max-width: 1000px;
}

.credits-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-1);
  letter-spacing: 2px;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Level actions ---------- */
.level-action {
  display: flex;
  gap: 14px;
  padding-top: 10px;
  margin-top: auto;
  flex-wrap: wrap;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  font-family: var(--arcade);
  font-size: 11px;
  letter-spacing: 2px;
  transition: all 0.25s ease;
  border: 2px solid;
  min-width: 140px;
  justify-content: center;
}

.action-btn.primary {
  background: var(--green);
  color: var(--bg-0);
  border-color: var(--green);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 255, 136, 0.3);
}

.action-btn.primary:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 255, 136, 0.5);
}

.action-btn.primary:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}

.action-btn.ghost {
  background: transparent;
  color: var(--green);
  border-color: var(--green);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.6);
}

.action-btn.ghost:hover {
  background: rgba(0, 255, 136, 0.1);
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.8);
}

.ab-key {
  font-size: 9px;
  color: var(--bg-0);
  opacity: 0.7;
  background: rgba(0, 0, 0, 0.15);
  padding: 3px 6px;
}

/* ===================================================
   MAP SCREEN
   =================================================== */
.map-screen { z-index: 340; }

.map-inner {
  max-width: 720px;
  width: 100%;
  padding: 32px;
  background: var(--panel);
  border: 2px solid var(--pink);
  box-shadow: 0 0 60px rgba(255, 61, 240, 0.3);
  backdrop-filter: blur(14px);
  position: relative;
}

.map-inner::before,
.map-inner::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--pink);
}
.map-inner::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.map-inner::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(255, 61, 240, 0.3);
}

.map-header h2 {
  font-family: var(--arcade);
  font-size: 16px;
  color: var(--pink);
  letter-spacing: 3px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}

.map-close {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--pink);
  letter-spacing: 2px;
  padding: 8px 14px;
  border: 1px solid var(--pink);
  background: rgba(255, 61, 240, 0.08);
}

.map-close:hover { background: rgba(255, 61, 240, 0.2); }

.map-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.map-node {
  padding: 18px;
  background: var(--bg-1);
  border: 2px solid var(--panel-b);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  position: relative;
  transition: all 0.25s ease;
}

.map-node:hover {
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 136, 0.25);
}

.map-node.visited { border-color: var(--green); }
.map-node.current {
  border-color: var(--yellow);
  background: rgba(255, 221, 51, 0.08);
  box-shadow: 0 0 20px rgba(255, 221, 51, 0.3);
}

.mn-num {
  font-family: var(--arcade);
  font-size: 16px;
  color: var(--yellow);
}

.mn-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  color: var(--ink-0);
  letter-spacing: 1px;
}

.mn-status {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-1);
  letter-spacing: 2px;
}

.map-node.visited .mn-status { color: var(--green); }
.map-node.current .mn-status { color: var(--yellow); }

.map-hint {
  text-align: center;
  margin-top: 20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-1);
  letter-spacing: 2px;
}

@media (max-width: 600px) {
  .map-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===================================================
   ITEM MODAL
   =================================================== */
.item-modal {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.item-modal.open {
  opacity: 1;
  visibility: visible;
}

.im-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 5, 10, 0.85);
  backdrop-filter: blur(10px);
}

.im-card {
  position: relative;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--panel);
  border: 2px solid var(--green);
  box-shadow: 0 0 60px rgba(0, 255, 136, 0.4);
  padding: 24px;
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.item-modal.open .im-card {
  transform: scale(1);
  opacity: 1;
}

.im-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  background: rgba(255, 61, 240, 0.1);
  border: 1px solid var(--pink);
  color: var(--pink);
  font-family: var(--mono);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.im-close:hover { background: var(--pink); color: var(--bg-0); }

.im-top {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px dashed rgba(0, 255, 136, 0.3);
}

.im-thumb {
  aspect-ratio: 16/9;
  border: 1px solid var(--panel-b);
  background: var(--bg-1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.im-thumb img, .im-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.im-rarity {
  font-family: var(--arcade);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--rarity-legendary);
  margin-bottom: 8px;
  text-shadow: 0 0 8px var(--rarity-legendary);
}

.im-name {
  font-family: var(--arcade);
  font-size: 18px;
  color: var(--green);
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
  line-height: 1.3;
}

.im-type {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 2px;
}

.im-desc {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-0);
  margin-bottom: 16px;
}

.im-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.im-stat-row {
  padding: 8px 12px;
  background: rgba(0, 255, 136, 0.05);
  border: 1px solid rgba(0, 255, 136, 0.2);
  font-family: var(--mono);
  font-size: 11px;
}

.im-stat-row .label {
  display: block;
  font-size: 9px;
  color: var(--ink-1);
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.im-stat-row .value {
  color: var(--green);
  font-weight: 700;
}

.im-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.im-tags span {
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 10px;
  background: rgba(124, 245, 255, 0.08);
  border: 1px solid rgba(124, 245, 255, 0.3);
  color: var(--cyan);
  letter-spacing: 1px;
}

.im-launches {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(0, 255, 136, 0.3);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.im-launch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  font-family: var(--arcade);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--bg-0);
  background: var(--yellow);
  border: 2px solid var(--yellow);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.8), 0 0 18px rgba(255, 221, 51, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.im-launch:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 221, 51, 0.8);
}

.im-launch:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
}

/* Music button — off state */
#musicBtn.muted {
  color: var(--ink-2);
  border-color: var(--ink-2);
  background: rgba(0, 0, 0, 0.4);
}

#musicBtn.muted svg { opacity: 0.5; }

@media (max-width: 680px) {
  .im-top { grid-template-columns: 1fr; }
}

/* ===================================================
   BIOS BOOT SCREEN
   =================================================== */
.bios-screen {
  z-index: 380;
  background: #000;
  padding: 0;
  justify-content: flex-start;
  align-items: flex-start;
}

.bios-inner {
  font-family: var(--mono);
  color: var(--green);
  padding: 40px 50px;
  max-width: 800px;
  width: 100%;
  font-size: 13px;
  line-height: 1.8;
  animation: crt-flicker 2.5s ease-in-out infinite;
}

@keyframes crt-flicker {
  0%, 100% { opacity: 1; }
  92% { opacity: 1; }
  93% { opacity: 0.92; }
  94% { opacity: 1; }
  97% { opacity: 0.95; }
}

.bios-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--green);
  text-shadow: 0 0 10px var(--green);
}

.bios-block {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: blink-slow 1s step-end infinite;
}

.bios-copyright {
  color: var(--ink-1);
  font-size: 11px;
  margin-top: 4px;
}

.bios-hr {
  height: 1px;
  background: var(--green);
  opacity: 0.4;
  margin: 20px 0 18px;
}

.bios-log {
  min-height: 240px;
  font-size: 12px;
}

.bios-log .bl-line {
  opacity: 0;
  animation: bl-in 0.08s ease forwards;
  display: block;
  white-space: pre;
  letter-spacing: 0.5px;
}

@keyframes bl-in {
  to { opacity: 1; }
}

.bios-log .ok { color: var(--green); text-shadow: 0 0 6px var(--green); }
.bios-log .warn { color: var(--yellow); }
.bios-log .info { color: var(--cyan); }
.bios-log .dim { color: var(--ink-1); }
.bios-log .fail { color: var(--red); }

.bios-skip {
  margin-top: 30px;
  color: var(--yellow);
  font-size: 11px;
  letter-spacing: 2px;
  text-shadow: 0 0 8px var(--yellow);
  animation: blink-slow 1.2s ease-in-out infinite;
}

/* ===================================================
   FX CANVAS (particle burst + mouse trail)
   =================================================== */
#fxCanvas {
  position: fixed;
  inset: 0;
  z-index: 250;
  pointer-events: none;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
}

/* ===================================================
   ACHIEVEMENT POPUP
   =================================================== */
.achievement {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(200%);
  z-index: 600;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px 24px 14px 18px;
  background: linear-gradient(135deg, rgba(255, 170, 0, 0.15), rgba(0, 0, 0, 0.85));
  border: 2px solid var(--yellow);
  box-shadow:
    0 0 40px rgba(255, 221, 51, 0.6),
    0 10px 40px rgba(0, 0, 0, 0.6),
    inset 0 0 20px rgba(255, 221, 51, 0.1);
  backdrop-filter: blur(14px);
  min-width: 340px;
  max-width: 480px;
  transition: transform 0.5s cubic-bezier(0.3, 1.5, 0.5, 1);
  pointer-events: none;
}

.achievement.show {
  transform: translateX(-50%) translateY(0);
}

.ach-badge {
  color: var(--yellow);
  filter: drop-shadow(0 0 10px var(--yellow));
  animation: badge-spin 3s linear infinite;
}

@keyframes badge-spin {
  from { transform: rotate(0); }
  to { transform: rotate(360deg); }
}

.ach-label {
  font-family: var(--arcade);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--yellow);
  text-shadow: 0 0 8px var(--yellow);
  margin-bottom: 4px;
}

.ach-title {
  font-family: var(--arcade);
  font-size: 13px;
  color: var(--ink-0);
  letter-spacing: 1px;
  margin-bottom: 2px;
}

.ach-desc {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-1);
}

/* ===================================================
   GOD MODE OVERLAY
   =================================================== */
.god-mode {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: radial-gradient(ellipse at center, rgba(255, 0, 200, 0.15), rgba(0, 0, 0, 0.95));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
  backdrop-filter: blur(10px);
}

.god-mode.active {
  opacity: 1;
  visibility: visible;
}

.gm-inner {
  max-width: 680px;
  padding: 40px;
  background: rgba(0, 0, 0, 0.9);
  border: 3px solid;
  border-image: linear-gradient(135deg, var(--yellow), var(--pink), var(--cyan), var(--green)) 1;
  text-align: center;
  animation: gm-pulse 2s ease-in-out infinite;
  position: relative;
}

@keyframes gm-pulse {
  0%, 100% { box-shadow: 0 0 60px rgba(255, 221, 51, 0.4); }
  33% { box-shadow: 0 0 80px rgba(255, 61, 240, 0.5); }
  66% { box-shadow: 0 0 80px rgba(124, 245, 255, 0.5); }
}

.gm-title {
  font-family: var(--arcade);
  font-size: clamp(20px, 3.5vw, 32px);
  letter-spacing: 4px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--cyan), var(--green));
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbow-flow 3s linear infinite;
  text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.8);
  filter: drop-shadow(0 0 10px rgba(255, 221, 51, 0.6));
}

@keyframes rainbow-flow {
  to { background-position: 300% 0; }
}

.gm-sub {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--cyan);
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.gm-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 26px;
}

.gm-stats > div {
  padding: 14px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--yellow);
}

.gm-stats span {
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ink-1);
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.gm-stats b {
  font-family: var(--arcade);
  font-size: 18px;
  color: var(--yellow);
  text-shadow: 0 0 10px var(--yellow);
}

.gm-lore {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 2;
  color: var(--ink-0);
  padding: 18px;
  border-top: 1px dashed rgba(255, 221, 51, 0.3);
  border-bottom: 1px dashed rgba(255, 221, 51, 0.3);
  margin-bottom: 22px;
}

.gm-close {
  font-family: var(--arcade);
  font-size: 11px;
  padding: 12px 20px;
  color: var(--yellow);
  border: 1px solid var(--yellow);
  background: rgba(255, 221, 51, 0.08);
  letter-spacing: 2px;
}

.gm-close:hover { background: rgba(255, 221, 51, 0.2); }

@media (max-width: 600px) {
  .gm-stats { grid-template-columns: 1fr; }
}

/* God mode rainbow HUD */
body.god-mode-on .hud {
  border-bottom-color: var(--yellow);
  animation: gm-border 3s linear infinite;
}

body.god-mode-on .progress-fill {
  background: linear-gradient(90deg, var(--yellow), var(--pink), var(--cyan), var(--green), var(--yellow));
  background-size: 300% 100%;
  animation: rainbow-flow 2s linear infinite;
}

@keyframes gm-border {
  0%, 100% { box-shadow: 0 1px 0 var(--yellow); }
  50% { box-shadow: 0 1px 20px var(--pink); }
}

/* ===================================================
   SESSION TIMER
   =================================================== */
.session-timer {
  position: fixed;
  bottom: 14px;
  right: 20px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(0, 255, 136, 0.3);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-1);
  letter-spacing: 1px;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.4s;
}

.session-timer.active { opacity: 1; }

.st-label { color: var(--green); font-weight: 700; }
.st-value { color: var(--yellow); text-shadow: 0 0 6px var(--yellow); }

/* ===================================================
   MUSIC PLAYER WIDGET
   =================================================== */
.music-player {
  position: fixed;
  bottom: 14px;
  left: 20px;
  z-index: 95;
  width: 220px;
  background: rgba(3, 5, 10, 0.85);
  border: 1px solid rgba(124, 245, 255, 0.35);
  backdrop-filter: blur(10px);
  font-family: var(--mono);
  color: var(--ink-0);
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.3s;
  pointer-events: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.music-player.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.music-player:hover {
  border-color: var(--cyan);
}

.mp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(124, 245, 255, 0.08);
  border-bottom: 1px solid rgba(124, 245, 255, 0.2);
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--cyan);
  font-weight: 700;
}

.mp-bars {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
  height: 12px;
}

.mp-bars i {
  display: block;
  width: 3px;
  background: var(--cyan);
  box-shadow: 0 0 4px var(--cyan);
  animation: mp-bounce 0.7s ease-in-out infinite;
}

.mp-bars i:nth-child(1) { animation-delay: 0s; height: 40%; }
.mp-bars i:nth-child(2) { animation-delay: 0.15s; height: 80%; }
.mp-bars i:nth-child(3) { animation-delay: 0.3s; height: 50%; }
.mp-bars i:nth-child(4) { animation-delay: 0.45s; height: 70%; }

@keyframes mp-bounce {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

.music-player.paused .mp-bars i {
  animation-play-state: paused;
  background: var(--ink-2);
  box-shadow: none;
}

.mp-label {
  flex: 1;
}

.mp-power {
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--bg-0);
  background: var(--green);
  border: none;
  transition: background 0.2s;
}

.music-player.paused .mp-power {
  background: var(--ink-2);
  color: var(--bg-0);
}

.mp-power:hover {
  background: var(--yellow);
}

.mp-track {
  padding: 12px 12px 8px;
  font-family: var(--arcade);
  font-size: 13px;
  color: var(--pink);
  letter-spacing: 2px;
  text-shadow: 0 0 8px var(--pink), 2px 2px 0 rgba(0, 0, 0, 0.8);
  text-align: center;
  animation: mp-track-glow 3s ease-in-out infinite;
}

@keyframes mp-track-glow {
  0%, 100% { text-shadow: 0 0 8px var(--pink), 2px 2px 0 rgba(0, 0, 0, 0.8); }
  50% { text-shadow: 0 0 18px var(--pink), 0 0 30px var(--pink), 2px 2px 0 rgba(0, 0, 0, 0.8); }
}

.music-player.paused .mp-track {
  color: var(--ink-2);
  text-shadow: none;
  animation: none;
}

.mp-controls {
  display: flex;
  justify-content: space-around;
  padding: 6px 10px 10px;
  gap: 6px;
}

.mp-btn {
  flex: 1;
  padding: 7px 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(124, 245, 255, 0.08);
  border: 1px solid rgba(124, 245, 255, 0.3);
  letter-spacing: 1px;
  transition: all 0.18s ease;
}

.mp-btn:hover {
  background: rgba(124, 245, 255, 0.22);
  color: var(--bg-0);
  background: var(--cyan);
  transform: translateY(-1px);
}

.mp-btn:active {
  transform: translateY(1px);
}

@media (max-width: 640px) {
  .music-player { width: 180px; left: 12px; bottom: 12px; }
  .session-timer { right: 12px; bottom: 12px; }
}

/* ===================================================
   SCREEN SHAKE
   =================================================== */
@keyframes screen-shake {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-3px, 1px); }
  20% { transform: translate(2px, -2px); }
  30% { transform: translate(-4px, 0); }
  40% { transform: translate(3px, 2px); }
  50% { transform: translate(-2px, -1px); }
  60% { transform: translate(1px, 2px); }
  70% { transform: translate(-3px, 0); }
  80% { transform: translate(2px, -1px); }
  90% { transform: translate(-1px, 1px); }
}

body.shake .game,
body.shake .hud { animation: screen-shake 0.4s ease-in-out; }

/* ---------- Typewrite effect marker ---------- */
.typewrite::after {
  content: '▌';
  color: var(--green);
  animation: blink-slow 0.8s step-end infinite;
  margin-left: 2px;
}

.typewrite.done::after { display: none; }
