:root {
  --bg:      #04070a;
  --panel:   rgba(8, 12, 18, 0.7);
  --border:  rgba(0, 255, 180, 0.2);
  --accent:  #00ffb4;
  --accent2: #00c8ff;
  --text:    #d4f0e8;
  --muted:   #5b7d71;
  --danger:  #ff4f6e;
  --bar-h:   46px;
  --font:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background: var(--bg);
  background-image: radial-gradient(circle at 50% 50%, #0a151d 0%, #04070a 100%);
  color: var(--text);
  font-family: var(--font);
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

/* ── BOOT SCREEN ── */
#boot {
  position: fixed; inset: 0;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.boot-text {
  font-size: 14px; color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 255, 180, 0.5);
  min-width: 380px;
}
.cursor { animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ── DESKTOP ── */
#desktop {
  position: relative; width: 100vw; height: 100vh;
  background: url('https://images.unsplash.com/photo-1614850523296-d8c1af93d400?q=80&w=2070&auto=format&fit=crop') center/cover;
  transition: box-shadow 0.3s ease;
}
#desktop.drag-over {
  box-shadow: inset 0 0 50px var(--accent);
  outline: 2px dashed var(--accent);
  outline-offset: -10px;
}

/* ── CRT EFFECT ── */
#crt-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), 
              linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 4px, 3px 100%;
  z-index: 99999; pointer-events: none;
  opacity: 0.12;
  animation: crt-flicker 0.15s infinite;
}
@keyframes crt-flicker { 0% { opacity: 0.12; } 50% { opacity: 0.11; } 100% { opacity: 0.13; } }

/* ── WINDOW ── */
.window {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  display: flex; flex-direction: column;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  pointer-events: none;
}
.window.win-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}
/* Minimize specific feel */
.window.minimizing {
  opacity: 0;
  transform: scale(0.3) translateY(100px);
}
.window.active-win {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(0, 255, 180, 0.15), 0 20px 50px rgba(0,0,0,0.9);
  transform: scale(1.005);
}

/* ── CORE APPS CONTRAST (v0.7.2) ── */
#win-terminal, #win-monitor, #win-files, #win-notes {
  background: rgba(2, 4, 6, 0.95);
  border-left: 2px solid var(--accent);
}
.win-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--border);
  cursor: move; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent);
}
.win-controls { display: flex; gap: 8px; align-items: center; }
.win-max, .win-close { background: transparent; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; transition: color 0.2s; }
.win-max:hover { color: var(--accent2); }
.win-close:hover { color: var(--danger); }
.win-body { padding: 16px; flex: 1; overflow-y: auto; }

.window.maximized {
  inset: 0 !important; width: 100vw !important; height: calc(100vh - var(--bar-h)) !important;
  border-radius: 0; z-index: 900 !important;
}

/* ── TERMINAL ── */
.terminal-body {
  background: rgba(0, 0, 0, 0.4);
  background-image: linear-gradient(rgba(0, 255, 180, 0.03) 1px, transparent 1px);
  background-size: 100% 3px;
  text-shadow: 0 0 5px rgba(255,255,255,0.1);
  font-size: 12px; line-height: 1.6; min-height: 250px; color: #fff;
}
.terminal-input-row { display: flex; padding: 10px 16px; background: rgba(0, 0, 0, 0.6); border-top: 1px solid var(--border); }
.prompt { color: var(--accent); margin-right: 10px; font-weight: bold; }
#term-input { flex: 1; background: transparent; border: 0; color: #fff; font-family: var(--font); outline: none; }
.t-line { margin-bottom: 4px; padding: 2px 4px; }
.t-line:hover { background: rgba(0, 255, 180, 0.05); cursor: default; }

/* Tokens */
.t-cmd { color: var(--accent); font-weight: bold; }
.t-arg { color: var(--accent2); }
.t-path { color: #ffbe00; }
.t-muted { color: var(--muted); }

/* ── TASKBAR ── */
#taskbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--bar-h);
  background: rgba(4, 7, 10, 0.8); border-top: 1px solid var(--border);
  backdrop-filter: blur(15px); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; z-index: 1000;
}
.logo { color: var(--accent); font-weight: 800; font-size: 15px; letter-spacing: 1.5px; text-shadow: 0 0 8px var(--accent); }
#taskbar-center { display: flex; gap: 12px; }
.task-btn {
  padding: 6px 16px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); border-radius: 2px;
  color: var(--text); font-family: var(--font); font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.task-btn:hover { background: rgba(0, 255, 180, 0.1); border-color: var(--accent); box-shadow: 0 0 15px rgba(0, 255, 180, 0.2); }
.task-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(0, 255, 180, 0.15); }

#clock { color: var(--accent2); font-weight: 700; font-size: 13px; }

/* ── DESKTOP SHORTCUTS ── */
#desktop-shortcuts { position: absolute; top: 40px; left: 20px; display: flex; flex-direction: column; gap: 25px; padding: 20px; }
.shortcut { width: 70px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; transition: transform 0.2s; }
.shortcut:hover { transform: scale(1.1); }
.shortcut-icon {
  width: 44px; height: 44px; background: rgba(0, 255, 180, 0.05); border: 1px solid var(--border); border-radius: 2px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; backdrop-filter: blur(5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}
.shortcut:hover .shortcut-icon { border-color: var(--accent); box-shadow: 0 0 15px var(--accent); background: rgba(0, 255, 180, 0.1); }
.shortcut-label { font-size: 11px; color: var(--text); text-shadow: 0 2px 4px rgba(0,0,0,0.8); font-weight: 600; text-align: center; }

/* ── HW MONITOR ── */
.monitor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-card { background: rgba(0, 255, 180, 0.05); border: 1px solid var(--border); border-radius: 2px; padding: 12px; }
.stat-card.full { grid-column: 1 / -1; }
.stat-label { font-size: 9px; color: var(--muted); text-transform: uppercase; }
.stat-val { font-size: 16px; font-weight: 700; margin-top: 4px; }
.stat-val.online { color: var(--accent); text-shadow: 0 0 10px var(--accent); }

/* ── EXPLORER ── */
.explorer-item { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; padding: 10px; border-radius: 4px; transition: background 0.2s; }
.explorer-item:hover { background: rgba(255, 255, 255, 0.05); }
.explorer-icon { font-size: 24px; }
.explorer-label { font-size: 10px; text-align: center; word-break: break-all; max-width: 60px; }

/* ── PROCESS TABLE ── */
.proc-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.proc-table th { text-align: left; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); text-transform: uppercase; font-size: 9px; }
.proc-table td { padding: 10px 8px; border-bottom: 1px solid rgba(255,255,255,0.02); }
.proc-status { color: var(--accent); font-weight: bold; }
.proc-kill { background: transparent; border: 1px solid var(--danger); color: var(--danger); padding: 2px 8px; border-radius: 4px; cursor: pointer; font-size: 9px; transition: all 0.2s; }
.proc-kill:hover { background: var(--danger); color: #fff; }

/* ── SETTINGS ── */
.settings-group { margin-bottom: 20px; }
.color-grid { display: flex; gap: 10px; margin-top: 10px; }
.color-opt { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform 0.2s, border-color 0.2s; }
.color-opt:hover { transform: scale(1.1); border-color: #fff; }
.settings-select { width: 100%; padding: 8px; background: rgba(0,0,0,0.4); border: 1px solid var(--border); border-radius: 4px; color: var(--text); font-family: var(--font); outline: none; margin-top: 10px; cursor: pointer; }

/* ── ABOUT ── */
.about-body { text-align: center; }
.about-logo { font-size: 48px; color: var(--accent); margin-bottom: 10px; animation: rotate 10s infinite linear; display: inline-block; }
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.about-title { font-size: 20px; font-weight: 800; color: #fff; }
.about-hr { border: 0; border-top: 1px solid var(--border); margin: 15px 0; }
.about-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px; }
.about-row span:last-child { color: var(--accent); }
.about-link { color: var(--accent2); text-decoration: none; font-size: 12px; font-weight: 700; }
.about-link:hover { text-decoration: underline; }

/* ── LOCK SCREEN ── */
#lock-screen { position: fixed; inset: 0; background: rgba(4, 7, 10, 0.95); backdrop-filter: blur(20px); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.lock-box { 
  text-align: center; padding: 40px; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 0 50px rgba(0,0,0,0.5); width: 300px; 
}
.lock-box.shake { animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* ── MOBILE MISSION CONTROL ─────────────────────── */
@media (max-width: 768px) {
  .hidden-desktop { display: flex !important; }
  :root { --bar-h: 70px; 
    --font-size-base: 16px; }
  .window {
    position: fixed !important; inset: 0 !important; width: 100vw !important; height: calc(100vh - var(--bar-h)) !important;
    border: 0; border-radius: 0; transform: none !important; box-shadow: none; z-index: 800 !important;
  }
  .window.active-win { z-index: 900 !important; }
  .win-bar { padding: 15px 20px; font-size: 14px; }
  #desktop-shortcuts { top: 20px; left: 10px; gap: 15px; }
  .shortcut { width: 60px; }
  .shortcut-icon { width: 40px; height: 40px; font-size: 20px; }
  #taskbar { height: var(--bar-h); padding: 0 10px; background: rgba(4, 7, 10, 0.95); }
  .logo { display: none; }
  #taskbar-center { flex: 1; overflow-x: auto; padding: 5px 0; gap: 8px; -webkit-overflow-scrolling: touch; }
  .task-btn { padding: 10px 20px; white-space: nowrap; font-size: 14px; }
  .monitor-grid { grid-template-columns: 1fr; }
  #crt-overlay { animation: none; opacity: 0.05; }
}

.hidden { display: none !important; }
.hidden-desktop { display: none !important; }

/* ── CUSTOM SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent2); }

#notes-area { width: 100%; height: 200px; background: transparent; border: 0; color: var(--text); font-family: var(--font); font-size: 13px; resize: none; outline: none; }

/* ── SERIAL CONSOLE v0.7 ── */
.t-line.serial-in  { color: #00ffb4; opacity: 0.9; }
.t-line.serial-out { color: #ffbe00; opacity: 0.7; font-style: italic; }

/* ── SERIAL CONSOLE v0.6.8 ── */
.t-line.serial-in  { color: #00ffb4; opacity: 0.9; }
.t-line.serial-out { color: #ffbe00; opacity: 0.7; font-style: italic; }
