:root {
  --bg-1: #12101f;
  --bg-2: #1d1b2e;
  --accent: #6c5ce7;
  --accent-2: #a29bfe;
  --text: #f0e9ff;
  --dim: #8f88a8;
  --win-bg: rgba(29, 27, 46, 0.92);
  --bar-bg: rgba(18, 16, 31, 0.85);
  --line: rgba(162, 155, 254, 0.25);
  --glow-1: rgba(108, 92, 231, 0.35);
  --glow-2: rgba(41, 216, 199, 0.18);
}

body[data-theme="mint"] {
  --bg-1: #07211b;
  --bg-2: #0d352c;
  --accent: #00b894;
  --accent-2: #55efc4;
  --text: #eafff7;
  --dim: #7fb8a8;
  --win-bg: rgba(13, 53, 44, 0.92);
  --bar-bg: rgba(7, 33, 27, 0.85);
  --line: rgba(85, 239, 196, 0.22);
  --glow-1: rgba(0, 184, 148, 0.30);
  --glow-2: rgba(85, 239, 196, 0.15);
}

body[data-theme="sunset"] {
  --bg-1: #2d1b2e;
  --bg-2: #4a1942;
  --accent: #e17055;
  --accent-2: #fdcb6e;
  --text: #fff3e6;
  --dim: #c39a94;
  --win-bg: rgba(74, 25, 66, 0.92);
  --bar-bg: rgba(45, 27, 46, 0.85);
  --line: rgba(253, 203, 110, 0.25);
  --glow-1: rgba(225, 112, 85, 0.32);
  --glow-2: rgba(253, 203, 110, 0.18);
}

body[data-theme="paper"] {
  --bg-1: #ece7dd;
  --bg-2: #f7f3ea;
  --accent: #5f4bb6;
  --accent-2: #4a3a94;
  --text: #2b2620;
  --dim: #8a8272;
  --win-bg: rgba(255, 253, 248, 0.95);
  --bar-bg: rgba(236, 231, 221, 0.9);
  --line: rgba(95, 75, 182, 0.25);
  --glow-1: rgba(95, 75, 182, 0.12);
  --glow-2: rgba(207, 198, 178, 0.35);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: 'Space Grotesk', Helvetica, sans-serif;
  color: var(--text);
}

body {
  background:
    radial-gradient(1200px 700px at 20% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, var(--glow-2), transparent 55%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
}

/* top bar */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: var(--bar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  z-index: 1000;
  user-select: none;
}

#brand { font-weight: 700; letter-spacing: 0.5px; color: var(--accent-2); margin-right: 8px; }

.tb-item { padding: 2px 8px; border-radius: 6px; cursor: pointer; }
.tb-item:hover { background: rgba(162, 155, 254, 0.18); }

#clock { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--dim); }

#themes { display: flex; gap: 6px; margin-right: 10px; align-items: center; }
.tbtn {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  padding: 0;
}
.tbtn:hover { transform: scale(1.2); }
.tbtn[data-theme="night"] { background: linear-gradient(135deg, #2d2a4a, #6c5ce7); }
.tbtn[data-theme="mint"] { background: linear-gradient(135deg, #0d352c, #55efc4); }
.tbtn[data-theme="sunset"] { background: linear-gradient(135deg, #e17055, #fdcb6e); }
.tbtn[data-theme="paper"] { background: linear-gradient(135deg, #f7f3ea, #cfc6b2); }

/* desktop icons */
#desktop {
  position: absolute;
  top: 34px; left: 0; right: 0; bottom: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.dicon {
  width: 76px;
  padding: 10px 4px;
  border-radius: 10px;
  text-align: center;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.dicon:hover { background: rgba(162, 155, 254, 0.14); }
.dicon .glyph {
  width: 42px; height: 42px;
  margin: 0 auto 6px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), #4834b4);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.dicon[data-app="notes"] .glyph { background: linear-gradient(145deg, #00b894, #00876c); }
.dicon[data-app="links"] .glyph { background: linear-gradient(145deg, #fdcb6e, #e17055); }
.dicon[data-app="term"] .glyph { background: linear-gradient(145deg, #2d3436, #111); }

/* windows */
.win {
  position: fixed;
  width: 420px;
  min-height: 180px;
  background: var(--win-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  display: none;
  overflow: hidden;
  z-index: 10;
}
.win.open { display: block; }

#win-notes { width: 380px; }
#win-links { width: 360px; }
#win-term { width: 470px; }

.win.focused { border-color: var(--accent-2); }
.win.focused .win-title { color: var(--text); }

.win-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(18, 16, 31, 0.6);
  border-bottom: 1px solid var(--line);
  cursor: grab;
  user-select: none;
}
.win-bar:active { cursor: grabbing; }

.win-title { font-size: 13px; font-weight: 500; color: var(--dim); }

.win-x {
  width: 18px; height: 18px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  background: rgba(255, 90, 95, 0.85);
  color: #3a0d10;
  font-size: 13px;
  cursor: pointer;
}
.win-x:hover { background: #ff5a5f; color: #fff; }

.win-body { padding: 14px 16px; font-size: 14px; line-height: 1.55; }

.win-body h1 { font-size: 18px; margin: 0 0 6px; }
.win-body p { margin: 8px 0; }

.about-row { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }

.avatar {
  flex: 0 0 56px;
  width: 56px; height: 56px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 35% 35%, #fff 0 18%, transparent 19%),
    radial-gradient(circle at 65% 35%, #fff 0 18%, transparent 19%),
    linear-gradient(145deg, var(--accent), var(--accent-2));
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* notes */
#notepad {
  width: 100%;
  height: 150px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.12);
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  padding: 10px;
  outline: none;
}
#notepad:focus { border-color: var(--accent); }

.note-foot { margin-top: 6px; font-size: 11px; color: var(--dim); }

/* links */
.linktile {
  display: block;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
}
.linktile:hover { background: rgba(162, 155, 254, 0.12); text-decoration: none; }
.linktile b { display: block; font-size: 14px; }
.linktile small { color: var(--dim); }

/* terminal */
#win-term .win-body { padding: 0; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
#term-out {
  height: 170px;
  overflow-y: auto;
  padding: 10px 12px 4px;
  white-space: pre-wrap;
  color: var(--accent-2);
}
#term-out .cmd { color: var(--accent-2); }
#term-line {
  display: flex;
  gap: 6px;
  padding: 6px 12px 10px;
  align-items: center;
}
.prompt { color: var(--accent); }
#term-in {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
}
