/* KogasonOS: a Windows 11-style desktop portfolio.
   Layout: wallpaper → desktop icon grid → floating windows → centered taskbar with flyouts above it. */
:root {
  --ui: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", "Noto Sans", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ui-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", "Noto Sans", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", "JetBrains Mono", Consolas, "Courier New", monospace;

  --accent-light: #0b6f9a; --accent-dark: #63d3ff;
  --accent: var(--accent-light); --on-accent: #ffffff; --grad-2: #7a52d6;

  --bg: #d9e6f0;
  --mica: rgba(236, 242, 247, .82);
  --acrylic: rgba(244, 247, 250, .92);
  --chrome: #edf1f5; --surface: #f8fafc; --surface-2: #eef2f6; --card: #ffffff;
  --fg: #15191e; --fg-2: #4f5965; --fg-3: #828c97;
  --stroke: rgba(16, 30, 44, .10); --stroke-2: rgba(16, 30, 44, .18);
  --hover: rgba(16, 30, 44, .055); --press: rgba(16, 30, 44, .095);
  --sel: color-mix(in srgb, var(--accent) 13%, transparent);
  --sel-line: color-mix(in srgb, var(--accent) 38%, transparent);
  --shadow: 0 18px 48px rgba(10, 22, 34, .24), 0 2px 8px rgba(10, 22, 34, .10);
  --shadow-soft: 0 8px 28px rgba(10, 22, 34, .16);
  --close: #c42b1c; --on-close: #ffffff;
  --label: #ffffff; --label-shadow: rgba(0, 0, 0, .55);

  --wall-a: #8cc4ea; --wall-b: #2f66ad; --wall-c: #b9a4ee; --wall-d: #7fb0dd;
  --trace-1: rgba(255, 255, 255, .92); --trace-2: rgba(255, 255, 255, .5); --trace-fill: rgba(255, 255, 255, .10);

  --term-bg: #0c0f13; --term-bar: #171b21; --term-fg: #d8dfe7; --term-dim: #7c8794; --term-err: #ff7a7a; --term-hi: #63d3ff;
  --night: rgba(255, 140, 40, .14);
  --tb-h: 48px;
  --media-bg: #0a0e14; --on-media: #f4f7fa; --on-media-2: rgba(244, 247, 250, .8);
  --scrim: rgba(4, 7, 12, .88); --ghost-bg: rgba(255, 255, 255, .12); --ghost-line: rgba(255, 255, 255, .3);
  --tv-bg: rgba(220, 230, 238, .55);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tv-bg: rgba(6, 9, 14, .55);
    --accent: var(--accent-dark); --on-accent: #04161f; --grad-2: #b48cff;
    --bg: #05080d;
    --mica: rgba(28, 31, 36, .80);
    --acrylic: rgba(34, 37, 42, .92);
    --chrome: #1f2226; --surface: #1a1d21; --surface-2: #25292e; --card: #2b2f35;
    --fg: #f1f3f5; --fg-2: #b3bbc4; --fg-3: #7d8690;
    --stroke: rgba(255, 255, 255, .08); --stroke-2: rgba(255, 255, 255, .15);
    --hover: rgba(255, 255, 255, .06); --press: rgba(255, 255, 255, .10);
    --shadow: 0 18px 48px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
    --shadow-soft: 0 8px 28px rgba(0, 0, 0, .45);
    --wall-a: #0e2c44; --wall-b: #04070c; --wall-c: #2b1c52; --wall-d: #0a1a28;
    --trace-1: #63d3ff; --trace-2: #c39bff; --trace-fill: rgba(99, 211, 255, .05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --tv-bg: rgba(6, 9, 14, .55);
  --accent: var(--accent-dark); --on-accent: #04161f; --grad-2: #b48cff;
  --bg: #05080d;
  --mica: rgba(28, 31, 36, .80);
  --acrylic: rgba(34, 37, 42, .92);
  --chrome: #1f2226; --surface: #1a1d21; --surface-2: #25292e; --card: #2b2f35;
  --fg: #f1f3f5; --fg-2: #b3bbc4; --fg-3: #7d8690;
  --stroke: rgba(255, 255, 255, .08); --stroke-2: rgba(255, 255, 255, .15);
  --hover: rgba(255, 255, 255, .06); --press: rgba(255, 255, 255, .10);
  --shadow: 0 18px 48px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, .45);
  --wall-a: #0e2c44; --wall-b: #04070c; --wall-c: #2b1c52; --wall-d: #0a1a28;
  --trace-1: #63d3ff; --trace-2: #c39bff; --trace-fill: rgba(99, 211, 255, .05);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--bg); color: var(--fg); -webkit-touch-callout: none;
  font-family: var(--ui); font-size: 14px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: default; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--stroke); margin: 6px 4px; }
.ic { display: inline-grid; place-items: center; flex: none; position: relative; }
.ic > svg, .ic > img { width: 100%; height: 100%; display: block; }
.ic.mono { border-radius: 22%; background: linear-gradient(135deg, var(--accent), var(--grad-2)); color: var(--on-accent); font-weight: 600; container-type: inline-size; }
.ic.mono > i { font-style: normal; font-size: 40cqw; letter-spacing: .02em; }
.g { display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; }
.g > svg { width: 100%; height: 100%; }
.g.lg { width: 20px; height: 20px; }

.folder-ic > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.folder-ic .fprev { position: absolute; left: 24%; right: 24%; top: 24%; height: 34%; display: flex; justify-content: center; gap: 6%; }
.folder-ic .fprev .ic { height: 100%; width: auto; aspect-ratio: 1; border-radius: 18%; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.folder-ic .ffront { position: absolute; inset: 0; }
.folder-ic .ffront svg { width: 100%; height: 100%; display: block; }
.titlebar .folder-ic .fprev, .nav-i .folder-ic .fprev, .tbb .folder-ic .fprev { display: none; }

#screen { position: fixed; inset: 0; overflow: hidden; }

/* ---------- wallpaper ---------- */
.wallbg {
  background:
    radial-gradient(110% 85% at 88% 108%, var(--wall-c) 0%, transparent 55%),
    radial-gradient(90% 80% at 80% -10%, var(--wall-a) 0%, transparent 62%),
    linear-gradient(200deg, var(--wall-d), var(--wall-b) 70%);
  overflow: hidden;
}
.wallbg > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wallbg[data-wall="gradient"] > svg, .wallbg[data-wall="solid"] > svg { display: none; }
.wallbg[data-wall="solid"] { background: var(--wall-b); }
.wallbg[data-wall="molecular"] { background: var(--media-bg) url("../wallpapers/molecular-field.webp") center / cover no-repeat; }
.wallbg[data-wall="molecular"] > svg { display: none; }
#wallpaper { position: absolute; inset: 0; }
#nightlight { position: absolute; inset: 0; pointer-events: none; background: var(--night); mix-blend-mode: multiply; opacity: 0; transition: opacity .4s; z-index: 9800; }
#nightlight.on { opacity: 1; }
#dim { position: absolute; inset: 0; pointer-events: none; background: #000; opacity: 0; z-index: 9801; }

/* ---------- desktop ---------- */
#desktop { position: absolute; left: 0; right: 0; top: env(safe-area-inset-top, 0px); bottom: calc(var(--tb-h) + env(safe-area-inset-bottom, 0px)); }
#icons { position: absolute; inset: 0; }
#icons.refresh { animation: refresh .35s ease; }
@keyframes refresh { 0% { opacity: .2; } 100% { opacity: 1; } }
.dicon {
  position: absolute; width: var(--dw, 84px); transition: left .18s ease, top .18s ease;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 3px 4px;
  border: 1px solid transparent; border-radius: 4px; background: none; color: var(--label); text-align: center;
}
.dicon > .ic { width: var(--di, 44px); height: var(--di, 44px); filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .25)); }
.dicon > span:last-child {
  font-size: 12px; line-height: 1.25; text-shadow: 0 0 2px rgba(0, 0, 0, .9), 0 1px 3px rgba(0, 0, 0, .75), 0 0 10px var(--label-shadow);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.dicon:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .12); }
.dicon.sel { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .32); }
.dicon.sel > span:last-child { -webkit-line-clamp: 4; }
.dicon.dragging { transition: none; z-index: 2; opacity: .85; }

/* ---------- windows ---------- */
#windows { position: absolute; inset: 0; pointer-events: none; }
.win {
  position: absolute; pointer-events: auto; display: flex; flex-direction: column;
  min-width: 320px; min-height: 200px;
  background: var(--chrome); border: 1px solid var(--stroke-2); border-radius: 8px;
  box-shadow: var(--shadow); overflow: hidden;
  transition: opacity .16s ease, transform .18s cubic-bezier(.1, .9, .2, 1), box-shadow .2s;
}
.win:not(.active) { box-shadow: var(--shadow-soft); }
.win.opening { opacity: 0; transform: scale(.96); }
.win.closing { opacity: 0; transform: scale(.96); pointer-events: none; }
.win.min { opacity: 0; transform: translate(var(--min-x, 0px), var(--min-y, 48px)) scale(.18); pointer-events: none; visibility: hidden; transition: opacity .2s ease-in, transform .24s cubic-bezier(.4, 0, .6, 1), visibility 0s .24s; }
.win.anim { transition: left .22s cubic-bezier(.2, .8, .2, 1), top .22s cubic-bezier(.2, .8, .2, 1), width .22s cubic-bezier(.2, .8, .2, 1), height .22s cubic-bezier(.2, .8, .2, 1), opacity .16s, transform .18s; }
.win.max { border-radius: 0; border: 0; min-width: 0; min-height: 0; }
.titlebar { height: 32px; flex: none; display: flex; align-items: center; gap: 10px; padding-left: 12px; touch-action: none; }
.titlebar .ti { display: flex; }
.titlebar .ti > .ic { width: 16px; height: 16px; }
.titlebar .t { flex: 1; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win:not(.active) .titlebar { color: var(--fg-3); }
.tact { display: flex; align-items: center; height: 32px; align-self: flex-start; margin-right: 6px; }
.ta { width: 40px; height: 32px; border: 0; border-radius: 0; background: none; color: var(--fg); display: grid; place-items: center; text-decoration: none; }
.ta:hover { background: var(--hover); }
.ta:active, .ta.on { background: var(--press); }
.win:not(.active) .ta { color: var(--fg-3); }
.wctl { display: flex; height: 100%; align-self: flex-start; }
.wctl button { width: 46px; height: 32px; border: 0; background: none; display: grid; place-items: center; }
.wctl .g { width: 10px; height: 10px; }
.wctl button:hover { background: var(--hover); }
.wctl button:active { background: var(--press); }
.wctl button.x:hover { background: var(--close); color: var(--on-close); }
.wbody { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); position: relative; }
.rz { position: absolute; z-index: 3; }
.rz-n { top: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.rz-s { bottom: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.rz-e { right: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.rz-w { left: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.rz-ne { right: -3px; top: -3px; width: 12px; height: 12px; cursor: nesw-resize; }
.rz-sw { left: -3px; bottom: -3px; width: 12px; height: 12px; cursor: nesw-resize; }
.rz-nw { left: -3px; top: -3px; width: 12px; height: 12px; cursor: nwse-resize; }
.rz-se { right: -3px; bottom: -3px; width: 12px; height: 12px; cursor: nwse-resize; }
.win.max .rz { display: none; }
body.dragging iframe { pointer-events: none; }
body.dragging .win { transition: none; }
#snap {
  position: absolute; border-radius: 8px; pointer-events: none; opacity: 0; z-index: 9000;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  backdrop-filter: blur(10px); transition: opacity .15s, left .15s, top .15s, width .15s, height .15s;
}
#snap.on { opacity: 1; }

/* shared controls */
.ibtn {
  width: 32px; height: 32px; flex: none; border: 0; border-radius: 4px; background: none;
  display: inline-grid; place-items: center; color: var(--fg); text-decoration: none;
}
.ibtn.sm { width: 24px; height: 24px; }
.ibtn:hover { background: var(--hover); }
.ibtn:active, .ibtn.on { background: var(--press); }
.ibtn:disabled { opacity: .38; background: none; }
.btn {
  height: 32px; padding: 0 14px; border-radius: 4px; border: 1px solid var(--stroke-2);
  background: var(--card); color: var(--fg); font-size: 13px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--fg)); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; padding: 2px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--stroke); color: var(--fg-2); }
.kv { margin: 0; display: grid; gap: 8px; font-size: 13px; }
.kv > div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; }
.kv.wide > div { grid-template-columns: 140px minmax(0, 1fr); }
.kv dt { color: var(--fg-2); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; user-select: text; }

/* ---------- File Explorer ---------- */
.ex { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ex-toolbar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; background: var(--chrome); border-bottom: 1px solid var(--stroke); }
.addr {
  flex: 1; min-width: 0; height: 32px; margin-left: 6px; display: flex; align-items: center; gap: 0;
  padding: 0 6px; border: 1px solid var(--stroke); border-radius: 4px; background: var(--surface);
  overflow: hidden; white-space: nowrap;
}
.addr .sep { width: 12px; height: 12px; color: var(--fg-3); }
.crumb { border: 0; background: none; padding: 3px 7px; border-radius: 3px; font-size: 13px; }
.crumb:hover { background: var(--hover); }
.ex-search {
  width: 220px; height: 32px; margin-left: 6px; display: flex; align-items: center; gap: 8px;
  padding: 0 10px; border: 1px solid var(--stroke); border-radius: 4px; background: var(--surface); color: var(--fg-2);
}
.ex-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--fg); font-size: 13px; }
.ex-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr) 280px; }
.ex-nav { overflow: auto; padding: 8px 6px; background: var(--surface); border-right: 1px solid var(--stroke); }
.nav-i {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px;
  border: 0; border-radius: 4px; background: none; font-size: 13px; text-align: left; white-space: nowrap;
}
.nav-i > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.nav-i > .ic { width: 18px; height: 18px; }
.nav-i.sub { padding-left: 30px; }
.nav-i:hover { background: var(--hover); }
.nav-i.on { background: var(--press); }
.nav-i.on::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 16px; margin-top: -8px; border-radius: 2px; background: var(--accent); }
.ex-files { overflow: auto; padding: 12px 14px 20px; background: var(--surface); }
.ex-h { margin: 6px 4px 8px; font-size: 13px; font-weight: 600; color: var(--fg); }
.ex-h:not(:first-child) { margin-top: 20px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px; }
.tile {
  display: flex; gap: 12px; align-items: center; min-width: 0; padding: 8px 10px; text-align: left;
  border: 1px solid transparent; border-radius: 4px; background: none;
}
.tile:hover { background: var(--hover); }
.tile.sel { background: var(--sel); border-color: var(--sel-line); }
.tile > .ic { width: 48px; height: 48px; }
.tile .meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tile b { font-weight: 400; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { font-size: 12px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 64px 16px; color: var(--fg-2); text-align: center; }
.empty > .ic { width: 72px; height: 72px; opacity: .8; }
.ex-details { overflow: auto; padding: 18px 16px; background: var(--surface); border-left: 1px solid var(--stroke); }
.ex-status { height: 28px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 14px; font-size: 12px; color: var(--fg-2); background: var(--surface); border-top: 1px solid var(--stroke); font-variant-numeric: tabular-nums; }
.win[data-size="m"] .ex-main { grid-template-columns: 190px minmax(0, 1fr); }
.win[data-size="m"] .ex-details { display: none; }
.win[data-size="s"] .ex-main { grid-template-columns: minmax(0, 1fr); }
.win[data-size="s"] .ex-nav, .win[data-size="s"] .ex-details { display: none; }
.win[data-size="s"] .ex-search { width: 120px; }
.win[data-size="s"] .tiles { grid-template-columns: minmax(0, 1fr); }

/* details panel (Explorer + site info) */
.dt { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.dt-ic > .ic { width: 64px; height: 64px; }
.dt-title { margin: 4px 0 0; font-family: var(--ui-display); font-size: 18px; font-weight: 600; line-height: 1.25; text-wrap: balance; }
.dt-type { margin-top: -6px; font-size: 12px; color: var(--fg-2); }
.dt-desc { margin: 0; color: var(--fg); line-height: 1.55; font-size: 13px; user-select: text; }
.dt-tip { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 13px; padding: 8px 10px; border-radius: 6px; background: var(--sel); color: var(--fg); }
.dt-tip .g { margin-top: 2px; color: var(--accent); }
.dt-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--fg-3); }
.dt .kv { width: 100%; padding: 10px 0; border-top: 1px solid var(--stroke); border-bottom: 1px solid var(--stroke); }

/* ---------- Website window ---------- */
.br-bar { display: flex; align-items: center; gap: 2px; padding: 5px 8px; background: var(--chrome); border-bottom: 1px solid var(--stroke); }
.br-addr {
  flex: 1; min-width: 0; height: 30px; margin: 0 6px; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; border-radius: 15px; background: var(--surface-2); color: var(--fg-2); font-size: 13px; user-select: text;
}
.br-addr .u { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-view { flex: 1; min-height: 0; position: relative; overflow: hidden; background: var(--surface); }
.br-view iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--card); }
.br-load > .ic { width: 56px; height: 56px; }
.br-load { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--fg-2); background: var(--surface); transition: opacity .35s; }
.br-load.done { opacity: 0; pointer-events: none; }
.spin { width: 32px; height: 32px; color: var(--accent); animation: spin 1.1s linear infinite; }
.spin svg { width: 100%; height: 100%; }
.spin circle { stroke-dasharray: 22 60; }
@keyframes spin { to { transform: rotate(360deg); } }
.launch { position: absolute; inset: 0; overflow: auto; display: grid; place-items: center; padding: 32px 24px; }
.launch-card { width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.launch-card > .ic { width: 72px; height: 72px; }
.eyebrow { font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-2); }
.launch-card h2 { margin: -6px 0 0; font-family: var(--ui-display); font-size: 30px; font-weight: 600; line-height: 1.15; text-wrap: balance; }
.launch-card > p { margin: 0; max-width: 60ch; color: var(--fg-2); line-height: 1.6; user-select: text; }
.launch-card .note { font-size: 12px; color: var(--fg-3); }
.br-info {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 100%); overflow: auto; padding: 18px 16px;
  background: var(--acrylic); backdrop-filter: blur(24px); border-left: 1px solid var(--stroke);
  transform: translateX(102%); transition: transform .22s cubic-bezier(.1, .9, .2, 1); z-index: 2;
}
.br-info.open { transform: none; box-shadow: var(--shadow-soft); }

/* ---------- Notepad ---------- */
.np { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--card); }
.np-menu { display: flex; gap: 2px; padding: 4px 6px; background: var(--chrome); border-bottom: 1px solid var(--stroke); }
.np-m { height: 28px; padding: 0 10px; border: 0; border-radius: 4px; background: none; font-size: 13px; }
.np-m:hover { background: var(--hover); }
.np-text {
  flex: 1; min-height: 0; width: 100%; resize: none; border: 0; outline: none; padding: 14px 18px;
  background: var(--card); color: var(--fg); font-family: var(--mono); font-size: 14px; line-height: 1.55;
  user-select: text; -webkit-user-select: text; white-space: pre-wrap;
}
.np-text.nowrap { white-space: pre; overflow-x: auto; }
.np-status { height: 28px; flex: none; display: flex; align-items: center; gap: 0; padding: 0 6px; font-size: 12px; color: var(--fg-2); background: var(--chrome); border-top: 1px solid var(--stroke); font-variant-numeric: tabular-nums; overflow: hidden; white-space: nowrap; }
.np-status span { padding: 0 14px; border-right: 1px solid var(--stroke); }
.np-status span:first-child { min-width: 120px; }
.np-status span:last-child { border-right: 0; }

/* ---------- Terminal (always dark, like most terminals) ---------- */
.tm { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--term-bg); color: var(--term-fg); }
.tm-tabs { height: 36px; flex: none; display: flex; align-items: flex-end; padding: 0 8px; background: var(--term-bar); }
.tm-tab { height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 6px 6px 0 0; background: var(--term-bg); font-size: 12px; }
.tm-tab > .ic { width: 14px; height: 14px; }
.tm-scroll { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px 16px; font-family: var(--mono); font-size: 13px; line-height: 1.5; user-select: text; -webkit-user-select: text; }
.tm-l { white-space: pre-wrap; overflow-wrap: anywhere; }
.tm-l.dim { color: var(--term-dim); }
.tm-l.err { color: var(--term-err); }
.tm-l.hi { color: var(--term-hi); }
.tm-line { display: flex; }
.tm-ps { white-space: pre; }
.tm-in { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--term-fg); font-family: var(--mono); font-size: 13px; padding: 0; caret-color: var(--term-hi); }

/* ---------- Settings ---------- */
.set { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px minmax(0, 1fr); background: var(--surface); }
.set-nav { overflow: auto; padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.set-me { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; }
.set-me .avatar { width: 56px; height: 56px; font-size: 22px; }
.set-me .meta { display: flex; flex-direction: column; min-width: 0; }
.set-me small { color: var(--fg-2); font-size: 12px; }
.set-nav .nav-i .g { color: var(--accent); }
.set-content { overflow: auto; padding: 20px 28px 32px; display: flex; flex-direction: column; gap: 12px; }
.set-content h1 { margin: 0 0 6px; font-family: var(--ui-display); font-size: 28px; font-weight: 600; }
.set-sub { margin: -8px 0 4px; color: var(--fg-2); font-size: 13px; }
.set-hero { display: flex; align-items: center; gap: 20px; padding: 12px; border-radius: 8px; background: var(--card); border: 1px solid var(--stroke); }
.set-hero > div:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-hero small { color: var(--fg-2); font-size: 12px; }
.set-preview { display: block; position: relative; width: 200px; aspect-ratio: 16 / 10; max-width: 45%; border-radius: 6px; flex: none; border: 1px solid var(--stroke-2); }
.mini-win { position: absolute; left: 22%; top: 20%; width: 56%; height: 50%; border-radius: 4px; background: var(--chrome); box-shadow: 0 4px 12px rgba(0, 0, 0, .25); padding: 6px; display: flex; gap: 3px; flex-direction: column; }
.mini-win i { display: block; height: 4px; border-radius: 2px; background: var(--stroke-2); }
.mini-win i:first-child { width: 40%; background: var(--accent); }
.set-card { border-radius: 8px; background: var(--card); border: 1px solid var(--stroke); display: flex; flex-direction: column; }
.set-card.list { padding: 4px 0; }
.set-h { margin: 0; padding: 14px 18px 4px; font-size: 14px; font-weight: 600; }
.set-card > .kv, .set-card > .btns { padding: 10px 18px 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; flex-wrap: wrap; }
.set-row + .set-row { border-top: 1px solid var(--stroke); }
.set-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.set-label b { font-weight: 400; }
.set-label small { color: var(--fg-2); font-size: 12px; }
.seg { display: inline-flex; padding: 2px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--stroke); }
.seg button { height: 28px; padding: 0 12px; border: 0; border-radius: 4px; background: none; font-size: 13px; }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); color: var(--accent); font-weight: 600; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { --sw: var(--sw-l); width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--sw); box-shadow: inset 0 0 0 2px var(--card); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .swatch { --sw: var(--sw-d); } }
:root[data-theme="dark"] .swatch { --sw: var(--sw-d); }
.swatch.on { border-color: var(--fg); }
.walls { display: flex; gap: 12px; padding: 0 18px 16px; flex-wrap: wrap; }
.wall-pick { display: flex; flex-direction: column; gap: 6px; padding: 4px; border: 2px solid transparent; border-radius: 8px; background: none; font-size: 12px; color: var(--fg-2); }
.wall-pick.on { border-color: var(--accent); color: var(--fg); }
.wthumb { position: relative; display: block; width: 132px; aspect-ratio: 16 / 10; border-radius: 5px; }
.set-app { display: flex; align-items: center; gap: 14px; padding: 10px 18px; }
.set-app + .set-app { border-top: 1px solid var(--stroke); }
.set-app > .ic { width: 28px; height: 28px; }
.win[data-size="s"] .set { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.win[data-size="s"] .set-nav { flex-direction: row; overflow-x: auto; padding: 8px; border-bottom: 1px solid var(--stroke); }
.win[data-size="s"] .set-me { display: none; }
.win[data-size="s"] .set-nav .nav-i { width: auto; }
.win[data-size="s"] .set-content { padding: 16px; }

/* ---------- taskbar ---------- */
#taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 9000;
  height: calc(var(--tb-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: var(--mica); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6);
  border-top: 1px solid var(--stroke);
}
.tb-side { display: flex; align-items: center; min-width: 0; padding-left: max(8px, env(safe-area-inset-left, 0px)); }
.tb-lab { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 8px; border: 1px solid var(--stroke); border-radius: 18px; background: var(--hover); color: var(--fg); font: 500 13px/1 var(--ui); white-space: nowrap; cursor: pointer; transition: background .15s, border-color .15s; }
.tb-lab:hover { background: var(--press); border-color: var(--stroke-2); }
.tb-lab:active { transform: translateY(1px); }
.tb-lab img { width: 20px; height: 20px; flex: none; border-radius: 5px; }
#tb-center { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: calc(100vw - 150px); overflow-x: auto; scrollbar-width: none; }
#tb-center::-webkit-scrollbar { display: none; }
.tb-apps { display: flex; gap: 4px; }
.tbb { position: relative; width: 40px; height: 40px; flex: none; border: 0; border-radius: 4px; background: none; display: grid; place-items: center; color: var(--fg); }
.tbb > .ic { width: 24px; height: 24px; }
.tbb:hover, .tbb.pressed { background: var(--hover); }
.tbb:active { background: var(--press); }
.tbb::after { content: ""; position: absolute; bottom: 2px; left: 50%; width: 0; height: 3px; border-radius: 2px; background: var(--fg-3); transform: translateX(-50%); transition: width .18s; }
.tbb.run::after { width: 6px; }
.tbb.act { background: var(--hover); }
.tbb.act::after { width: 16px; background: var(--accent); }
.start-btn > .ic { width: 26px; height: 26px; }
#tray { justify-self: end; display: flex; align-items: center; gap: 2px; height: 100%; }
.trayb { height: 40px; padding: 0 9px; border: 0; border-radius: 4px; background: none; display: flex; align-items: center; gap: 8px; color: var(--fg); }
.trayb:hover, .trayb.pressed { background: var(--hover); }
.trayb.clock { flex-direction: column; align-items: flex-end; justify-content: center; gap: 0; font-size: 12px; line-height: 1.35; font-variant-numeric: tabular-nums; }
.showdesk { width: 10px; height: 100%; margin-left: 4px; border: 0; border-left: 1px solid var(--stroke); background: none; }
.showdesk:hover { background: var(--hover); }

/* ---------- flyouts ---------- */
.fly {
  position: absolute; z-index: 9500; bottom: calc(var(--tb-h) + env(safe-area-inset-bottom, 0px) + 12px);
  background: var(--acrylic); backdrop-filter: blur(40px) saturate(1.5); -webkit-backdrop-filter: blur(40px) saturate(1.5);
  border: 1px solid var(--stroke-2); border-radius: 8px; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(var(--tx, 0), 24px);
  transition: opacity .14s, transform .22s cubic-bezier(.1, .9, .2, 1), visibility 0s .22s;
}
.fly.open { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(var(--tx, 0), 0); transition: opacity .14s, transform .22s cubic-bezier(.1, .9, .2, 1); }

/* Start */
.start { --tx: -50%; left: 50%; width: min(640px, calc(100vw - 24px)); height: min(700px, calc(100% - var(--tb-h) - 36px)); display: flex; flex-direction: column; }
.st-top { padding: 28px 32px 4px; }
.st-search { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--stroke); border-bottom-color: var(--stroke-2); color: var(--fg-2); }
.st-search:focus-within { border-bottom: 2px solid var(--accent); }
.st-q { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--fg); font-size: 13px; }
.st-main { flex: 1; min-height: 0; overflow: auto; padding: 18px 32px 20px; }
.st-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; padding: 0 12px; }
.st-head:not(:first-child) { margin-top: 18px; }
.st-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.pill { height: 26px; padding: 0 8px 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--stroke); border-radius: 4px; background: var(--card); font-size: 12px; }
.pill .g { width: 12px; height: 12px; }
.pill:hover { background: var(--surface-2); }
.st-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; }
.st-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 10px; border: 0; border-radius: 4px; background: none; }
.st-tile:hover { background: var(--hover); }
.st-tile > .ic, .st-fold { width: 34px; height: 34px; }
.st-tile > span:last-child { font-size: 12px; line-height: 1.3; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-fold { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; border-radius: 7px; background: var(--hover); border: 1px solid var(--stroke); }
.st-fold .ic { width: 100%; height: 100%; }
.st-desc { margin: -2px 12px 14px; color: var(--fg-2); font-size: 13px; line-height: 1.5; max-width: 60ch; }
.st-folder-foot { margin-top: 18px; padding: 0 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.st-note { margin: 0; color: var(--fg-3); font-size: 12px; }
.st-rec { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.rec, .st-best { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px 12px; border: 0; border-radius: 4px; background: none; text-align: left; }
.rec:hover, .st-best:hover { background: var(--hover); }
.rec > .ic { width: 32px; height: 32px; }
.rec .meta, .st-best .meta { min-width: 0; display: flex; flex-direction: column; }
.rec b, .st-best b { font-weight: 400; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec small, .st-best small { font-size: 12px; color: var(--fg-2); }
.st-best { width: 100%; padding: 14px; align-items: flex-start; background: var(--hover); }
.st-best > .ic { width: 48px; height: 48px; }
.st-best p { margin: 6px 0 0; font-size: 12px; color: var(--fg-2); line-height: 1.5; }
.st-all { display: flex; flex-direction: column; }
.st-all .rec > .ic { width: 24px; height: 24px; }
.st-letter { padding: 10px 12px 4px; font-size: 12px; font-weight: 600; color: var(--accent); }
.st-empty { padding: 40px 12px; color: var(--fg-2); }
.st-empty p { margin: 0 0 4px; color: var(--fg); }
.st-foot { height: 64px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 44px; border-top: 1px solid var(--stroke); background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-radius: 0 0 8px 8px; }
.st-user { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border: 0; border-radius: 4px; background: none; font-size: 13px; }
.st-user:hover { background: var(--hover); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--grad-2)); color: var(--on-accent); font-weight: 600; flex: none; }

/* Quick settings */
.qs { right: 12px; width: min(360px, calc(100vw - 24px)); padding: 20px 20px 0; }
.qs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.qs-t { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; text-align: center; }
.qs-b { width: 100%; height: 48px; border: 1px solid var(--stroke); border-radius: 6px; background: var(--card); display: grid; place-items: center; }
.qs-b:hover { background: var(--surface-2); }
.qs-b.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.qs-slider { display: flex; align-items: center; gap: 14px; margin-top: 18px; color: var(--fg-2); }
.qs-slider input { flex: 1; accent-color: var(--accent); }
.qs-foot { display: flex; align-items: center; justify-content: space-between; margin: 18px -20px 0; padding: 8px 12px 8px 20px; border-top: 1px solid var(--stroke); background: color-mix(in srgb, var(--surface-2) 60%, transparent); border-radius: 0 0 8px 8px; font-size: 12px; }
.bat { display: flex; align-items: center; gap: 8px; }

/* Calendar */
.cal { right: 12px; width: min(336px, calc(100vw - 24px)); }
.cal-top { padding: 14px 18px; border-bottom: 1px solid var(--stroke); font-size: 14px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 4px 12px 14px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-w { font-size: 12px; color: var(--fg-2); padding: 6px 0; }
.cal-d { display: grid; place-items: center; height: 38px; width: 38px; margin: auto; border-radius: 50%; font-size: 13px; }
.cal-d.other { color: var(--fg-3); }
.cal-d.today { background: var(--accent); color: var(--on-accent); font-weight: 600; }

/* Context menu */
.ctx {
  position: absolute; z-index: 9700; min-width: 220px; padding: 4px;
  background: var(--acrylic); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border: 1px solid var(--stroke-2); border-radius: 8px; box-shadow: var(--shadow);
  animation: ctx-in .12s ease;
}
@keyframes ctx-in { from { opacity: 0; transform: translateY(-4px); } }
.ctx-i { display: flex; align-items: center; gap: 12px; width: 100%; height: 32px; padding: 0 12px; border: 0; border-radius: 4px; background: none; color: var(--fg); font-size: 13px; text-align: left; text-decoration: none; white-space: nowrap; }
.ctx-i:hover, .ctx-i:focus-visible { background: var(--hover); outline: none; }
.ctx-sep { height: 1px; margin: 4px 0; background: var(--stroke); }

/* Notifications */
#toasts { position: absolute; right: 12px; bottom: calc(var(--tb-h) + env(safe-area-inset-bottom, 0px) + 12px); z-index: 9600; display: flex; flex-direction: column; gap: 8px; width: min(364px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; padding: 12px 14px 14px; border-radius: 8px; background: var(--acrylic); backdrop-filter: blur(40px); border: 1px solid var(--stroke-2); box-shadow: var(--shadow); animation: toast-in .3s cubic-bezier(.1, .9, .2, 1); transition: opacity .2s, transform .2s; }
.toast.out { opacity: 0; transform: translateX(24px); }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px); } }
.toast-h { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg-2); margin-bottom: 8px; }
.toast-h > .ic { width: 16px; height: 16px; }
.toast-h .tn { flex: 1; }
.toast b { font-size: 14px; }
.toast p { margin: 2px 0 0; font-size: 13px; color: var(--fg-2); line-height: 1.45; }

/* Lock screen */
#lock { position: absolute; inset: 0; z-index: 9900; display: grid; place-items: start center; color: #fff; opacity: 0; transition: opacity .3s, transform .38s cubic-bezier(.4, 0, .2, 1); }
#lock.on { opacity: 1; }
#lock.up { transform: translateY(-100%); }
#lock::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .18); }
.lk-inner { position: relative; margin-top: 12vh; text-align: center; text-shadow: 0 2px 16px rgba(0, 0, 0, .35); }
.lk-time { font-family: var(--ui-display); font-size: clamp(64px, 14vw, 128px); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.lk-date { margin-top: 10px; font-size: clamp(18px, 3vw, 24px); }
.lk-hint { position: absolute; bottom: 48px; left: 0; right: 0; text-align: center; font-size: 13px; opacity: .85; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .win { border-radius: 0; }
  .wctl .mx { display: none; }
  .hide-s { display: none; }
  .tb-side { display: none; }
  #taskbar { grid-template-columns: minmax(0, 1fr) auto; }
  #tb-center { justify-content: flex-start; padding-left: 6px; max-width: none; }
  .start { height: min(640px, calc(100% - var(--tb-h) - 24px)); }
  .st-top { padding: 18px 16px 4px; }
  .st-main { padding: 14px 12px 16px; }
  .st-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .st-rec { grid-template-columns: minmax(0, 1fr); }
  .st-foot { padding: 0 16px; }
  #icons { grid-auto-columns: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
