/* ============================================================
   VainOS 2.0 — vainos2.css
   Holographic shell: 3D scene, volumetric portrait, HUD glass.
   --mx / --my (-1..1) are set by js/main.js from the pointer.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
  --bg: #020409;
  --accent: #4df3c3;
  --accent-2: #7aa2ff;
  --accent-3: #b66bff;
  --hud: rgba(77, 243, 195, 0.55);
  --warn: #ffd166;
  --glass: rgba(6, 14, 22, 0.88);
  --glass-light: rgba(120, 220, 255, 0.05);
  --border: rgba(77, 243, 195, 0.16);
  --border-strong: rgba(77, 243, 195, 0.38);
  --text: #e8f2f5;
  --text-dim: #8b9aa7;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 10px;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 40px rgba(77, 243, 195, 0.06);
  --mx: 0;
  --my: 0;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--glass-light); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }

/* ============================ BOOT ============================ */
#boot {
  position: fixed; inset: 0; z-index: 9999;
  background: #010206;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: opacity 0.6s ease;
}
#boot.fade-out { opacity: 0; pointer-events: none; }
#boot-log {
  font-family: var(--mono);
  font-size: 13px;
  color: #9fb3c8;
  width: min(640px, 90vw);
  height: 280px;
  overflow: hidden;
}
#boot-log div { white-space: pre; }
#boot-log div:last-child { color: var(--accent); }
#boot-logo {
  margin-top: 28px;
  opacity: 0;
  transform: scale(0.92);
  transition: all 0.5s ease;
  text-align: center;
}
#boot-logo.show { opacity: 1; transform: scale(1); }
#boot-logo .glyph {
  font-size: 56px;
  color: var(--accent);
  text-shadow: 0 0 32px rgba(77, 243, 195, 0.7);
  display: block;
}
#boot-logo .name {
  font-family: var(--mono);
  letter-spacing: 0.5em;
  margin-top: 12px;
  font-size: 18px;
  color: var(--text);
  animation: glitch 2.4s steps(1) infinite;
}
#boot-logo .ver { color: var(--accent-3); letter-spacing: 0.1em; }
@keyframes glitch {
  0%, 92% { text-shadow: none; transform: none; }
  93% { text-shadow: -2px 0 var(--accent-3), 2px 0 var(--accent); transform: translateX(1px); }
  94% { text-shadow: 2px 0 var(--accent-3), -2px 0 var(--accent); transform: translateX(-1px) skewX(2deg); }
  95% { text-shadow: none; transform: none; }
}
#boot-logo .bar {
  margin: 20px auto 0;
  width: 220px; height: 3px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
#boot-logo .bar::after {
  content: "";
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  transform-origin: left;
  animation: bootbar 1.3s ease forwards;
}
@keyframes bootbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
#boot-skip {
  position: absolute; bottom: 24px;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
}

/* ============================ BACKDROP ============================ */
#os { opacity: 0; transition: opacity 0.9s ease; height: 100%; }
#os.ready { opacity: 1; }

#stars { position: fixed; inset: 0; z-index: 0; }
#nebula {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(1100px 700px at 72% 90%, rgba(77, 243, 195, 0.07), transparent 60%),
    radial-gradient(900px 650px at 18% 8%, rgba(122, 162, 255, 0.08), transparent 55%),
    radial-gradient(700px 500px at 88% 12%, rgba(182, 107, 255, 0.05), transparent 60%);
  transform: translate(calc(var(--mx) * -10px), calc(var(--my) * -8px));
}

/* ============================ 3D SCENE ============================ */
#space {
  position: fixed; inset: 0; z-index: 2;
  perspective: 1300px;
  pointer-events: none;
}
#scene {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--my) * -1.8deg)) rotateY(calc(var(--mx) * 2.6deg));
  will-change: transform;
}
#grid-floor {
  position: absolute;
  left: -40%; right: -40%; bottom: -42%;
  height: 80%;
  transform: rotateX(76deg);
  background-image:
    repeating-linear-gradient(90deg, rgba(77, 243, 195, 0.16) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(0deg, rgba(77, 243, 195, 0.13) 0 1px, transparent 1px 90px);
  animation: gridflow 4.5s linear infinite;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 30%, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 30%, #000 78%, transparent 100%);
}
@keyframes gridflow { to { background-position: 0 90px, 0 90px; } }

/* ============================ HERO ============================ */
#hero3d {
  position: absolute; inset: 32px 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 6vw, 110px);
  padding: 0 4vw;
  user-select: none;
}
#hero-text { max-width: 480px; }
#hero-text .hero-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.35em;
  color: var(--accent);
  margin-bottom: 16px;
}
#hero-text h1 {
  font-size: clamp(46px, 7.5vw, 96px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 0.98;
  background: linear-gradient(125deg, #fff 25%, var(--accent-2) 65%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 30px rgba(122, 162, 255, 0.25));
}
#hero-text .hero-tagline {
  margin-top: 18px;
  font-size: clamp(12px, 1.5vw, 15px);
  color: var(--text-dim);
  font-family: var(--mono);
  line-height: 1.9;
}
#hero-text .hero-hint {
  margin-top: 26px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-dim);
  animation: pulse 2.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.85; } }

/* ============================ HOLOGRAM ============================ */
#holo {
  position: relative;
  width: min(360px, 34vw);
  aspect-ratio: 2 / 3;
  transform: rotateY(calc(var(--mx) * 9deg));
  transform-style: preserve-3d;
  flex-shrink: 0;
}

/* light cone rising from the base ring */
.holo-beam {
  position: absolute;
  left: 50%; bottom: 4%;
  width: 86%; height: 102%;
  transform: translateX(-50%);
  background: linear-gradient(to top,
    rgba(77, 243, 195, 0.16),
    rgba(77, 243, 195, 0.045) 45%,
    transparent 85%);
  clip-path: polygon(32% 100%, 68% 100%, 100% 0%, 0% 0%);
  filter: blur(6px);
  animation: beam 5s ease-in-out infinite;
}
@keyframes beam { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }

.holo-figure {
  position: absolute;
  left: 50%; bottom: 7%;
  width: 88%; height: 92%;
  margin-left: -44%;
  animation: float 6.5s ease-in-out infinite;
  will-change: transform;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

.holo-img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: bottom center;
}
.holo-img.base {
  filter: grayscale(0.35) sepia(0.9) hue-rotate(118deg) saturate(2.4)
          brightness(1.18) contrast(1.02)
          drop-shadow(0 0 22px rgba(77, 243, 195, 0.4));
  opacity: 0.95;
  animation: flicker 7s steps(1) infinite;
}
@keyframes flicker {
  0%, 88%, 92%, 100% { opacity: 0.95; }
  89% { opacity: 0.72; }
  90% { opacity: 0.99; }
  91% { opacity: 0.8; }
}
.holo-img.ghost {
  opacity: 0.22;
  mix-blend-mode: screen;
}
.holo-img.g1 {
  filter: grayscale(1) sepia(1) hue-rotate(190deg) saturate(5) brightness(1.3);
  animation: jitter1 6s steps(1) infinite;
}
.holo-img.g2 {
  filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(5) brightness(1.3);
  animation: jitter2 9s steps(1) infinite;
}
@keyframes jitter1 {
  0%, 80%, 100% { transform: translateX(-2px); }
  81% { transform: translateX(-7px) skewX(1.5deg); }
  83% { transform: translateX(-3px); }
}
@keyframes jitter2 {
  0%, 64%, 100% { transform: translateX(2px); }
  65% { transform: translateX(8px) skewX(-2deg); }
  67% { transform: translateX(3px); }
}

/* static scanlines over the figure */
.holo-scan {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg,
    rgba(2, 6, 12, 0.28) 0 1px, transparent 1px 4px);
  mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(to top, #000 70%, transparent);
  mask-image: linear-gradient(to top, #000 92%, transparent);
}
/* travelling scan band */
.holo-band {
  position: absolute; left: 0; right: 0; height: 9%;
  top: -10%;
  background: linear-gradient(to bottom,
    transparent, rgba(150, 255, 226, 0.22), transparent);
  animation: band 4.2s linear infinite;
}
@keyframes band { 0% { top: -10%; } 100% { top: 105%; } }

.holo-reflection {
  position: absolute;
  left: 50%; bottom: -46%;
  width: 88%; height: 60%;
  margin-left: -44%;
  object-fit: contain;
  object-position: top center;
  transform: scaleY(-1);
  filter: grayscale(0.4) sepia(0.9) hue-rotate(118deg) saturate(2) brightness(1.1) blur(3px);
  opacity: 0.16;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 55%);
  mask-image: linear-gradient(to bottom, #000, transparent 55%);
  pointer-events: none;
}

/* base rings (lying flat on the floor) */
.holo-ring {
  position: absolute;
  left: 50%; bottom: 0;
  border-radius: 50%;
  transform: translateX(-50%) rotateX(76deg);
  border: 1px solid rgba(77, 243, 195, 0.55);
  box-shadow: 0 0 18px rgba(77, 243, 195, 0.45), inset 0 0 18px rgba(77, 243, 195, 0.3);
}
.holo-ring.r1 { width: 78%; height: 60px; animation: ringpulse 3s ease-in-out infinite; }
.holo-ring.r2 { width: 56%; height: 42px; bottom: 8px; opacity: 0.6; animation: ringpulse 3s ease-in-out 0.6s infinite; }
.holo-ring.r3 { width: 96%; height: 74px; bottom: -7px; opacity: 0.3; animation: ringspin 14s linear infinite; border-style: dashed; }
@keyframes ringpulse {
  0%, 100% { box-shadow: 0 0 14px rgba(77, 243, 195, 0.35), inset 0 0 14px rgba(77, 243, 195, 0.2); }
  50% { box-shadow: 0 0 30px rgba(77, 243, 195, 0.65), inset 0 0 26px rgba(77, 243, 195, 0.4); }
}
@keyframes ringspin {
  from { transform: translateX(-50%) rotateX(76deg) rotateZ(0deg); }
  to { transform: translateX(-50%) rotateX(76deg) rotateZ(360deg); }
}
.holo-base-glow {
  position: absolute;
  left: 50%; bottom: -16px;
  width: 110%; height: 70px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(77, 243, 195, 0.3), transparent 65%);
  filter: blur(8px);
}
.holo-label {
  position: absolute;
  left: 50%; bottom: -84px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  line-height: 1.9;
  text-align: center;
  color: rgba(77, 243, 195, 0.75);
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(77, 243, 195, 0.5);
}

/* materialise on first reveal */
#os.ready .holo-figure {
  animation: float 6.5s ease-in-out 1.4s infinite, materialize 1.4s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes materialize {
  0% { clip-path: inset(100% 0 0 0); filter: brightness(3); opacity: 0; }
  60% { clip-path: inset(0 0 0 0); opacity: 1; }
  72% { filter: brightness(1.9); }
  100% { clip-path: inset(0 0 0 0); filter: brightness(1); opacity: 1; }
}

/* ============================ MENUBAR ============================ */
#menubar {
  position: fixed; top: 0; left: 0; right: 0; height: 34px;
  z-index: 500;
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 16px;
  background: linear-gradient(rgba(2, 6, 12, 0.85), rgba(2, 6, 12, 0.55));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
#menu-logo {
  font-family: var(--mono); font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.12em;
  padding: 2px 8px;
  border-radius: 6px;
  text-shadow: 0 0 14px rgba(77, 243, 195, 0.5);
}
#menu-logo:hover { background: var(--glass-light); }
#menu-sub { color: var(--text-dim); font-size: 12px; font-family: var(--mono); }
#menubar .spacer { flex: 1; }
#menu-holo {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--accent);
  display: flex; align-items: center; gap: 7px;
}
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
#menu-badge {
  font-family: var(--mono); font-size: 11px;
  color: var(--accent);
  border: 1px solid rgba(77, 243, 195, 0.35);
  padding: 1px 8px;
  border-radius: 99px;
}
#menu-clock { font-family: var(--mono); font-size: 12px; color: var(--text-dim); white-space: pre; }

/* ============================ DESKTOP & RAIL ============================ */
#desktop {
  position: fixed; inset: 34px 0 0 0;
  z-index: 10;
  perspective: 1500px;
}
#desktop-icons {
  position: absolute; top: 26px; left: 20px;
  display: flex; flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 7px;
  z-index: 1;
  max-height: calc(100% - 140px);
  transform: perspective(900px) rotateY(11deg);
  transform-origin: left center;
  transform-style: preserve-3d;
}
.desktop-icon {
  display: flex; flex-direction: column; align-items: center;
  gap: 7px;
  width: 92px;
  padding: 12px 6px 10px;
  border-radius: 12px;
  transition: background 0.15s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateZ(0);
}
.desktop-icon:hover, .desktop-icon:focus-visible {
  background: rgba(77, 243, 195, 0.06);
  outline: none;
  transform: translateZ(34px);
}
.di-glyph {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(120, 220, 255, 0.10), rgba(120, 220, 255, 0.02));
  border: 1px solid var(--border-strong);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 14px rgba(77, 243, 195, 0.12);
  color: var(--accent);
}
.di-glyph svg { width: 22px; height: 22px; }
.di-label {
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--text);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* ============================ WINDOWS ============================ */
.window {
  position: absolute;
  display: flex; flex-direction: column;
  background: var(--glass);
  backdrop-filter: blur(26px) saturate(1.3);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  transition: opacity 0.3s ease, transform 0.34s cubic-bezier(0.2, 0.9, 0.27, 1.08);
}
/* HUD corner brackets */
.window::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    linear-gradient(var(--hud) 0 0) top left / 20px 2px,
    linear-gradient(var(--hud) 0 0) top left / 2px 20px,
    linear-gradient(var(--hud) 0 0) top right / 20px 2px,
    linear-gradient(var(--hud) 0 0) top right / 2px 20px,
    linear-gradient(var(--hud) 0 0) bottom left / 20px 2px,
    linear-gradient(var(--hud) 0 0) bottom left / 2px 20px,
    linear-gradient(var(--hud) 0 0) bottom right / 20px 2px,
    linear-gradient(var(--hud) 0 0) bottom right / 2px 20px;
  background-repeat: no-repeat;
  opacity: 0.45;
  transition: opacity 0.2s;
}
.window.focused::after { opacity: 1; }
.window.focused {
  border-color: var(--border-strong);
  box-shadow: var(--shadow), 0 0 50px rgba(77, 243, 195, 0.1);
}
.window.opening { opacity: 0; transform: translateZ(-280px) rotateX(10deg) scale(0.88); }
.window.closing { opacity: 0; transform: translateZ(-160px) scale(0.92); pointer-events: none; }
.window.minimized { display: none; }
.window.dragging { transition: none; }
.window.maximized {
  left: 0 !important; top: 0 !important;
  width: 100% !important; height: 100% !important;
  border-radius: 0;
}

.win-titlebar {
  display: flex; align-items: center;
  height: 40px;
  padding: 0 12px;
  flex-shrink: 0;
  cursor: grab;
  background: linear-gradient(rgba(120, 220, 255, 0.05), rgba(120, 220, 255, 0.01));
  border-bottom: 1px solid var(--border);
  touch-action: none;
  user-select: none;
}
.window.dragging .win-titlebar { cursor: grabbing; }
.win-lights { display: flex; gap: 6px; width: 70px; justify-content: flex-end; }
.light {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  background: transparent;
  border: 1px solid rgba(120, 220, 255, 0.18);
  color: rgba(127, 215, 232, 0.7);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.light svg { width: 11px; height: 11px; display: block; }
.light:hover {
  color: var(--accent, #7fd7e8);
  border-color: rgba(120, 220, 255, 0.55);
  background: rgba(120, 220, 255, 0.08);
  box-shadow: 0 0 8px rgba(120, 220, 255, 0.35);
}
.light.close:hover {
  color: #ff6b63;
  border-color: rgba(255, 107, 99, 0.6);
  background: rgba(255, 107, 99, 0.08);
  box-shadow: 0 0 8px rgba(255, 107, 99, 0.4);
}
.win-title {
  flex: 1;
  text-align: center;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.win-title-icon svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--accent); }
.win-titlebar-spacer { width: 70px; }
.win-body {
  flex: 1;
  overflow: auto;
  padding: 22px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(77, 243, 195, 0.25) transparent;
}
.win-body::-webkit-scrollbar { width: 8px; }
.win-body::-webkit-scrollbar-thumb { background: rgba(77, 243, 195, 0.18); border-radius: 8px; }
.win-resize {
  position: absolute;
  right: 0; bottom: 0;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  touch-action: none;
  z-index: 6;
  background: linear-gradient(135deg, transparent 50%, rgba(77, 243, 195, 0.4) 50%);
  border-bottom-right-radius: var(--radius);
}

/* ============================ DOCK ============================ */
#dock {
  position: fixed;
  bottom: 16px; left: 50%;
  transform: translateX(-50%) perspective(700px) rotateX(16deg);
  transform-style: preserve-3d;
  z-index: 600;
  display: flex; align-items: flex-end;
  gap: 6px;
  padding: 9px 13px;
  background: rgba(4, 10, 18, 0.6);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 30px rgba(77, 243, 195, 0.06);
}
.dock-item {
  position: relative;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--text);
  background: linear-gradient(145deg, rgba(120, 220, 255, 0.09), rgba(120, 220, 255, 0.02));
  border: 1px solid var(--border);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.15s, box-shadow 0.2s;
  transform: translateZ(0);
}
.dock-item svg { width: 21px; height: 21px; }
.dock-item:hover {
  transform: translateZ(26px) translateY(-4px);
  color: var(--accent);
  box-shadow: 0 0 18px rgba(77, 243, 195, 0.25);
}
.dock-tip {
  position: absolute;
  bottom: 60px; left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  background: rgba(2, 6, 12, 0.94);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--mono); font-size: 11px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 0.12s;
}
.dock-item:hover .dock-tip { opacity: 1; }
.dock-dot {
  position: absolute;
  bottom: -6px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}
.dock-item.open .dock-dot { opacity: 1; }
.dock-item.minimized .dock-dot { background: var(--warn); box-shadow: 0 0 6px var(--warn); }

/* ============================ HUD CORNERS ============================ */
.hud-corner {
  position: fixed;
  width: 26px; height: 26px;
  z-index: 450;
  pointer-events: none;
  opacity: 0.5;
}
.hud-corner.tl { top: 44px; left: 12px; border-top: 2px solid var(--hud); border-left: 2px solid var(--hud); }
.hud-corner.tr { top: 44px; right: 12px; border-top: 2px solid var(--hud); border-right: 2px solid var(--hud); }
.hud-corner.bl { bottom: 12px; left: 12px; border-bottom: 2px solid var(--hud); border-left: 2px solid var(--hud); }
.hud-corner.br { bottom: 12px; right: 12px; border-bottom: 2px solid var(--hud); border-right: 2px solid var(--hud); }

/* ============================ APP STYLES ============================ */
.app-intro { color: var(--text-dim); margin-bottom: 18px; font-size: 14px; }
.app-footnote { color: var(--text-dim); margin-top: 18px; font-size: 13px; }
h2 {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin: 26px 0 12px;
  font-weight: 500;
}
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-family: var(--mono); font-size: 11px;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--glass-light);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.btn-primary {
  font-family: var(--mono); font-size: 12px;
  padding: 7px 14px;
  border-radius: 8px;
  background: rgba(77, 243, 195, 0.12);
  border: 1px solid rgba(77, 243, 195, 0.4);
  color: var(--accent);
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-primary:hover { background: rgba(77, 243, 195, 0.22); box-shadow: 0 0 14px rgba(77, 243, 195, 0.25); }
.btn-ghost {
  font-family: var(--mono); font-size: 12px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  display: inline-block;
}
.btn-ghost:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }

/* --------------------------- About app --------------------------- */
.about-hero { display: flex; gap: 20px; align-items: center; margin-bottom: 22px; }
.about-avatar {
  width: 104px; height: 104px;
  flex-shrink: 0;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, rgba(2, 6, 12, 0.22) 0 1px, transparent 1px 4px),
    linear-gradient(135deg, rgba(77, 243, 195, 0.7), rgba(122, 162, 255, 0.7));
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(77, 243, 195, 0.25), inset 0 0 30px rgba(2, 6, 12, 0.4);
}
.about-avatar img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.app-about h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.about-postnoms { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-top: 2px; }
.about-tagline { font-size: 13px; color: var(--text-dim); margin-top: 6px; }
.about-role { font-size: 13px; margin-top: 6px; }
.about-loc { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.app-about p { margin-bottom: 12px; color: #c2d2da; }
.about-highlights { list-style: none; display: grid; gap: 8px; }
.about-highlights li {
  padding: 10px 14px;
  background: var(--glass-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.about-highlights strong { font-size: 13.5px; }
.about-highlights span { font-size: 12.5px; color: var(--text-dim); }

/* ----------------------- Publications app ------------------------ */
.pubs-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.pub-filter {
  font-family: var(--mono); font-size: 12px;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.pub-filter span { opacity: 0.6; margin-left: 4px; }
.pub-filter.active { border-color: rgba(77, 243, 195, 0.5); color: var(--accent); background: rgba(77, 243, 195, 0.08); }
.pubs-orcid { font-family: var(--mono); font-size: 12px; }
.pubs-orcid:first-of-type { margin-left: auto; }
.pub-year {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--accent-2);
  margin: 18px 0 8px;
  position: sticky; top: -22px;
  background: linear-gradient(rgba(6, 14, 22, 0.95), rgba(6, 14, 22, 0.7));
  padding: 4px 0;
}
.pub {
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--glass-light);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.pub-title { font-size: 14px; font-weight: 600; line-height: 1.4; }
.pub-meta { display: flex; gap: 8px; align-items: baseline; margin-top: 6px; flex-wrap: wrap; }
.pub-badge {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 7px;
  border-radius: 4px;
}
.pub-badge.journal { background: rgba(77, 243, 195, 0.14); color: var(--accent); }
.pub-badge.conference { background: rgba(122, 162, 255, 0.14); color: var(--accent-2); }
.pub-badge.preprint { background: rgba(182, 107, 255, 0.16); color: var(--accent-3); }
.pub-venue { font-size: 12.5px; color: var(--text-dim); font-style: italic; }
.pub-actions { display: flex; gap: 14px; margin-top: 8px; align-items: center; }
.pub-actions a { font-family: var(--mono); font-size: 11.5px; }
.pub-bib { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); text-decoration: underline dotted; }
.pub-bib:hover { color: var(--accent); }

/* ------------------------- Lectures app -------------------------- */
.lecture-list { display: grid; gap: 10px; }
.lecture-card {
  padding: 14px 16px;
  background: var(--glass-light);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.lecture-code { font-family: var(--mono); font-size: 11px; color: var(--accent-2); display: flex; gap: 8px; align-items: center; }
.sample-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.1em;
  background: rgba(255, 209, 102, 0.15);
  color: var(--warn);
  padding: 1px 6px;
  border-radius: 4px;
}
.lecture-title { font-weight: 600; font-size: 14.5px; margin-top: 4px; }
.lecture-desc { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.lecture-link { font-family: var(--mono); font-size: 12px; display: inline-block; margin-top: 8px; }
.lecture-soon { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); display: inline-block; margin-top: 8px; }

/* ------------------------ Experiments app ------------------------ */
.exp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

/* Saved omni apps section */
.omni-saved-section { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.omni-saved-heading { font-family: var(--mono); font-size: 14px; color: var(--text); margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.omni-saved-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.omni-saved-card .exp-info { padding: 14px; }
.exp-card {
  background: var(--glass-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.exp-thumb { position: relative; height: 130px; background: #02030a; }
.exp-thumb iframe {
  width: 200%; height: 200%;
  transform: scale(0.5);
  transform-origin: top left;
  border: 0;
  pointer-events: none;
}
.exp-thumb-cover { position: absolute; inset: 0; }
.exp-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.exp-title { font-weight: 600; font-size: 14.5px; }
.exp-desc { font-size: 12.5px; color: var(--text-dim); flex: 1; }
.exp-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ------------------------- Projects app -------------------------- */
.venture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.venture-card {
  padding: 16px;
  background: var(--glass-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 7px;
}
.venture-card.exited { opacity: 0.75; }
.venture-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.venture-name { font-weight: 700; font-size: 15.5px; }
.venture-status {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.1em;
  padding: 2px 7px;
  border-radius: 4px;
}
.venture-status.active { background: rgba(77, 243, 195, 0.13); color: var(--accent); }
.venture-status.exited { background: rgba(255, 209, 102, 0.13); color: var(--warn); }
.venture-role { font-family: var(--mono); font-size: 11px; color: var(--accent-2); }
.venture-blurb { font-size: 13px; color: #b4c4cd; flex: 1; }
.venture-boot { margin-top: 8px; align-self: flex-start; }
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.code-card { padding: 13px 14px; background: var(--glass-light); border: 1px solid var(--border); border-radius: 10px; }
.code-name { font-weight: 600; font-size: 13.5px; font-family: var(--mono); }
.code-blurb { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }

/* -------------------------- Contact app -------------------------- */
.contact-list { display: grid; gap: 8px; }
.contact-row {
  display: flex; gap: 14px; align-items: baseline;
  padding: 12px 16px;
  background: var(--glass-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.contact-row:hover {
  border-color: rgba(77, 243, 195, 0.4);
  background: rgba(77, 243, 195, 0.05);
  box-shadow: 0 0 16px rgba(77, 243, 195, 0.12);
  text-decoration: none;
}
.contact-k { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); width: 80px; flex-shrink: 0; }
.contact-v { font-family: var(--mono); font-size: 13px; color: var(--text); }

/* ------------------------- Terminal app -------------------------- */
.app-terminal {
  display: flex; flex-direction: column;
  height: 100%;
  margin: -22px -24px;
  font-family: var(--mono);
  font-size: 13px;
  background: rgba(1, 3, 8, 0.9);
}
.term-output { flex: 1; overflow-y: auto; padding: 16px 18px 8px; }
.term-line { margin-bottom: 4px; color: #c4cedd; word-break: break-word; }
.term-line b { color: var(--accent); font-weight: 500; }
.term-echo { color: var(--text-dim); }
.term-prompt { color: var(--accent); margin-right: 8px; }
.term-input-row { display: flex; align-items: center; padding: 8px 18px 14px; }
.term-input {
  flex: 1;
  background: none; border: none; outline: none;
  color: var(--text);
  font-family: var(--mono); font-size: 13px;
  caret-color: var(--accent);
}
.term-fetch { line-height: 1.45; font-size: 12px; }
.tf-a { color: var(--accent); }
.tf-b { color: var(--accent-2); font-weight: 700; }
.tf-c { color: var(--warn); }

/* ----------------------- Simulated screen ------------------------ */
.screen-app { display: flex; flex-direction: column; height: 100%; margin: -22px -24px; }
.screen-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(120, 220, 255, 0.03);
  flex-shrink: 0;
}
.screen-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); flex-shrink: 0; }
.screen-url {
  flex: 1;
  font-family: var(--mono); font-size: 12px;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  outline: none;
  min-width: 0;
}
.screen-btn { font-size: 15px; color: var(--text-dim); padding: 3px 8px; border-radius: 6px; text-decoration: none; flex-shrink: 0; }
.screen-btn:hover { color: var(--accent); background: var(--glass-light); text-decoration: none; }
.screen-viewport { position: relative; flex: 1; background: #04060c; }
.screen-viewport iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.screen-scanlines {
  position: absolute; inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.045) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.screen-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  background: #04060c;
  z-index: 2;
  font-family: var(--mono); font-size: 12.5px;
  color: var(--text-dim);
  transition: opacity 0.4s ease;
}
.screen-loading.hidden { opacity: 0; pointer-events: none; }
.screen-spinner {
  width: 26px; height: 26px;
  border: 2px solid rgba(77, 243, 195, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.screen-note {
  flex-shrink: 0;
  padding: 6px 14px;
  font-family: var(--mono); font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  background: rgba(120, 220, 255, 0.02);
}

/* ------------------------- About VainOS -------------------------- */
.about-os { text-align: center; padding-top: 10px; }
.about-os-logo { font-size: 44px; color: var(--accent); text-shadow: 0 0 26px rgba(77, 243, 195, 0.6); }
.about-os h1 { font-family: var(--mono); letter-spacing: 0.2em; margin: 8px 0 2px; font-size: 22px; }
.about-os-ver { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); margin-bottom: 16px; }
.about-os p { font-size: 13.5px; margin-bottom: 10px; color: #c2d2da; }
.about-os-fine { font-size: 12px !important; color: var(--text-dim) !important; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 980px) {
  #hero3d { gap: 24px; }
  #holo { width: min(280px, 36vw); }
}

/* Tablet: windows still float but never larger than the safe area */
@media (min-width: 761px) and (max-width: 1024px) {
  .window { max-width: calc(100vw - 24px); max-height: calc(100dvh - 110px); }
  .dock-item { width: 46px; height: 46px; }
  .light { width: 24px; height: 24px; }
}

/* Tablet portrait: stack the hero like mobile so it doesn't collide with the icon rail */
@media (min-width: 761px) and (max-width: 1024px) and (orientation: portrait) {
  #hero3d {
    flex-direction: column-reverse;
    justify-content: flex-end;
    padding-top: 150px;
    gap: 70px;
  }
  #hero-text { text-align: center; max-width: 80vw; }
  #hero-text h1 { font-size: 52px; }
  #hero-text h1 br { display: none; }
  #holo { width: min(250px, 34vw); }
  .holo-label { bottom: -52px; }
  #desktop-icons {
    flex-direction: row;
    flex-wrap: wrap;
    top: 12px; left: 16px; right: 16px;
    justify-content: center;
    max-height: none;
    transform: none;
  }
  .desktop-icon:hover { transform: none; }
}

@media (max-width: 760px) {
  /* dynamic viewport height: keeps layout correct as the mobile URL bar collapses */
  html, body, #os { height: 100dvh; }

  #boot-log { font-size: 10px; }
  #boot-skip { font-size: 9px; padding: 0 16px; text-align: center; }

  /* --- hero: fit everything above the fold --- */
  #hero3d {
    flex-direction: column-reverse;
    justify-content: flex-end;
    padding-top: 196px;
    gap: 44px;
  }
  #hero-text { text-align: center; max-width: 92vw; }
  #hero-text h1 { font-size: clamp(28px, 8vw, 36px); margin: 4px 0; }
  #hero-text h1 br { display: none; }
  .hero-kicker { font-size: 9px; }
  .hero-tagline { font-size: 11px; }
  .hero-hint { display: none; }
  #holo { width: min(150px, 42vw); }
  .holo-label { font-size: 8px; bottom: -34px; }
  .holo-ring.r3 { display: none; }
  #scene { transform: none; }

  /* --- desktop icons: horizontal strip, comfortable touch targets --- */
  #desktop-icons {
    flex-direction: row;
    flex-wrap: wrap;
    top: 6px; left: 8px; right: 8px;
    justify-content: center;
    gap: 2px 4px;
    max-height: none;
    transform: none;
  }
  .desktop-icon { width: 72px; padding: 6px 2px; min-height: 44px; }
  .desktop-icon:hover { transform: none; }
  .di-glyph { width: 40px; height: 40px; }
  .di-label { font-size: 9px; }

  /* --- menubar --- */
  #menu-sub, #menu-badge, #menu-holo { display: none; }
  #menubar { padding: 0 10px; }

  /* --- dock: thumb-sized, scrollable, flat --- */
  .dock-item { width: 46px; height: 46px; }
  #dock {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    gap: 4px; padding: 6px 8px;
    max-width: 96vw;
    overflow-x: auto;
    transform: translateX(-50%);
  }
  .dock-item:hover { transform: none; }

  /* --- windows: full-screen sheets between menubar and dock --- */
  .window,
  .window.maximized {
    left: 0 !important;
    top: 34px !important;
    width: 100% !important;
    height: calc(100dvh - 34px - 74px - env(safe-area-inset-bottom, 0px)) !important;
    border-radius: 0;
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
  }
  .window.opening { transform: translateY(24px) scale(0.97); }
  .win-resize { display: none; }
  .win-titlebar { cursor: default; height: 44px; }
  .light { width: 28px; height: 28px; }
  .light svg { width: 13px; height: 13px; }
  .light.max { display: none; } /* windows are always full-size on phones */
  .win-title { font-size: 12px; }

  .win-body { padding: 14px; -webkit-overflow-scrolling: touch; }
  .app-terminal, .screen-app { margin: -14px; }

  /* --- terminal: 16px input stops iOS auto-zoom on focus --- */
  .term-input, .term-out { font-size: 16px; }
  .term-out { padding: 12px; }
  .term-input-row { padding: 8px 12px 12px; }

  /* --- content grids collapse to one column --- */
  .exp-grid, .omni-saved-list { grid-template-columns: 1fr; }
  .exp-actions .btn-primary, .exp-actions .btn-ghost,
  .omni-saved-boot, .omni-saved-del { min-height: 44px; }
  .omni-save-btn { min-height: 36px; }

  .hud-corner { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  #scene, #holo { transform: none !important; }
}

/* ------------------------ Apps app extras ------------------------ */
.exp-thumb-glyph {
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 50% 80%, rgba(77, 243, 195, 0.14), transparent 65%),
    #02030a;
}
.exp-thumb-glyph span {
  font-size: 34px;
  color: var(--accent);
  text-shadow: 0 0 22px rgba(77, 243, 195, 0.6);
  animation: pulse 3.2s ease-in-out infinite;
}
.exp-thumb-glyph.off span { color: var(--text-dim); text-shadow: none; animation: none; }
.exp-card.offline { opacity: 0.65; }
.hosted-badge, .offline-badge {
  font-family: var(--mono);
  font-size: 9px; font-weight: 700;
  letter-spacing: 0.1em;
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: 2px;
}
.hosted-badge { background: rgba(77, 243, 195, 0.14); color: var(--accent); }
.offline-badge { background: rgba(255, 209, 102, 0.14); color: var(--warn); }
