/* ══════════════════════════════════════════
   BLACKOUT.OS  ·  v5.0  ·  OS/TERMINAL THEME
   ══════════════════════════════════════════ */

/* ═══ TOKENS ═══ */
:root {
  --bg:              #000;
  --panel:           #030303;
  --titlebar:        #0d0d0d;
  --titlebar-active: #1a1a1a;
  --border:          #1a1a1a;
  --border-hi:       #2e2e2e;
  --border-active:   #5a5a5a;
  --text:            #c8c8c8;
  --text-dim:        #555;
  --text-mute:       #222;
  --accent:          #fff;
  --font-mono:       'Share Tech Mono', 'Courier New', monospace;
  --font-vt:         'VT323', 'Courier New', monospace;
  --banner-h:        52px;
  --sbar-h:          26px;
}

/* ═══ RESET ═══ */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ═══ UTILITIES ═══ */
.webdings {
  font-family: 'Webdings', 'Wingdings', sans-serif;
  text-transform: none;
  letter-spacing: 0;
}

/* ═══ CRT FX ═══ */
.crt-fx { filter: url(#wavyFilter) grayscale(100%); }
.svg-filters {
  position: absolute; width: 0; height: 0;
  overflow: hidden; pointer-events: none;
}

/* Noise overlay */
#noiseCanvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 9990;
  opacity: 0.025; mix-blend-mode: screen;
}

/* Scanlines */
body::before {
  content: ""; position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 3px,
    rgba(0,0,0,0.1) 3px, rgba(0,0,0,0.1) 4px
  );
  pointer-events: none; z-index: 9991;
}

/* Vignette + flicker */
body::after {
  content: ""; position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0,0,0,0.88) 100%);
  pointer-events: none; z-index: 9989;
  animation: flicker 8s ease-in-out infinite;
}

/* Corner brackets */
.corner {
  position: fixed; width: 20px; height: 20px;
  border-color: var(--border-hi); border-style: solid;
  z-index: 9996; pointer-events: none;
}
.corner-tl { top: 12px; left: 12px;   border-width: 1px 0 0 1px; }
.corner-tr { top: 12px; right: 12px;  border-width: 1px 1px 0 0; }
.corner-bl { bottom: 12px; left: 12px;  border-width: 0 0 1px 1px; }
.corner-br { bottom: 12px; right: 12px; border-width: 0 1px 1px 0; }

/* ═══ BOOT ═══ */
.boot {
  position: fixed; inset: 0; z-index: 10000;
  background: #000; color: var(--text);
  font-family: var(--font-mono); font-size: 12px;
  padding: 40px 50px;
  display: flex; flex-direction: column;
  letter-spacing: 0.06em;
}
.boot-header {
  font-size: 11px; color: var(--text-dim);
  letter-spacing: 0.3em; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.boot-log { flex: 1; white-space: pre-wrap; line-height: 1.7; overflow: hidden; color: #9a9a9a; }
.boot-log .ok   { color: #c8c8c8; }
.boot-log .warn { color: #888; }
.boot-bar { margin-top: 18px; }
.boot-bar-label {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-dim);
  margin-bottom: 6px; letter-spacing: 0.2em;
}
.boot-bar-track { height: 8px; border: 1px solid var(--border-hi); background: #050505; }
.boot-bar-fill {
  height: 100%; width: 0%;
  background: repeating-linear-gradient(90deg, #555 0 6px, transparent 6px 8px);
  transition: width 0.15s linear;
}
.boot-foot {
  margin-top: 12px; font-size: 9px; color: var(--text-mute);
  letter-spacing: 0.3em; text-align: center;
  animation: blinkAnim 1.4s step-end infinite;
}

/* ═══ LOGIN ═══ */
.login {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(ellipse at center, #0a0a0a 0%, #000 80%);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.3s ease;
}
.login-box {
  text-align: center; padding: 40px 60px;
  border: 1px solid var(--border-hi); background: var(--panel);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.9);
}
.login-globe {
  width: 80px; height: 80px; margin-bottom: 14px;
  animation: globeSpin 8s linear infinite;
  opacity: 0.85; filter: drop-shadow(0 0 8px rgba(255,255,255,0.25));
}
.login-globe-fb { display: none; font-size: 64px; color: var(--text); margin-bottom: 14px; line-height: 1; }
.login-title {
  font-family: var(--font-vt); font-size: 56px;
  color: var(--accent); letter-spacing: 10px;
  text-shadow: 3px 0 2px rgba(255,0,0,0.7), -3px 0 2px rgba(0,255,255,0.7), 0 0 14px rgba(255,255,255,0.4);
}
.login-sub   { font-size: 9px; color: var(--text-mute); letter-spacing: 0.3em; margin: 6px 0 24px; }
.login-btn   {
  background: transparent; border: 1px solid var(--border-hi);
  color: var(--text); font-family: var(--font-mono);
  font-size: 14px; letter-spacing: 0.4em;
  padding: 12px 32px; cursor: pointer; transition: 0.1s;
}
.login-btn:hover { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.login-hint {
  font-size: 8px; color: var(--text-mute); letter-spacing: 0.3em; margin-top: 18px;
  animation: blinkAnim 1.6s step-end infinite;
}

/* ═══ SHUTDOWN OVERLAY ═══ */
.shutdown {
  position: fixed; inset: 0; z-index: 10001; background: #000;
  display: flex; align-items: center; justify-content: center;
  animation: shutFade 0.6s ease;
}
.shutdown-inner { text-align: center; }
.shutdown-glyph { font-size: 80px; color: var(--text-dim); margin-bottom: 24px; }
.shutdown-title { font-family: var(--font-vt); font-size: 32px; color: var(--text); letter-spacing: 6px; margin-bottom: 10px; }
.shutdown-sub   { font-size: 9px; color: var(--text-mute); letter-spacing: 0.3em; }

/* ═══ TOP BANNER ═══ */
.top-banner {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--banner-h);
  background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 0 12px; z-index: 300; gap: 14px;
}
.banner-left  { display: flex; align-items: center; gap: 12px; min-width: 0; }
.banner-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.banner-sep   { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
.banner-vsep  { width: 1px; height: 18px; background: var(--border); }
.banner-sub   { font-size: 7px; color: var(--text-mute); letter-spacing: 0.25em; white-space: nowrap; }

.globe-icon {
  width: 32px; height: 32px; flex-shrink: 0; opacity: 0.85;
  animation: globeSpin 22s linear infinite;
}
@keyframes globeSpin { to { transform: rotate(360deg); } }

.blackout-title {
  font-family: var(--font-vt); font-size: 44px;
  letter-spacing: 8px; color: var(--accent);
  line-height: 1; cursor: default; flex-shrink: 0;
  text-shadow:
    3px 0 2px rgba(255,0,0,0.7),
    -3px 0 2px rgba(0,255,255,0.7),
    0 0 12px rgba(255,255,255,0.5),
    0 0 30px rgba(255,255,255,0.14);
  animation: titlePulse 14s ease-in-out infinite;
}

.timer-label      { font-size: 7px; color: var(--text-mute); letter-spacing: 0.2em; }
.banner-countdown { font-family: var(--font-vt); font-size: 24px; color: var(--text-dim); letter-spacing: 4px; line-height: 1; }
.banner-clock     { font-family: var(--font-vt); font-size: 20px; color: var(--text-mute); letter-spacing: 3px; line-height: 1; }
.blink-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  animation: blinkAnim 1.2s step-end infinite;
  box-shadow: 0 0 5px rgba(255,255,255,0.5);
}

/* ═══ DESKTOP ═══ */
.desktop {
  position: fixed;
  top: var(--banner-h); bottom: var(--sbar-h);
  left: 0; right: 0;
  overflow: hidden;

  /*
   * BACKGROUND IMAGE
   * ─────────────────
   * Drop your pixelated background into IMGS/bg.png
   * and it will appear here automatically.
   * Recommended resolution: 512×512 or larger,
   * kept intentionally pixel-art / low-res.
   * If the file doesn't exist the dark fallback shows.
   */
  background-color: var(--bg);
  background-image: url('IMGS/bg.png');
  background-size: cover;
  background-position: center;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Dot-grid overlay sits on top of the bg image,
   below icons and windows.                      */
.desktop::before {
  content: "";
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: 8px 8px;
  pointer-events: none;
  z-index: 0;
}

/* ═══ DESKTOP ICONS ═══ */
.icon-layer {
  position: absolute; inset: 0;
  z-index: 10;
  pointer-events: none;
}
.desk-icon {
  position: absolute;
  width: 84px; padding: 10px 4px 6px;
  background: transparent; border: 1px dashed transparent;
  color: var(--text-dim);
  font-family: var(--font-mono); font-size: 8px;
  letter-spacing: 0.12em; text-transform: uppercase;
  cursor: grab;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  pointer-events: auto;
  user-select: none;
}
.desk-icon:hover       { background: rgba(255,255,255,0.025); border-color: var(--border-hi); color: var(--text); }
.desk-icon.is-selected { background: rgba(255,255,255,0.07);  border-color: var(--border-active); color: var(--accent); }
.desk-icon.is-dragging { cursor: grabbing; opacity: 0.85; border-style: solid; border-color: var(--border-active); z-index: 20; }

.desk-ico-glyph          { font-size: 30px; line-height: 1; color: var(--text); }
.desk-ico-glyph.webdings { font-size: 34px; }
.desk-ico-label          { font-size: 8px; letter-spacing: 0.14em; text-align: center; }

/* Drag hint bar */
.drag-hint {
  position: absolute; left: 50%; bottom: 14px;
  transform: translateX(-50%);
  font-size: 7px; color: var(--text-mute); letter-spacing: 0.28em;
  padding: 6px 14px; border: 1px dashed var(--border-hi);
  background: rgba(0,0,0,0.5); z-index: 5; pointer-events: none;
  animation: hintFade 0.4s ease;
}
.drag-hint.fade-out { opacity: 0; transition: opacity 0.6s ease; }
@keyframes hintFade { from { opacity: 0; } to { opacity: 1; } }

/* ═══ WINDOWS ═══ */
.windows-layer { position: absolute; inset: 0; }

.win {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--border-hi);
  display: flex; flex-direction: column;
  min-width: 240px; min-height: 80px;
  overflow: hidden;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.85);
  transition: box-shadow 0.1s, border-color 0.1s;
}
.win.is-active {
  border-color: var(--border-active);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.95), 0 0 18px rgba(255,255,255,0.04);
}
.win.is-max {
  left: 0 !important; top: 0 !important;
  width: 100% !important; height: 100% !important;
  box-shadow: none;
}
.win.is-min {
  transform: scale(0.05) translateY(400px);
  opacity: 0; pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Title bar */
.win-tb {
  background: var(--titlebar);
  border-bottom: 1px solid var(--border);
  padding: 0 8px; height: 24px;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; cursor: move;
}
.win.is-active .win-tb { background: var(--titlebar-active); }

/* Window control buttons */
.win-btns { display: flex; gap: 3px; flex-shrink: 0; }
.wb {
  width: 13px; height: 13px;
  border: 1px solid var(--border-hi); background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; cursor: pointer; color: var(--text-mute);
  font-family: inherit; line-height: 1;
  transition: 0.07s; flex-shrink: 0;
}
.wb:hover       { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.wb-close:hover { background: #d23;          color: #fff;      border-color: #d23; }

.win-ico   { font-size: 13px; color: var(--text-mute); flex-shrink: 0; line-height: 1; }
.win-label {
  font-size: 8px; color: var(--text-dim); letter-spacing: 0.16em;
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.win.is-active .win-label { color: var(--text); }

/* Window body */
.win-body {
  flex: 1; overflow-y: auto; padding: 15px;
  min-height: 0; position: relative;
  scrollbar-width: thin; scrollbar-color: var(--border-hi) transparent;
  user-select: text; -webkit-user-select: text;
}
.win-body-flush { padding: 0; }
.win-body::-webkit-scrollbar       { width: 3px; }
.win-body::-webkit-scrollbar-thumb { background: var(--border-hi); }

/* Scan-line shimmer inside body */
.win-body::after {
  content: ""; position: absolute; left: 0; right: 0;
  height: 2px; background: rgba(255,255,255,0.013);
  animation: scanBar 8s linear infinite;
  pointer-events: none; z-index: 1;
}
@keyframes scanBar { from { top: 0%; } to { top: 100%; } }

/* Resize handle */
.win::after {
  content: ""; position: absolute; right: 0; bottom: 0;
  width: 14px; height: 14px; cursor: nwse-resize;
  background: linear-gradient(
    135deg,
    transparent 50%, var(--border-hi) 50%, var(--border-hi) 60%,
    transparent 60%, transparent 70%, var(--border-hi) 70%, var(--border-hi) 80%,
    transparent 80%
  );
  z-index: 2;
}
.win.is-max::after { display: none; }

/* ═══ CONTENT COMPONENTS ═══ */

/* Eyebrow label */
.win-eyebrow { font-size: 7px; color: var(--text-mute); letter-spacing: 0.32em; margin-bottom: 10px; }

/* Divider */
.win-rule { border: none; border-top: 1px dashed var(--border); margin: 15px 0; }

/* Sector / file entries — used by file manager and sectors display */
.sec-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit; transition: 0.1s;
  width: 100%; background: transparent; border-top: none;
  border-left: none; border-right: none;
  font-family: var(--font-mono); cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.sec-entry:last-child { border-bottom: none; }
.sec-entry:hover      { background: rgba(255,255,255,0.012); }

.sec-dot                      { width: 4px; height: 4px; border-radius: 50%; background: var(--border-hi); flex-shrink: 0; transition: 0.12s; }
.sec-entry:hover .sec-dot     { background: var(--accent); box-shadow: 0 0 5px rgba(255,255,255,0.5); }
.sec-label                    { flex: 1; font-size: 10px; color: var(--text); letter-spacing: 0.1em; }
.sec-entry:hover .sec-label   { color: var(--accent); }
.sec-arr                      { font-size: 12px; color: var(--text-mute); transition: 0.1s; }
.sec-entry:hover .sec-arr     { color: var(--accent); transform: translateX(3px); }

/* File manager footer hint */
.file-hint {
  padding: 8px 12px;
  font-size: 7px; color: var(--text-mute); letter-spacing: 0.22em;
  border-top: 1px solid var(--border);
}

/* ═══ TERMINAL ═══ */
.win-body-term {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text); padding: 10px 12px;
  display: flex; flex-direction: column;
  text-transform: none; letter-spacing: 0.02em;
}
.term-out {
  flex: 1; white-space: pre-wrap; line-height: 1.6;
  overflow-y: auto; min-height: 0;
}
.term-input-row { display: flex; gap: 4px; align-items: center; padding-top: 6px; }
.term-prompt    { color: var(--accent); flex-shrink: 0; }
.term-in {
  flex: 1; background: transparent; border: none;
  color: var(--text); font-family: inherit; font-size: inherit;
  outline: none; caret-color: var(--accent);
}

/* ═══ TASKBAR ═══ */
.status-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--sbar-h);
  background: var(--titlebar); border-top: 1px solid var(--border);
  display: flex; align-items: stretch; z-index: 300;
  font-size: 7.5px; letter-spacing: 0.18em;
}
.sbi {
  display: flex; align-items: center; padding: 0 12px;
  color: var(--text-mute); border-right: 1px solid var(--border);
  white-space: nowrap;
}
.sbi:first-child { padding-left: 10px; }
.sbi.on  { color: var(--text-dim); }
.sbi-hi  { color: var(--text); margin-left: 6px; }

/* START button */
.start-btn {
  background: transparent;
  font-family: var(--font-mono); font-size: 8px;
  letter-spacing: 0.22em; color: var(--text);
  border: none; border-right: 1px solid var(--border);
  cursor: pointer; gap: 6px;
  transition: background 0.08s, color 0.08s;
}
.start-btn .webdings            { font-size: 12px; color: var(--accent); }
.start-btn:hover                { background: rgba(255,255,255,0.05); color: var(--accent); }
.start-btn.is-open              { background: var(--accent); color: var(--bg); }
.start-btn.is-open .webdings    { color: var(--bg); }

/* Taskbar window buttons */
.taskbar { flex: 1; gap: 4px; padding: 0 8px; overflow: hidden; }
.task-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 18px; padding: 0 10px;
  background: transparent; border: 1px solid var(--border-hi);
  color: var(--text-dim); font-family: inherit; font-size: 7.5px;
  letter-spacing: 0.18em; cursor: pointer; transition: 0.08s;
  text-transform: uppercase;
}
.task-btn:hover     { color: var(--text); border-color: var(--border-active); }
.task-btn.is-active { background: rgba(255,255,255,0.06); color: var(--accent); border-color: var(--border-active); }

/* Clock slot */
.sbi.push {
  margin-left: 0; border-left: 1px solid var(--border); border-right: none;
  font-family: var(--font-vt); font-size: 14px;
  letter-spacing: 2px; color: var(--text-mute);
}

/* ═══ START MENU ═══ */
.start-menu {
  position: fixed; left: 0; bottom: var(--sbar-h);
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--border-active); border-bottom: none;
  box-shadow: 4px -4px 0 rgba(0,0,0,0.9);
  z-index: 400;
  animation: startIn 0.12s ease;
}
.start-menu-header {
  padding: 10px 14px;
  font-family: var(--font-vt); font-size: 16px;
  letter-spacing: 4px; color: var(--accent);
  background: var(--titlebar-active);
  border-bottom: 1px solid var(--border);
}
.start-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 14px;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text-dim); font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase;
  cursor: pointer; text-align: left;
  transition: background 0.08s, color 0.08s;
}
.start-item:last-child { border-bottom: none; }
.start-item:hover      { background: rgba(255,255,255,0.04); color: var(--accent); }
.start-item .start-ico { font-size: 16px; width: 20px; text-align: center; color: var(--text); }
.start-item-danger:hover            { background: rgba(210,50,50,0.18); color: #f88; }
.start-item-danger:hover .start-ico { color: #f88; }

/* ═══ TOAST ═══ */
.toast {
  position: fixed; bottom: calc(var(--sbar-h) + 10px);
  left: 50%; transform: translateX(-50%);
  background: var(--titlebar); border: 1px solid var(--border-hi);
  color: var(--text-dim); font-family: var(--font-mono);
  font-size: 8px; letter-spacing: 0.22em;
  padding: 8px 18px; z-index: 9997;
  pointer-events: none; white-space: nowrap;
  animation: toastIn 0.14s ease, toastOut 0.3s ease 2.1s forwards;
}

/* ═══ ANIMATIONS ═══ */
@keyframes titlePulse {
  0%, 88%, 100% { opacity: 1; }
  90%           { opacity: 0.5; }
  92%           { opacity: 1; }
  94%           { opacity: 0.25; }
  96%           { opacity: 1; }
}
@keyframes flicker {
  0%, 96%, 100% { opacity: 1; }
  97%           { opacity: 0.93; }
  99%           { opacity: 0.96; }
}
@keyframes blinkAnim { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes shutFade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes startIn   { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn   { from { opacity: 0; transform: translateX(-50%) translateY(6px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut  { to { opacity: 0; } }

/* ═══ SCROLLBARS ═══ */
::-webkit-scrollbar       { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hi); }

/* ═══ TRANSITION HELPERS ═══ */
.boot.fade-out, .login.fade-out { opacity: 0; transition: opacity 0.18s ease; }
body.is-dragging,
body.is-dragging * { cursor: move !important; user-select: none !important; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 680px) {
  .blackout-title        { font-size: 30px; letter-spacing: 4px; }
  .banner-countdown      { font-size: 16px; letter-spacing: 2px; }
  .banner-clock          { font-size: 14px; }
  .banner-sub, .banner-sep { display: none; }
  .desk-icon             { width: 72px; }
}
