/* Layout: a night-sky desktop — menubar on top, floating glass windows, monitor widgets pinned right, dock at the bottom. */
:root {
  --void: #05060f;
  --ink: #e9ecff;
  --muted: #8d95c4;
  --faint: #5c6392;
  --glass: rgba(15, 18, 40, .84);
  --glass-hi: rgba(28, 33, 68, .72);
  --panel: rgba(9, 11, 28, .55);
  --line: rgba(170, 185, 255, .13);
  --line-hi: rgba(200, 212, 255, .24);
  --ice: #7cc4ff;
  --petal: #ff9ad5;
  --orchid: #b39bff;
  --ok: #6ff0b0;
  --warn: #ffcf6b;
  --bad: #ff6f91;
  --sel: rgba(124, 196, 255, .18);
  --glow: 0 0 24px rgba(124, 196, 255, .35);
  --f-display: "Unbounded", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Manrope", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --mb-h: 30px;
  --ease: cubic-bezier(.2, .9, .25, 1.04);
  --r-win: 16px;
  --ink-2: #cdd2f5;
  --t1: rgba(255, 255, 255, .035); --t2: rgba(255, 255, 255, .06); --t3: rgba(255, 255, 255, .09); --hl: rgba(255, 255, 255, .07);
  --field: rgba(0, 0, 0, .25); --side: rgba(0, 0, 0, .12); --term: rgba(0, 0, 0, .28); --pv: rgba(0, 0, 0, .35); --ed: rgba(4, 6, 18, .55);
  --menubar: rgba(8, 10, 26, .5); --dock: rgba(20, 24, 52, .42); --pop: rgba(22, 26, 56, .94); --th: rgba(14, 17, 38, .92);
  --wdg: linear-gradient(160deg, rgba(34, 40, 84, .55), rgba(12, 14, 34, .55));
  --scrim: rgba(3, 4, 12, .5); --scrim-2: rgba(5, 6, 15, .75); --sh: rgba(0, 0, 0, .6); --sh-strong: rgba(0, 0, 0, .8);
  --btn-grad: linear-gradient(135deg, #5aa8ff, #9b7bff);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
  --void: #eef1fb; --ink: #1a1e3a; --ink-2: #3a4068; --muted: #626a93; --faint: #9197b8;
  --glass: rgba(255, 255, 255, .8); --glass-hi: rgba(255, 255, 255, .9); --panel: rgba(255, 255, 255, .6);
  --line: rgba(40, 50, 110, .11); --line-hi: rgba(40, 50, 110, .17);
  --ice: #2c78d8; --petal: #d2408f; --orchid: #7352e6; --ok: #129a63; --warn: #b87a06; --bad: #dc3a5a;
  --sel: rgba(44, 120, 216, .13); --glow: 0 0 20px rgba(44, 120, 216, .25);
  --t1: rgba(30, 40, 100, .035); --t2: rgba(30, 40, 100, .06); --t3: rgba(30, 40, 100, .09); --hl: rgba(255, 255, 255, .9);
  --field: rgba(255, 255, 255, .75); --side: rgba(245, 247, 255, .55); --term: rgba(250, 251, 255, .85); --pv: rgba(30, 40, 90, .06); --ed: rgba(255, 255, 255, .65);
  --menubar: rgba(255, 255, 255, .55); --dock: rgba(255, 255, 255, .45); --pop: rgba(255, 255, 255, .96); --th: rgba(250, 251, 255, .96);
  --wdg: linear-gradient(160deg, rgba(255, 255, 255, .82), rgba(240, 243, 255, .66));
  --scrim: rgba(225, 230, 248, .5); --scrim-2: rgba(236, 240, 252, .8); --sh: rgba(40, 50, 110, .18); --sh-strong: rgba(40, 50, 110, .28);
  color-scheme: light;
  }
}
:root[data-theme="light"] {
  --void: #eef1fb; --ink: #1a1e3a; --ink-2: #3a4068; --muted: #626a93; --faint: #9197b8;
  --glass: rgba(255, 255, 255, .8); --glass-hi: rgba(255, 255, 255, .9); --panel: rgba(255, 255, 255, .6);
  --line: rgba(40, 50, 110, .11); --line-hi: rgba(40, 50, 110, .17);
  --ice: #2c78d8; --petal: #d2408f; --orchid: #7352e6; --ok: #129a63; --warn: #b87a06; --bad: #dc3a5a;
  --sel: rgba(44, 120, 216, .13); --glow: 0 0 20px rgba(44, 120, 216, .25);
  --t1: rgba(30, 40, 100, .035); --t2: rgba(30, 40, 100, .06); --t3: rgba(30, 40, 100, .09); --hl: rgba(255, 255, 255, .9);
  --field: rgba(255, 255, 255, .75); --side: rgba(245, 247, 255, .55); --term: rgba(250, 251, 255, .85); --pv: rgba(30, 40, 90, .06); --ed: rgba(255, 255, 255, .65);
  --menubar: rgba(255, 255, 255, .55); --dock: rgba(255, 255, 255, .45); --pop: rgba(255, 255, 255, .96); --th: rgba(250, 251, 255, .96);
  --wdg: linear-gradient(160deg, rgba(255, 255, 255, .82), rgba(240, 243, 255, .66));
  --scrim: rgba(225, 230, 248, .5); --scrim-2: rgba(236, 240, 252, .8); --sh: rgba(40, 50, 110, .18); --sh-strong: rgba(40, 50, 110, .28);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: var(--void); color: var(--ink);
  font: 500 13.5px/1.45 var(--f-body); -webkit-font-smoothing: antialiased;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(124, 196, 255, .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(160, 175, 255, .18); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(160, 175, 255, .32); }
.mono { font-family: var(--f-mono); }
.num { font-variant-numeric: tabular-nums; }

#space { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

/* ---------- boot ---------- */
#boot {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 55%, rgba(40, 30, 90, .55), rgba(3, 4, 12, .98) 60%);
  transition: opacity .9s ease, filter .9s ease, transform 1.1s var(--ease);
}
#boot.out { opacity: 0; filter: blur(12px); transform: scale(1.08); pointer-events: none; }
.letterbox { position: absolute; left: 0; right: 0; height: 11vh; background: #000; z-index: 2; transition: transform 1s var(--ease) .1s; }
.letterbox.top { top: 0; } .letterbox.bottom { bottom: 0; }
#boot.out .letterbox.top { transform: translateY(-100%); }
#boot.out .letterbox.bottom { transform: translateY(100%); }
.boot-core { text-align: center; display: grid; justify-items: center; gap: 14px; }
.boot-mascot { width: 120px; height: 120px; animation: rise 1.2s var(--ease) both; }
.boot-title {
  margin: 6px 0 0; font: 300 clamp(36px, 7vw, 72px)/1 var(--f-display); letter-spacing: .5em; padding-left: .5em; color: #f2f4ff;
  text-shadow: 0 0 28px rgba(124, 196, 255, .55), 0 0 60px rgba(179, 155, 255, .35);
}
.boot-title span { display: inline-block; animation: letter 1.1s var(--ease) both, glint 3.2s ease-in-out 1.6s infinite; }
@keyframes glint { 0%, 70%, 100% { color: #f2f4ff; } 80% { color: #9fd4ff; } 90% { color: #ffc2e6; } }
.boot-title span:nth-child(1) { animation-delay: .25s } .boot-title span:nth-child(2) { animation-delay: .32s }
.boot-title span:nth-child(3) { animation-delay: .39s } .boot-title span:nth-child(4) { animation-delay: .46s }
.boot-title span:nth-child(5) { animation-delay: .53s } .boot-title span:nth-child(6) { animation-delay: .60s }
.boot-sub { margin: 0; font: 500 11px var(--f-display); letter-spacing: .6em; text-transform: uppercase; color: #8d95c4; animation: fade 1s ease .9s both; }
.boot-bar { width: min(280px, 60vw); height: 2px; background: var(--t3); border-radius: 2px; overflow: hidden; margin-top: 18px; animation: fade .6s ease 1s both; }
.boot-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ice), var(--petal)); box-shadow: var(--glow); transition: width .35s ease; }
.boot-line { margin: 0; font: 400 11.5px var(--f-mono); color: #5c6392; min-height: 1.4em; animation: fade .6s ease 1s both; }
.boot-skip { position: absolute; right: 24px; bottom: calc(11vh + 16px); z-index: 3; font-size: 12px; color: #8d95c4; padding: 6px 12px; border-radius: 99px; border: 1px solid rgba(170, 185, 255, .2); }
.boot-skip:hover { color: #fff; }
@keyframes letter { from { opacity: 0; transform: translateY(30px) scale(.8); filter: blur(10px); } }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(30px) scale(.7); filter: blur(8px); } }

/* ---------- mascot ---------- */
.mascot { width: 100%; height: 100%; overflow: visible; }
.mascot .bob { animation: bob 3.6s ease-in-out infinite; transform-origin: 60px 60px; }
.mascot .eye { animation: blink 5s infinite; transform-box: fill-box; transform-origin: center; }
.mascot .happy { opacity: 0; }
.mascot .led { animation: led 1.6s steps(2) infinite; }
.mascot .led.b { animation-duration: 2.3s; animation-delay: .4s; }
.mascot .orb { filter: drop-shadow(0 0 6px var(--ice)); animation: orb 2.4s ease-in-out infinite; }
.mascot .shadow { animation: shadow 3.6s ease-in-out infinite; transform-origin: 60px 112px; }
.busy .mascot .eye { opacity: 0; }
.busy .mascot .happy { opacity: 1; }
.busy .mascot .led { animation-duration: .25s; }
.busy .mascot .bob { animation-duration: 1.4s; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-1.5deg); } }
@keyframes shadow { 50% { transform: scaleX(.82); opacity: .5; } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes led { 50% { opacity: .25; } }
@keyframes orb { 50% { fill: var(--petal); filter: drop-shadow(0 0 9px var(--petal)); } }

/* ---------- menubar ---------- */
#menubar {
  position: fixed; top: 0; left: 0; right: 0; height: calc(var(--mb-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 12px 0;
  z-index: 500; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--menubar); backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.mb-left, .mb-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mb-logo { display: grid; place-items: center; width: 24px; height: 22px; color: var(--ice); border-radius: 6px; }
.mb-logo:hover { background: var(--t3); }
.mb-app { font-weight: 700; }
.mb-menu { display: flex; gap: 2px; }
.mb-menu button { padding: 3px 9px; border-radius: 6px; color: var(--ink-2); }
.mb-menu button:hover { background: var(--t3); }
.mb-net { display: flex; gap: 5px; align-items: center; font: 11px var(--f-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.mb-net span { min-width: 64px; }
.mb-net .dn { color: var(--ice); } .mb-net .up { color: var(--petal); }
.mb-online { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.mb-online i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: led 2s ease-in-out infinite; }
.mb-me { padding: 2px 9px; border-radius: 99px; background: var(--t2); border: 1px solid var(--line); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-me:hover { border-color: var(--line-hi); }
.mb-clock { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* ---------- desktop ---------- */
#desktop { position: fixed; top: calc(var(--mb-h) + env(safe-area-inset-top, 0px)); left: 0; right: 0; bottom: 0; z-index: 1; }
body.booting #desktop, body.booting #dock, body.booting #menubar { opacity: 0; }
body.revealed #desktop, body.revealed #menubar, body.revealed #dock { animation: reveal 1.1s var(--ease) both; }
body.revealed #dock { animation-delay: .25s; }
@keyframes reveal { from { opacity: 0; transform: scale(.97); filter: blur(10px); } }

/* ---------- widgets ---------- */
#widgets {
  position: absolute; top: 14px; right: 14px; bottom: 96px; width: 296px; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: 12px; padding-right: 2px; z-index: 2;
  transition: transform .5s var(--ease), opacity .4s ease;
  scrollbar-width: none;
}
#widgets::-webkit-scrollbar { display: none; }
#widgets.off { transform: translateX(calc(100% + 30px)); opacity: 0; pointer-events: none; }
.wdg {
  position: relative; padding: 14px 16px; border-radius: 20px;
  background: var(--wdg);
  border: 1px solid var(--line); backdrop-filter: blur(22px) saturate(1.5); -webkit-backdrop-filter: blur(22px) saturate(1.5);
  box-shadow: 0 20px 40px -20px var(--sh), inset 0 1px 0 var(--hl);
  animation: wdg-in .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms + .3s);
  flex-shrink: 0;
}
@keyframes wdg-in { from { opacity: 0; transform: translateX(30px); } }
.wdg-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.wdg-t { font: 500 10px var(--f-display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.wdg-v { font: 600 22px/1 var(--f-body); font-variant-numeric: tabular-nums; }
.wdg-v small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.wdg-sub { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.wdg canvas { display: block; width: 100%; height: 54px; margin-top: 8px; }
.wdg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wdg.small { padding: 12px 14px; }

.w-server { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; }
.w-server .m { width: 76px; height: 76px; }
.w-server h3 { margin: 0; font: 500 14px var(--f-display); letter-spacing: .02em; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; background: rgba(111, 240, 176, .12); color: var(--ok); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill.warn { background: rgba(255, 207, 107, .12); color: var(--warn); }
.pill.bad { background: rgba(255, 111, 145, .12); color: var(--bad); }
.w-addr { margin-top: 6px; font: 11px var(--f-mono); color: var(--ice); user-select: text; }

.w-storage { display: grid; grid-template-columns: 104px 1fr; gap: 14px; align-items: center; }
.ring { position: relative; width: 104px; height: 104px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .trk { fill: none; stroke: var(--t2); stroke-width: 10; }
.ring .val { fill: none; stroke: url(#ringGrad); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1.2s var(--ease); filter: drop-shadow(0 0 6px rgba(124, 196, 255, .5)); }
.ring-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-c b { font: 500 19px var(--f-display); font-variant-numeric: tabular-nums; }
.ring-c span { font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.legend { display: grid; gap: 5px; font-size: 11.5px; }
.legend div { display: grid; grid-template-columns: 8px 1fr auto; gap: 7px; align-items: center; }
.legend i { width: 8px; height: 8px; border-radius: 3px; }
.legend span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.segbar { display: flex; height: 6px; border-radius: 6px; overflow: hidden; background: var(--t2); margin-top: 12px; }
.segbar i { height: 100%; transition: width 1s var(--ease); }

.w-net .rates { display: flex; gap: 16px; }
.w-net .rates div { display: grid; }
.w-net .rates b { font: 600 17px var(--f-body); font-variant-numeric: tabular-nums; }
.w-net .rates span { font-size: 10.5px; color: var(--muted); }
.w-net .dn b { color: var(--ice); } .w-net .up b { color: var(--petal); }

.bar { height: 6px; border-radius: 6px; background: var(--t2); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--orchid), var(--ice)); transition: width .8s var(--ease); }
.devices { display: grid; gap: 8px; }
.dev { display: grid; grid-template-columns: 28px 1fr auto; gap: 9px; align-items: center; font-size: 12px; }
.av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 11px var(--f-body); color: #0b0d22; }
.dev small { display: block; color: var(--muted); font-size: 10.5px; }
.dev .me { font-size: 10px; color: var(--ice); }

/* ---------- windows ---------- */
.win {
  position: absolute; display: flex; flex-direction: column; min-width: 320px; min-height: 220px;
  border-radius: var(--r-win);
  background: var(--glass); border: 1px solid var(--line-hi);
  backdrop-filter: blur(34px) saturate(1.5); -webkit-backdrop-filter: blur(34px) saturate(1.5);
  box-shadow: 0 40px 80px -30px var(--sh-strong), 0 0 0 .5px var(--sh), inset 0 1px 0 var(--hl);
  animation: win-in .45s var(--ease) both; z-index: 10;
}
.win.focused { box-shadow: 0 50px 100px -30px var(--sh-strong), 0 0 0 .5px var(--sh), 0 0 60px -20px rgba(124, 196, 255, .25), inset 0 1px 0 var(--hl); }
.win:not(.focused) .win-bar { opacity: .75; }
.win.ready { animation: none; }
.win.closing { animation: win-out .28s ease-in both; pointer-events: none; }
.win.min { transition: transform .45s cubic-bezier(.6, 0, .8, .4), opacity .45s ease; opacity: 0; pointer-events: none; }
.win.max { top: 8px !important; left: 8px !important; width: calc(100% - 16px) !important; height: calc(100% - 96px) !important; }
.win.maxing { transition: top .35s var(--ease), left .35s var(--ease), width .35s var(--ease), height .35s var(--ease); }
@keyframes win-in { from { opacity: 0; transform: translateY(16px) scale(.94); filter: blur(6px); } }
@keyframes win-out { to { opacity: 0; transform: scale(.94); filter: blur(4px); } }
.win-bar { border-radius: var(--r-win) var(--r-win) 0 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; height: 44px; padding: 0 12px; flex-shrink: 0; cursor: grab; touch-action: none; border-bottom: 1px solid var(--line); background: var(--t1); }
.win-bar:active { cursor: grabbing; }
.lights { display: flex; gap: 9px; align-items: center; }
.lights button { position: relative; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .3), 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s var(--ease), filter .15s; }
.lights button::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; }
.lights .close { background: radial-gradient(circle at 35% 30%, #ff8a98, #ff4d63); }
.lights .min { background: radial-gradient(circle at 35% 30%, #ffd88a, #ffb02e); }
.lights .max { background: radial-gradient(circle at 35% 30%, #7bf0ad, #2fcf75); }
.lights svg { width: 9px; height: 9px; stroke: rgba(40, 10, 20, .7); stroke-width: 1.9; stroke-linecap: round; fill: none; opacity: .5; transition: opacity .15s; }
.lights .min svg { stroke: rgba(80, 45, 0, .75); } .lights .max svg { stroke: rgba(0, 60, 25, .75); }
.win-bar:hover .lights svg, .lights button:focus-visible svg { opacity: 1; }
.lights button:hover { transform: scale(1.18); filter: brightness(1.08); }
.lights button:active { transform: scale(.92); }
.win:not(.focused) .lights button:not(:hover) { filter: saturate(.35) brightness(.95); }
/* resize edges */
.rz { position: absolute; z-index: 5; touch-action: none; }
.rz.n, .rz.s { left: 10px; right: 10px; height: 8px; cursor: ns-resize; } .rz.n { top: -3px; } .rz.s { bottom: -3px; }
.rz.e, .rz.w { top: 10px; bottom: 10px; width: 8px; cursor: ew-resize; } .rz.e { right: -3px; } .rz.w { left: -3px; }
.rz.ne, .rz.nw, .rz.se, .rz.sw { width: 16px; height: 16px; } .rz.ne { top: -3px; right: -3px; cursor: nesw-resize; } .rz.sw { bottom: -3px; left: -3px; cursor: nesw-resize; }
.rz.nw { top: -3px; left: -3px; cursor: nwse-resize; } .rz.se { bottom: -3px; right: -3px; cursor: nwse-resize; }
.rz.se::after { content: ""; position: absolute; right: 6px; bottom: 6px; width: 8px; height: 8px; border-right: 2px solid var(--line-hi); border-bottom: 2px solid var(--line-hi); border-bottom-right-radius: 3px; opacity: .8; }
.win.max .rz, .win.min .rz { display: none; }
.snap-ghost { position: absolute; inset: 8px 8px 88px; border-radius: var(--r-win); background: var(--sel); border: 2px solid var(--ice); z-index: 9; pointer-events: none; animation: fade .2s ease both; }
body.resizing, body.resizing * { user-select: none !important; }
body.resizing iframe { pointer-events: none; }
.win-title { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 13px; min-width: 0; }
.win-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-title svg { width: 18px; height: 18px; flex-shrink: 0; }
.win-actions { display: flex; gap: 6px; align-items: center; }
.win-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; overflow: hidden; border-radius: 0 0 var(--r-win) var(--r-win); }

/* ---------- buttons / inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 9px; font-weight: 600; font-size: 12.5px; background: var(--t2); border: 1px solid var(--line); white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { background: var(--t3); border-color: var(--line-hi); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--btn-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px -6px rgba(124, 150, 255, .7); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: rgba(255, 111, 145, .14); color: #ffb3c5; border-color: rgba(255, 111, 145, .3); }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
.btn svg, .ib svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn.on { background: var(--sel); border-color: rgba(124, 196, 255, .4); color: var(--ice); }
.ib { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-2); }
.ib:hover:not(:disabled) { background: var(--t3); }
.ib:disabled { opacity: .3; cursor: default; }
.field { height: 30px; padding: 0 10px; border-radius: 9px; background: var(--field); border: 1px solid var(--line); outline: none; min-width: 0; }
.field:focus { border-color: rgba(124, 196, 255, .55); box-shadow: 0 0 0 3px rgba(124, 196, 255, .15); }
select.field { padding-right: 6px; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--field); border: 1px solid var(--line); }
.seg button { height: 24px; min-width: 28px; padding: 0 8px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 600; }
.seg button.on { background: var(--t3); color: var(--ink); }
.seg svg { width: 15px; height: 15px; }

/* ---------- files window ---------- */
.fm { display: grid; grid-template-columns: 200px 1fr; flex: 1; min-height: 0; }
.fm-side { border-right: 1px solid var(--line); padding: 12px 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; background: var(--side); }
.side-h { font: 500 9.5px var(--f-display); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); padding: 0 8px 4px; }
.side-list { display: grid; gap: 1px; }
.side-item { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 8px; text-align: left; width: 100%; font-size: 13px; color: var(--ink-2); transition: background .12s; }
.side-item:hover { background: var(--t2); }
.side-item.on { background: var(--sel); color: var(--ink); }
.side-item.drop { background: rgba(255, 154, 213, .2); box-shadow: inset 0 0 0 1px var(--petal); }
.side-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.side-item .cnt { margin-left: auto; font-size: 11px; color: var(--faint); }
.side-store { margin-top: auto; padding: 10px; border-radius: 12px; background: var(--t1); border: 1px solid var(--line); font-size: 11.5px; }
.side-store b { font-weight: 700; }
.side-store .bar { margin-top: 7px; }
.side-store p { margin: 6px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }

.fm-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.fm-tools { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
.crumbs button { padding: 3px 8px; border-radius: 7px; font-weight: 600; white-space: nowrap; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.crumbs button:last-child { color: var(--ink); }
.crumbs button:hover, .crumbs button.drop { background: var(--t3); color: var(--ink); }
.crumbs .sep { color: var(--faint); font-size: 11px; }
.search { position: relative; }
.search svg { position: absolute; left: 9px; top: 50%; translate: 0 -50%; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.search .field { padding-left: 28px; width: 170px; transition: width .3s var(--ease); }
.search .field:focus { width: 220px; }

.fm-view { flex: 1; overflow: auto; padding: 14px; position: relative; outline: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 6px; align-content: start; }
.tile { position: relative; display: grid; justify-items: center; gap: 6px; padding: 10px 6px 8px; border-radius: 12px; text-align: center; cursor: default; animation: tile-in .4s var(--ease) both; animation-delay: calc(min(var(--i, 0), 30) * 14ms); border: 1px solid transparent; }
@keyframes tile-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.tile:hover { background: var(--t2); }
.tile.sel { background: var(--sel); border-color: rgba(124, 196, 255, .35); }
.tile.drop { background: rgba(255, 154, 213, .16); border-color: var(--petal); transform: scale(1.04); }
.tile.cut { opacity: .45; }
.tile .ico { width: 64px; height: 64px; display: grid; place-items: center; transition: transform .25s var(--ease); }
.tile:hover .ico { transform: translateY(-2px) scale(1.04); }
.tile .ico svg { width: 64px; height: 64px; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.tile .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; box-shadow: 0 6px 14px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .12); background: var(--t2); }
.tile .nm { font-size: 12px; line-height: 1.3; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 100%; }
.tile.sel .nm { color: var(--ink); }
.tile .meta { font-size: 10.5px; color: var(--faint); margin-top: -3px; font-variant-numeric: tabular-nums; }
.tile .where { font-size: 10px; color: var(--ice); opacity: .8; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.list { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.list th { position: sticky; top: -14px; background: var(--th); backdrop-filter: blur(10px); text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; z-index: 1; }
.list th:hover { color: var(--ink); }
.list th .arr { color: var(--ice); margin-left: 4px; }
.list td { padding: 5px 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.list tr.row { animation: tile-in .35s var(--ease) both; animation-delay: calc(min(var(--i, 0), 30) * 10ms); }
.list tr.row:nth-child(even) td { background: var(--t1); }
.list tr.row:hover td { background: var(--t2); }
.list tr.row.sel td { background: var(--sel); }
.list tr.row.drop td { background: rgba(255, 154, 213, .16); }
.list td:first-child { border-radius: 8px 0 0 8px; } .list td:last-child { border-radius: 0 8px 8px 0; }
.list .n { display: flex; align-items: center; gap: 9px; max-width: 420px; }
.list .n svg, .list .n img { width: 24px; height: 24px; flex-shrink: 0; border-radius: 4px; object-fit: cover; }
.list .n span { overflow: hidden; text-overflow: ellipsis; }
.list .dim { color: var(--muted); }

.fm-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.empty { display: grid; place-items: center; text-align: center; gap: 8px; padding: 40px 20px; color: var(--muted); height: 100%; }
.empty .m { width: 110px; height: 110px; }
.empty h4 { margin: 0; font: 500 15px var(--f-display); color: var(--ink); }
.empty p { margin: 0; max-width: 36ch; }

/* ---------- drop zone ---------- */
#dropzone {
  position: fixed; inset: 0; z-index: 800; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center;
  background: radial-gradient(circle at 50% 45%, var(--sel), var(--scrim-2) 60%);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .2s ease both; pointer-events: none;
}
.dz-ring { width: 220px; height: 220px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.dz-ring::before, .dz-ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px dashed rgba(124, 196, 255, .6); animation: spin 14s linear infinite; }
.dz-ring::after { inset: 18px; border-color: rgba(255, 154, 213, .5); animation-direction: reverse; animation-duration: 9s; }
.dz-mascot { width: 120px; height: 120px; }
.dz-title { margin: 8px 0 0; font: 500 26px var(--f-display); }
.dz-dest { margin: 0; color: var(--ice); font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- dock ---------- */
#dock {
  position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; z-index: 600;
  display: flex; align-items: flex-end; gap: 6px; padding: 7px 9px; height: 68px;
  border-radius: 22px; background: var(--dock); border: 1px solid var(--line-hi);
  backdrop-filter: blur(28px) saturate(1.7); -webkit-backdrop-filter: blur(28px) saturate(1.7);
  box-shadow: 0 20px 50px -10px var(--sh), inset 0 1px 0 var(--hl);
}
.dock-item { position: relative; width: 52px; height: 52px; transform-origin: 50% 100%; transition: transform .18s ease, margin .18s ease; }
.dock-item svg { width: 100%; height: 100%; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .4)); }
.dock-item .tip { position: absolute; bottom: calc(100% + 14px); left: 50%; translate: -50% 0; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--pop); border: 1px solid var(--line-hi); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
.dock-item:hover .tip, .dock-item:focus-visible .tip { opacity: 1; }
.dock-item .run { position: absolute; bottom: -6px; left: 50%; translate: -50% 0; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-2); opacity: 0; box-shadow: 0 0 6px #fff; }
.dock-item.running .run { opacity: 1; }
.dock-item .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.dock-item.bounce { animation: dock-bounce .6s ease; }
.dock-sep { width: 1px; height: 44px; align-self: center; background: var(--line-hi); margin: 0 3px; }
@keyframes dock-bounce { 30% { translate: 0 -16px; } 60% { translate: 0 0; } 80% { translate: 0 -5px; } }

/* ---------- HUD ---------- */
#hud {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; z-index: 590; width: min(420px, calc(100% - 32px));
  display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 16px; cursor: pointer;
  background: var(--pop); border: 1px solid var(--line-hi); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 16px 40px -12px var(--sh); animation: hud-in .45s var(--ease) both;
}
#hud .m { width: 38px; height: 38px; }
#hud b { font-size: 12.5px; }
#hud .sub { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
#hud .pct { font: 500 15px var(--f-display); font-variant-numeric: tabular-nums; }
@keyframes hud-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* ---------- progress ---------- */
.prog { position: relative; height: 6px; border-radius: 6px; background: var(--t2); overflow: hidden; }
.prog i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, var(--ice), var(--orchid), var(--petal)); background-size: 200% 100%; box-shadow: 0 0 12px rgba(124, 196, 255, .6); transition: width .3s ease; }
.prog i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); width: 40%; animation: shimmer 1.3s linear infinite; }
.prog.done i { background: var(--ok); box-shadow: 0 0 10px rgba(111, 240, 176, .5); }
.prog.done i::after, .prog.err i::after, .prog.idle i::after { display: none; }
.prog.err i { background: var(--bad); box-shadow: none; }
.prog.idle i { background: var(--line-hi); box-shadow: none; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- panels (transfers / activity / logs / trash) ---------- */
.pane-tools { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pane-tools .grow { flex: 1; }
.pane-body { flex: 1; overflow: auto; padding: 8px 10px; min-height: 0; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); }
.chip:hover { color: var(--ink); }
.chip.on { background: var(--sel); color: var(--ice); border-color: rgba(124, 196, 255, .4); }

.xfer { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; }
.xfer:hover { background: var(--t1); }
.xfer .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.xfer .ic svg { width: 20px; height: 20px; }
.xfer .ic.up { background: rgba(255, 154, 213, .14); color: var(--petal); }
.xfer .ic.down { background: rgba(124, 196, 255, .14); color: var(--ice); }
.xfer .top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 6px; }
.xfer .top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; min-width: 0; }
.xfer .top span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 11.5px; }
.xfer .bot { display: flex; justify-content: space-between; gap: 10px; margin-top: 5px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.xfer .st-done { color: var(--ok); } .xfer .st-err { color: var(--bad); }
.xfer-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.xfer-sum div { padding: 10px 12px; border-radius: 12px; background: var(--t1); border: 1px solid var(--line); }
.xfer-sum b { display: block; font: 500 17px var(--f-display); font-variant-numeric: tabular-nums; }
.xfer-sum span { font-size: 11px; color: var(--muted); }

.act-hist { padding: 12px 14px 4px; border-bottom: 1px solid var(--line); }
.act-hist canvas { width: 100%; height: 64px; display: block; }
.act-hist .lbl { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); margin-top: 4px; padding-bottom: 8px; }
.day { font: 500 9.5px var(--f-display); letter-spacing: .16em; text-transform: uppercase; color: var(--faint); padding: 12px 8px 6px; }
.act { display: grid; grid-template-columns: 32px 1fr auto; gap: 11px; align-items: center; padding: 8px; border-radius: 10px; animation: tile-in .35s var(--ease) both; }
.act:hover { background: var(--t1); }
.act .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.act .ic svg { width: 16px; height: 16px; }
.act .txt { min-width: 0; font-size: 12.5px; }
.act .txt b { font-weight: 700; }
.act .txt a { color: var(--ice); cursor: pointer; text-decoration: none; word-break: break-all; }
.act .txt a:hover { text-decoration: underline; }
.act .txt small { display: block; color: var(--faint); font-size: 11px; }
.act time { font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.logs { font: 12px/1.65 var(--f-mono); padding: 10px 14px; user-select: text; background: var(--term); flex: 1; overflow: auto; }
.logs .ln { display: grid; grid-template-columns: 76px 52px 1fr; gap: 10px; animation: fade .3s ease both; }
.logs .ln:hover { background: var(--t1); }
.logs .t { color: var(--faint); }
.logs .INFO { color: var(--ice); } .logs .WARN { color: var(--warn); } .logs .ERROR { color: var(--bad); }
.logs .m { color: var(--ink-2); word-break: break-word; }
.logs .x { color: var(--faint); }
.logs .cursor { display: inline-block; width: 8px; height: 14px; background: var(--ice); vertical-align: middle; animation: led 1s steps(2) infinite; }

.trow { display: grid; grid-template-columns: 34px 1fr auto; gap: 11px; align-items: center; padding: 8px; border-radius: 10px; }
.trow:hover { background: var(--t1); }
.trow svg { width: 32px; height: 32px; }
.trow small { display: block; color: var(--muted); font-size: 11px; }
.trow .acts { display: flex; gap: 6px; }

/* ---------- editor ---------- */
.ed { flex: 1; display: grid; grid-template-columns: auto 1fr; min-height: 0; background: var(--ed); font: 13px/1.6 var(--f-mono); }
.ed-gut { padding: 12px 10px 12px 14px; text-align: right; color: var(--faint); overflow: hidden; user-select: none; border-right: 1px solid var(--line); white-space: pre; font-variant-numeric: tabular-nums; }
.ed textarea { resize: none; border: 0; outline: none; background: transparent; padding: 12px 14px; font: inherit; color: var(--ink); tab-size: 2; white-space: pre; overflow: auto; caret-color: var(--petal); user-select: text; }
.ed textarea.wrap { white-space: pre-wrap; }
.ed-status { display: flex; justify-content: space-between; gap: 10px; padding: 5px 14px; font: 11px var(--f-mono); color: var(--muted); border-top: 1px solid var(--line); }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--petal); box-shadow: 0 0 8px var(--petal); }

/* ---------- preview ---------- */
/* The viewer is a dark stage in both themes, so it pins its own ink and line colours. */
.pv { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; position: relative; overflow: hidden; user-select: none;
  --ink: #eef0ff; --muted: #a3abd8; --line: rgba(190, 202, 255, .16); --line-hi: rgba(210, 220, 255, .3); --t2: rgba(255, 255, 255, .08); --t3: rgba(255, 255, 255, .14);
  color: var(--ink); background: radial-gradient(120% 90% at 50% 0%, #1b2046 0%, #0a0c1c 55%, #05060f 100%); }
.pv:fullscreen { background: #000; }
.pv-stage { position: relative; min-width: 0; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden; }
.pv-stage > * { grid-area: 1 / 1; }
.pv-media { max-width: 100%; max-height: 100%; }
img.pv-media { object-fit: contain; touch-action: none; cursor: zoom-in; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .55)); transition: transform .18s ease-out, opacity .25s; }
.pv.zoomed img.pv-media { cursor: grab; }
.pv.grab img.pv-media { cursor: grabbing; transition: none; }
.pv.wait img.pv-media { opacity: 0; }
video.pv-media { width: 100%; height: 100%; object-fit: contain; cursor: pointer; }
iframe.pv-media { width: 100%; height: 100%; border: 0; background: #fff; }
.pv.pdf .pv-meta { display: none; }

.pv-load { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .14); border-top-color: #b39bff; animation: pv-spin .8s linear infinite; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 2; }
.pv.wait .pv-load { opacity: 1; transition-delay: .2s; }
@keyframes pv-spin { to { rotate: 360deg; } }
.pv-meta { place-self: start; margin: 12px; z-index: 3; padding: 5px 11px; border-radius: 999px; background: rgba(14, 17, 38, .6); border: 1px solid var(--line); backdrop-filter: blur(12px); font: 500 11.5px var(--f-mono); color: var(--muted); white-space: pre; pointer-events: none; transition: opacity .25s; }
.pv-meta:empty { display: none; }

.pv-nav { place-self: center start; margin: 0 12px; z-index: 3; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: rgba(14, 17, 38, .6); border: 1px solid var(--line-hi); backdrop-filter: blur(12px); opacity: 0; transition: opacity .2s, background .15s, scale .15s; }
.pv-nav.r { justify-self: end; }
.pv-nav svg { width: 18px; height: 18px; }
.pv-nav:hover { background: rgba(40, 46, 92, .85); scale: 1.06; }
.pv-stage:hover .pv-nav, .pv-nav:focus-visible { opacity: 1; }
@media (hover: none) { .pv-nav { opacity: 1; } }

.pv-bar { z-index: 3; transition: opacity .25s; }
.pv-bar.tools { place-self: end center; margin-bottom: 14px; display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 14px; background: rgba(14, 17, 38, .72); border: 1px solid var(--line); backdrop-filter: blur(16px) saturate(1.4); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .7); }
.pv-bar.media { place-self: end stretch; display: grid; gap: 2px; padding: 34px 14px 10px; background: linear-gradient(transparent, rgba(4, 5, 14, .85)); }
.pv-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pv-grow { flex: 1; }
.pv-b { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; transition: background .15s, transform .1s; }
.pv-b:hover { background: var(--t3); }
.pv-b:active { transform: scale(.94); }
.pv-b svg { width: 18px; height: 18px; }
.pv-b[data-a="play"] svg, .pv-b[data-a="prev"] svg, .pv-b[data-a="next"] svg, .pv-big svg { fill: currentColor; }
.pv-b.txt { width: auto; min-width: 48px; padding: 0 8px; font: 700 12px var(--f-body); font-variant-numeric: tabular-nums; }
.pv-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.pv-time { padding: 0 8px; font: 500 12px var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-vol { width: 78px; height: 18px; margin: 0 6px 0 0; accent-color: #b39bff; cursor: pointer; }

.pv-seek { position: relative; height: 18px; cursor: pointer; touch-action: none; outline: none; }
.pv-track { position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .18); overflow: hidden; transition: top .12s, height .12s; }
.pv-seek:hover .pv-track, .pv-seek:focus-visible .pv-track, .pv.drag .pv-track { top: 6px; height: 6px; }
.pv-buf, .pv-play { position: absolute; left: 0; top: 0; bottom: 0; width: 0; }
.pv-buf { background: rgba(255, 255, 255, .22); }
.pv-play { background: linear-gradient(90deg, #7cc4ff, #b39bff 60%, #ff9ad5); }
.pv-knob { position: absolute; top: 9px; left: 0; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(179, 155, 255, .35), 0 2px 6px rgba(0, 0, 0, .5); scale: 0; transition: scale .12s; }
.pv-seek:hover .pv-knob, .pv-seek:focus-visible .pv-knob, .pv.drag .pv-knob { scale: 1; }
.pv-tip { position: absolute; bottom: 22px; translate: -50% 0; padding: 3px 7px; border-radius: 7px; background: rgba(14, 17, 38, .94); border: 1px solid var(--line); font: 500 11px var(--f-mono); opacity: 0; pointer-events: none; transition: opacity .12s; }
.pv-seek:hover .pv-tip, .pv.drag .pv-tip { opacity: 1; }

.pv-big { z-index: 2; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(14, 17, 38, .6); border: 1px solid var(--line-hi); backdrop-filter: blur(12px); box-shadow: 0 0 0 8px rgba(124, 196, 255, .08), 0 18px 40px -12px rgba(0, 0, 0, .8); transition: opacity .2s, scale .2s; }
.pv-big svg { width: 30px; height: 30px; translate: 2px 0; }
.pv-big:hover { scale: 1.06; }
.pv.playing .pv-big, .pv.wait .pv-big { opacity: 0; scale: 1.3; pointer-events: none; }
.pv.idle { cursor: none; }
.pv.idle .pv-bar, .pv.idle .pv-meta, .pv.idle .pv-nav { opacity: 0; pointer-events: none; }

.pv-card { display: grid; justify-items: center; gap: 8px; max-width: 100%; padding: 20px 24px 104px; text-align: center; }
.pv-art { width: 168px; height: 168px; margin-bottom: 10px; border-radius: 34px; display: grid; place-items: center; background: linear-gradient(145deg, rgba(124, 196, 255, .22), rgba(179, 155, 255, .2) 50%, rgba(255, 154, 213, .22)); border: 1px solid var(--line-hi); box-shadow: 0 30px 60px -24px rgba(124, 150, 255, .55), inset 0 1px 0 rgba(255, 255, 255, .12); }
.pv-art .m { width: 124px; height: 124px; }
.pv-card b { max-width: 560px; font: 700 17px/1.35 var(--f-body); overflow-wrap: anywhere; user-select: text; }
.pv-card span { font-size: 12.5px; color: var(--muted); white-space: pre; }
.pv-eq { display: flex; align-items: flex-end; gap: 3px; height: 22px; margin-top: 6px; }
.pv-eq i { width: 4px; height: 22%; border-radius: 2px; background: linear-gradient(#ff9ad5, #7cc4ff); }
.pv.playing .pv-eq i { animation: pv-eq .9s ease-in-out infinite alternate; }
.pv-eq i:nth-child(2) { animation-delay: -.35s !important; } .pv-eq i:nth-child(3) { animation-delay: -.6s !important; }
.pv-eq i:nth-child(4) { animation-delay: -.15s !important; } .pv-eq i:nth-child(5) { animation-delay: -.5s !important; }
@keyframes pv-eq { to { height: 100%; } }
.pv.wait.audio .pv-load { place-self: start end; margin: 12px; width: 22px; height: 22px; border-width: 2px; }

.pv-fail { z-index: 4; display: grid; justify-items: center; gap: 8px; max-width: 420px; padding: 24px; text-align: center; }
.pv-fail > svg { width: 40px; height: 40px; color: var(--muted); }
.pv-fail b { font-size: 15px; }
.pv-fail > span { margin-bottom: 8px; font-size: 12.5px; color: var(--muted); }
.pv.failed .pv-media, .pv.failed .pv-bar, .pv.failed .pv-big, .pv.failed .pv-load, .pv.failed .pv-card { display: none; }

.pv-strip { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; background: rgba(6, 7, 18, .72); border-top: 1px solid var(--line); scrollbar-width: none; }
.pv-strip::-webkit-scrollbar { display: none; }
.pv-strip:empty, .pv:fullscreen .pv-strip { display: none; }
.pv-strip button { flex: 0 0 52px; height: 52px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--t2); border: 2px solid transparent; opacity: .55; transition: opacity .15s, border-color .15s; }
.pv-strip button:hover { opacity: .9; }
.pv-strip button.on { opacity: 1; border-color: #b39bff; box-shadow: 0 0 16px -2px rgba(179, 155, 255, .7); }
.pv-strip img { width: 100%; height: 100%; object-fit: cover; }
.pv-strip svg { width: 34px; height: 34px; }
@media (max-height: 560px) { .pv-strip { display: none; } }
@media (max-width: 760px) {
  .pv-vol, .pv-wide { display: none; }
  .pv-bar.media { padding: 28px 8px 8px; }
  .pv-time { padding: 0 4px; font-size: 11px; }
  .pv-strip button { flex-basis: 44px; height: 44px; }
}

/* ---------- context menu ---------- */
.ctx { position: fixed; z-index: 900; min-width: 210px; padding: 5px; border-radius: 12px; background: var(--pop); border: 1px solid var(--line-hi); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 20px 50px -10px var(--sh); animation: ctx-in .14s ease-out both; font-size: 13px; }
@keyframes ctx-in { from { opacity: 0; transform: scale(.96); } }
.ctx button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border-radius: 7px; text-align: left; }
.ctx button:hover { background: linear-gradient(90deg, #5aa8ff, #9b7bff); color: #fff; }
.ctx button.danger { color: #ff9fb5; }
.ctx button.danger:hover { background: var(--bad); color: #fff; }
.ctx button svg { width: 15px; height: 15px; opacity: .85; }
.ctx kbd { margin-left: auto; font: 11px var(--f-mono); opacity: .5; }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; background: var(--scrim); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); animation: fade .2s ease both; padding: 16px; }
.modal { width: min(400px, 100%); padding: 22px; border-radius: 20px; background: var(--pop); border: 1px solid var(--line-hi); box-shadow: 0 40px 80px -20px var(--sh-strong); animation: win-in .35s var(--ease) both; display: grid; gap: 14px; }
.modal .m { width: 64px; height: 64px; justify-self: center; }
.modal h3 { margin: 0; font: 500 16px var(--f-display); text-align: center; text-wrap: balance; }
.modal p { margin: 0; color: var(--muted); text-align: center; white-space: pre-line; }
.dim { color: var(--muted); }
.modal .field { width: 100%; height: 38px; font-size: 14px; }
.modal .row { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: calc(var(--mb-h) + 12px + env(safe-area-inset-top, 0px)); left: 50%; translate: -50% 0; z-index: 960; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 9px 16px 9px 12px; border-radius: 14px; font-size: 13px; font-weight: 600; background: var(--pop); border: 1px solid var(--line-hi); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 16px 40px -10px var(--sh); animation: toast-in .45s var(--ease) both; max-width: min(460px, calc(100vw - 32px)); }
.toast.out { animation: toast-out .3s ease-in both; }
.toast i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; flex-shrink: 0; background: rgba(124, 196, 255, .2); color: var(--ice); }
.toast.ok i { background: rgba(111, 240, 176, .18); color: var(--ok); }
.toast.bad i { background: rgba(255, 111, 145, .2); color: var(--bad); }
.toast span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.96); } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  #widgets { background: var(--scrim-2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); top: 0; right: 0; bottom: 0; width: 330px; padding: 14px 16px 100px; z-index: 400; }
}
@media (max-width: 760px) {
  .mb-menu, .mb-net { display: none; }
  .win { top: 0 !important; left: 0 !important; width: 100% !important; height: calc(100% - 86px) !important; border-radius: 0 0 var(--r-win) var(--r-win); min-width: 0; }
  .rz { display: none; }
  .lights button { width: 18px; height: 18px; } .lights svg { width: 10px; height: 10px; opacity: 1; }
  .win-bar { cursor: default; }
  .fm { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .fm-side { flex-direction: row; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 4px; }
  .fm-side .side-h, .side-store { display: none; }
  .side-list { display: flex; gap: 4px; }
  .side-item { width: auto; white-space: nowrap; }
  .side-item .cnt { display: none; }
  .crumbs { flex: 1 1 calc(100% - 80px); }
  .search { flex: 1; }
  .search .field, .search .field:focus { width: 100%; }
  #widgets { width: 100%; padding: 14px 16px 100px; }
  .dock-item { width: 44px; height: 44px; }
  #dock { height: 60px; gap: 4px; padding: 7px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .xfer-sum { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .list th:nth-child(3), .list td:nth-child(3), .list th:nth-child(4), .list td:nth-child(4) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- theme switch ---------- */
.mb-theme { width: 26px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--ink-2); }
.mb-theme:hover { background: var(--t3); }
.mb-theme svg { width: 15px; height: 15px; }
html.theming * { transition: background-color .4s ease, color .4s ease, border-color .4s ease !important; }

/* ---------- office ---------- */
.office-host { flex: 1; min-height: 0; position: relative; background: var(--pv); }
.office-host > div, .office-host iframe { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border: 0; }
.office-wait { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--muted); text-align: center; padding: 20px; }
.office-wait .m { width: 90px; height: 90px; }
.ro-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: rgba(255, 207, 107, .15); color: var(--warn); }

/* ---------- tasks in transfers ---------- */
.xfer .ic.task { background: rgba(179, 155, 255, .16); color: var(--orchid); }
.prog.indet i { width: 35% !important; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { from { left: -35%; } to { left: 100%; } }

/* ---------- access (accounts) ---------- */
.switch { position: relative; width: 38px; height: 22px; border-radius: 99px; background: var(--t3); border: 1px solid var(--line-hi); transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .25s var(--ease); }
.switch[aria-checked="true"] { background: var(--ok); border-color: transparent; }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.portal-card { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; margin: 14px; padding: 14px 16px; border-radius: 16px; background: var(--wdg); border: 1px solid var(--line); }
.portal-card .pic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--sel); color: var(--ice); }
.portal-card .pic svg { width: 22px; height: 22px; }
.portal-card b { font-size: 13.5px; }
.portal-card p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.portal-card code, .cred code { font: 12px var(--f-mono); color: var(--ice); user-select: all; }
.acct { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; }
.acct:hover { background: var(--t1); }
.acct .av { width: 36px; height: 36px; font-size: 13px; }
.acct .nm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.acct small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.acct .acts { display: flex; gap: 4px; }
.tag { font-size: 10.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--t2); color: var(--ink-2); border: 1px solid var(--line); }
.tag.rw { background: rgba(111, 240, 176, .13); color: var(--ok); border-color: transparent; }
.tag.ro { background: rgba(124, 196, 255, .13); color: var(--ice); border-color: transparent; }
.tag.off { background: rgba(255, 111, 145, .13); color: var(--bad); border-color: transparent; }
.sec-h { font: 500 9.5px var(--f-display); letter-spacing: .18em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; display: flex; justify-content: space-between; align-items: center; }
.attempt { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 5px 10px; font-size: 12px; }
.attempt i { width: 8px; height: 8px; border-radius: 50%; }
.attempt time { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.modal.wide { width: min(480px, 100%); text-align: left; }
.modal.wide h3 { text-align: left; }
.frm { display: grid; gap: 12px; }
.frm label.l { display: grid; gap: 5px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.frm .row2 { display: flex; gap: 8px; }
.frm .row2 .field { flex: 1; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); font-size: 12px; font-weight: 600; cursor: pointer; }
.checks label:has(input:checked) { background: var(--sel); border-color: rgba(124, 196, 255, .45); color: var(--ice); }
.checks input { accent-color: var(--ice); margin: 0; }
.radios { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radios label { display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; font-size: 12.5px; font-weight: 700; }
.radios label span { font-weight: 500; font-size: 11.5px; color: var(--muted); }
.radios label:has(input:checked) { border-color: var(--ice); background: var(--sel); }
.radios input { position: absolute; opacity: 0; pointer-events: none; }
.cred { padding: 12px 14px; border-radius: 12px; background: var(--term); border: 1px solid var(--line); display: grid; gap: 6px; font-size: 12.5px; }
.cred div { display: flex; justify-content: space-between; gap: 10px; }
.err { color: var(--bad); font-size: 12px; font-weight: 600; min-height: 1em; margin: 0; }

/* ---------- guest mode ---------- */
body.guest .lan-only { display: none !important; }
body.readonly .write-only { display: none !important; }

/* ---------- sign-in portal ---------- */
.portal { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.login { width: min(380px, 100%); padding: 30px 28px 24px; border-radius: 26px; display: grid; gap: 14px; text-align: center;
  background: var(--glass); border: 1px solid var(--line-hi); backdrop-filter: blur(34px) saturate(1.5); -webkit-backdrop-filter: blur(34px) saturate(1.5);
  box-shadow: 0 50px 100px -30px var(--sh-strong), inset 0 1px 0 var(--hl); animation: win-in .8s var(--ease) both .2s; }
.login.shake { animation: shake .45s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.login .m { width: 96px; height: 96px; justify-self: center; margin-top: -6px; }
.login h1 { margin: 0; font: 300 26px/1 var(--f-display); letter-spacing: .38em; padding-left: .38em; }
.login .sub { margin: -4px 0 6px; color: var(--muted); font-size: 13px; }
.login form { display: grid; gap: 10px; text-align: left; }
.login .field { height: 44px; font-size: 14.5px; width: 100%; border-radius: 12px; padding: 0 14px; }
.login .pw { position: relative; }
.login .pw .field { padding-right: 44px; }
.login .pw button { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.login .pw button:hover { background: var(--t3); color: var(--ink); }
.login .pw svg { width: 17px; height: 17px; }
.login .opts { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); margin: 2px 2px 4px; }
.login .opts label { display: flex; gap: 7px; align-items: center; cursor: pointer; }
.login .opts input { accent-color: var(--ice); width: 15px; height: 15px; margin: 0; }
.login .btn.primary { height: 44px; justify-content: center; font-size: 14px; border-radius: 12px; }
.login .btn[disabled] { opacity: .7; cursor: progress; }
.login .foot { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .7s linear infinite; }
.portal-theme { position: fixed; top: calc(12px + env(safe-area-inset-top, 0px)); right: 14px; z-index: 3; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--line); color: var(--ink-2); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.portal-theme svg { width: 17px; height: 17px; }
