/* ===== StardanceOS theme ===== */
:root {
  --bg1: #1a1040;
  --bg2: #3b1d6e;
  --accent: #ff6ec7;
  --accent2: #6ec7ff;
  --window: rgba(30, 20, 60, 0.85);
  --window-bar: rgba(60, 40, 110, 0.95);
  --text: #f3e9ff;
  --taskbar: rgba(20, 12, 40, 0.9);
}

/* Light / alternate theme */
body.daydream {
  --bg1: #ffd9ec;
  --bg2: #c7e0ff;
  --accent: #c34da0;
  --accent2: #3b7fd6;
  --window: rgba(255, 255, 255, 0.85);
  --window-bar: rgba(255, 220, 240, 0.95);
  --text: #2a1640;
  --taskbar: rgba(255, 255, 255, 0.8);
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg1), var(--bg2));
  background-size: 200% 200%;
  animation: drift 18s ease infinite;
  user-select: none;
}

@keyframes drift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* twinkling stars overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 60% 70%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 80% 20%, #fff, transparent),
    radial-gradient(1px 1px at 40% 80%, #fff, transparent),
    radial-gradient(2px 2px at 90% 60%, #fff, transparent);
  opacity: 0.5;
  animation: twinkle 4s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes twinkle { from { opacity: 0.25; } to { opacity: 0.7; } }

/* ===== Boot screen ===== */
#boot {
  position: fixed;
  inset: 0;
  background: #0c0820;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.6s;
}
#boot.gone { opacity: 0; pointer-events: none; }
.boot-logo { font-size: 80px; color: var(--accent); animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-text { font-size: 28px; margin-top: 16px; letter-spacing: 4px; color: #f3e9ff; }
.boot-bar { width: 220px; height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; margin-top: 24px; overflow: hidden; }
.boot-bar-fill { height: 100%; width: 0; background: var(--accent); animation: load 2.2s ease forwards; }
@keyframes load { to { width: 100%; } }

/* ===== Desktop ===== */
#desktop { position: absolute; inset: 0; bottom: 48px; }
.desktop-icons {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  width: 100px;
}
.icon {
  background: none;
  border: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: background 0.15s;
}
.icon:hover { background: rgba(255,255,255,0.12); }
.icon-glyph { font-size: 30px; color: var(--accent2); }
.icon-label { font-size: 12px; }

/* ===== Windows ===== */
.window {
  position: absolute;
  min-width: 260px;
  min-height: 160px;
  background: var(--window);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: pop 0.18s ease;
}
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.window.minimized { display: none; }

/* Resize handle */
.resize-handle {
  position: absolute;
  width: 16px; height: 16px;
  right: 0; bottom: 0;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0.4) 60%, transparent 60%, transparent 75%, rgba(255,255,255,0.4) 75%, rgba(255,255,255,0.4) 85%, transparent 85%);
}

.title-bar {
  display: flex;
  align-items: center;
  background: var(--window-bar);
  padding: 8px 10px;
  cursor: grab;
}
.title-bar:active { cursor: grabbing; }
.title-bar .title { flex: 1; font-size: 13px; font-weight: 600; }
.win-btn {
  width: 22px; height: 22px;
  border: none; border-radius: 50%;
  margin-left: 6px; cursor: pointer;
  font-size: 12px; line-height: 1;
  color: #1a1040;
}
.win-min { background: #ffd166; }
.win-max { background: #06d6a0; }
.win-close { background: #ef476f; }

.window-body { flex: 1; padding: 14px; overflow: auto; font-size: 14px; line-height: 1.5; }
.window-body h2 { margin-bottom: 8px; color: var(--accent); }
.window-body a { color: var(--accent2); }

/* Notes textarea */
.notes-area {
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.2);
  border: none; resize: none;
  color: var(--text); padding: 10px;
  font-family: inherit; font-size: 14px; border-radius: 8px;
}

/* Terminal */
.term { font-family: "Courier New", monospace; font-size: 13px; height: 100%; display: flex; flex-direction: column; }
.term-out { flex: 1; overflow: auto; white-space: pre-wrap; }
.term-line { display: flex; }
.term-line span { color: var(--accent); margin-right: 6px; }
.term-line input { flex: 1; background: none; border: none; color: var(--text); font-family: inherit; font-size: 13px; outline: none; }

/* Wallpaper picker */
.wall-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wall-swatch {
  height: 60px; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; transition: transform 0.1s, border 0.1s;
}
.wall-swatch:hover { transform: scale(1.05); }
.wall-swatch.selected { border-color: #fff; }

/* Paint */
.paint-tools { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; flex-wrap: wrap; }
.paint-canvas { background: #fff; border-radius: 8px; cursor: crosshair; touch-action: none; }

/* ===== Taskbar ===== */
#taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 48px;
  background: var(--taskbar);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  z-index: 500;
  border-top: 1px solid rgba(255,255,255,0.15);
}
#start-btn {
  background: var(--accent);
  color: #1a1040;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}
#start-btn:hover { filter: brightness(1.1); }
#task-windows { flex: 1; display: flex; gap: 6px; overflow-x: auto; }
.task-btn {
  background: rgba(255,255,255,0.12);
  color: var(--text);
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.task-btn.active { background: rgba(255,255,255,0.28); }
#clock { font-size: 13px; padding: 0 8px; font-variant-numeric: tabular-nums; }

/* ===== Start menu ===== */
#start-menu {
  position: fixed;
  bottom: 54px; left: 10px;
  width: 220px;
  background: var(--window);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 10px;
  z-index: 600;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
#start-menu.hidden { display: none; }
.start-header { font-weight: 700; color: var(--accent); padding: 6px 8px; }
.start-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 10px 8px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.start-item:hover { background: rgba(255,255,255,0.12); }
.start-divider { height: 1px; background: rgba(255,255,255,0.15); margin: 6px 0; }
