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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #090d16;
}

#desktop {
  width: 100vw;
  height: 100vh;
  position: relative;
  transition: background 0.4s ease, filter 0.2s ease;
  overflow: hidden;
}

/* Wallpapers */
#desktop.wp-midnight {
  background: radial-gradient(circle at 20% 20%, #1e1b4b 0%, #090d16 100%);
}
#desktop.wp-aurora {
  background: linear-gradient(135deg, #064e3b 0%, #022c22 45%, #0f172a 100%);
}
#desktop.wp-cyber {
  background: linear-gradient(135deg, #380842 0%, #170420 50%, #04040a 100%);
}

/* Neon Glow Theme */
#desktop.neon-mode .window {
  border-color: #00f0ff !important;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.4) !important;
}
#desktop.neon-mode #top-bar {
  border-bottom: 1px solid #ff007f;
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.4);
}
#desktop.neon-mode .dock {
  border: 1px solid #00f0ff !important;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4) !important;
}

/* Top System Bar */
#top-bar {
  height: 38px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  color: #f1f5f9;
  font-size: 13px;
  z-index: 999999;
  position: relative;
}

.bar-left, .bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.os-logo {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.os-status {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 2px 6px;
  border-radius: 4px;
}

.bar-item {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: 0.15s;
}

.bar-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.bar-separator {
  color: rgba(255, 255, 255, 0.2);
}

/* Windows */
.window {
  position: absolute;
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.window.maximized {
  top: 38px !important;
  left: 0 !important;
  width: 100vw !important;
  height: calc(100vh - 38px - 85px) !important;
  border-radius: 0 !important;
}

.window-header {
  background: rgba(15, 23, 42, 0.96);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  font-size: 13px;
  font-weight: 600;
}

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

.win-controls {
  display: flex;
  gap: 4px;
}

.win-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 4px;
}

.win-btn:hover { background: rgba(255, 255, 255, 0.15); color: white; }
.win-btn.close:hover { background: #ef4444; color: white; }

.window-body {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Notes App */
#notes-content {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: inherit;
  font-size: 13px;
  resize: none;
  user-select: text;
}

/* Terminal CLI */
.terminal-body {
  background: #090d16;
  font-family: 'Consolas', monospace;
  font-size: 13px;
  color: #38bdf8;
}

#terminal-output {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 8px;
  line-height: 1.5;
  user-select: text;
}

.term-hl { color: #34d399; font-weight: bold; }
.terminal-prompt { display: flex; align-items: center; gap: 8px; }
.prompt-user { color: #818cf8; }
.terminal-prompt input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: inherit;
  font-size: 13px;
  user-select: text;
}

/* Sketchpad */
.sketchpad-body { align-items: center; }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
  font-size: 12px;
  color: #cbd5e1;
}

.tool-btn {
  background: #334155;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
.tool-btn:hover { background: #475569; }

#sketch-canvas {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: crosshair;
}

/* VibePlayer */
.player-body {
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
.track-title { font-size: 14px; font-weight: 600; color: #f8fafc; }
.track-sub { font-size: 11px; color: #94a3b8; }
.synth-controls { font-size: 12px; color: #cbd5e1; }
.visualizer {
  display: flex;
  gap: 5px;
  height: 38px;
  align-items: flex-end;
  justify-content: center;
}
.visualizer .bar {
  width: 6px;
  height: 6px;
  background: #38bdf8;
  border-radius: 3px;
}
.visualizer.active .bar {
  animation: bounce 0.6s infinite alternate ease-in-out;
}
.visualizer.active .bar:nth-child(2) { animation-delay: 0.1s; }
.visualizer.active .bar:nth-child(3) { animation-delay: 0.2s; }
.visualizer.active .bar:nth-child(4) { animation-delay: 0.3s; }
.visualizer.active .bar:nth-child(5) { animation-delay: 0.15s; }
.visualizer.active .bar:nth-child(6) { animation-delay: 0.25s; }
.visualizer.active .bar:nth-child(7) { animation-delay: 0.05s; }
.visualizer.active .bar:nth-child(8) { animation-delay: 0.18s; }

@keyframes bounce {
  from { height: 6px; }
  to { height: 34px; background: #818cf8; }
}
.player-controls { display: flex; gap: 10px; }
.player-btn {
  background: #0284c7;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.player-btn:hover { background: #0369a1; }

/* Stardust Miner Game */
.miner-body {
  align-items: center;
  justify-content: space-around;
  text-align: center;
}
.miner-stats { margin-bottom: 6px; }
.stardust-count { font-size: 18px; font-weight: bold; color: #38bdf8; }
.stardust-rate { font-size: 12px; color: #94a3b8; }
.mine-big-btn {
  background: linear-gradient(135deg, #0284c7 0%, #6366f1 100%);
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
  transition: transform 0.1s;
}
.mine-big-btn:active { transform: scale(0.96); }

/* Calculator */
.calc-body { padding: 8px; gap: 8px; }
#calc-display {
  width: 100%;
  height: 44px;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #38bdf8;
  font-family: 'Consolas', monospace;
  font-size: 20px;
  text-align: right;
  padding: 0 10px;
  border-radius: 6px;
  outline: none;
}
.calc-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.calc-btn {
  height: 38px;
  background: #334155;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.calc-btn:hover { background: #475569; }
.calc-btn.op { background: #1e293b; color: #38bdf8; }
.calc-btn.equals { background: #0284c7; }
.calc-btn.wide { grid-column: span 2; }

/* Settings Hub */
.settings-body { gap: 12px; color: #f8fafc; }
.settings-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 6px;
}
.theme-buttons { display: flex; gap: 6px; }
.theme-btn {
  flex: 1;
  background: #334155;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
}
.theme-btn:hover { background: #475569; }
.diag-info {
  font-size: 11px;
  color: #64748b;
  background: rgba(0, 0, 0, 0.2);
  padding: 8px;
  border-radius: 4px;
  line-height: 1.4;
}

/* Permanent Visible Bottom Dock */
#dock-container {
  position: absolute;
  bottom: 12px;
  width: 100%;
  display: flex;
  justify-content: center;
  z-index: 999990;
}

.dock {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(20px);
  padding: 8px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  transition: transform 0.15s ease, background 0.15s ease;
}

.dock-item:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.1);
}

.dock-icon {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 2px;
}

.dock-label {
  font-size: 11px;
  font-weight: 500;
  color: #cbd5e1;
}

.dock-indicator {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  margin-top: 3px;
}

.dock-indicator.active {
  background: #38bdf8;
  box-shadow: 0 0 6px #38bdf8;
}

.dock-divider {
  width: 1px;
  height: 28px;
  background: rgba(255, 255, 255, 0.2);
}