/* ============================================================
   style.css - JakeOS
   dark, understated, one accent. realism over effects.
   ============================================================ */

/* ---------------- tokens ---------------- */
:root {
    --bg: #101114;
    --bg-2: #14161a;
    --bg-3: #191c21;
    --surface: #16181d;
    --surface-2: #1b1e24;
    --surface-3: #20242b;
    --line: #262a31;
    --line-2: #2e333c;
    --fg: #d7dae0;
    --fg-2: #a6acb8;
    --fg-3: #7d8492;
    --muted: #7d8492;
    --mono: ui-monospace, "JetBrains Mono", "IBM Plex Mono", "Cascadia Mono", Menlo, Consolas, monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
    --red: #d07a7a;
    --red-2: #a95f5f;
    --green: #93c48b;
    --amber: #d4b483;
    --radius: 5px;
    --radius-s: 4px;
    --shadow: 0 12px 34px rgba(0, 0, 0, .48), 0 2px 8px rgba(0, 0, 0, .35);
    --shadow-s: 0 5px 16px rgba(0, 0, 0, .4);
    --dur: .16s;
    --ease: cubic-bezier(.25, .8, .35, 1);
    --tr-alpha: .965;
    --taskbar-h: 2.9rem;
}

/* accents */
:root[data-accent="blue"]   { --acc: #7aa2f7; --acc-dim: #5570ad; --acc-fg: #0d1117; --acc-soft: rgba(122,162,247,.14); }
:root[data-accent="cyan"]   { --acc: #6cc5d8; --acc-dim: #4e8f9e; --acc-fg: #0d1117; --acc-soft: rgba(108,197,216,.14); }
:root[data-accent="green"]  { --acc: #8fbf7f; --acc-dim: #6a9159; --acc-fg: #0d1117; --acc-soft: rgba(143,191,127,.14); }
:root[data-accent="purple"] { --acc: #a99ce8; --acc-dim: #7d72b3; --acc-fg: #0d1117; --acc-soft: rgba(169,156,232,.15); }

/* light theme */
:root[data-theme="light"] {
    --bg: #d9dbdf;
    --bg-2: #e3e5e8;
    --bg-3: #eceef1;
    --surface: #f4f5f7;
    --surface-2: #eceef1;
    --surface-3: #e2e5e9;
    --line: #d3d7dd;
    --line-2: #c3c8d0;
    --fg: #23262b;
    --fg-2: #4c525d;
    --fg-3: #6b7280;
    --muted: #6b7280;
    --shadow: 0 12px 34px rgba(30, 34, 40, .22), 0 2px 8px rgba(30, 34, 40, .14);
    --shadow-s: 0 5px 16px rgba(30, 34, 40, .18);
    --tr-alpha: .97;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
    margin: 0;
    height: 100dvh;
    overflow: hidden;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--sans);
    font-size: .9rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}
img { max-width: 100%; }
button { font: inherit; color: inherit; }
input, textarea { font: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

::selection { background: var(--acc-soft); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; border-radius: 3px; }
body.dragging, body.resizing { cursor: grabbing; }
body.resizing * { cursor: inherit !important; }

/* scrollbars */
.scroll { overflow: auto; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

.ic { display: inline-block; vertical-align: -3px; flex: none; }

/* ============================================================
   boot
   ============================================================ */
#boot {
    position: fixed; inset: 0; z-index: 9000;
    background: #0b0c0e;
    padding: clamp(1rem, 5vw, 4rem);
    font-family: var(--mono);
    font-size: .72rem;
    line-height: 1.42;
    color: #b9bfc7;
    transition: opacity .24s ease;
}
#boot.done { opacity: 0; pointer-events: none; }
#boot-log { white-space: pre-wrap; max-width: 62rem; }
#boot .b-ok { color: #8fbf7f; }
#boot .b-head { color: #d7dae0; }
#boot .b-dim { color: #666d77; }
#boot .b-ready { color: #d7dae0; }
#boot .b-prompt { color: #8fbf7f; }
#boot .b-cursor { display: inline-block; width: .55em; height: 1em; background: #b9bfc7; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
#boot-skip { position: absolute; bottom: 1.1rem; right: 1.4rem; color: #4c525d; font-size: .68rem; letter-spacing: .04em; }
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   desktop
   ============================================================ */
#desktop { position: fixed; inset: 0; }
#desktop.booting #taskbar, #desktop.booting #desktop-icons { opacity: 0; }
#desktop #taskbar, #desktop #desktop-icons { transition: opacity .4s ease; }

#wallpaper {
    position: absolute; inset: 0;
    background-color: #121419;
    background-size: cover;
    background-position: center;
    z-index: 0;
}

/* desktop icons */
#desktop-icons {
    position: absolute; inset: 10px 10px calc(var(--taskbar-h) + 18px) 10px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 10px;
    padding: 6px;
    max-height: calc(100% - var(--taskbar-h) - 28px);
}
.dicon {
    width: 88px;
    display: flex; flex-direction: column; align-items: center; gap: 7px;
    padding: 8px 4px;
    background: transparent;
    border: 0;
    border-radius: var(--radius-s);
    cursor: default;
}
.dicon:active .dicon-tile { transform: translateY(0) scale(.96); }
.dicon-tile {
    width: 58px; height: 58px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--tint, #9aa3b0);
    transition: transform .12s var(--ease);
}
.dicon-tile svg { width: 46px; height: 46px; stroke-width: 1.5; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .45)); }
.dicon:hover .dicon-tile { transform: translateY(-2px); }
.dicon-label {
    font-size: .74rem;
    color: #e8eaee;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .85);
    line-height: 1.25;
    max-width: 86px;
    overflow-wrap: break-word;
}
:root[data-theme="light"] .dicon-label { color: #1d2025; text-shadow: 0 1px 3px rgba(255, 255, 255, .7); }

/* ============================================================
   windows
   the container ignores pointer events so desktop icons stay
   clickable; the windows themselves get them back.
   ============================================================ */
#windows { position: absolute; inset: 0 0 var(--taskbar-h) 0; z-index: 2; pointer-events: none; }
.window {
    position: absolute;
    pointer-events: auto;
    display: flex; flex-direction: column;
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) calc(var(--tr-alpha) * 100%), transparent);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 300px; min-height: 190px;
    overflow: hidden;
}
body.no-transparency .window { background: var(--surface); }

.window .titlebar {
    display: flex; align-items: center; gap: .45rem;
    height: 2.05rem;
    padding: 0 .35rem 0 .6rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    flex: none;
    cursor: default;
}
.tb-app-ic { color: var(--fg-2); display: inline-flex; }
.tb-title {
    font-size: .72rem;
    color: var(--fg-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    flex: 1;
}
.window.active .tb-title { color: var(--fg); }
.tb-controls { display: flex; gap: 4px; }
.tb-btn {
    width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; border-radius: 5px;
    color: var(--fg-3); cursor: default; padding: 0;
}
.tb-btn:hover { background: var(--surface-3); color: var(--fg); }
.tb-btn.plain { width: 24px; height: 24px; }
.tb-close:hover { background: #c25656; color: #fff; }

.win-body { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* window states */
.window.opening { animation: win-open .18s var(--ease); }
.window.closing { animation: win-close .13s ease-in forwards; }
.window.minimizing { animation: win-min .16s ease-in forwards; }
.window.min { display: none; }
.window.maximized { border-radius: 0; border: none; }
@keyframes win-open { from { opacity: 0; transform: scale(.965) translateY(8px); } }
@keyframes win-close { to { opacity: 0; transform: scale(.96); } }
@keyframes win-min { to { opacity: 0; transform: scale(.92) translateY(28px); } }

/* resize handles */
.rh { position: absolute; z-index: 5; }
.rh-n { top: -3px; left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.rh-s { bottom: -3px; left: 8px; right: 8px; height: 6px; cursor: ns-resize; }
.rh-e { right: -3px; top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
.rh-w { left: -3px; top: 8px; bottom: 8px; width: 6px; cursor: ew-resize; }
.rh-ne { top: -3px; right: -3px; width: 12px; height: 12px; cursor: nesw-resize; }
.rh-nw { top: -3px; left: -3px; width: 12px; height: 12px; cursor: nwse-resize; }
.rh-se { bottom: -3px; right: -3px; width: 12px; height: 12px; cursor: nwse-resize; }
.rh-sw { bottom: -3px; left: -3px; width: 12px; height: 12px; cursor: nesw-resize; }
.window.maximized .rh { display: none; }

/* shared bits inside apps */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .42rem .85rem;
    border-radius: var(--radius-s);
    border: 1px solid var(--line-2);
    background: var(--surface-2);
    color: var(--fg);
    cursor: default;
    transition: background var(--dur), border-color var(--dur);
}
.btn:hover { background: var(--surface-3); border-color: var(--fg-3); }
.btn.small { padding: .25rem .6rem; font-size: .78rem; }
.btn.primary { background: var(--acc-dim); border-color: var(--acc-dim); color: #fff; }
.btn.primary:hover { background: var(--acc); border-color: var(--acc); }
.btn.danger { color: var(--red); border-color: var(--red-2); }
.btn.danger:hover { background: rgba(210, 100, 100, .12); }
.btn.ghost { background: transparent; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: 4px 0; font-size: .8rem; }
.kv .k { color: var(--fg-3); flex: none; }
.kv .v { text-align: right; word-break: break-word; }
.app-error { padding: 1rem; color: var(--red); }
.app-error pre { font-family: var(--mono); font-size: .7rem; color: var(--fg-3); white-space: pre-wrap; }

/* ============================================================
   taskbar
   ============================================================ */
#taskbar {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: var(--taskbar-h);
    display: flex; align-items: stretch;
    background: color-mix(in srgb, var(--bg-2) 92%, transparent);
    border-top: 1px solid var(--line);
    z-index: 3;
    padding: 0 .4rem;
    gap: .4rem;
}
body.no-transparency #taskbar { background: var(--bg-2); }
.tb-left, .tb-right { display: flex; align-items: center; gap: 2px; flex: none; }
.tb-center { flex: 1; display: flex; align-items: stretch; justify-content: center; gap: 4px; overflow: hidden; min-width: 0; }

.tb-launch {
    width: 32px; height: 32px;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; border-radius: 8px;
    color: var(--acc); cursor: default;
}
.tb-launch:hover, .tb-launch.on { background: var(--acc-soft); }

.task-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 0 .55rem;
    margin: 4px 0;
    max-width: 160px;
    min-width: 42px;
    flex: 0 1 auto;
    overflow: hidden;
    background: transparent;
    border: 0; border-radius: 5px;
    color: var(--fg-2);
    position: relative;
    cursor: default;
}
.task-btn:hover { background: var(--surface-3); }
.task-btn.active { background: var(--surface-3); color: var(--fg); }
.task-btn.min { color: var(--fg-3); }
.task-btn.active::after {
    content: "";
    position: absolute; left: .8rem; right: .8rem; bottom: 2px;
    height: 2px; border-radius: 2px;
    background: var(--acc);
}
.task-btn-ic { display: inline-flex; }
.task-btn-label { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.tray-btn {
    height: 32px;
    padding: 0 6px;
    display: inline-flex; align-items: center; gap: 5px;
    background: transparent; border: 0; border-radius: 8px;
    color: var(--fg-2); cursor: default;
}
.tray-btn:hover { background: var(--surface-3); color: var(--fg); }
.clock-btn { flex-direction: column; justify-content: center; gap: 0; padding: 0 10px; align-items: flex-end; }
.clock-time { font-size: .76rem; font-family: var(--mono); line-height: 1.2; }
.clock-date { font-size: .62rem; color: var(--fg-3); line-height: 1.2; }

/* ============================================================
   the menu
   apps only appear here on mobile (no desktop icons there)
   ============================================================ */
.menu-panel {
    position: fixed;
    left: 6px; bottom: calc(var(--taskbar-h) + 6px);
    z-index: 300;
    width: 232px;
    max-width: calc(100vw - 12px);
    background: var(--surface);
    background: color-mix(in srgb, var(--surface) 97%, transparent);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
    opacity: 0; transform: translateY(10px) scale(.98);
    pointer-events: none;
    transform-origin: bottom left;
    transition: opacity var(--dur), transform var(--dur) var(--ease);
}
body.no-transparency .menu-panel { background: var(--surface); }
.menu-panel.open { opacity: 1; transform: none; pointer-events: auto; }

.menu-apps { display: none; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.menu-app {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 11px 4px 9px;
    background: transparent; border: 0; border-radius: var(--radius-s);
    cursor: default;
}
.menu-app:hover { background: var(--surface-2); }
.menu-app-tile {
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--tint, #9aa3b0);
}
.menu-app-tile svg { filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.menu-app-name { font-size: .74rem; color: var(--fg-2); text-align: center; }
.menu-app:hover .menu-app-name { color: var(--fg); }

.menu-sep { display: none; height: 1px; background: var(--line); margin: 8px 2px; }

.menu-sys { display: flex; flex-direction: column; gap: 2px; }
.menu-sys-btn {
    display: flex; align-items: center; gap: .55rem;
    width: 100%;
    padding: .45rem .6rem;
    background: transparent; border: 0; border-radius: var(--radius-s);
    color: var(--fg-2); font-size: .74rem;
    cursor: default;
    text-align: left;
    line-height: 1.25;
}
.menu-sys-tx { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-sys-btn:hover { background: var(--surface-2); color: var(--fg); }
.menu-sys-ic { color: var(--fg-3); display: inline-flex; }
.menu-sys-btn:hover .menu-sys-ic { color: var(--fg-2); }
.menu-sys-btn.power { color: var(--red); }
.menu-sys-btn.power .menu-sys-ic { color: var(--red); }
.menu-sys-btn.power:hover { background: rgba(210, 100, 100, .12); }

/* ============================================================
   popovers, menus, toasts
   ============================================================ */
.popover {
    position: fixed; z-index: 400;
    min-width: 200px;
    background: var(--surface-2);
    background: color-mix(in srgb, var(--surface-2) 97%, transparent);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-s);
    padding: .7rem .85rem;
    opacity: 0; transform: translateY(4px);
    transition: opacity var(--dur), transform var(--dur);
}
.popover.in { opacity: 1; transform: none; }
.popover.wide { min-width: 260px; }
body.no-transparency .popover { background: var(--surface-2); }
.pop-title { font-size: .72rem; color: var(--fg-3); text-transform: lowercase; letter-spacing: .06em; margin-bottom: .5rem; }
.pop-icon-btn {
    width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; border-radius: 6px; color: var(--fg-2); cursor: default;
}
.pop-icon-btn:hover { background: var(--surface-3); }

.net-status { display: flex; align-items: center; gap: .6rem; padding: .3rem 0 .6rem; font-size: .86rem; }
.net-status.on { color: var(--green); }
.net-status.off { color: var(--red); }

.vol-row { display: flex; align-items: center; gap: .6rem; }
.vol-val { font-family: var(--mono); font-size: .74rem; color: var(--fg-2); min-width: 34px; text-align: right; }
.vol-range, .mu-seek, .mu-vol { accent-color: var(--acc); }

.cal-now { padding-bottom: .6rem; border-bottom: 1px solid var(--line); margin-bottom: .6rem; }
.cal-time { font-family: var(--mono); font-size: 1.3rem; }
.cal-date { font-size: .74rem; color: var(--fg-3); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; }
.cal-title { font-size: .8rem; color: var(--fg-2); }
.cal-nav { background: transparent; border: 0; color: var(--fg-3); padding: 2px; border-radius: 4px; cursor: default; display: inline-flex; }
.cal-nav:hover { color: var(--fg); background: var(--surface-3); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-wd { font-size: .64rem; color: var(--fg-3); padding: 3px 0; }
.cal-day { font-size: .76rem; padding: 4px 0; border-radius: 5px; color: var(--fg-2); font-family: var(--mono); }
.cal-day.today { background: var(--acc); color: var(--acc-fg); font-weight: 600; }
.cal-tz { margin-top: .6rem; font-size: .68rem; color: var(--fg-3); font-family: var(--mono); }

/* context menu */
.ctx-menu {
    position: fixed; z-index: 500;
    min-width: 180px;
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-radius: 8px;
    box-shadow: var(--shadow-s);
    padding: 5px;
    animation: pop-in .12s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: scale(.97); } }
.ctx-item {
    display: flex; align-items: center; gap: .6rem;
    width: 100%;
    padding: .38rem .55rem;
    background: transparent; border: 0; border-radius: 5px;
    color: var(--fg);
    font-size: .8rem; text-align: left; cursor: default;
}
.ctx-item:hover:not(:disabled) { background: var(--surface-3); }
.ctx-item:disabled { color: var(--fg-3); opacity: .5; }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover:not(:disabled) { background: rgba(210, 100, 100, .12); }
.ctx-ic { color: var(--fg-3); display: inline-flex; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* toasts */
#toasts {
    position: absolute;
    right: 12px; bottom: calc(var(--taskbar-h) + 12px);
    display: flex; flex-direction: column; gap: 8px;
    z-index: 350;
    max-width: min(320px, 80vw);
}
.toast {
    display: flex; gap: .7rem; align-items: flex-start;
    background: var(--surface-2);
    background: color-mix(in srgb, var(--surface-2) 97%, transparent);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: var(--shadow-s);
    padding: .55rem .75rem;
    cursor: default;
    animation: toast-in .22s var(--ease);
}
body.no-transparency .toast { background: var(--surface-2); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
.toast-ic { color: var(--acc); display: inline-flex; margin-top: 1px; }
.toast-title { font-size: .8rem; font-weight: 600; }
.toast-body { font-size: .74rem; color: var(--fg-2); margin-top: 2px; word-break: break-word; }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } }

/* ============================================================
   power screens
   ============================================================ */
.power-screen {
    position: fixed; inset: 0; z-index: 8000;
    background-color: #0a0b0d;
    background-size: cover; background-position: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .6rem;
    color: #e8eaee;
    animation: fade-in .3s ease;
}
.power-screen.instant { animation: none; }   /* boot handoff: must be opaque at once */
@keyframes fade-in { from { opacity: 0; } }
.lock-clock { font-family: Georgia, 'Iowan Old Style', 'Times New Roman', serif; font-size: clamp(3.2rem, 11vw, 5.4rem); font-weight: 400; letter-spacing: .02em; }
.lock-date { font-size: .95rem; color: #b6bcc4; letter-spacing: .14em; margin-top: .4rem; }
.lock-hint { margin-top: 2.5rem; font-size: .72rem; color: #6b7280; letter-spacing: .12em; }
.power-screen.off { background: #060708; }
.off-text { font-family: var(--mono); font-size: .95rem; color: #b9bfc7; text-align: center; line-height: 2; }
.off-sub { color: #585f6a; font-size: .75rem; }
.off-btn {
    margin-top: 2.5rem;
    display: inline-flex; align-items: center; gap: .6rem;
    padding: .6rem 1.2rem;
    background: transparent; color: #8b929c;
    border: 1px solid #33383f; border-radius: 8px;
    cursor: default;
}
.off-btn:hover { color: #e8eaee; border-color: #4a505a; }

/* ============================================================
   about
   ============================================================ */
.app-about { padding: 1.05rem 1.2rem; }

.ab-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.4rem; }
.ab-avatar {
    width: 76px; height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--line-2);
    background: var(--surface-3);
    flex: none;
    display: inline-flex; align-items: center; justify-content: center;
}
.ab-avatar-fallback {
    font-weight: 650; font-size: 1.7rem; color: #fff;
    background: linear-gradient(160deg, var(--acc), var(--acc-dim));
}
.ab-name { font-size: 1.25rem; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.ab-meta { color: var(--fg-3); font-size: .8rem; margin-top: 2px; }

.ct-sub { font-size: .7rem; color: var(--fg-3); text-transform: lowercase; letter-spacing: .07em; padding: .2rem .2rem .5rem; }
.ct-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.ct-tile {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: .9rem .4rem .8rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-s);
    cursor: default;
    position: relative;
}
.ct-tile:hover { border-color: var(--line-2); background: var(--surface-3); }
.ct-tile-ic {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px;
    color: var(--tint, #9aa3b0);
    background: linear-gradient(160deg,
        color-mix(in srgb, var(--tint, #9aa3b0) 16%, #17191e),
        color-mix(in srgb, var(--tint, #9aa3b0) 5%, #101114));
    border: 1px solid color-mix(in srgb, var(--tint, #9aa3b0) 24%, transparent);
}
.ct-tile-name { font-size: .76rem; color: var(--fg-2); }
.ct-tile:hover .ct-tile-name { color: var(--fg); }
.ct-tile-tag {
    position: absolute; top: 6px; right: 6px;
    font-size: .58rem; font-family: var(--mono);
    color: var(--fg-3);
    border: 1px solid var(--line-2);
    border-radius: 99px;
    padding: 1px 6px;
}
.ct-tile-copy {
    position: absolute; top: 5px; right: 5px;
    background: var(--surface-3); border: 1px solid var(--line-2);
    color: var(--fg-3); padding: 4px; border-radius: 5px;
    cursor: default; display: inline-flex;
}
.ct-tile-copy:hover { color: var(--fg); }

/* ============================================================
   about this pc
   ============================================================ */
.app-sysinfo { padding: 1rem 1.2rem; }
.pc-art { display: flex; justify-content: center; margin-bottom: .5rem; }
.pc-art svg { width: min(320px, 82%); height: auto; }
.si-head h1 { font-size: 1.15rem; margin: 0 0 .2rem; font-weight: 650; }
.si-head p { margin: 0 0 1rem; }
.si-rows { border-top: 1px solid var(--line); padding-top: .6rem; }

/* ============================================================
   games hub
   ============================================================ */
.app-games { padding: 1rem 1.2rem; display: flex; flex-direction: column; }
.gm-head h1 { font-size: 1.15rem; margin: 0 0 .2rem; font-weight: 650; }
.gm-head p { margin: 0 0 1.1rem; }
.gm-card {
    display: flex; align-items: center; gap: 1rem;
    padding: .95rem 1.05rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: .7rem;
    cursor: default;
    text-align: left;
}
.gm-card:hover { border-color: var(--line-2); background: var(--surface-3); }
.gm-tile {
    width: 46px; height: 46px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    color: var(--tint, #9aa3b0);
    background: linear-gradient(160deg,
        color-mix(in srgb, var(--tint, #9aa3b0) 17%, #17191e),
        color-mix(in srgb, var(--tint, #9aa3b0) 5%, #101114));
    border: 1px solid color-mix(in srgb, var(--tint, #9aa3b0) 26%, transparent);
}
.gm-name { font-weight: 650; display: block; }
.gm-desc { font-size: .78rem; display: block; }

/* ============================================================
   wallpaper picker
   ============================================================ */
.app-wallpaper { padding: 1rem 1.2rem; }
.wp-head h1 { font-size: 1.15rem; margin: 0 0 .2rem; font-weight: 650; }
.wp-head p { margin: 0 0 1.1rem; }
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.wp-thumb {
    background: transparent;
    border: 2px solid var(--line);
    border-radius: var(--radius-s);
    overflow: hidden;
    padding: 0;
    cursor: default;
    display: flex; flex-direction: column;
}
.wp-thumb:hover { border-color: var(--fg-3); }
.wp-thumb.on { border-color: var(--acc); }
.wp-img { display: block; width: 100%; height: 76px; background-size: cover; background-position: center; }
.wp-name { font-size: .68rem; color: var(--fg-3); padding: .3rem .45rem .4rem; font-family: var(--mono); text-align: left; }
.wp-thumb.on .wp-name { color: var(--acc); }


/* ============================================================
   settings
   ============================================================ */
.app-settings { padding: 1rem 1.2rem; }
.st-wrap { max-width: 30rem; }
.st-title { font-size: .74rem; font-weight: 600; color: var(--fg-3); text-transform: lowercase; letter-spacing: .08em; margin: 1.4rem 0 .3rem; }
.st-wrap .st-title:first-child { margin-top: 0; }
.st-row { display: flex; align-items: center; justify-content: space-between; gap: 1.4rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.st-row-tx { min-width: 0; }
.st-label { font-size: .86rem; }
.st-hint { font-size: .72rem; }
.st-sub { font-size: .72rem; color: var(--fg-3); text-transform: lowercase; letter-spacing: .07em; margin: 1.2rem 0 .2rem; }

/* switch */
.switch { width: 40px; height: 22px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; cursor: default; padding: 0; flex: none; transition: background var(--dur); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--fg-2); transition: all var(--dur) var(--ease); }
.switch.on { background: var(--acc-dim); border-color: var(--acc-dim); }
.switch.on .switch-knob { left: 20px; background: #fff; }

/* segmented */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-s); overflow: hidden; }
.seg-btn { padding: .32rem .8rem; background: transparent; border: 0; color: var(--fg-2); font-size: .76rem; cursor: default; }
.seg-btn:hover { background: var(--surface-2); }
.seg-btn.on { background: var(--acc-soft); color: var(--acc); }

/* swatches */
.swatches { display: flex; gap: 7px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; cursor: default; padding: 0; }
.swatch[data-accent="blue"] { background: #7aa2f7; }
.swatch[data-accent="cyan"] { background: #6cc5d8; }
.swatch[data-accent="green"] { background: #8fbf7f; }
.swatch[data-accent="purple"] { background: #a99ce8; }
.swatch.on { border-color: var(--fg); }
.st-about .kv { border-bottom: 1px solid var(--line); }

/* ============================================================
   terminal (+ terminal escape)
   ============================================================ */
.app-terminal, .app-escape { background: #0d0e11; display: flex; flex-direction: column; }
:root[data-theme="light"] .app-terminal, :root[data-theme="light"] .app-escape { background: #17191d; }
.tm-out, .te-out { flex: 1; overflow: auto; padding: .7rem .9rem; font-family: var(--mono); font-size: .8rem; line-height: 1.5; color: #c9ced6; user-select: text; }
.tm-line, .te-line { white-space: pre-wrap; word-break: break-word; min-height: 1.2em; }
.tm-inline, .te-inline { display: flex; align-items: center; gap: 0; padding: 0 .9rem .7rem; font-family: var(--mono); flex: none; }
.tm-prompt, .te-prompt { color: #8fbf7f; font-size: .8rem; white-space: pre; }
.tm-in, .te-in { flex: 1; background: transparent; border: 0; outline: none; color: #e4e7ec; font-family: var(--mono); font-size: .8rem; caret-color: #8fbf7f; min-width: 40px; }
.tm-user { color: #8fbf7f; }
.tm-host { color: #7aa2f7; }
.tm-path { color: #d4b483; }
.tm-colon { color: #7d8492; }
.tm-err { color: #d08080; }
.tm-strong { color: #e4e7ec; font-weight: 600; }
.tm-dirname { color: #7aa2f7; }
.tm-cmdname { color: #d4b483; }
.tm-logo { color: #7d8492; }
.app-terminal .muted, .app-escape .muted { color: #7d8492; }
.tm-fetch { display: flex; gap: 1.6rem; align-items: flex-start; flex-wrap: wrap; }
.te-room { color: #d4b483; font-weight: 600; }
.te-logo { color: #e4e7ec; font-weight: 700; letter-spacing: .1em; }
.te-win { color: #8fbf7f; font-weight: 700; font-size: 1rem; }
.te-hint { color: #d4b483; }
.te-dir { color: #7aa2f7; }
.te-again { margin-top: .8rem; }

/* ============================================================
   blog
   ============================================================ */
.app-blog { display: flex; }
.bl-layout { flex: 1; display: flex; min-width: 0; min-height: 0; }
.bl-layout.narrow { flex-direction: column; }
.bl-list-pane { width: 264px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow: auto; }
.bl-layout.narrow .bl-list-pane { width: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 40%; }
.bl-search { margin: .7rem; padding: .45rem .7rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s); color: var(--fg); font-size: .8rem; flex: none; }
.bl-search:focus { outline: none; border-color: var(--acc-dim); }
.bl-year { font-family: var(--mono); font-size: .72rem; color: var(--fg-3); padding: .7rem .85rem .25rem; }
.bl-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: .45rem .7rem; background: transparent; border: 0; border-left: 2px solid transparent; cursor: default; }
.bl-item:hover { background: var(--surface-2); }
.bl-item.on { background: var(--surface-2); border-left-color: var(--acc); }
.bl-item-title { font-size: .83rem; color: var(--fg); line-height: 1.35; }
.bl-item-meta { font-size: .68rem; color: var(--fg-3); font-family: var(--mono); }
.bl-item-desc { font-size: .74rem; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bl-tagfilter { align-self: flex-start; margin: .5rem .85rem 0; padding: .2rem .7rem; font-size: .72rem; font-family: var(--mono); background: var(--acc-soft); color: var(--acc); border: 1px solid var(--acc-dim); border-radius: 99px; cursor: default; }
.bl-empty { padding: 1.5rem; text-align: center; color: var(--fg-3); }

.bl-read { flex: 1; min-width: 0; padding: 0 0 2rem; }
.bl-hint, .bl-loading { padding: 2rem; text-align: center; }
.bl-back { margin: .9rem 0 0 1.4rem; }
.bl-article { max-width: 46rem; margin: 0 auto; padding: .4rem 1.8rem 0; }
.bl-title { font-size: 1.35rem; line-height: 1.3; margin: .3rem 0 .5rem; font-weight: 680; letter-spacing: -.01em; }
.bl-meta { font-size: .74rem; color: var(--fg-3); font-family: var(--mono); display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.bl-tag { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 99px; padding: 1px 9px; font-size: .68rem; color: var(--fg-2); cursor: default; }
.bl-tag:hover { border-color: var(--acc-dim); color: var(--acc); }
.bl-report { border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface-2); padding: .7rem .95rem; margin: 0 0 1.4rem; }
.bl-report-title { font-size: .68rem; text-transform: lowercase; letter-spacing: .09em; color: var(--fg-3); margin-bottom: .35rem; }
.bl-demo { margin-top: 1.6rem; font-size: .74rem; border-top: 1px dashed var(--line-2); padding-top: .8rem; }

/* markdown content */
.md { font-size: .92rem; line-height: 1.72; color: var(--fg); user-select: text; }
.md p { margin: 0 0 1rem; }
.md h1 { font-size: 1.3rem; margin: 1.8rem 0 .7rem; font-weight: 680; }
.md h2 { font-size: 1.08rem; margin: 1.6rem 0 .6rem; font-weight: 650; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.md h3 { font-size: .96rem; margin: 1.3rem 0 .5rem; font-weight: 650; }
.md h4, .md h5, .md h6 { font-size: .9rem; margin: 1.1rem 0 .4rem; }
.md ul, .md ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.md li { margin: .25rem 0; }
.md a { color: var(--acc); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md img { border-radius: 6px; border: 1px solid var(--line); margin: .4rem 0 1rem; display: block; max-width: 100%; }
.md blockquote { margin: 0 0 1rem; padding: .3rem 1rem; border-left: 3px solid var(--acc-dim); background: var(--surface-2); border-radius: 0 6px 6px 0; color: var(--fg-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.6rem 0; }
.md code { font-family: var(--mono); font-size: .8em; background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.md strong { color: #e8eaee; font-weight: 650; }
:root[data-theme="light"] .md strong { color: #17191d; }

.codeblock { margin: 0 0 1.1rem; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: #0e0f12; overflow: hidden; }
:root[data-theme="light"] .codeblock { background: #1a1c20; }
.cb-bar { display: flex; justify-content: space-between; align-items: center; padding: .3rem .4rem .3rem .8rem; background: var(--surface-3); border-bottom: 1px solid var(--line-2); }
.cb-bar span { font-family: var(--mono); font-size: .64rem; color: var(--fg-3); text-transform: lowercase; letter-spacing: .05em; }
.cb-copy { background: transparent; border: 0; color: var(--fg-3); font-size: .66rem; font-family: var(--mono); padding: 3px 9px; border-radius: 4px; cursor: default; }
.cb-copy:hover { background: var(--surface-2); color: var(--fg); }
.codeblock pre { margin: 0; padding: .75rem .9rem; overflow: auto; }
.codeblock code { font-family: var(--mono); font-size: .78rem; line-height: 1.55; background: transparent; border: 0; padding: 0; color: #c9ced6; white-space: pre; }
/* tokens */
.tk-k { color: #c792ea; }
.tk-s { color: #a8d08d; }
.tk-n { color: #f0b36b; }
.tk-c { color: #5c6370; font-style: italic; }
.tk-a { color: #7dcfff; }
.tk-m { color: #82aaff; }
.tk-f { color: #d4b483; }
.tk-v { color: #e5c07b; }
.redacted { background: #3a3f48; color: transparent; border-radius: 3px; padding: 0 2px; user-select: none; font-family: var(--mono); }

/* ============================================================
   music
   ============================================================ */
.app-music { padding: .75rem; display: flex; }
.mu-layout { flex: 1; display: flex; gap: 1rem; min-height: 0; }
.mu-main { display: flex; gap: 1.1rem; flex: none; width: 300px; flex-direction: column; min-height: 0; }
.mu-cover {
    width: 100%; aspect-ratio: 1;
    background: var(--surface-3) center/cover no-repeat;
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    flex: 1 1 auto;
    min-height: 90px;
    max-height: 200px;
    position: relative;
}
.mu-cover .vinyl {
    position: absolute; inset: 0; margin: auto;   /* centers both axes */
    height: 78%; width: auto; aspect-ratio: 1;    /* sized to the box height, always square, always inside */
}
.mu-cover.spin .vinyl { animation: mu-spin 3.4s linear infinite; }
@keyframes mu-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .mu-cover .vinyl { animation: none !important; } }
.mu-info { display: flex; flex-direction: column; gap: 2px; }
.mu-title { font-weight: 650; font-size: 1rem; }
.mu-album { font-size: .74rem; }
.mu-seek-row { display: flex; align-items: center; gap: .6rem; margin-top: .7rem; }
.mu-time { font-family: var(--mono); font-size: .68rem; color: var(--fg-3); min-width: 34px; }
.mu-time:last-child { text-align: right; }
.mu-seek { flex: 1; height: 4px; }
.mu-controls { display: flex; align-items: center; justify-content: center; gap: .7rem; margin-top: .8rem; }
.mu-ctl { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 50%; color: var(--fg-2); cursor: default; }
.mu-ctl:hover { background: var(--surface-2); color: var(--fg); }
.mu-ctl.small { width: 28px; height: 28px; color: var(--fg-3); }
.mu-ctl.small.on { color: var(--acc); }
.mu-play { width: 40px; height: 40px; background: var(--acc-dim); color: #fff; }
.mu-play:hover { background: var(--acc); color: var(--acc-fg); }
.mu-vol-row { display: flex; align-items: center; gap: .55rem; margin-top: .8rem; color: var(--fg-3); }
.mu-vol { flex: 1; height: 4px; }
.mu-side { flex: 1; display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--line); padding-left: 1rem; }
.mu-side-head { font-size: .74rem; color: var(--fg-3); padding: .2rem 0 .5rem; }
.mu-list { flex: 1; }
.mu-track { display: flex; align-items: center; gap: .8rem; width: 100%; padding: .5rem .6rem; background: transparent; border: 0; border-radius: var(--radius-s); cursor: default; text-align: left; }
.mu-track:hover { background: var(--surface-2); }
.mu-track.on { background: var(--acc-soft); }
.mu-track-num { color: var(--fg-3); font-size: .7rem; }
.mu-track.on .mu-track-num { color: var(--acc); }
.mu-track-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mu-track-title { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-track.on .mu-track-title { color: var(--acc); }
.mu-track-sub { font-size: .7rem; }
.mu-track-dur { font-size: .68rem; }
.mu-empty { padding: 1.5rem; text-align: center; }

/* ============================================================
   packet panic
   ============================================================ */
.app-panic { display: flex; flex-direction: column; background: #0d0e11; }
:root[data-theme="light"] .app-panic { background: #17191d; }
.pp-bar { display: flex; align-items: center; gap: 1rem; padding: .5rem .9rem; border-bottom: 1px solid var(--line); font-size: .74rem; flex: none; flex-wrap: wrap; }
.pp-name { font-family: var(--mono); color: #b78fc0; font-weight: 600; letter-spacing: .04em; }
.pp-stat { display: inline-flex; align-items: center; gap: .3rem; }
.pp-stat b { color: #e4e7ec; font-family: var(--mono); font-weight: 600; }
.pp-alert { width: 9px; height: 9px; border-radius: 50%; background: #3a3f47; display: inline-block; margin-left: 3px; }
.pp-alert.left { background: #d08080; }
.pp-spacer { flex: 1; }
.pp-feed { flex: 1; position: relative; overflow: hidden; padding: .6rem .8rem; display: flex; flex-direction: column; gap: 5px; }
.pp-feed.paused { opacity: .6; }
.pp-packet {
    display: grid;
    grid-template-columns: 64px 52px 1fr auto 46px;
    align-items: center; gap: .7rem;
    padding: .48rem .7rem;
    background: #14161a;
    border: 1px solid #242830;
    border-left: 3px solid #3a4150;
    border-radius: 6px;
    font-size: .72rem;
    text-align: left;
    color: #aeb5c0;
    cursor: pointer;
    animation: pp-enter .25s var(--ease);
}
@keyframes pp-enter { from { opacity: 0; transform: translateY(-8px); } }
.pp-packet:hover { border-color: #3a4150; background: #171a1f; }
.pp-time { color: #5c6370; }
.pp-proto { color: #7aa2f7; font-weight: 600; text-transform: uppercase; }
.pp-route { color: #8b929c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-info { color: #c9ced6; }
.pp-life { position: relative; height: 3px; background: #242830; border-radius: 2px; overflow: hidden; }
.pp-life::after { content: ""; position: absolute; inset: 0; background: #6b7484; transform-origin: left; animation: pp-life linear forwards; }
@keyframes pp-life { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.pp-packet.hit { border-left-color: #8fbf7f; background: #12170f; animation: pp-pop .3s; }
.pp-packet.missed { border-left-color: #d08080; background: #1a1010; animation: pp-pop .3s; }
.pp-packet.false { border-left-color: #d4b483; background: #1a160e; animation: pp-pop .3s; }
.pp-packet.clean { opacity: .35; pointer-events: none; }
.pp-packet:disabled { pointer-events: none; }
@keyframes pp-pop { 40% { transform: scale(1.012); } }
.pp-verdict { font-family: var(--mono); font-size: .68rem; padding: .2rem .7rem; color: #8fbf7f; animation: pp-enter .2s; }
.pp-verdict.bad { color: #d08080; }
.pp-overlay {
    position: absolute; inset: 0; z-index: 5;
    background: rgba(10, 11, 13, .78);
    display: none; align-items: center; justify-content: center;
}
.pp-overlay.on { display: flex; animation: fade-in .2s; }
.pp-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1.4rem 1.6rem; max-width: 420px; margin: 1rem; text-align: center; }
.pp-card h2 { margin: 0 0 .6rem; }
.pp-card p { font-size: .8rem; }
.pp-legend { list-style: none; padding: 0; margin: .8rem 0 1.1rem; font-size: .74rem; color: var(--fg-2); text-align: left; }
.pp-legend li { padding: .2rem 0 .2rem 1.1rem; position: relative; }
.pp-legend li::before { content: "›"; position: absolute; left: .3rem; color: var(--acc); }
.pp-newhigh { color: #d4b483; font-family: var(--mono); font-size: .8rem; margin: .4rem 0; }

/* ============================================================
   noscript
   ============================================================ */
.noscript {
    position: fixed; inset: 0; z-index: 9999;
    background: #101114; color: #d7dae0;
    padding: 2rem; overflow: auto;
    font-family: var(--sans);
}
.noscript h1 { font-size: 1.2rem; }
.noscript code { font-family: var(--mono); color: #7aa2f7; }

/* ============================================================
   mobile
   ============================================================ */
body.mobile .window { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; border: none; max-width: 100vw; }
body.mobile #desktop-icons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 6px;
    padding: 22px 10px;
    align-content: start;
    overflow-y: auto;
}
body.mobile .dicon { width: auto; }
body.mobile .rh { display: none; }
body.mobile .task-btn { max-width: 46px; padding: 0 10px; justify-content: center; }
body.mobile .task-btn-label { display: none; }
body.mobile .task-btn.active::after { left: 10px; right: 10px; }
body.mobile #taskbar { padding: 0 .25rem; }
body.mobile .clock-date { display: none; }
body.mobile #tray-bat, body.mobile #tray-net { display: none; }
body.mobile .menu-panel { left: 8px; right: 8px; width: auto; }
body.mobile .bl-list-pane { width: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 38%; }
body.mobile .bl-article { padding: .4rem 1.1rem 0; }
body.mobile .mu-layout { flex-direction: column; overflow: auto; }
body.mobile .mu-main { width: auto; }
body.mobile .mu-cover { max-height: 170px; width: 170px; margin: 0 auto; }
body.mobile .mu-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: .6rem; }
body.mobile .pp-packet { grid-template-columns: 50px 44px 1fr 46px; }
body.mobile .pp-route { display: none; }
body.mobile .app-about { padding: 1rem 1.1rem; }
body.mobile .ab-head { flex-direction: column; text-align: center; }

/* ============================================================
   reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 767px) {
    :root { --taskbar-h: 3.2rem; }
    body { font-size: .88rem; }
    .window { min-width: 0; min-height: 0; }
}
