:root {
  --bg: #1a1b26; --fg: #c0caf5; --accent: #7aa2f7; --surface: #24283b; --muted: #565f89;
  --red: #f7768e; --green: #9ece6a; --yellow: #e0af68; --blue: #7aa2f7; --magenta: #bb9af7; --cyan: #7dcfff;
  --bar-h: 28px;
  --font: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg); font: 13px/1.45 var(--font); }
body { user-select: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

#desktop { position: fixed; inset: 0; background-color: var(--bg); transition: background .6s; }

/* ---------- bar (waybar) ---------- */
#bar { position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px; background: color-mix(in srgb, var(--bg) 92%, transparent); z-index: 50; font-size: 12px; }
#bar .left, #bar .right { display: flex; align-items: center; gap: 2px; min-width: 0; }
#bar .center { position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
#bar .logo { padding: 0 8px; font-weight: 800; color: var(--fg); letter-spacing: -.5px; }
#bar .ws { min-width: 22px; height: 22px; display: grid; place-items: center; opacity: .5; border-radius: 0; }
#bar .ws.occ { opacity: .85; }
#bar .ws.on { opacity: 1; color: var(--accent); font-weight: 800; }
#bar .mod { display: flex; align-items: center; gap: 5px; padding: 0 7px; height: 22px; opacity: .9; }
#bar .mod svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#bar .mod:hover, #bar .ws:hover, #bar .logo:hover { color: var(--accent); }
@media (max-width: 640px) { #bar .hide-sm { display: none; } #bar .center { position: static; transform: none; } }

/* ---------- windows ---------- */
.win { position: absolute; border: 2px solid color-mix(in srgb, var(--muted) 70%, transparent);
  background: color-mix(in srgb, var(--bg) 94%, transparent); overflow: hidden; display: flex; flex-direction: column;
  transition: left .22s cubic-bezier(.2,.9,.3,1), top .22s cubic-bezier(.2,.9,.3,1), width .22s cubic-bezier(.2,.9,.3,1), height .22s cubic-bezier(.2,.9,.3,1), opacity .18s, transform .18s, border-color .15s;
  animation: winIn .22s cubic-bezier(.2,.9,.3,1); }
.win.active { border-color: var(--accent); }
.win.floating { z-index: 20; box-shadow: 0 20px 50px #0008; }
.win.fs { z-index: 60; border-width: 0; }
.win.off { opacity: 0; pointer-events: none; transform: scale(.96); }
.win.closing { opacity: 0; transform: scale(.92); }
.win.dragging { transition: none; }
.win .body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.win .grip { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; display: none; z-index: 5; }
.win.floating .grip { display: block; }
@keyframes winIn { from { opacity: 0; transform: scale(.9); } }

/* ---------- terminal ---------- */
.term { flex: 1; overflow-y: auto; padding: 8px 12px; cursor: text; user-select: text; white-space: pre-wrap; word-break: break-word; }
.term .line { display: flex; }
.term .in { flex: 1; background: none; border: 0; outline: 0; padding: 0; caret-color: var(--fg); min-width: 0; }
.term .ghost { position: absolute; opacity: 0; pointer-events: none; }
.c-red { color: var(--red); } .c-green { color: var(--green); } .c-yellow { color: var(--yellow); } .c-blue { color: var(--blue); }
.c-magenta { color: var(--magenta); } .c-cyan { color: var(--cyan); } .c-muted { color: var(--muted); } .c-accent { color: var(--accent); }
.b { font-weight: 800; }
.ff { display: flex; gap: 24px; flex-wrap: wrap; margin: 4px 0; }
.ff pre { margin: 0; color: var(--accent); font: inherit; }
.ff .k { color: var(--accent); font-weight: 700; }
.swatch { display: inline-block; width: 22px; height: 14px; margin-right: 2px; }

/* ---------- editor ---------- */
.ed { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.ed .main { flex: 1; display: flex; min-height: 0; }
.ed .gutter { padding: 6px 8px 6px 6px; text-align: right; color: var(--muted); overflow: hidden; white-space: pre; min-width: 44px; }
.ed .gutter .cur { color: var(--yellow); font-weight: 700; }
.ed textarea { flex: 1; resize: none; border: 0; outline: 0; background: none; padding: 6px 4px; white-space: pre; overflow: auto; line-height: inherit; tab-size: 2; caret-color: var(--accent); user-select: text; }
.ed.normal textarea { caret-color: var(--fg); }
.ed .status { display: flex; height: 22px; align-items: stretch; background: var(--surface); white-space: nowrap; overflow: hidden; }
.ed .status > * { padding: 0 10px; display: flex; align-items: center; }
.ed .mode { background: var(--accent); color: var(--bg); font-weight: 800; }
.ed.insert .mode { background: var(--green); }
.ed.command .mode { background: var(--yellow); }
.ed .status .sp { flex: 1; }
.ed .cmd { height: 22px; display: flex; align-items: center; padding: 0 6px; }
.ed .cmd input { flex: 1; background: none; border: 0; outline: 0; padding: 0; }
.ed .msg.err { color: var(--red); }
.ed .dash { position: absolute; inset: 0 0 22px 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; outline: 0; z-index: 2; }
.ed .dash pre { color: var(--accent); margin: 0 0 18px; font: inherit; font-size: 11px; line-height: 1.15; }
.ed .dash .opt { display: flex; width: 280px; justify-content: space-between; padding: 3px 8px; }
.ed .dash .opt span:last-child { color: var(--yellow); }

/* ---------- btop ---------- */
.btop { flex: 1; padding: 6px 8px; overflow: hidden; white-space: pre; font-size: 12px; line-height: 1.25; outline: 0; }
.btop .box { border: 1px solid var(--muted); padding: 2px 8px 4px; margin-bottom: 6px; position: relative; }
.btop .box .t { position: absolute; top: -9px; left: 10px; background: var(--bg); padding: 0 4px; color: var(--accent); }
.btop .row { display: flex; gap: 8px; }

/* ---------- file manager ---------- */
.fm { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.fm .tb { display: flex; gap: 6px; align-items: center; padding: 6px 8px; background: var(--surface); }
.fm .tb button { padding: 2px 8px; border: 1px solid var(--muted); white-space: nowrap; flex-shrink: 0; }
.fm .path { min-width: 0; }
.fm .split { container-type: inline-size; }
@container (max-width: 420px) { .fm .side { display: none; } }
.fm .tb button:hover { border-color: var(--accent); color: var(--accent); }
.fm .path { flex: 1; padding: 2px 8px; background: var(--bg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm .split { flex: 1; display: flex; min-height: 0; }
.fm .side { width: 150px; padding: 8px 0; border-right: 1px solid var(--surface); flex-shrink: 0; }
.fm .side button { display: block; width: 100%; text-align: left; padding: 4px 14px; }
.fm .side button:hover, .fm .side button.on { color: var(--accent); background: var(--surface); }
.fm .grid { flex: 1; overflow: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; align-content: start; }
.fm .item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; text-align: center; word-break: break-all; font-size: 12px; }
.fm .item:hover, .fm .item.sel { background: var(--surface); }
.fm .item .ic { width: 40px; height: 34px; display: grid; place-items: center; font-size: 22px; }
.fm .item.dir .ic { color: var(--accent); }
@media (max-width: 640px) { .fm .side { display: none; } }

/* ---------- browser ---------- */
.br { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.br .tb { display: flex; gap: 4px; padding: 6px; background: var(--surface); align-items: center; }
.br .tb button { width: 26px; height: 26px; }
.br .tb button:hover { color: var(--accent); }
.br .tb input { flex: 1; min-width: 0; background: var(--bg); border: 1px solid transparent; outline: 0; padding: 4px 10px; border-radius: 13px; user-select: text; }
.br .tb input:focus { border-color: var(--accent); }
.br iframe { flex: 1; border: 0; background: #fff; width: 100%; }
.br .note { font-size: 11px; padding: 3px 10px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--bg); }
.br .note a { color: var(--accent); cursor: pointer; }

/* ---------- walker / menus ---------- */
#overlay { position: fixed; inset: 0; z-index: 100; display: none; align-items: flex-start; justify-content: center; padding-top: 14vh; }
#overlay.show { display: flex; }
.menu { width: min(620px, calc(100vw - 32px)); background: var(--bg); border: 2px solid var(--accent); box-shadow: 0 30px 80px #000a; animation: winIn .15s; }
.menu .q { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--surface); }
.menu .q .crumb { color: var(--accent); white-space: nowrap; }
.menu .q input { flex: 1; background: none; border: 0; outline: 0; font-size: 15px; min-width: 0; user-select: text; }
.menu ul { list-style: none; margin: 0; padding: 4px 0; max-height: 52vh; overflow-y: auto; }
.menu li { display: flex; align-items: center; gap: 12px; padding: 7px 14px; cursor: pointer; }
.menu li .ic { width: 22px; text-align: center; color: var(--accent); flex-shrink: 0; }
.menu li .lb { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu li .ht { color: var(--muted); font-size: 12px; white-space: nowrap; }
.menu li.on { background: var(--surface); color: var(--accent); }
.menu li .dot { width: 12px; height: 12px; border: 1px solid #fff3; }
.menu .empty { padding: 14px; color: var(--muted); }

/* ---------- notifications (mako) ---------- */
#notes { position: fixed; top: calc(var(--bar-h) + 10px); right: 10px; z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 20px)); }
.note-t { background: var(--bg); border: 2px solid var(--accent); padding: 10px 14px; animation: slideIn .25s cubic-bezier(.2,.9,.3,1); cursor: pointer; }
.note-t .tt { font-weight: 800; margin-bottom: 2px; }
.note-t.out { opacity: 0; transform: translateX(30px); transition: .25s; }
@keyframes slideIn { from { opacity: 0; transform: translateX(40px); } }

/* ---------- lock / boot / power ---------- */
.screen { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 16px; }
#lock { background-size: cover; background-position: center; backdrop-filter: blur(4px); }
#lock::before { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(14px); }
#lock > * { position: relative; }
#lock .time { font-size: clamp(56px, 12vw, 120px); font-weight: 800; line-height: 1; }
#lock .date { font-size: 16px; opacity: .8; }
#lock .field { margin-top: 30px; border: 2px solid var(--accent); padding: 10px 24px; min-width: 260px; background: color-mix(in srgb, var(--bg) 80%, transparent); }
#boot { background: #000; color: #ddd; }
#boot .brand { font-size: 34px; font-weight: 800; letter-spacing: -1px; }
#boot .prog { width: 220px; height: 3px; background: #222; overflow: hidden; }
#boot .prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 1.1s ease-out; }
#boot .hint { color: #666; font-size: 12px; max-width: 420px; }
#off { background: #000; color: #555; cursor: pointer; }
.fade-out { opacity: 0; transition: opacity .4s; pointer-events: none; }

/* ---------- theme picker extras ---------- */
.kbd { border: 1px solid var(--muted); padding: 0 5px; font-size: 11px; color: var(--fg); }

/* ---------- welcome / feature tour ---------- */
.welcome { flex: 1; overflow-y: auto; padding: 22px clamp(14px, 3vw, 34px) 30px; outline: 0; }
.welcome header { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 8px; }
.welcome h1 { margin: 0; font-size: clamp(26px, 4vw, 40px); letter-spacing: -1.5px; color: var(--accent); }
.welcome header p { margin: 4px 0 0; max-width: 560px; opacity: .8; }
.welcome .hb { display: flex; gap: 8px; flex-wrap: wrap; }
.welcome .hb button { padding: 9px 16px; border: 2px solid var(--accent); font-weight: 700; }
.welcome .hb .primary { background: var(--accent); color: var(--bg); }
.welcome .hb button:hover { filter: brightness(1.15); }
.welcome h3 { margin: 22px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); }
.welcome .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.welcome .card { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 12px 14px; text-align: left;
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid transparent; transition: border-color .12s, transform .12s; }
.welcome .card:hover { border-color: var(--accent); transform: translateY(-1px); }
.welcome .card:active { transform: scale(.98); }
.welcome .ci { font-size: 18px; color: var(--accent); height: 24px; }
.welcome .ct { font-weight: 700; }
.welcome .ck { font-size: 11px; color: var(--muted); }
.welcome .swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 8px; }
.welcome .sw { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border: 2px solid; color: #eee; text-align: left; }
.welcome .sw i { width: 10px; height: 10px; flex-shrink: 0; }
.welcome .sw span { margin-left: 6px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.welcome .sw:hover { filter: brightness(1.2); }
.welcome .foot { margin-top: 26px; font-size: 11px; color: var(--muted); }
#bar .center { cursor: pointer; }
#bar .center:hover { color: var(--accent); }

/* ---------- settings ---------- */
.settings { flex: 1; overflow-y: auto; padding: 16px 20px; }
.settings h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); margin: 12px 0 8px; }
.settings .tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.settings .tcard { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 2px solid transparent; text-align: left; }
.settings .tcard.on, .settings .tcard:hover { border-color: var(--accent); }
.settings .prev { height: 76px; position: relative; background-size: cover !important; }
.settings .mini { position: absolute; left: 12%; top: 18%; width: 52%; height: 56%; border: 2px solid; display: flex; gap: 3px; padding: 4px; align-items: flex-start; }
.settings .mini i { width: 8px; height: 8px; }
.settings .row { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.settings input[type=range] { accent-color: var(--accent); width: 200px; }

/* ---------- calendar ---------- */
.cal { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cal .ch { display: flex; justify-content: space-between; align-items: center; }
.cal .ch button { width: 28px; height: 28px; font-size: 16px; }
.cal .ch button:hover { color: var(--accent); }
.cal .cg { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .cg span { padding: 6px 0; }
.cal .cg .dn { color: var(--muted); font-size: 11px; }
.cal .cg .td { background: var(--accent); color: var(--bg); font-weight: 800; }

/* ---------- music ---------- */
.music { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.music .art { height: 130px; background: linear-gradient(135deg, var(--accent), var(--magenta)); display: flex; align-items: flex-end; padding: 10px; flex-shrink: 0; }
.music .viz { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; }
.music .viz i { flex: 1; background: color-mix(in srgb, var(--bg) 70%, transparent); animation: eq 1s ease-in-out infinite alternate; height: 20%; }
.music .viz i:nth-child(3n) { animation-duration: .7s; } .music .viz i:nth-child(4n+1) { animation-duration: 1.3s; } .music .viz i:nth-child(5n+2) { animation-duration: .9s; animation-delay: -.4s; }
.music .viz.paused i { animation-play-state: paused; }
@keyframes eq { to { height: 90%; } }
.music .mt { font-weight: 800; font-size: 15px; margin-top: 6px; }
.music .prog { height: 4px; background: var(--surface); margin-top: 6px; }
.music .prog i { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.music .ctl { display: flex; justify-content: center; gap: 18px; align-items: center; margin: 4px 0; }
.music .ctl button { font-size: 16px; } .music .ctl button:hover { color: var(--accent); }
.music .ctl .big { width: 40px; height: 40px; border: 2px solid var(--accent); }
.music .ml button { display: flex; justify-content: space-between; width: 100%; padding: 5px 6px; text-align: left; }
.music .ml button:hover, .music .ml .on { background: var(--surface); color: var(--accent); }
