

@import url('https://fonts.googleapis.com/css2?family=Libertinus+Serif:wght@400;600;700&family=Ubuntu:wght@400;700&family=Ubuntu+Mono&family=Pixelify+Sans&family=VT323&display=swap');

/* ── VARIABLES ───────────────────────────────────────────── */
:root {
  /* Two-tone palette: primary + dim */
  --ph:          #f0c677;
  --ph-dim:      #f0c677b7;
  --ph-faint:    rgba(240,198,119,0.06);
  --ph-glow:     rgba(240,198,119,0.15);

  /* Screen — pure black */
  --bg:          #000000;
  --bg-deep:     #000000;

  /* Outer void — black */
  --void:        #000000;
  --sepia-hi:    #f0c677;
  --sepia-mid:   rgba(240,198,119,0.35);
  --sepia-dim:   rgba(240,198,119,0.15);
  --sepia-star:  rgba(240,198,119,0.35);

  /* Windows — matches UI */
  --win-bg:      #000000;
  --win-border:  #f0c677;

  /* Layout */
  --tbh: 32px;

  /* Fonts */
  --serif:  'Libertinus Serif', Georgia, serif;
  --sans:   'Ubuntu', sans-serif;
  --mono:   'Ubuntu Mono', monospace;
  --pixel:  'Pixelify Sans', monospace;
  --vt:     'VT323', monospace;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--void);
  font-family: var(--sans);
  color: var(--ph);
}

/* Custom cursor */
body {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpolygon points='0,0 0,11 3,8 5,13 7,12 5,7 9,7' fill='%23f0c677' stroke='%23000' stroke-width='1'/%3E%3C/svg%3E") 0 0, auto;
}

/* ── THREE.JS CANVAS ──────────────────────────────────────── */
#three-canvas { position: fixed; inset: 0; z-index: 0; display: block; }


/* ── VOID PARTICLES ───────────────────────────────────────── */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  will-change: transform;
}

#particles::before {
  content: '';
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(circle at 20% 25%, rgba(240,198,119,0.08), transparent 45%),
    radial-gradient(circle at 82% 70%, rgba(240,198,119,0.05), transparent 40%);
  filter: blur(22px);
  opacity: 0.75;
}

.void-particle {
  position: absolute;
  width: 1.6px;
  height: 1.6px;
  border-radius: 50%;
  background: rgba(240,198,119,0.55);
  box-shadow: 0 0 8px rgba(240,198,119,0.35);
  opacity: 0;
  animation:
    pdrift-a linear infinite,
    ptwinkle var(--twinkle-duration, 4.2s) ease-in-out infinite;
}

.vp-layer-0 {
  width: 1px;
  height: 1px;
  opacity: 0.6;
}

.vp-layer-1 {
  width: 1.8px;
  height: 1.8px;
  background: rgba(240,198,119,0.7);
  box-shadow: 0 0 10px rgba(240,198,119,0.45);
  animation-name: pdrift-b, ptwinkle;
}

.vp-layer-2 {
  width: 2.5px;
  height: 2.5px;
  background: rgba(240,198,119,0.9);
  box-shadow: 0 0 16px rgba(240,198,119,0.55);
  animation-name: pdrift-c, ptwinkle;
}

@keyframes pdrift-a {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  12% { opacity: 0.42; }
  82% { opacity: 0.18; }
  100% {
    transform: translate3d(var(--drift-x, 20px), calc(-1 * var(--rise-vh, 95vh)), 0);
    opacity: 0;
  }
}

@keyframes pdrift-b {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  10% { opacity: 0.6; }
  72% { opacity: 0.26; }
  100% {
    transform: translate3d(calc(var(--drift-x, 20px) * -0.7), calc(-1 * var(--rise-vh, 95vh)), 0);
    opacity: 0;
  }
}

@keyframes pdrift-c {
  0% {
    transform: translate3d(0, 0, 0);
    opacity: 0;
  }
  14% { opacity: 0.75; }
  88% { opacity: 0.22; }
  100% {
    transform: translate3d(calc(var(--drift-x, 20px) * 0.5), calc(-1 * var(--rise-vh, 95vh)), 0);
    opacity: 0;
  }
}

@keyframes ptwinkle {
  0%, 100% { filter: brightness(0.75); }
  50% { filter: brightness(1.35); }
}

/* ── VOID ICON LAYER ──────────────────────────────────────── */
#void-layer { position: fixed; inset: 0; pointer-events: none; z-index: 15; }
.void-icon {
  position: absolute; pointer-events: all; display: none;
  flex-direction: column; align-items: center; cursor: pointer;
  transform: translate(-50%,-50%); user-select: none;
}
.void-icon-hit {
  width: 80px; height: 80px;
  background: transparent;
  pointer-events: all;
  clip-path: circle(50% at 50% 50%);
}
.vi-glyph {
  font-size: 26px; display: block; line-height: 1;
  filter: drop-shadow(0 0 8px var(--ph));
  transition: transform .15s, filter .15s;
}
.void-icon:hover .vi-glyph    { transform: scale(1.18); filter: drop-shadow(0 0 14px var(--ph)) brightness(1.2); }
.void-icon.selected .vi-glyph { filter: drop-shadow(0 0 18px var(--ph)) brightness(1.4); }
.void-icon:focus-visible .vi-glyph {
  transform: scale(1.22);
  filter: drop-shadow(0 0 16px var(--ph)) brightness(1.35);
}
.vi-label {
  font-family: var(--pixel); font-size: 5px; color: var(--ph);
  margin-top: 58px;
  letter-spacing: 1px; white-space: nowrap;
  text-shadow: 0 0 8px var(--ph); display: none;
  background: rgba(0,0,0,0.65); padding: 2px 5px;
}

/* ── SCREEN OVERLAY ───────────────────────────────────────── */
#screen-overlay {
  position: fixed;
  z-index: 10;
  overflow: hidden;
  background: none;
  pointer-events: all;
}
/* CRT scanlines on screen overlay — clip to desktop area */
#screen-overlay::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  bottom: var(--tbh);
  background: repeating-linear-gradient(
    to bottom, transparent 0, transparent 2px,
    rgba(0,0,0,.20) 2px, rgba(0,0,0,.20) 3px);
  pointer-events: none; z-index: 9000;
}
/* CRT vignette — now handled globally by #crt-scanlines::after */

/* Subtle dot grid on screen */
#desktop-grid {
  position: absolute; inset: 0; bottom: 26px; pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(240,198,119,0.07) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* ── BOOT SCREEN ──────────────────────────────────────────── */
#boot-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--tbh);
  background: transparent; z-index: 800;
  display: flex; flex-direction: column; align-items: flex-start;
  justify-content: flex-start; padding: 10px 13px; gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  scrollbar-width: none;
}
#boot-screen::-webkit-scrollbar { display: none; }
.boot-line {
  font-family: var(--mono); font-size: 10px; color: var(--ph);
  white-space: pre; line-height: 1.55; min-height: 1.55em;
}
.boot-line.ok     { color: var(--ph); }
.boot-line.dim    { color: var(--ph-dim); }
.boot-line.warn   { color: var(--ph); }
.boot-line.header { color: var(--ph); font-family: var(--pixel); font-size: 8px; letter-spacing: 2px; margin-bottom: 2px; }
.boot-line.cursor::after { content: '█'; animation: bl .7s steps(1) infinite; }
@keyframes bl { 0%,49%{opacity:1} 50%,100%{opacity:0} }

#boot-screen.boot-screen-splashing {
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.startup-splash {
  width: min(92%, 640px);
  border: 2px solid var(--ph);
  background: linear-gradient(180deg, rgba(8, 8, 8, 0.98) 0%, rgba(0, 0, 0, 0.98) 100%);
  box-shadow: 0 0 0 1px rgba(240, 198, 119, 0.35), 0 0 22px rgba(240, 198, 119, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 12px;
  animation: startup-panel-in 0.33s steps(5);
}

.startup-splash.is-exiting {
  animation: startup-panel-out 0.30s steps(5) forwards;
}

.startup-art {
  width: 100%;
  border: 1px solid rgba(240, 198, 119, 0.6);
  background: rgba(240, 198, 119, 0.04);
  min-height: 90px;
  max-height: min(58vh, 320px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  box-sizing: border-box;
  overflow: auto;
}

.startup-art-svg {
  width: 100%;
  max-width: 520px;
}

.startup-art-svg svg {
  width: 100%;
  height: auto;
  display: block;
}

.startup-art-img {
  width: 100%;
  max-width: 520px;
  max-height: 140px;
  object-fit: contain;
  image-rendering: pixelated;
  display: block;
}

.startup-art-ascii {
  margin: 0;
  color: var(--ph);
  font-family: "Cascadia Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: clamp(5px, 0.58vw, 8px);
  line-height: 1.2;
  letter-spacing: 0;
  font-variant-ligatures: none;
  white-space: pre;
  text-shadow: 0 0 8px rgba(240, 198, 119, 0.35);
}

@media (max-width: 1200px), (max-height: 760px) {
  .startup-splash {
    width: min(96%, 900px);
    padding: 10px 12px;
    gap: 6px;
  }

  .startup-art {
    min-height: 64px;
    max-height: min(52vh, 260px);
    padding: 6px;
  }

  .startup-title {
    font-size: 7px;
    letter-spacing: 1.4px;
  }

  .startup-subtitle,
  .startup-loading {
    font-size: 9px;
  }

  .boot-line {
    font-size: 9px;
    line-height: 1.45;
    min-height: 1.45em;
  }
}

@media (max-width: 760px), (max-height: 620px) {
  #boot-screen {
    padding: 8px 9px;
  }

  .startup-splash {
    width: 98%;
  }

  .startup-art-ascii {
    font-size: clamp(4px, 0.95vw, 6px);
  }

  .boot-line {
    font-size: 8px;
    line-height: 1.35;
    min-height: 1.35em;
  }
}

.startup-art-ascii.astraos-reveal {
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  animation:
    astraos-reveal-in 0.9s steps(36, end) forwards,
    astraos-glow-in 0.9s steps(8, end) forwards;
}

.startup-title {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--ph);
  text-transform: uppercase;
}

.startup-subtitle {
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(240, 198, 119, 0.9);
  letter-spacing: 0.5px;
  text-align: center;
}

.startup-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--ph);
}

.startup-loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.startup-loading-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ph);
  opacity: 0.2;
  animation: startup-dot 0.9s steps(4) infinite;
}

.startup-loading-dots span:nth-child(2) { animation-delay: 0.18s; }
.startup-loading-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes startup-panel-in {
  0% { opacity: 0; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes startup-panel-out {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.94); }
}

@keyframes startup-dot {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 1; }
}

@keyframes astraos-reveal-in {
  0% {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    transform: translateY(2px);
  }
  100% {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    transform: translateY(0);
  }
}

@keyframes astraos-glow-in {
  0% { text-shadow: 0 0 0 rgba(240, 198, 119, 0); }
  40% { text-shadow: 0 0 12px rgba(240, 198, 119, 0.6); }
  100% { text-shadow: 0 0 8px rgba(240, 198, 119, 0.35); }
}

#boot-screen.shutdown-active {
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: linear-gradient(180deg, rgba(6, 6, 6, 0.99) 0%, rgba(0, 0, 0, 0.99) 100%);
}

.shutdown-panel {
  width: min(90%, 540px);
  border: 2px solid var(--ph);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(5, 5, 5, 0.96) 100%);
  box-shadow: 0 0 0 1px rgba(240, 198, 119, 0.25), 0 0 26px rgba(240, 198, 119, 0.14);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  color: var(--ph);
  text-align: center;
  animation: shutdown-panel-in 0.3s steps(4);
}

.shutdown-panel.is-exiting {
  animation: shutdown-panel-out 0.36s steps(4) forwards;
}

.shutdown-logo {
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.shutdown-status {
  font-family: var(--mono);
  font-size: 12px;
}

.shutdown-sub,
.shutdown-footer {
  font-family: var(--mono);
  font-size: 10px;
  opacity: 0.92;
}

.shutdown-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

.shutdown-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ph);
  opacity: 0.2;
  animation: shutdown-dot 0.95s steps(4) infinite;
}

.shutdown-dots span:nth-child(2) { animation-delay: 0.16s; }
.shutdown-dots span:nth-child(3) { animation-delay: 0.32s; }

#boot-screen.shutdown-fading {
  transition: opacity 0.52s ease;
  opacity: 0;
}

@keyframes shutdown-panel-in {
  0% { opacity: 0; transform: scale(0.985); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes shutdown-panel-out {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.92); }
}

@keyframes shutdown-dot {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 1; }
}

/* ── DESKTOP ──────────────────────────────────────────────── */
#desktop { position: absolute; inset: 0; bottom: var(--tbh); overflow: hidden; display: none; }

/* ── DESKTOP ICONS ────────────────────────────────────────── */
.desk-icon {
  position: absolute; width: 60px; text-align: center; cursor: pointer;
  user-select: none; padding: 4px 2px 5px; border: 1px solid transparent;
  border-radius: 1px; z-index: 10;
}
.desk-icon:hover   { border-color: var(--ph-dim); background: var(--ph-faint); }
.desk-icon.selected { border-color: var(--ph); background: rgba(240,198,119,0.10); }
.desk-icon:focus-visible {
  outline: 2px solid var(--ph);
  outline-offset: 2px;
  border-color: var(--ph);
  background: rgba(240,198,119,0.12);
}
.desk-icon-em {
  font-size: 24px; display: block; line-height: 1;
  filter: drop-shadow(0 0 5px var(--ph)); margin: 0 auto;
}
.desk-icon:hover .desk-icon-em { animation: jit .1s steps(1) infinite; }
@keyframes jit {
  0%  { transform: translate(0,0); }   25% { transform: translate(-1px,1px); }
  50% { transform: translate(1px,-1px); } 75% { transform: translate(-1px,-1px); }
}
.desk-icon-lbl {
  font-family: var(--mono); font-size: 10px; color: var(--ph);
  margin-top: 3px; line-height: 1.2; text-shadow: 0 0 6px var(--ph);
  white-space: nowrap;
  word-break: normal;
  display: block;
}

/* ── TASKBAR ──────────────────────────────────────────────── */
#taskbar {
  position: absolute; bottom: 0; left: 0; right: 0; height: var(--tbh);
  background: var(--win-bg); border: 2px solid var(--win-border);
  display: flex; align-items: stretch; z-index: 50;
  box-shadow:
    0 0 0 1px rgba(240,198,119,0.08),
    0 0 20px rgba(240,198,119,0.06);
  filter: drop-shadow(0 0 1px rgba(240,198,119,0.7));
}

/* Shared section style */
.tb-section {
  display: flex; align-items: center; justify-content: center;
}

/* Left: Start */
.tb-left {
  border-right: 2px solid var(--ph-dim);
  padding: 0;
  flex-shrink: 0;
}
#start-btn {
  font-family: var(--pixel); font-size: 8px; color: #000;
  background: var(--ph); border: none; padding: 3px 12px;
  cursor: pointer; letter-spacing: 1px; white-space: nowrap; line-height: 2;
  height: 100%;
}
#start-btn:hover  { background: #fff; }
#start-btn:active { transform: scale(.95); }
#start-btn:focus-visible {
  outline: 2px solid var(--ph);
  outline-offset: -2px;
}

/* Middle: icon shortcuts */
.tb-mid {
  flex: 1; padding: 2px 4px;
  justify-content: flex-start;
}
.tb-icons-box {
  display: flex; align-items: stretch;
  border: 1px solid var(--ph-dim);
  height: 100%;
}
.tb-icon {
  font-family: var(--mono); font-size: 12px; color: var(--ph-dim);
  padding: 0 10px; cursor: pointer;
  display: flex; align-items: center;
  border-right: 1px solid var(--ph-dim);
  transition: all .1s; white-space: nowrap;
  background: transparent;
}
.tb-icon:last-child { border-right: none; }
.tb-icon:hover   { color: var(--ph); background: var(--ph-faint); }
.tb-icon.running { color: var(--ph); border-color: var(--ph); background: rgba(240,198,119,0.06); }
.tb-icon:focus-visible {
  outline: 2px solid var(--ph);
  outline-offset: -2px;
}

/* Right: Clock */
.tb-right {
  border-left: 2px solid var(--ph-dim);
  padding: 0 8px;
  flex-shrink: 0;
}
#taskbar-clock {
  font-family: var(--serif); font-size: 16px; font-weight: 600;
  color: var(--ph); white-space: nowrap; letter-spacing: 0.04em;
}

/* ── START MENU ───────────────────────────────────────────── */
#start-menu {
  position: absolute; bottom: var(--tbh); left: 0;
  width: 220px;
  background: #000; border: 2px solid var(--win-border);
  z-index: 60;
  display: none;
  flex-direction: column;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: none;
}
#start-menu::-webkit-scrollbar { display: none; }
#start-menu.open { display: flex; }

/* Header strip */
.sm-header {
  padding: 6px 10px;
  border-bottom: 2px solid var(--ph);
  background: #000;
}
.sm-header-name {
  font-family: var(--pixel); font-size: 8px; color: var(--ph);
  letter-spacing: 2px;
}

/* Sections */
.sm-section {
  border-bottom: 1px solid var(--ph-dim);
}
.sm-section:last-child { border-bottom: none; }
.sm-section-title {
  font-family: var(--pixel); font-size: 7px; color: var(--ph-dim);
  letter-spacing: 2px; padding: 6px 10px 2px;
}

/* Menu items */
.sm-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; cursor: pointer;
  font-family: var(--mono); font-size: 12px; color: var(--ph-dim);
  border: none; background: transparent;
  text-decoration: none;
  transition: all 0.08s;
}
.sm-item:hover {
  background: var(--ph-faint); color: var(--ph);
}
.sm-item:focus-visible {
  outline: 1px solid var(--ph);
  outline-offset: -1px;
  background: var(--ph-faint);
  color: var(--ph);
}
.sm-icon {
  width: 16px; text-align: center; font-size: 10px; flex-shrink: 0;
}
.sm-label { flex: 1; }
.sm-type {
  font-size: 9px; color: var(--ph-dim); opacity: 0.6;
  font-family: var(--mono);
}

/* CRT scanlines on start menu */
#start-menu::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom, transparent 0, transparent 2px,
    rgba(0,0,0,.12) 2px, rgba(0,0,0,.12) 3px);
  pointer-events: none; z-index: 1;
}

/* ── PROJECT APP (inside popup-win) ────────────────────────── */
#winbody-project {
  padding: 0; position: relative; display: flex; flex-direction: column;
}

/* empty */
#proj-empty {
  position: absolute; inset: 0; display: flex;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
}
.pe-title { font-family: var(--pixel); font-size: 7px; color: var(--ph-dim); letter-spacing: 2px; }
.pe-sub   { font-family: var(--mono); font-size: 12px; color: var(--ph-dim); text-align: center; }

/* preview */
#proj-preview { position: absolute; inset: 0; display: none; flex-direction: column; cursor: pointer; }
#proj-preview:focus-visible {
  outline: 2px solid var(--ph);
  outline-offset: -2px;
}
#prev-wrap {
  flex: 1; position: relative; overflow: hidden;
  display: flex; align-items: stretch;
}
#prev-wrap img,
#prev-wrap canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; object-fit: cover; }
#prev-bar {
  padding: 4px 10px; border-top: 1px solid var(--ph); background: #000;
  display: flex; align-items: center; gap: 8px; font-family: var(--mono);
  font-size: 9px; color: var(--ph-dim); flex-shrink: 0;
}
#prev-title { color: var(--ph); font-size: 11px; }
.prev-hint  { margin-left: auto; font-size: 9px; }

/* info */
#proj-info {
  position: absolute; inset: 0; display: none; flex-direction: column;
  overflow: hidden;
}
#proj-info-content {
  flex: 1; padding: 18px 20px; overflow-y: auto; position: relative; z-index: 8002;
  scrollbar-width: none;
}
#proj-info-content::-webkit-scrollbar { display: none; }
#proj-info-scrollbar {
  width: 8px;
  margin: 8px 8px 8px 0;
  border: 1px solid var(--ph-dim);
  display: flex; flex-direction: column; align-items: center;
  padding: 0; gap: 0; position: relative; background: #000;
  flex-shrink: 0; z-index: 8002; overflow: hidden; cursor: ns-resize;
  box-sizing: content-box;
}
#proj-info h1 {
  font-family: var(--serif); font-size: 22px; font-weight: 700;
  color: var(--ph); letter-spacing: 0.05em; margin-bottom: 4px;
  text-shadow: 0 0 16px var(--ph-glow);
}
.info-sub  { font-family: var(--mono); font-size: 10px; color: var(--ph-dim); margin-bottom: 14px; letter-spacing: 1px; }
#proj-info-content p {
  font-family: var(--sans); font-size: 13px; font-weight: 300;
  color: var(--ph); margin-bottom: 8px; line-height: 1.7;
  opacity: 0.9;
}
.info-tags  { display: flex; flex-wrap: wrap; gap: 4px; margin: 12px 0; }
.itag {
  border: 1px solid var(--ph-dim); padding: 1px 8px;
  font-family: var(--mono); font-size: 8.5px; color: var(--ph-dim);
  letter-spacing: 0.5px;
}
.info-meta {
  font-family: var(--mono); font-size: 10px; color: var(--ph-dim);
  border-top: 1px solid var(--ph-dim); padding-top: 10px; margin-top: 10px;
}
.info-link {
  display: inline-block; margin-top: 14px; border: 1px solid var(--ph);
  padding: 6px 16px; font-family: var(--pixel); font-size: 5.5px;
  color: var(--ph); text-decoration: none; letter-spacing: 1px;
}
.info-link:hover { background: var(--ph); color: #000; }
.info-hint { font-family: var(--mono); font-size: 9px; color: var(--ph-dim); margin-top: 14px; }


/* ── POPUP WINDOWS ────────────────────────────────────────── */
/*
   Design language:
   - Pure black background
   - #f0c677 border (outline only — no fill on titlebar)
   - Serif headings, sans-serif body
   - Custom dot scrollbar on right
*/

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

.popup-win {
  position: fixed;
  background: var(--win-bg);
  border: 2px solid var(--win-border);
  min-width: 280px; max-width: 440px;
  pointer-events: all;
  display: none;
  animation: wopen .12s steps(3);
  min-height: 180px;
  overflow: hidden; /* clip children */
  flex-direction: column;
}
#win-project { max-width: none; min-height: 340px; }
.popup-win.open     { display: flex; }
.popup-win.focused  { border-color: var(--ph); }
.popup-win.maximised {
  max-width: none; min-width: 0;
  border: none;
}
.popup-win.maximised .win-body { max-height: none; }
@keyframes wopen { 0%{transform:scale(.93);opacity:0} 100%{transform:scale(1);opacity:1} }

/* Title bar — just a border line, no fill */
.win-bar {
  background: #000;
  border-bottom: 2px solid var(--ph-dim);
  color: var(--ph);
  padding: 2px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: grab; user-select: none;
  font-family: var(--pixel); font-size: 5.5px; letter-spacing: 1px;
  position: sticky; top: 0; z-index: 8002; flex-shrink: 0;
  min-height: 30px;
}
.win-bar:active { cursor: grabbing; }
.popup-win.focused .win-bar { border-bottom-color: var(--ph); color: var(--ph); }
.win-title {
  flex: 1; font-family: var(--serif); font-size: 18px; font-weight: 600;
  height: 20px;
  margin-right: 2px;
  padding: 0 4px;
  border: 1px solid var(--ph-dim);
  background: #000;
  display: flex; align-items: center;
}
.popup-win.focused .win-title { border-color: var(--ph); }
.win-btn {
  width: 20px;
  height: 20px;
  margin-left: 2px;
  flex-shrink: 0;
  background: #000;
  border: 1px solid var(--ph-dim);
  cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ph); font-family: var(--mono);
}
.win-btn:hover { border-color: var(--ph); background: var(--ph-faint); }
.popup-win.focused .win-btn { border-color: var(--ph); }
.win-btn:focus-visible,
.info-link:focus-visible,
.dl-btn:focus-visible,
.win-body a:focus-visible {
  outline: 2px solid var(--ph);
  outline-offset: 1px;
}

/* Window body + scrollable area container */
.win-body-wrap {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* The actual scrollable content */
.win-body {
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
  position: relative;
  z-index: 8002;
  max-height: none;
  /* hide native scrollbar */
  scrollbar-width: none;
}
.win-body::-webkit-scrollbar { display: none; }

/* ── CUSTOM DOT SCROLLBAR ─────────────────────────────────── */
.win-scrollbar {
  width: 8px;
  margin: 2px;
  border: 1px solid var(--ph-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  gap: 0;
  position: relative;
  background: #000;
  flex-shrink: 0;
  z-index: 8002;
  overflow: hidden;
  cursor: ns-resize;
  /* width is the usable lane (dot + left/right gaps); border is extra */
  box-sizing: content-box;
}
.scrollbar-dot {
  width: 4px;
  height: 4px;
  border-radius: 0;
  background: transparent;
  border: 1px solid var(--ph-dim);
  box-sizing: border-box;
  flex-shrink: 0;
  transition: background 0.1s, transform 0.1s, box-shadow 0.1s;
  box-shadow: none;
}
.scrollbar-dot.active {
  background: var(--ph);
  border-color: var(--ph);
  transform: none;
  box-shadow: 0 0 8px var(--ph);
}

#proj-info-scrollbar .scrollbar-dot {
  width: 4px;
  height: 4px;
  border-radius: 0;
  background: transparent;
  border: 1px solid var(--ph-dim);
  box-sizing: border-box;
  flex-shrink: 0;
  transition: background 0.1s, transform 0.1s, box-shadow 0.1s;
  box-shadow: none;
}
#proj-info-scrollbar .scrollbar-dot.active {
  background: var(--ph);
  border-color: var(--ph);
  transform: none;
  box-shadow: 0 0 8px var(--ph);
}

/* Window typography */
.win-body h2 {
  font-family: var(--serif); font-size: 20px; font-weight: 600;
  margin-bottom: 12px; letter-spacing: 0.03em;
  color: var(--ph);
  text-shadow: 0 0 14px var(--ph-glow);
  border-bottom: 2px solid var(--ph-dim);
  filter: drop-shadow(0 1px 1px rgba(240,198,119,0.65));
  padding-bottom: 6px;
}
.win-body h3 {
  font-family: var(--serif); font-size: 14px; font-weight: 600;
  color: var(--ph); margin-bottom: 8px; letter-spacing: 0.04em;
}
.win-body p {
  font-family: var(--sans); font-size: 12px; font-weight: 300;
  margin-bottom: 8px; line-height: 1.7; color: var(--ph); opacity: 0.88;
}
.win-body a { color: var(--ph); text-decoration: none; border-bottom: 1px solid var(--ph-dim); }
.win-body a:hover { border-bottom-color: var(--ph); }
.wsep { border: none; border-top: 1px solid var(--ph-dim); margin: 12px 0; }

.win-section-box {
  border: 1px solid var(--ph-dim);
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(240,198,119,0.03);
}
.win-section-box h2,
.win-section-box h3 {
  margin-top: 0;
}
.win-section-box:last-child {
  margin-bottom: 0;
}

/* Skill tags */
.wtag {
  display: inline-block; border: 2px solid var(--ph-dim);
  padding: 1px 8px; font-size: 8.5px; margin: 2px 2px 2px 0;
  filter: drop-shadow(0 0 1px rgba(240,198,119,0.6));
  color: var(--ph-dim); font-family: var(--mono); letter-spacing: 0.5px;
}

/* Contact links */
.link-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 2px solid var(--ph-faint);
  font-family: var(--sans); font-size: 12px;
  filter: drop-shadow(0 1px 1px rgba(240,198,119,0.5));
}
.lr-icon  { width: 20px; text-align: center; font-size: 14px; }
.lr-lbl   { color: var(--ph-dim); font-size: 10px; min-width: 64px; font-family: var(--mono); letter-spacing: 0.5px; }
.wnote    { font-size: 11px !important; color: var(--ph-dim) !important; margin-top: 10px; font-family: var(--mono) !important; }

/* CV entries */
.cv-section {
  border: 1px solid var(--ph-dim);
  padding: 10px 12px;
  margin-bottom: 10px;
  background: rgba(240,198,119,0.03);
}
.cv-section h2 {
  margin-top: 0;
}
.cv-e      { margin-bottom: 14px; }
.cv-section .cv-e:last-child { margin-bottom: 0; }
.cv-role   { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ph); }
.cv-period { font-family: var(--mono); font-size: 9px; color: var(--ph-dim); margin: 3px 0; letter-spacing: 0.5px; }
.cv-desc   { font-family: var(--sans); font-size: 12px; color: var(--ph); line-height: 1.5; opacity: 0.85; }
.cv-award  { font-family: var(--sans); font-size: 12px; color: var(--ph); margin-bottom: 5px; line-height: 1.5; }
.cv-section .cv-award:last-child { margin-bottom: 0; }
.cv-award::before { content: '- '; opacity: 0.5; }

.dl-btn {
  display: inline-block; margin-top: 14px; border: 1px solid var(--ph);
  padding: 6px 16px; font-family: var(--pixel); font-size: 5.5px;
  color: var(--ph); text-decoration: none; letter-spacing: 1px;
}
.dl-btn:hover { background: var(--ph); color: #000; border-color: var(--ph); }

/* ── TOAST ────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 50px; right: 18px;
  background: rgba(0,0,0,0.97); border: 1px solid var(--sepia-mid);
  color: var(--sepia-hi); font-family: var(--mono); font-size: 10px;
  padding: 7px 12px; z-index: 9000; display: none; max-width: 220px;
  line-height: 1.4; box-shadow: 0 0 20px rgba(200,180,138,.1);
}

/* ── EXTERNAL LINKS BAR ─────────────────────────────────── */
#neocities-bar {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 9100;
  width: auto;
  max-width: calc(100vw - 12px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.neo-btn {
  flex: none;
  display: block;
  line-height: 0;
  text-decoration: none;
  padding: 0;
  border: none;
  background: transparent;
  transition: transform 0.12s;
  overflow: hidden;
}

.neo-btn-img {
  width: 96px;
  height: 34px;
  display: block;
  image-rendering: auto;
  object-fit: contain;
}

.neo-btn:hover,
.neo-btn:focus-visible {
  transform: translateY(-1px);
}

.neo-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 760px) {
  #neocities-bar {
    width: auto;
    max-width: calc(100vw - 8px);
    bottom: 6px;
    gap: 0;
  }

  .neo-btn {
    transform-origin: center;
  }

  .neo-btn-img {
    width: 80px;
    height: 28px;
  }
}

/* ── CRT GLOBAL SCANLINES (covers screen + popups) ──────── */
#crt-scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 9000;
  background: repeating-linear-gradient(
    to bottom, transparent 0, transparent 2px,
    rgba(0,0,0,.18) 2px, rgba(0,0,0,.18) 3px);
}
#crt-scanlines::after {
  content: ''; position: fixed; inset: 0;
  pointer-events: none;
}
/* ── CRT FLICKER ──────────────────────────────────────────── */
#crt-flicker { position: fixed; inset: 0; pointer-events: none; z-index: 9999; animation: flick 14s steps(1) infinite; }
@keyframes flick {
  0%,94%,100% { opacity: 0; }
  95%   { opacity: .022; background: #fff; }
  96%   { opacity: 0; }
  97.5% { opacity: .012; background: #fff; }
}

/* ── POWER HOVER FINGER ─────────────────────────────────── */
#power-finger {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 170px;
  height: auto;
  z-index: 9200;
  pointer-events: none;
  opacity: 0;
  --finger-offset-x: 0px;
  --finger-offset-y: 0px;
  --finger-rise-px: 140px;
  transform: translate(
    calc(-50% + var(--finger-offset-x)),
    calc(-50% + var(--finger-offset-y) + var(--finger-rise-px))
  );
  transition: none;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.6));
}

#power-finger.show {
  transform: translate(
    calc(-50% + var(--finger-offset-x)),
    calc(-50% + var(--finger-offset-y) + var(--finger-rise-px))
  );
}

/* ── SHARED ───────────────────────────────────────────────── */
.blink { animation: bl .9s steps(1) infinite; }

/* Native scrollbar fallback (elements without custom scrollbar) */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ph-dim); }

/* ── DEBUG POSITIONING PANEL ──────────────────────────────── */
#debug-positioning-panel {
  position: fixed;
  bottom: 40px;
  right: 20px;
  width: 320px;
  max-height: 80vh;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid var(--ph);
  border-radius: 4px;
  z-index: 10000;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ph);
  display: none;
  box-shadow: 0 0 20px rgba(240, 198, 119, 0.3);
}

#debug-positioning-panel .debug-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ph-dim);
  background: rgba(240, 198, 119, 0.05);
}

#debug-positioning-panel .debug-header h3 {
  margin: 0;
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;
}

#debug-close-btn {
  background: transparent;
  border: 1px solid var(--ph-dim);
  color: var(--ph);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 10px;
  border-radius: 2px;
}

#debug-close-btn:hover {
  background: var(--ph-faint);
  border-color: var(--ph);
}

.debug-divider {
  height: 1px;
  background: var(--ph-dim);
  margin: 4px 0 0 0;
}

.debug-section-title {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 6px 10px 0;
  color: var(--ph);
  opacity: 0.7;
}

.debug-controls {
  padding: 10px;
  max-height: 250px;
  overflow-y: auto;
}

.debug-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.debug-group label {
  min-width: 110px;
  font-size: 10px;
}

.debug-group input[type="range"] {
  flex: 1;
  height: 4px;
  cursor: pointer;
  accent-color: var(--ph);
}

.debug-group input.debug-num {
  width: 70px;
  background: #111;
  color: var(--ph);
  border: 1px solid var(--ph-dim);
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 4px;
  text-align: right;
}

.debug-group span {
  min-width: 35px;
  text-align: right;
  font-size: 10px;
  color: var(--ph-dim);
}

.debug-output {
  border-top: 1px solid var(--ph-dim);
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
}

.debug-output-label {
  font-size: 9px;
  font-weight: bold;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

#debug-settings-display {
  font-family: var(--mono);
  font-size: 9px;
  background: rgba(240, 198, 119, 0.03);
  border: 1px solid var(--ph-dim);
  padding: 6px;
  border-radius: 2px;
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--ph-dim);
  line-height: 1.3;
}

#debug-copy-btn {
  width: 100%;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--ph-dim);
  color: var(--ph);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  border-radius: 2px;
  transition: all 0.2s;
}

#debug-copy-btn:hover {
  background: var(--ph-faint);
  border-color: var(--ph);
}