:root {
  --bg: #0b0b12;
  --panel: #12122a;
  --border: #2a2520;
  --orange-glow: #ff6b35;
  --orange-dim: #ff6b3530;
  --orange-bright: #ff9f50;
  --cyan-glow: #4fd8ff;
  --cyan-dim: #4fd8ff30;
  --text: #d4d4d4;
  --text-dim: #777;
  --text-bright: #fff;
  --font-mono: 'Courier New', 'Consolas', monospace;
  --font-display: 'VT323', 'Courier New', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  user-select: none;
  -webkit-user-select: none;
}

/* Boot overlay */
#boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  padding: 48px 40px;
  cursor: pointer;
  transition: opacity 0.7s ease;
}

#boot-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#boot-log {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.7;
  letter-spacing: 1px;
  color: var(--orange-glow);
  text-shadow: 0 0 6px var(--orange-dim);
  white-space: pre-wrap;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

#boot-log::after {
  content: '▌';
  animation: blink 1s step-end infinite;
}

.boot-skip {
  position: absolute;
  bottom: 24px;
  left: 40px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

/* Desktop */
#desktop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 107, 53, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(255, 45, 120, 0.04) 0%, transparent 50%),
    linear-gradient(180deg, #0b0b12 0%, #0f0a08 40%, #0d0d18 70%, #0b0b12 100%);
  z-index: 1;
}

#wallpaper {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: url('../assets/images/IMG_0431.PNG') center 25% / cover no-repeat;
  opacity: 0.15;
  filter: saturate(0.85) brightness(0.9);
  pointer-events: none;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(5, 5, 12, 0.8) 100%);
}

.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.08) 2px, rgba(0,0,0,0.08) 4px);
  z-index: 2;
}

.noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

/* Fences */
.fence {
  position: absolute;
  z-index: 3;
  background: rgba(12, 12, 24, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--orange-dim);
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0,0,0,0.5), 0 0 6px var(--orange-dim);
  overflow: hidden;
  width: 420px;
  min-height: 120px;
  opacity: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

@keyframes fence-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

body.booted .fence {
  animation: fence-in 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

@media (prefers-reduced-motion: reduce) {
  body.booted .fence {
    animation: none;
    opacity: 1;
  }
}

.fence.focused {
  border-color: rgba(255, 107, 53, 0.45);
  box-shadow: 0 0 24px rgba(0,0,0,0.6), 0 0 14px var(--orange-dim);
}

.fence-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--orange-glow);
  text-shadow: 0 0 6px var(--orange-dim);
  letter-spacing: 2px;
  border-bottom: 1px solid rgba(255, 107, 53, 0.12);
  background: rgba(255, 107, 53, 0.04);
  cursor: grab;
  user-select: none;
}

.fence-header:active {
  cursor: grabbing;
}

.fence-gallery {
  width: auto;
  max-width: 90vw;
}

.fence-gallery .fence-header {
  color: var(--cyan-glow);
  text-shadow: 0 0 6px var(--cyan-dim);
  border-bottom-color: rgba(79, 216, 255, 0.12);
  background: rgba(79, 216, 255, 0.04);
}

.fence-gallery .fence-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  align-items: flex-start;
}

.fence-thumb {
  position: relative;
  height: 240px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.fence-thumb img {
  height: 100%;
  width: auto;
  display: block;
}

.fence-thumb:hover {
  border-color: var(--cyan-glow);
  box-shadow: 0 0 10px var(--cyan-dim);
  transform: scale(1.05);
  z-index: 1;
}

.fence-links {
  width: 360px;
}

.fence-links .fence-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 6px 8px;
}

.fence-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(11, 11, 18, 0.5);
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.fence-link:hover {
  border-color: var(--orange-glow);
  box-shadow: 0 0 10px var(--orange-dim);
  background: rgba(255, 107, 53, 0.06);
  color: var(--text-bright);
}

.fence-link-icon { font-size: 16px; flex-shrink: 0; width: 22px; text-align: center; }
.fence-link-label { flex: 1; }
.fence-link-note { color: var(--text-dim); font-size: 11px; }

.fence-about { width: 420px; }

/* File windows */
.fence-file { width: 400px; }

.fence-file .fence-body {
  padding: 14px;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.fence-close {
  background: none;
  border: none;
  padding: 0 2px;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
}

.fence-close:hover { color: var(--orange-glow); }

/* Desktop icons */
#desktop-icons {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 30px 44px;
}

.desk-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 128px;
  padding: 14px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
}

body.booted .desk-icon {
  animation: fence-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
  animation-delay: calc(var(--icon-i, 0) * 80ms + 120ms);
}

@media (prefers-reduced-motion: reduce) {
  body.booted .desk-icon {
    animation: none;
    opacity: 1;
  }
}

.desk-icon:hover,
.desk-icon:focus-visible {
  background: rgba(255, 107, 53, 0.07);
  border-color: var(--orange-dim);
  outline: none;
}

.desk-icon-glyph {
  font-size: 44px;
  line-height: 1;
  color: var(--orange-bright);
  text-shadow: 0 0 12px var(--orange-dim);
}

.desk-icon:hover .desk-icon-glyph,
.desk-icon:focus-visible .desk-icon-glyph {
  text-shadow: 0 0 16px var(--orange-glow);
}

.desk-icon-name {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 1px;
  color: var(--text);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.fence-about .fence-body {
  display: block;
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
}

.about-name {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--orange-glow);
  text-shadow: 0 0 6px var(--orange-glow), 0 0 16px var(--orange-dim);
  margin-bottom: 4px;
}

.about-tagline { color: var(--text-dim); font-style: italic; margin-bottom: 12px; }
.about-bio { margin-bottom: 12px; }

.about-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 107, 53, 0.08);
  border: 1px solid var(--orange-dim);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--orange-bright);
  margin-bottom: 16px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange-glow);
  box-shadow: 0 0 8px var(--orange-glow);
  animation: pulse 2s infinite;
}

.about-section-label {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--orange-bright);
  text-shadow: 0 0 6px var(--orange-dim);
  margin: 10px 0 2px;
}

.about-list { color: var(--text-dim); font-size: 12px; margin-bottom: 8px; }

/* Lightbox */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox.visible { opacity: 1; }
.lightbox.closing  { opacity: 0; }

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border: 1px solid var(--border);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  transition: opacity 0.25s ease;
}

.lightbox .lb-close,
.lightbox .lb-nav {
  position: absolute;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  transition: background 0.1s, color 0.1s;
  font-family: var(--font-mono);
}

.lightbox .lb-close { top: 16px; right: 16px; width: 40px; height: 40px; }
.lightbox .lb-nav { top: 50%; transform: translateY(-50%); width: 44px; height: 44px; }

.lightbox .lb-close:hover,
.lightbox .lb-nav:hover {
  background: var(--orange-glow);
  color: #fff;
}

.lightbox .lb-prev { left: 16px; }
.lightbox .lb-next { right: 16px; }

.lightbox .lb-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* Link confirmation */
.link-confirm {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.link-confirm-box {
  background: rgba(12, 12, 24, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--orange-dim);
  border-radius: 6px;
  padding: 24px;
  text-align: center;
  min-width: 280px;
  max-width: 360px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.7), 0 0 10px var(--orange-dim);
}

.link-confirm-icon {
  font-size: 28px;
  margin-bottom: 8px;
  filter: drop-shadow(0 0 6px rgba(255, 107, 53, 0.5));
}

.link-confirm-label {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--orange-glow);
  text-shadow: 0 0 6px var(--orange-dim);
}

.link-confirm-note { font-size: 13px; color: var(--text-dim); margin-top: 4px; font-family: var(--font-mono); }
.link-confirm-message { margin: 16px 0; font-size: 13px; color: var(--text-dim); font-family: var(--font-mono); }
.link-confirm-buttons { display: flex; gap: 8px; justify-content: center; }

.link-confirm-btn {
  padding: 8px 24px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.link-confirm-btn:hover { border-color: var(--orange-glow); }
.link-confirm-cancel:hover { background: rgba(255, 255, 255, 0.04); }

.link-confirm-go {
  border-color: var(--orange-glow) !important;
  background: rgba(255, 107, 53, 0.1) !important;
  color: var(--orange-bright) !important;
  box-shadow: 0 0 8px var(--orange-dim);
}

.link-confirm-go:hover {
  background: rgba(255, 107, 53, 0.2) !important;
  box-shadow: 0 0 14px var(--orange-dim);
}

/* Clock */
#bg-clock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(80px, 18vw, 200px);
  color: var(--cyan-glow);
  opacity: 0.16;
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
  letter-spacing: 8px;
}

/* Taskbar */
#taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: 30px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 14px;
  background: rgba(12, 12, 24, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid var(--orange-dim);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1.5px;
}

.tb-brand {
  color: var(--orange-glow);
  text-shadow: 0 0 6px var(--orange-dim);
}

.tb-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--orange-bright);
}

.tb-clock {
  margin-left: auto;
  color: var(--cyan-glow);
  text-shadow: 0 0 6px var(--cyan-dim);
}

/* Mobile */
@media (max-width: 767px) {
  .fence {
    position: relative;
    top: auto !important;
    left: auto !important;
    width: calc(100vw - 32px);
    margin: 8px 16px;
  }

  .fence-gallery .fence-body {
    flex-wrap: wrap;
  }

  .fence-thumb {
    height: 120px;
  }

  .fence-links,
  .fence-about,
  .fence-file {
    width: calc(100vw - 32px);
  }

  #desktop-icons {
    position: static;
    transform: none;
    display: flex;
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    gap: 4px;
  }

  .desk-icon {
    width: 96px;
    padding: 8px 4px;
  }

  .desk-icon-glyph {
    font-size: 32px;
  }

  .desk-icon-name {
    font-size: 14px;
  }

  #desktop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 46px;
    overflow-y: auto;
  }

  #boot-overlay {
    padding: 32px 20px;
  }

  #boot-log {
    font-size: 16px;
  }

  .boot-skip {
    left: 20px;
  }

  #taskbar {
    font-size: 13px;
    gap: 12px;
  }
}
