/* ====================================================================
   weblinux — minimal browser desktop
   near-monochrome · hairlines · one muted accent · quiet motion
   ==================================================================== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

[data-theme="dark"] {
  --bg: #16171b;
  --surface: #1c1d22;
  --surface-2: #232429;
  --border: rgba(255,255,255,.09);
  --border-strong: rgba(255,255,255,.22);
  --fg: #d7d8dd;
  --muted: #71737d;
  --faint: #4a4c54;
}
[data-theme="light"] {
  --bg: #e9eaec;
  --surface: #ffffff;
  --surface-2: #f1f1f3;
  --border: rgba(0,0,0,.10);
  --border-strong: rgba(0,0,0,.30);
  --fg: #26272b;
  --muted: #8a8c94;
  --faint: #c2c3c8;
}
[data-accent="slate"] { --accent: #7d8aa8; }
[data-accent="sage"]  { --accent: #93a48d; }
[data-accent="clay"]  { --accent: #b08d7d; }

html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--fg); background: var(--bg);
  user-select: none; -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
.mono { font-family: "JetBrains Mono", monospace; }

#wallpaper { position: fixed; inset: 0; z-index: 0; background: var(--bg); transition: background .4s ease; }

/* ---------- Boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 9999; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity .5s ease;
}
#boot.gone { opacity: 0; pointer-events: none; }
.b-word { font-family: "JetBrains Mono", monospace; font-size: 15px; letter-spacing: 2px; color: var(--muted); }
.b-bar { width: 140px; height: 1px; background: var(--border); overflow: hidden; }
.b-bar i { display: block; height: 100%; width: 100%; background: var(--fg); transform: translateX(-100%); animation: load 1.3s ease forwards; }
@keyframes load { to { transform: translateX(0); } }

/* ---------- Desktop ---------- */
#desktop { position: fixed; inset: 0; z-index: 1; }

/* ---------- Desktop widget (conky-style, sits behind windows) ---------- */
#widget {
  position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; user-select: none;
  animation: widget-in 1s ease .25s both;
}
@keyframes widget-in { from { opacity: 0; } to { opacity: 1; } }
#widget .w-time { font-family: "JetBrains Mono", monospace; font-size: 86px; font-weight: 400; line-height: 1; letter-spacing: 2px; color: var(--muted); opacity: .5; }
#widget .w-date { margin-top: 16px; font-size: 14px; color: var(--muted); opacity: .7; }
#widget .w-greet { margin-top: 5px; font-family: "JetBrains Mono", monospace; font-size: 12.5px; color: var(--faint); letter-spacing: .5px; }

/* ---------- Windows ---------- */
.win {
  position: absolute; min-width: 320px; min-height: 200px; z-index: 10;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
  box-shadow: 0 12px 34px rgba(0,0,0,.30);
  animation: win-in .14s ease-out;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.win.focused { border-color: var(--border-strong); }
@keyframes win-in { from { opacity: 0; transform: scale(.985); } to { opacity: 1; transform: none; } }
.win.closing { animation: win-out .11s ease-in forwards; }
@keyframes win-out { to { opacity: 0; } }

.titlebar {
  height: 36px; flex: 0 0 36px; cursor: move;
  display: flex; align-items: center; gap: 9px; padding: 0 6px 0 12px;
  border-bottom: 1px solid var(--border);
}
.titlebar .t-ico { width: 15px; height: 15px; flex: 0 0 15px; color: var(--muted); }
.titlebar .t-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; }
.titlebar .t-title { flex: 1; font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win.focused .t-title { color: var(--fg); }
.t-close {
  width: 24px; height: 24px; border: 0; background: transparent; cursor: pointer; color: var(--muted);
  display: grid; place-items: center; border-radius: 5px; transition: color .12s, background .12s;
}
.t-close svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
.t-close:hover { color: var(--fg); background: var(--surface-2); }

.win-body { flex: 1; overflow: auto; background: var(--surface); animation: body-in .3s ease; }
@keyframes body-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- App content ---------- */
.pad { padding: 22px 22px; }
.pad h2 { font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.pad .sub { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.pad p { color: var(--muted); line-height: 1.65; margin-bottom: 10px; }
.pad code { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--fg); }
.list .row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); }
.list .row:last-child { border-bottom: 0; }
.list .row .t-ico { width: 16px; height: 16px; color: var(--muted); }
.list .row .t-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; }
.list .row .meta { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 11.5px; color: var(--faint); }

.editor { width: 100%; height: 100%; border: 0; resize: none; padding: 18px; background: var(--surface); color: var(--fg);
  font-family: "JetBrains Mono", monospace; font-size: 13px; line-height: 1.75; outline: none; }
.editor::placeholder { color: var(--faint); }

.clock-app { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 6px; }
.clock-app .t { font-family: "JetBrains Mono", monospace; font-size: 44px; font-weight: 400; letter-spacing: 1px; }
.clock-app .d { color: var(--muted); font-size: 13px; }

/* terminal */
.term { height: 100%; padding: 14px 16px; background: var(--surface); overflow: auto;
  font-family: "JetBrains Mono", monospace; font-size: 12.5px; line-height: 1.7; color: var(--fg); }
.term .out { white-space: pre-wrap; }
.term .k { color: var(--muted); } .term .a { color: var(--accent); }
.term .ln { display: flex; gap: 8px; align-items: baseline; }
.term .prompt { color: var(--accent); white-space: nowrap; }
.term input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--fg); font: inherit; }
.term .err { color: #c08a8a; }

/* run (script runner) */
.runner { display: flex; flex-direction: column; height: 100%; }
.run-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.run-go, .run-clear { font-family: "JetBrains Mono", monospace; font-size: 12px; padding: 5px 12px; border-radius: 5px; cursor: pointer; background: transparent; border: 1px solid var(--border); transition: all .14s ease; }
.run-go { color: var(--accent); border-color: var(--border-strong); }
.run-go:hover { background: var(--surface-2); }
.run-clear { color: var(--muted); } .run-clear:hover { color: var(--fg); border-color: var(--border-strong); }
.run-hint { margin-left: auto; font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--faint); }
.run-code { flex: 2 1 0; min-height: 80px; border: 0; resize: none; padding: 14px; background: var(--surface); color: var(--fg);
  font-family: "JetBrains Mono", monospace; font-size: 13px; line-height: 1.65; outline: none; tab-size: 2; }
.run-code::placeholder { color: var(--faint); }
.run-out { flex: 1 1 0; min-height: 96px; overflow: auto; padding: 12px 14px; border-top: 1px solid var(--border);
  background: var(--bg); font-family: "JetBrains Mono", monospace; font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; color: var(--fg); }
.run-out .muted { color: var(--muted); } .run-out .err { color: #c08a8a; } .run-out .ret { color: var(--accent); }

/* calculator */
.calc { display: flex; flex-direction: column; height: 100%; }
.calc-display { padding: 20px 18px 8px; text-align: right; }
.calc-expr { min-height: 16px; font-family: "JetBrains Mono", monospace; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.calc-val { margin-top: 6px; font-family: "JetBrains Mono", monospace; font-size: 34px; font-weight: 500; word-break: break-all; }
.calc-keys { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 14px 16px; }
.calc-keys button { border: 1px solid var(--border); background: var(--surface); color: var(--fg); border-radius: 11px;
  font-family: "JetBrains Mono", monospace; font-size: 16px; cursor: pointer; transition: transform .07s ease, background .12s, border-color .12s; }
.calc-keys button:hover { border-color: var(--border-strong); }
.calc-keys button:active { transform: scale(.92); background: var(--surface-2); }
.calc-keys .op { color: var(--accent); }
.calc-keys .ac, .calc-keys .del { color: var(--muted); }
.calc-keys .zero { grid-column: span 2; }
.calc-keys .eq { background: var(--accent); color: #fff; border-color: var(--accent); }
.calc-keys .eq:active { background: var(--accent); }

/* chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.chat-status { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--muted); transition: color .2s; }
.chat-status.on { color: #6fae86; }
.chat-name { margin-left: auto; width: 120px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
  color: var(--fg); padding: 6px 9px; font-size: 12px; outline: none; transition: border-color .12s; }
.chat-name:focus { border-color: var(--border-strong); }
.chat-log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto; color: var(--muted); font-size: 13px; }
.chat-msg { animation: msg-in .26s var(--ease, ease-out); }
@keyframes msg-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.chat-msg .meta { font-family: "JetBrains Mono", monospace; font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.chat-msg .meta b { color: var(--accent); font-weight: 500; }
.chat-msg .body { font-size: 13.5px; line-height: 1.5; color: var(--fg); word-break: break-word; }
.chat-form { display: flex; gap: 8px; padding: 11px 14px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px;
  color: var(--fg); padding: 10px 12px; outline: none; font-size: 13px; font-family: inherit; transition: border-color .12s; }
.chat-input:focus { border-color: var(--border-strong); }
.chat-send { background: var(--accent); color: #fff; border: 0; border-radius: 9px; padding: 0 17px; cursor: pointer;
  font-size: 13px; font-family: inherit; transition: opacity .12s, transform .08s; }
.chat-send:hover { opacity: .9; } .chat-send:active { transform: scale(.95); }

/* settings */
.settings { padding: 22px; }
.settings .group { margin-bottom: 26px; }
.settings .lbl { font-family: "JetBrains Mono", monospace; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.opts { display: flex; gap: 8px; }
.opt { padding: 8px 16px; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--muted); transition: all .14s ease; background: transparent; }
.opt:hover { color: var(--fg); border-color: var(--border-strong); }
.opt.active { color: var(--fg); border-color: var(--fg); }
.swatch { width: 34px; height: 34px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; transition: border-color .14s; }
.swatch.active { border-color: var(--fg); }

/* ---------- Bar ---------- */
#bar {
  position: fixed; top: 0; left: 0; right: 0; height: 30px; z-index: 4000;
  display: flex; align-items: center; gap: 14px; padding: 0 12px;
  background: var(--bg); border-bottom: 1px solid var(--border);
  font-family: "JetBrains Mono", monospace; font-size: 12px;
}
#apps-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 4px 6px; border-radius: 4px; transition: color .12s, background .12s; }
#apps-btn:hover { color: var(--fg); background: var(--surface); }
#workspaces { display: flex; gap: 9px; align-items: center; }
#workspaces .ws { width: 6px; height: 6px; border-radius: 50%; border: 1px solid var(--faint); cursor: pointer; transition: all .14s ease; }
#workspaces .ws:hover { border-color: var(--muted); }
#workspaces .ws.active { background: var(--accent); border-color: var(--accent); }
.bar-mid { flex: 1; text-align: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#clock { background: transparent; border: 0; color: var(--fg); cursor: pointer; font: inherit; padding: 4px 6px; border-radius: 4px; transition: background .12s; }
#clock:hover { background: var(--surface); }

/* ---------- Intro hint (one-time, travels to apps) ---------- */
#intro { position: fixed; inset: 0; z-index: 4500; pointer-events: none; opacity: 0; transition: opacity .4s ease; }
#intro.show { opacity: 1; }
#intro.gone { opacity: 0; }
.intro-cursor { position: absolute; left: 0; top: 0; width: 24px; height: 44px; transform-origin: 50% 50%; will-change: transform; }
.intro-cursor svg { width: 100%; height: 100%; overflow: visible; display: block; }
.intro-shaft, .intro-head { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

body.intro-on #apps-btn { color: var(--accent); animation: apps-pulse 1.9s ease-in-out infinite; }
@keyframes apps-pulse { 0%, 100% { background: transparent; } 50% { background: var(--surface); } }

/* ---------- Launcher ---------- */
#overlay { position: fixed; inset: 0; z-index: 5000; background: rgba(0,0,0,.32); animation: fade .12s ease; }
#overlay.hidden { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.launcher {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  width: 440px; max-width: 90vw; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
}
.launcher .search { width: 100%; height: 46px; background: transparent; border: 0; border-bottom: 1px solid var(--border);
  color: var(--fg); padding: 0 16px; outline: none; font-family: "JetBrains Mono", monospace; font-size: 13.5px; }
.launcher .search::placeholder { color: var(--faint); }
.launcher .list { max-height: 320px; overflow: auto; padding: 6px; }
.launcher .row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; cursor: pointer;
  animation: row-in .3s var(--ease, ease-out); transition: background .12s, padding-left .14s ease; }
@keyframes row-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.launcher .row .t-ico { width: 16px; height: 16px; color: var(--muted); transition: color .12s; }
.launcher .row .t-ico svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; }
.launcher .row .desc { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.launcher .row:hover { background: var(--surface-2); padding-left: 16px; }
.launcher .row:hover .t-ico { color: var(--accent); }
.launcher .row.sel { background: var(--surface-2); }
.launcher .row.sel .t-ico { color: var(--accent); }

.hidden { display: none !important; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
