/* Early-2000s desktop theme variables and window layouts.
   Two families set geometry: data-theme="light" (glossy) and data-theme="dark" (beveled). */
:root {
    --font-ui: Tahoma, Verdana, 'Segoe UI', sans-serif;
    --font-title: 'Trebuchet MS', Tahoma, sans-serif;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --taskbar-h: calc(44px + var(--safe-b));

    /* Luna Blue (default light skin) */
    --desktop: linear-gradient(180deg, #3a6fd8 0%, #5d94ec 45%, #8cbef4 100%);
    --win-border: #0831d9;
    --title-a: #0a5ee8;
    --title-b: #3d95ff;
    --title-c: #0352d6;
    --title-text: #ffffff;
    --title-shadow: 1px 1px 0 #0a2a8a;
    --tbbtn-a: #3b7cf5;
    --tbbtn-b: #1e56cc;
    --tbbtn-edge: #ffffff;
    --tbbtn-glyph: #ffffff;
    --win-body: #ece9d8;
    --win-text: #1b1b1b;
    --muted: #4a4a45;
    --panel: #ffffff;
    --panel-border: #6886a3;
    --bevel-hi: #ffffff;
    --bevel-mid: #d4d0c8;
    --bevel-lo: #9c988a;
    --accent: #0a4bc4;
    --link: #083bb0;
    --on-accent: #ffffff;
    --btn-a: #ffffff;
    --btn-b: #e3e0d2;
    --btn-border: #003c74;
    --btn-text: #1b1b1b;
    --btn-hover: #d99014;
    --primary-a: #288028;
    --primary-b: #1c661c;
    --primary-border: #144d14;
    --primary-text: #ffffff;
    --primary-hover: #2d872d;
    --select: #2257b8;
    --select-text: #ffffff;
    --task-a: #1e4ec4;
    --task-b: #2e6be0;
    --task-c: #1942ab;
    --task-btn: #2560cf;
    --task-btn-active: #143b94;
    --task-text: #ffffff;
    --start-a: #2e822e;
    --start-b: #1f691f;
    --start-hi: #52b352;
    --start-lo: #164f16;
    --start-text: #ffffff;
    --orb: radial-gradient(circle at 35% 30%, #ffffff 0%, #d8f5d8 25%, #3a9a3a 70%, #1d641d 100%);
    --tray: #0b70b3;
    --tray-text: #ffffff;
    --menu-bg: #ffffff;
    --menu-text: #1b1b1b;
    --menu-border: #0831d9;
    --menu-head-a: #2568db;
    --menu-head-b: #084ab8;
    --avatar: #18439e;
    --icon-text: #ffffff;
    --icon-shadow: 1px 1px 2px rgba(0, 0, 0, 0.85);
    --icon-select: rgba(10, 52, 180, 0.85);
    --ok-text: #155215;
    --ok-bg: #e3f5e3;
    --err-text: #7d190c;
    --err-bg: #fbe3df;
    --win-radius: 8px 8px 0 0;
    --shadow: 3px 4px 14px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] {
    /* Olive Drab */
    --desktop: radial-gradient(ellipse at 50% 0%, #4a5442 0%, #2c3326 70%, #232820 100%);
    --win-border: #22271d;
    --title-a: #526148;
    --title-b: #526148;
    --title-c: #434f3b;
    --title-text: #eef3e8;
    --title-shadow: 1px 1px 0 #181c15;
    --win-body: #424d3b;
    --win-text: #edf2e6;
    --muted: #ccd6c2;
    --panel: #333b2d;
    --panel-border: #22271d;
    --bevel-hi: #8c9880;
    --bevel-mid: #5a6650;
    --bevel-lo: #22271d;
    --accent: #e0d16c;
    --link: #e8da7d;
    --on-accent: #161a13;
    --btn-a: #526148;
    --btn-b: #424d3b;
    --btn-border: #22271d;
    --btn-text: #edf2e6;
    --btn-hover: #5c6d51;
    --primary-a: #bdb04a;
    --primary-b: #a89b3d;
    --primary-border: #332e10;
    --primary-text: #161a13;
    --primary-hover: #ccc056;
    --select: #bdb04a;
    --select-text: #161a13;
    --task-a: #363e30;
    --task-b: #424d3b;
    --task-c: #363e30;
    --task-btn: #4c5944;
    --task-btn-active: #293024;
    --task-text: #edf2e6;
    --start-a: #bdb04a;
    --start-hi: #dcd074;
    --start-lo: #332e10;
    --start-text: #161a13;
    --tray: #31382b;
    --tray-text: #edf2e6;
    --menu-bg: #424d3b;
    --menu-text: #edf2e6;
    --menu-border: #22271d;
    --menu-head-a: #4f5e46;
    --menu-head-b: #424d3b;
    --avatar: #e0d16c;
    --icon-text: #edf2e6;
    --icon-select: #31382b;
    --ok-text: #e2f0ce;
    --ok-bg: #324a23;
    --err-text: #f7dbd3;
    --err-bg: #5e2c1f;
    --win-radius: 0;
    --shadow: 4px 5px 0 rgba(0, 0, 0, 0.35);
}

/* Night LCD */
[data-skin="noir"] {
    --desktop:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 0%, #23272e 0%, #0d0f12 70%, #08090b 100%);
    --win-border: #050607;
    --title-a: #2b2f36;
    --title-b: #2b2f36;
    --title-c: #22252b;
    --title-text: #dce1e8;
    --title-shadow: 1px 1px 0 #000;
    --win-body: #1d2025;
    --win-text: #dce1e8;
    --muted: #9da6b3;
    --panel: #121418;
    --panel-border: #050607;
    --bevel-hi: #4f5661;
    --bevel-mid: #2f343d;
    --bevel-lo: #050607;
    --accent: #a6ff4d;
    --link: #a6ff4d;
    --on-accent: #0c1205;
    --btn-a: #2f343c;
    --btn-b: #262a31;
    --btn-border: #050607;
    --btn-text: #dce1e8;
    --btn-hover: #38404a;
    --primary-a: #8fe03a;
    --primary-b: #7acc29;
    --primary-border: #2c4a0c;
    --primary-text: #0c1205;
    --primary-hover: #a6ff4d;
    --select: #3e6317;
    --select-text: #f2ffe6;
    --task-a: #16181c;
    --task-b: #22252b;
    --task-c: #16181c;
    --task-btn: #2b2f36;
    --task-btn-active: #0d0f12;
    --task-text: #dce1e8;
    --start-a: #8fe03a;
    --start-hi: #c8ff8f;
    --start-lo: #2c4a0c;
    --start-text: #0c1205;
    --tray: #0d0f12;
    --tray-text: #a6ff4d;
    --menu-bg: #1d2025;
    --menu-text: #dce1e8;
    --menu-border: #050607;
    --menu-head-a: #2b2f36;
    --menu-head-b: #22252b;
    --avatar: #a6ff4d;
    --icon-text: #e4e8ee;
    --icon-select: #3e6317;
    --ok-text: #d9ffb3;
    --ok-bg: #26400a;
    --err-text: #ffd6cf;
    --err-bg: #541a11;
}

/* Y2K Cyber */
[data-skin="cyber"] {
    --desktop:
        radial-gradient(circle at 15% 85%, rgba(255, 79, 209, 0.25), transparent 40%),
        radial-gradient(circle at 85% 15%, rgba(79, 230, 255, 0.22), transparent 40%),
        linear-gradient(160deg, #1b1236 0%, #0c0820 100%);
    --win-border: #0c0820;
    --title-a: #3a2a72;
    --title-b: #3a2a72;
    --title-c: #2e2160;
    --title-text: #f3edff;
    --title-shadow: 0 0 6px rgba(255, 79, 209, 0.5);
    --win-body: #241a46;
    --win-text: #f0ebff;
    --muted: #beb2e6;
    --panel: #181132;
    --panel-border: #0c0820;
    --bevel-hi: #7360c9;
    --bevel-mid: #3d2c78;
    --bevel-lo: #0c0820;
    --accent: #ff7ad9;
    --link: #66f3ff;
    --on-accent: #1a0a2a;
    --btn-a: #3a2a72;
    --btn-b: #2e2160;
    --btn-border: #0c0820;
    --btn-text: #f0ebff;
    --btn-hover: #4b3791;
    --primary-a: #ff7ad9;
    --primary-b: #f060c7;
    --primary-border: #5a1250;
    --primary-text: #1a0a2a;
    --primary-hover: #ff94e2;
    --select: #5ef2ff;
    --select-text: #0c0820;
    --task-a: #150e2e;
    --task-b: #2e2160;
    --task-c: #150e2e;
    --task-btn: #2e2160;
    --task-btn-active: #0c0820;
    --task-text: #f0ebff;
    --start-a: #5ef2ff;
    --start-hi: #b8f9ff;
    --start-lo: #0f5f6a;
    --start-text: #0c0820;
    --tray: #0c0820;
    --tray-text: #5ef2ff;
    --menu-bg: #241a46;
    --menu-text: #f0ebff;
    --menu-border: #0c0820;
    --menu-head-a: #3a2a72;
    --menu-head-b: #2e2160;
    --avatar: #ff7ad9;
    --icon-text: #f3edff;
    --icon-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    --icon-select: #6c227d;
    --ok-text: #c9fff8;
    --ok-bg: #0d525c;
    --err-text: #ffd6f0;
    --err-bg: #611049;
    --shadow: 4px 5px 0 rgba(0, 0, 0, 0.5);
}

/* Silver Metal */
[data-skin="silver"] {
    --desktop:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 4px),
        linear-gradient(180deg, #565f73 0%, #7d879c 55%, #a9b1c2 100%);
    --win-border: #6c748a;
    --title-a: #c2c7d6;
    --title-b: #f1f2f6;
    --title-c: #a5acc0;
    --title-text: #181d29;
    --title-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
    --tbbtn-a: #f4f5f8;
    --tbbtn-b: #c4c8d4;
    --tbbtn-edge: #6c748a;
    --tbbtn-glyph: #1d2230;
    --win-body: #eceef3;
    --win-text: #181d29;
    --muted: #464d61;
    --panel-border: #858d9f;
    --bevel-lo: #858d9f;
    --accent: #244796;
    --link: #1e3f8a;
    --btn-border: #5c657a;
    --btn-hover: #5c82cf;
    --primary-a: #3558ab;
    --primary-b: #25438c;
    --primary-border: #1b336e;
    --primary-text: #ffffff;
    --primary-hover: #3d63bd;
    --select: #2b4c99;
    --select-text: #ffffff;
    --task-a: #c2c7d3;
    --task-b: #eef0f5;
    --task-c: #a6acbd;
    --task-btn: #dfe3ec;
    --task-btn-active: #b8bfd0;
    --task-text: #181d29;
    --tray: #d6dae3;
    --tray-text: #181d29;
    --menu-border: #6c748a;
    --menu-head-a: #3558ab;
    --menu-head-b: #233f85;
    --avatar: #25438c;
    --icon-shadow: 1px 1px 3px rgba(0, 0, 0, 0.85);
    --icon-select: rgba(37, 67, 140, 0.88);
}

/* Aero Glass */
[data-skin="aero"] {
    --desktop:
        radial-gradient(circle at 18% 30%, rgba(255, 255, 255, 0.45) 0 22px, rgba(255, 255, 255, 0.1) 23px 26px, transparent 27px),
        radial-gradient(circle at 82% 22%, rgba(255, 255, 255, 0.35) 0 34px, rgba(255, 255, 255, 0.08) 35px 38px, transparent 39px),
        radial-gradient(ellipse 120% 40% at 50% 110%, #4b9416 0%, #37730d 45%, transparent 46%),
        linear-gradient(180deg, #1269ab 0%, #2488cc 55%, #4ba3db 100%);
    --win-border: #146ba3;
    --title-a: #166ca8;
    --title-b: #2b86c4;
    --title-c: #0d5587;
    --title-text: #ffffff;
    --title-shadow: 0 1px 2px rgba(0, 28, 56, 0.75);
    --tbbtn-a: #2982bf;
    --tbbtn-b: #0f5c91;
    --tbbtn-edge: #ffffff;
    --tbbtn-glyph: #ffffff;
    --win-body: #f2fbff;
    --win-text: #0e2a40;
    --muted: #355770;
    --panel-border: #78b3d6;
    --bevel-lo: #8ec1df;
    --accent: #08619c;
    --link: #06568c;
    --btn-a: #ffffff;
    --btn-b: #dff3fc;
    --btn-border: #3a8ec0;
    --btn-text: #0e2a40;
    --btn-hover: #6cc22b;
    --primary-a: #9be35a;
    --primary-b: #6fc22e;
    --primary-border: #2c6e0d;
    --primary-text: #0f2606;
    --primary-hover: #aef06c;
    --select: #0b69ab;
    --select-text: #ffffff;
    --task-a: rgba(6, 36, 62, 0.88);
    --task-b: rgba(18, 66, 104, 0.9);
    --task-c: rgba(4, 26, 46, 0.94);
    --task-btn: rgba(8, 42, 72, 0.85);
    --task-btn-active: rgba(2, 18, 34, 0.92);
    --task-text: #ffffff;
    --start-a: #1574b5;
    --start-b: #09568c;
    --start-hi: #4aa8e6;
    --start-lo: #053b63;
    --start-text: #ffffff;
    --orb: radial-gradient(circle at 35% 30%, #ffffff 0%, #c9f1ff 25%, #2aa8e8 70%, #064a7a 100%);
    --tray: rgba(4, 28, 50, 0.88);
    --tray-text: #ffffff;
    --menu-border: #146ba3;
    --menu-head-a: #166ca8;
    --menu-head-b: #0b5182;
    --avatar: #0d588c;
    --icon-shadow: 0 1px 3px rgba(0, 24, 48, 0.95);
    --icon-select: rgba(8, 78, 132, 0.88);
    --win-radius: 10px 10px 0 0;
    --shadow: 0 8px 28px rgba(0, 40, 75, 0.35);
}

/* Base reset and typography */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font: 15px/1.55 var(--font-ui);
    color: var(--win-text);
    background: var(--desktop);
    background-attachment: fixed;
    padding-bottom: var(--taskbar-h);
    overflow-x: hidden;
}

a {
    color: var(--link);
}

h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.25;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.desktop {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - var(--taskbar-h));
    min-height: calc(100dvh - var(--taskbar-h));
    margin: 0 auto;
    padding: 20px max(24px, env(safe-area-inset-right, 0px)) 12px calc(78px + 20px + env(safe-area-inset-left, 0px));
}

/* Window chrome */
.window {
    background: var(--win-body);
    border: 3px solid var(--win-border);
    border-top: 0;
    border-radius: var(--win-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

[data-theme="dark"] .window {
    border: 1px solid var(--win-border);
    box-shadow: inset 1px 1px 0 var(--bevel-hi), var(--shadow);
}

.window[hidden] {
    display: none;
}

.titlebar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 6px 0 8px;
    background: linear-gradient(180deg, var(--title-b) 0%, var(--title-a) 12%, var(--title-a) 60%, var(--title-c) 100%);
    color: var(--title-text);
    border-radius: var(--win-radius);
    user-select: none;
}

[data-theme="dark"] .titlebar {
    height: 30px;
    border-bottom: 1px solid var(--bevel-lo);
}

.titlebar-text {
    flex: 1;
    font: bold 15px var(--font-title);
    text-shadow: var(--title-shadow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .titlebar-text {
    font: bold 13px var(--font-ui);
    letter-spacing: 0.02em;
}

.titlebar-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border-radius: 3px;
    background: linear-gradient(135deg, #ffffff 0%, #c9dcf7 100%);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.titlebar-icon.icon-folder {
    background: linear-gradient(180deg, #f7cf5c, #e8b33a);
}

.titlebar-icon.icon-mail {
    background: linear-gradient(180deg, #ffffff, #e2e2e2);
}

.titlebar-icon.icon-text {
    background: linear-gradient(180deg, #ffffff 0 20%, #9fb4cc 20% 30%, #ffffff 30% 50%, #9fb4cc 50% 60%, #ffffff 60%);
}

[data-theme="dark"] .titlebar-icon {
    background: var(--accent);
    border-radius: 0;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.3), inset -1px -1px 0 rgba(0, 0, 0, 0.4);
}

.titlebar-buttons {
    display: flex;
    gap: 3px;
}

button.tb-btn {
    position: relative;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--tbbtn-edge);
    border-radius: 3px;
    background: linear-gradient(180deg, var(--tbbtn-a), var(--tbbtn-b));
    cursor: pointer;
    font: inherit;
}

button.tb-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 1px;
}

.tb-close {
    border-color: #ffffff;
    background: linear-gradient(180deg, #e8805e, #c7381c);
}

.tb-btn::before,
.tb-btn::after {
    content: "";
    position: absolute;
    background: var(--tbbtn-glyph);
}

.tb-close::before,
.tb-close::after {
    background: #ffffff;
}

.tb-min::before {
    left: 5px;
    bottom: 5px;
    width: 8px;
    height: 3px;
}

.tb-max::before {
    inset: 4px;
    background: transparent;
    border: 1px solid var(--tbbtn-glyph);
    border-top-width: 3px;
}

.tb-close::before,
.tb-close::after {
    left: 9px;
    top: 3px;
    width: 2px;
    height: 14px;
    transform: rotate(45deg);
}

.tb-close::after {
    transform: rotate(-45deg);
}

[data-theme="dark"] button.tb-btn {
    width: 20px;
    height: 20px;
    border: 1px solid var(--bevel-lo);
    border-radius: 0;
    background: var(--btn-b);
    box-shadow: inset 1px 1px 0 var(--bevel-hi);
}

[data-theme="dark"] .tb-btn::before,
[data-theme="dark"] .tb-btn::after {
    background: var(--win-text);
}

[data-theme="dark"] .tb-min::before {
    left: 5px;
    bottom: 4px;
    width: 8px;
    height: 2px;
}

[data-theme="dark"] .tb-max::before {
    inset: 4px;
    background: transparent;
    border-color: var(--win-text);
    border-top-width: 2px;
}

[data-theme="dark"] .tb-close::before,
[data-theme="dark"] .tb-close::after {
    left: 8px;
    top: 3px;
    height: 12px;
}

.window-body {
    padding: 20px 24px;
}

.statusbar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--bevel-lo);
    box-shadow: inset 0 1px 0 var(--bevel-hi);
}

.address-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 5px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--bevel-lo);
    box-shadow: 0 1px 0 var(--bevel-hi);
}

.address-label {
    color: var(--muted);
}

.address-path {
    flex: 1;
    padding: 2px 8px;
    background: var(--panel);
    color: var(--win-text);
    border: 1px solid var(--panel-border);
    font-family: var(--font-ui);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .address-path {
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 96px;
    padding: 6px 16px;
    border: 1px solid var(--btn-border);
    border-radius: 3px;
    background: linear-gradient(180deg, var(--btn-a), var(--btn-b));
    color: var(--btn-text);
    font: 14px var(--font-ui);
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}

.btn:hover {
    box-shadow: inset 0 0 0 2px var(--btn-hover);
}

.btn:active {
    background: linear-gradient(180deg, var(--btn-b), var(--btn-a));
}

[data-theme="dark"] .btn {
    border-radius: 0;
    background: var(--btn-b);
    box-shadow: inset 1px 1px 0 var(--bevel-hi), inset -1px -1px 0 var(--bevel-lo);
}

[data-theme="dark"] .btn:hover {
    background: var(--btn-a);
}

[data-theme="dark"] .btn:active {
    box-shadow: inset -1px -1px 0 var(--bevel-hi), inset 1px 1px 0 var(--bevel-lo);
}

.btn-primary {
    border-color: var(--primary-border);
    background: linear-gradient(180deg, var(--primary-a), var(--primary-b));
    color: var(--primary-text);
    font-weight: bold;
    text-shadow: none;
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--primary-hover), var(--primary-b));
}

[data-theme="dark"] .btn-primary {
    background: var(--primary-a);
}

[data-theme="dark"] .btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: progress;
}

.btn-small {
    min-width: 0;
    min-height: 32px;
    padding: 4px 12px;
    font-size: 13px;
}

/* Desktop shortcuts and Welcome window */
.hero {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    align-items: center;
    min-height: 0;
}

.desktop-icons {
    --cell: 78px;
    position: fixed;
    top: 4px;
    left: env(safe-area-inset-left, 0px);
    bottom: var(--taskbar-h);
    z-index: 1;
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(auto-fill, var(--cell));
    grid-auto-columns: var(--cell);
    align-content: start;
    gap: 2px;
    padding: 4px 0 0 2px;
    pointer-events: none;
}

.desk-icon {
    position: relative;
    display: grid;
    grid-template-rows: auto auto;
    justify-items: center;
    align-content: center;
    gap: 3px;
    width: var(--cell);
    height: var(--cell);
    padding: 4px 2px;
    pointer-events: auto;
    color: var(--icon-text);
    font-size: 11px;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    text-shadow: var(--icon-shadow);
    border: 1px dotted transparent;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: auto;
}

.desk-icon svg {
    width: 36px;
    height: 36px;
    filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.35));
}

.desk-icon span {
    padding: 1px 3px;
}

.desk-icon:hover span,
.desk-icon:focus-visible span,
.desk-icon.dragging span {
    background: var(--icon-select);
    outline: 1px dotted var(--icon-text);
}

.desk-icon.dragging {
    opacity: 0.78;
    cursor: grabbing;
}

.window-welcome {
    position: relative;
    z-index: 2;
    align-self: center;
    width: min(max(920px, 58vw), 100%);
}

.window-welcome .titlebar {
    cursor: move;
    touch-action: none;
}

.window-welcome.hung {
    z-index: 60;
}

.window.hung .titlebar {
    filter: saturate(0.35) brightness(1.08);
}

.js .window-welcome.pending {
    display: none;
}

.window-welcome.opening {
    animation: win-open 0.25s ease-out;
}

.window-welcome.zooming {
    animation: win-zoom 0.5s cubic-bezier(0.35, 0.55, 0.3, 1);
}

@keyframes win-zoom {
    from {
        opacity: 0.2;
        transform: translate(var(--zoom-x, 0), var(--zoom-y, 0)) scale(0.08);
    }
    60% {
        opacity: 1;
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.hero-body {
    position: relative;
    overflow-x: clip;
    overflow-y: auto;
    isolation: isolate;
    padding: clamp(24px, 5vh, 52px) clamp(20px, 4.5vw, 56px);
}

.hero-body > :not(.ascii-aura) {
    position: relative;
    z-index: 1;
}

.ascii-aura {
    position: absolute;
    inset: 0;
    z-index: 0;
    margin: 0;
    font: 12px/12px Consolas, 'Lucida Console', 'Courier New', monospace;
    letter-spacing: 0;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
    color: transparent;
    background: linear-gradient(110deg, var(--accent) 0%, var(--link) 35%, var(--accent) 60%, var(--title-text) 80%, var(--accent) 100%);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    opacity: 0.24;
    animation: aura-shimmer 9s linear infinite;
    -webkit-mask-image: radial-gradient(ellipse 75% 85% at 50% 50%, #000 40%, transparent 100%);
    mask-image: radial-gradient(ellipse 75% 85% at 50% 50%, #000 40%, transparent 100%);
}

[data-theme="light"] .ascii-aura {
    opacity: 0.14;
}

@keyframes aura-shimmer {
    from { background-position: 0% 0; }
    to   { background-position: 300% 0; }
}

.greeting {
    margin: 0 0 6px;
    color: var(--accent);
    font-weight: bold;
}

.hero-name {
    --name-top: var(--title-a);
    --name-bottom: var(--title-c);
    --name-edge: color-mix(in srgb, var(--title-c) 35%, transparent);
    width: fit-content;
    max-width: 100%;
    padding: 0 0.06em 0.06em 0;
    font: bold italic clamp(2.3rem, 5.8vw, 4.8rem) / 1.04 var(--font-title);
    letter-spacing: -0.01em;
    color: var(--title-a);
    background: linear-gradient(180deg, var(--name-top) 20%, var(--name-bottom) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 2px 0 var(--name-edge));
}

[data-theme="dark"] .hero-name {
    --name-top: #ffffff;
    --name-bottom: color-mix(in srgb, var(--accent) 45%, #ffffff);
    --name-edge: color-mix(in srgb, #000 45%, transparent);
    font-style: normal;
    font-family: var(--font-ui);
    letter-spacing: 0;
}

.hero-tagline {
    margin: 10px 0 0;
    font-size: clamp(1.15rem, 2.1vw, 1.55rem);
    font-weight: bold;
    color: var(--accent);
}

.hero-lede {
    max-width: 68ch;
    margin: 14px 0 0;
    font-size: clamp(0.95rem, 1.35vw, 1.06rem);
    line-height: 1.58;
    color: var(--win-text);
}

.hero-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 20px 0 0;
    padding: 10px 14px;
    max-width: fit-content;
    background: var(--panel);
    border: 1px solid var(--panel-border);
}

[data-theme="dark"] .hero-metrics {
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
}

.metric-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding-right: 16px;
    border-right: 1px solid var(--bevel-mid);
}

.metric-item:last-child {
    padding-right: 0;
    border-right: 0;
}

.metric-item dt {
    font-size: 12px;
    color: var(--muted);
}

.metric-item dd {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    color: var(--accent);
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

/* Shared pop-up window shell */
.section {
    padding: 24px 0;
}

.section-lede {
    margin: 0 0 16px;
    color: var(--muted);
}

.js #contact:not(.popup) {
    display: none;
}

.section.popup {
    position: fixed;
    inset: 0 0 var(--taskbar-h) 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    pointer-events: none;
}

.section.popup[hidden] {
    display: none;
}

.popup > .window {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    width: min(680px, 100%);
    max-height: 100%;
}

.popup > .window .titlebar {
    flex-shrink: 0;
    cursor: move;
}

.popup > .window .window-body {
    overflow-y: auto;
}

.popup > .window.opening {
    animation: win-open 0.2s ease-out;
}

@keyframes win-open {
    from { opacity: 0; scale: 0.95; }
    to   { opacity: 1; scale: 1; }
}

.trail-layer {
    position: fixed;
    inset: 0;
    z-index: 55;
    pointer-events: none;
    overflow: hidden;
}

.trail-layer .trail {
    position: fixed;
    margin: 0;
    max-width: none;
    transform: none !important;
    transition: none !important;
    opacity: 1 !important;
}

/* Window 1: experience.exe (master-detail inspector) */
.popup > .window.window-experience {
    width: min(880px, 100%);
    height: min(560px, 100%);
}

.window-experience .window-body.exp-body {
    flex: 1;
    min-height: 0;
    padding: 14px;
    display: flex;
    overflow: hidden;
}

.exp-split {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 12px;
}

.exp-sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    overflow-y: auto;
}

[data-theme="dark"] .exp-sidebar {
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
}

.exp-tab {
    display: grid;
    gap: 3px;
    width: 100%;
    min-height: 52px;
    padding: 8px 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--win-text);
    font: 14px var(--font-ui);
    text-align: left;
    cursor: pointer;
}

.exp-tab:hover {
    background: color-mix(in srgb, var(--select) 16%, transparent);
}

.exp-tab[aria-selected="true"] {
    background: var(--select);
    color: var(--select-text);
    border-color: var(--panel-border);
}

.exp-tab-company {
    font-weight: bold;
}

.exp-tab-meta {
    font-size: 12px;
    opacity: 0.9;
}

.exp-detail-wrap {
    min-width: 0;
    min-height: 0;
    display: flex;
}

.exp-panel {
    flex: 1;
    min-height: 0;
    padding: 16px 18px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.exp-panel[hidden] {
    display: none;
}

[data-theme="dark"] .exp-panel {
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
}

.exp-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bevel-mid);
}

.exp-head h3 {
    font-size: 1.25rem;
    color: var(--accent);
}

.exp-role {
    margin: 3px 0 0;
    font-weight: bold;
    color: var(--win-text);
}

.exp-place {
    display: grid;
    justify-items: end;
    font-size: 12px;
    color: var(--muted);
}

.exp-points {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 20px;
    font-size: 14px;
    line-height: 1.55;
}

/* Window 2: Projects (featured + cards + directory table + live filter) */
.popup > .window.window-projects {
    width: min(940px, 100%);
    height: min(680px, 100%);
}

.proj-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    flex-shrink: 0;
    padding: 8px 14px;
    border-bottom: 1px solid var(--bevel-lo);
    box-shadow: 0 1px 0 var(--bevel-hi);
}

.proj-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    min-height: 32px;
    padding: 4px 10px;
    border: 1px solid var(--btn-border);
    border-radius: 3px;
    background: var(--btn-b);
    color: var(--btn-text);
    font: 12px var(--font-ui);
    cursor: pointer;
}

[data-theme="dark"] .filter-chip {
    border-radius: 0;
    box-shadow: inset 1px 1px 0 var(--bevel-hi), inset -1px -1px 0 var(--bevel-lo);
}

.filter-chip:hover {
    background: var(--btn-a);
}

.filter-chip[aria-pressed="true"] {
    background: var(--select);
    color: var(--select-text);
    border-color: var(--win-border);
    font-weight: bold;
}

.proj-search-label {
    flex: 1 1 210px;
    max-width: 280px;
}

.proj-search-label input {
    width: 100%;
    min-height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--panel-border);
    background: var(--panel);
    color: var(--win-text);
    font: 13px var(--font-ui);
}

[data-theme="dark"] .proj-search-label input {
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
}

.window-projects .window-body.projects-body {
    flex: 1;
    min-height: 0;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.project-grid[hidden],
.shipped-archive[hidden] {
    display: none;
}

.project-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
}

.project-card[hidden] {
    display: none;
}

[data-theme="dark"] .project-card {
    box-shadow: inset 1px 1px 0 var(--bevel-lo), inset -1px -1px 0 var(--bevel-mid);
}

.project-featured {
    grid-column: 1 / -1;
}

.project-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.project-card h3 {
    font: bold 1.1rem var(--font-title);
    color: var(--accent);
}

[data-theme="dark"] .project-card h3 {
    font-family: var(--font-ui);
}

.project-featured h3 {
    font-size: 1.28rem;
}

.project-client {
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: bold;
    color: var(--muted);
}

.project-card > p:not(.project-client) {
    margin: 0;
    color: var(--win-text);
    font-size: 14px;
    line-height: 1.5;
}

.project-badge {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.02em;
    color: var(--primary-text);
    background: var(--primary-b);
    border: 1px solid var(--primary-border);
    white-space: nowrap;
}

[data-theme="dark"] .project-badge {
    color: var(--on-accent);
    background: var(--accent);
}

.project-badge.muted {
    color: var(--muted);
    background: var(--win-body);
    border-color: var(--panel-border);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: auto 0 0;
    padding: 4px 0 0;
    list-style: none;
}

.tags li {
    padding: 2px 8px;
    font-size: 12px;
    background: var(--win-body);
    color: var(--win-text);
    border: 1px solid var(--panel-border);
}

.archive-heading {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--accent);
}

.archive-table-wrap {
    background: var(--panel);
    border: 1px solid var(--panel-border);
}

.archive-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.archive-table th,
.archive-table td {
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--bevel-mid);
}

[data-theme="dark"] .archive-table th,
[data-theme="dark"] .archive-table td {
    border-bottom-color: var(--bevel-lo);
}

.archive-table thead th {
    background: var(--btn-b);
    color: var(--btn-text);
    font-weight: bold;
    white-space: nowrap;
}

.archive-table tbody th {
    font-weight: bold;
    color: var(--accent);
    white-space: nowrap;
}

.archive-table tbody tr[hidden] {
    display: none;
}

.empty-state {
    display: grid;
    justify-items: start;
    gap: 10px;
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    color: var(--win-text);
}

.empty-state[hidden] {
    display: none;
}

.empty-state p {
    margin: 0;
}

/* Window 3: education.exe (System Properties tabbed dialog) */
.popup > .window.window-education {
    width: min(800px, 100%);
    height: min(600px, 100%);
}

.window-education .window-body.edu-body {
    flex: 1;
    min-height: 0;
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sys-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex-shrink: 0;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

.sys-tab {
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid var(--panel-border);
    border-bottom-color: var(--panel-border);
    border-radius: 4px 4px 0 0;
    background: var(--btn-b);
    color: var(--btn-text);
    font: 13px var(--font-ui);
    cursor: pointer;
}

[data-theme="dark"] .sys-tab {
    border-radius: 0;
}

.sys-tab[aria-selected="true"] {
    background: var(--panel);
    color: var(--accent);
    font-weight: bold;
    border-bottom-color: var(--panel);
}

.sys-panel {
    flex: 1;
    min-height: 0;
    padding: 16px 18px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sys-panel[hidden] {
    display: none;
}

.edu-block {
    display: grid;
    gap: 12px;
}

.edu-compact {
    padding-top: 14px;
    border-top: 1px solid var(--bevel-mid);
}

.edu-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 6px 14px;
}

.edu-header h3 {
    font-size: 1.12rem;
    color: var(--accent);
}

.edu-degree {
    margin: 3px 0 0;
    font-size: 14px;
    color: var(--win-text);
}

.edu-meta {
    display: grid;
    justify-items: end;
    gap: 2px;
    font-size: 12px;
    color: var(--muted);
}

.edu-score {
    padding: 2px 8px;
    font-weight: bold;
    color: var(--primary-text);
    background: var(--primary-b);
    border: 1px solid var(--primary-border);
}

[data-theme="dark"] .edu-score {
    color: var(--on-accent);
    background: var(--accent);
}

.honors-ledger {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.honors-ledger > div {
    padding: 10px 12px;
    background: var(--win-body);
    border: 1px solid var(--panel-border);
}

.honors-ledger dt {
    font-size: 12px;
    font-weight: bold;
    color: var(--accent);
}

.honors-ledger dd {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--win-text);
}

.leader-list {
    display: grid;
    gap: 14px;
}

.leader-item {
    padding: 12px 14px;
    background: var(--win-body);
    border: 1px solid var(--panel-border);
}

.leader-date {
    font-size: 12px;
    font-weight: bold;
    color: var(--muted);
    white-space: nowrap;
}

.leader-item ul {
    display: grid;
    gap: 6px;
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 13.5px;
    line-height: 1.5;
}

/* Window 4: skills.txt (Notepad text editor with live filter) */
.popup > .window.window-notepad {
    width: min(720px, 100%);
    height: min(580px, 100%);
}

.notepad-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 6px 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--bevel-lo);
}

.skill-search-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.skill-search-wrap span {
    white-space: nowrap;
    color: var(--muted);
}

.skill-search-wrap input {
    flex: 1;
    min-width: 0;
    min-height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--panel-border);
    background: var(--panel);
    color: var(--win-text);
    font: 13px var(--font-ui);
}

.window-notepad .window-body.notepad-body {
    flex: 1;
    min-height: 0;
    padding: 0;
    display: flex;
}

.notepad-doc {
    flex: 1;
    margin: 0;
    padding: 16px 18px;
    overflow-y: auto;
    background: var(--panel);
    color: var(--win-text);
    border: 1px solid var(--panel-border);
    font: 13.5px/1.55 Consolas, 'Lucida Console', 'Courier New', monospace;
}

[data-theme="dark"] .notepad-doc {
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
}

.notepad-header {
    padding-bottom: 12px;
    margin-bottom: 14px;
    border-bottom: 1px dashed var(--bevel-mid);
}

.mono-title {
    margin: 0;
    font-size: 15px;
    font-weight: bold;
    color: var(--accent);
}

.mono-sub {
    margin: 3px 0 0;
    font-size: 12.5px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.skill-groups {
    display: grid;
    gap: 12px;
}

.skill-group[hidden] {
    display: none;
}

.skill-group h3 {
    font: bold 13.5px/1.3 Consolas, 'Lucida Console', 'Courier New', monospace;
    color: var(--accent);
}

.skill-group p {
    margin: 4px 0 0;
    color: var(--win-text);
}

/* Window 5: New Message (Contact composer) */
.window-contact > .window-body {
    display: flex;
    flex-direction: column;
}

.contact-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.field {
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

.field > span {
    font-size: 14px;
    text-align: right;
}

.field-message {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 4px;
}

.static-value,
.field input,
.field textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--panel-border);
    background: var(--panel);
    color: var(--win-text);
    font: 14px var(--font-ui);
}

.static-value {
    color: var(--muted);
    background: transparent;
    overflow-wrap: anywhere;
}

[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea {
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
}

.field textarea {
    flex: 1;
    resize: vertical;
    min-height: clamp(90px, 20vh, 140px);
}

.window-contact.maximized .field-message textarea {
    resize: none;
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
    border-color: var(--err-text);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.form-status p {
    margin: 6px 0 0;
    padding: 8px 10px;
    font-size: 13.5px;
    border: 1px solid;
}

.form-status p.success {
    color: var(--ok-text);
    background: var(--ok-bg);
}

.form-status p.error {
    color: var(--err-text);
    background: var(--err-bg);
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.copyright {
    margin: 10px 0 0;
    text-align: center;
    font-size: 12px;
    color: var(--icon-text);
    text-shadow: var(--icon-shadow);
    opacity: 0.85;
}

/* Maximized windows */
.window.maximized {
    position: fixed;
    inset: 0 0 var(--taskbar-h) 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: auto !important;
    height: auto !important;
    max-width: none;
    max-height: none;
    margin: 0;
    border-radius: 0;
    transform: none !important;
    align-self: stretch;
    justify-self: stretch;
}

.window.maximized[hidden] {
    display: none;
}

.window.maximized .titlebar {
    flex-shrink: 0;
    border-radius: 0;
    cursor: default;
}

.window.maximized > .window-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.window-welcome.maximized > .hero-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: max(36px, 8vw);
    padding-right: max(36px, 8vw);
}

.window.maximized .statusbar {
    flex-shrink: 0;
}

.section.popup:has(.window.maximized) {
    padding: 0;
}

.maximized .tb-max::before {
    inset: 8px 8px 4px 4px;
}

.maximized .tb-max::after {
    inset: 4px 4px 8px 8px;
    background: transparent;
    border: 1px solid var(--tbbtn-glyph);
    border-top-width: 2px;
}

[data-theme="dark"] .maximized .tb-max::before {
    inset: 7px 7px 3px 3px;
}

[data-theme="dark"] .maximized .tb-max::after {
    inset: 3px 3px 7px 7px;
    background: transparent;
    border-color: var(--win-text);
}

/* Resizable windows */
.popup > .window:not(.maximized):not(.resized) {
    position: relative;
}

.window.resized.resized:not(.maximized) {
    position: fixed;
    left: var(--win-l);
    top: var(--win-t);
    width: var(--win-w);
    height: var(--win-h);
    max-width: none;
    max-height: none;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.window.resized > .titlebar,
.window.resized > .proj-toolbar,
.window.resized > .notepad-toolbar,
.window.resized > .address-bar,
.window.resized > .statusbar {
    flex-shrink: 0;
}

.window.resized > .window-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.window-welcome.resized > .hero-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.window.resizing,
.window.resizing * {
    user-select: none;
    transition: none !important;
}

.rz {
    position: absolute;
    z-index: 5;
    touch-action: none;
}

.rz-n { top: 0; left: 6px; right: 6px; height: 4px; cursor: ns-resize; }
.rz-s { bottom: 0; left: 14px; right: 14px; height: 5px; cursor: ns-resize; }
.rz-e { right: 0; top: 6px; bottom: 14px; width: 5px; cursor: ew-resize; }
.rz-w { left: 0; top: 6px; bottom: 14px; width: 5px; cursor: ew-resize; }
.rz-se, .rz-sw { width: 14px; height: 14px; }
.rz-ne, .rz-nw { width: 6px; height: 6px; }
.rz-ne { top: 0; right: 0; cursor: nesw-resize; }
.rz-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.rz-nw { top: 0; left: 0; cursor: nwse-resize; }
.rz-se { bottom: 0; right: 0; cursor: nwse-resize; }

.rz-se::after {
    content: '';
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 9px;
    height: 9px;
    opacity: 0.55;
    background: linear-gradient(135deg,
        transparent 0 45%, var(--muted) 45% 52%,
        transparent 52% 65%, var(--muted) 65% 72%,
        transparent 72% 85%, var(--muted) 85% 92%, transparent 92%);
    pointer-events: none;
}

.window.maximized > .rz,
.trail > .rz {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .rz {
        display: none;
    }
}

/* Taskbar, Start menu, and Display Properties */
.taskbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 100;
    display: flex;
    align-items: stretch;
    height: var(--taskbar-h);
    padding: 0 env(safe-area-inset-right, 0px) var(--safe-b) env(safe-area-inset-left, 0px);
    background: linear-gradient(180deg, var(--task-b) 0%, var(--task-a) 10%, var(--task-a) 90%, var(--task-c) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 13px;
}

[data-theme="dark"] .taskbar {
    border-top: 1px solid var(--bevel-hi);
}

.start-wrap {
    position: relative;
    display: flex;
}

.start-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 22px 0 14px;
    border: 0;
    border-radius: 0 14px 14px 0;
    background: linear-gradient(180deg, var(--start-hi) 0%, var(--start-a) 15%, var(--start-b) 85%, var(--start-lo) 100%);
    color: var(--start-text);
    font: bold italic 18px var(--font-title);
    cursor: pointer;
    box-shadow: inset -2px 0 3px rgba(0, 0, 0, 0.25);
}

.start-btn:hover,
.start-btn[aria-expanded="true"] {
    filter: brightness(1.08);
}

[data-theme="dark"] .start-btn {
    margin: 4px;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 0;
    background: var(--start-a);
    font: bold 14px var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    box-shadow: inset 1px 1px 0 var(--start-hi), inset -1px -1px 0 var(--start-lo);
}

.start-logo {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--orb);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .start-logo {
    width: 10px;
    height: 10px;
    border-radius: 0;
    background: var(--start-text);
    box-shadow: none;
}

.start-menu,
.skin-menu {
    position: absolute;
    bottom: calc(100% + 2px);
    background: var(--menu-bg);
    color: var(--menu-text);
    border: 2px solid var(--menu-border);
    border-radius: 8px 8px 0 0;
    box-shadow: 3px -2px 12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.start-menu {
    left: 0;
    width: 280px;
}

.start-head,
.skin-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(180deg, var(--menu-head-a), var(--menu-head-b));
    color: var(--title-text);
    font: bold 15px var(--font-title);
    text-shadow: var(--title-shadow);
}

.start-user-meta {
    display: grid;
    gap: 1px;
}

.start-user-meta small {
    font: normal 12px var(--font-ui);
    opacity: 0.92;
}

.start-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border: 2px solid #ffffff;
    border-radius: 4px;
    background: var(--avatar);
    color: #ffffff;
    font: bold 14px var(--font-ui);
    text-shadow: none;
}

.start-list {
    margin: 0;
    padding: 6px 0;
    list-style: none;
}

.start-list a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 7px 16px;
    color: var(--menu-text);
    text-decoration: none;
}

.start-list a:hover,
.start-list a:focus-visible {
    background: var(--select);
    color: var(--select-text);
}

.start-list .sep {
    height: 1px;
    margin: 6px 10px;
    background: var(--bevel-mid);
}

[data-theme="dark"] .start-menu,
[data-theme="dark"] .skin-menu {
    border: 1px solid var(--menu-border);
    border-radius: 0;
    box-shadow: inset 1px 1px 0 var(--bevel-hi), 4px -4px 0 rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .start-head,
[data-theme="dark"] .skin-head {
    background: var(--menu-head-a);
    font: bold 14px var(--font-ui);
    border-bottom: 1px solid var(--bevel-lo);
}

[data-theme="dark"] .start-avatar {
    border: 1px solid var(--bevel-lo);
    border-radius: 0;
    color: var(--on-accent);
}

[data-theme="dark"] .start-list .sep {
    background: var(--bevel-lo);
    box-shadow: 0 1px 0 var(--bevel-hi);
}

.tray-wrap {
    position: relative;
    display: flex;
}

.skin-menu {
    right: -12px;
    width: 280px;
}

.skin-list {
    display: grid;
    gap: 4px;
    margin: 0;
    padding: 8px;
    list-style: none;
}

.skin-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 6px 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--menu-text);
    font: 14px var(--font-ui);
    text-align: left;
    cursor: pointer;
}

.skin-option:hover,
.skin-option:focus-visible {
    background: var(--select);
    color: var(--select-text);
}

.skin-option[aria-pressed="true"] {
    border-color: var(--accent);
    font-weight: bold;
}

.skin-swatch {
    display: flex;
    flex-shrink: 0;
    width: 54px;
    height: 20px;
    border: 1px solid rgba(0, 0, 0, 0.4);
}

.skin-swatch span {
    flex: 1;
}

.skin-family {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.85;
}

.task-buttons {
    flex: 1;
    display: flex;
    gap: 4px;
    margin: 0;
    padding: 5px 8px;
    list-style: none;
    min-width: 0;
}

.task-buttons li {
    min-width: 0;
}

.task-buttons a {
    display: flex;
    align-items: center;
    height: 100%;
    width: 150px;
    max-width: 100%;
    padding: 0 12px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    background: var(--task-btn);
    color: var(--task-text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.25);
}

.task-buttons a:hover {
    filter: brightness(1.08);
}

.task-buttons a.active {
    background: var(--task-btn-active);
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .task-buttons a {
    border: 1px solid var(--bevel-lo);
    border-radius: 0;
    box-shadow: inset 1px 1px 0 var(--bevel-hi);
}

[data-theme="dark"] .task-buttons a.active {
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
    color: var(--accent);
}

.tray {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    background: var(--tray);
    border-left: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.25);
    color: var(--tray-text);
}

[data-theme="dark"] .tray {
    margin: 4px 4px 4px 0;
    border: 1px solid var(--bevel-lo);
    box-shadow: inset -1px -1px 0 var(--bevel-hi);
}

.tray-btn {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.tray-btn:hover {
    filter: brightness(1.2);
}

.tray-btn svg {
    width: 18px;
    height: 18px;
}

.sound-btn .sound-x { display: none; }
.sound-btn.muted .sound-waves { display: none; }
.sound-btn.muted .sound-x { display: inline; }
.sound-btn.muted { opacity: 0.78; }

.clock {
    font-size: 13px;
    white-space: nowrap;
}

/* Desktop pet: Bit the droid */
.droid {
    --droid-line: color-mix(in srgb, var(--win-text) 55%, transparent);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 49;
    width: 46px;
    height: 52px;
    cursor: grab;
    touch-action: none;
    user-select: none;
    will-change: transform;
}

.droid.carried {
    cursor: grabbing;
}

.droid-svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
    filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.35));
}

.droid.carried .droid-svg {
    filter: drop-shadow(3px 8px 4px rgba(0, 0, 0, 0.4));
}

.d-shell {
    fill: var(--win-body);
    stroke: var(--droid-line);
    stroke-width: 1.4;
}

.d-visor {
    fill: #0b0d10;
}

.d-eye-track {
    transition: transform 0.35s ease;
}

.d-eye {
    fill: var(--accent);
    filter: drop-shadow(0 0 2px var(--accent));
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.2s ease;
}

.droid.asleep .d-eye {
    transform: scaleY(0.18);
    filter: none;
    opacity: 0.6;
}

.droid.happy .d-eye {
    transform: scale(1.35);
}

.d-antenna {
    stroke: var(--droid-line);
    stroke-width: 1.4;
    stroke-linecap: round;
}

.d-neck,
.d-leg {
    fill: var(--droid-line);
}

.d-tip,
.d-panel,
.d-light {
    fill: var(--accent);
}

.d-panel-dim {
    opacity: 0.5;
}

.d-tip {
    animation: droid-blink 2.4s steps(2, jump-none) infinite;
}

.d-light {
    animation: droid-blink 1.1s steps(2, jump-none) infinite;
}

.d-light-2 {
    animation-delay: 0.55s;
}

.droid.asleep .d-tip,
.droid.asleep .d-light {
    animation: none;
    opacity: 0.25;
}

@keyframes droid-blink {
    50% { opacity: 0.2; }
}

.d-boot {
    fill: var(--win-body);
    stroke: var(--droid-line);
    stroke-width: 1.2;
}

.d-nozzle {
    fill: #26292e;
}

.d-jet {
    transform-box: fill-box;
    transform-origin: 50% 0;
    transform: scaleY(var(--thrust, 0));
    opacity: min(1, calc(var(--thrust, 0) * 3));
}

.d-flame {
    fill: var(--accent);
    opacity: 0.9;
    filter: drop-shadow(0 0 2px var(--accent));
    transform-box: fill-box;
    transform-origin: 50% 0;
    animation: jet-flicker 0.09s steps(2, jump-none) infinite alternate;
}

.d-flame-core {
    fill: #ffffff;
    opacity: 0.85;
}

@keyframes jet-flicker {
    from { transform: scale(1, 1); }
    to   { transform: scale(0.8, 0.82); }
}

.d-bob {
    transition: transform 0.1s linear;
}

.droid-bubble {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    padding: 3px 8px;
    font: 11px Consolas, 'Lucida Console', monospace;
    white-space: nowrap;
    color: var(--menu-text);
    background: var(--menu-bg);
    border: 1px solid var(--menu-border);
    border-radius: 6px;
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

.droid-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -4px;
    border: 4px solid transparent;
    border-top-color: var(--menu-border);
}

.droid-bubble.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Log-on screen */
.logon {
    display: none;
    --lg-a: var(--lg-accent, var(--accent));
}

.js .logon:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background: var(--desktop);
    color: var(--icon-text);
    transition: opacity 0.42s ease;
}

.logon.leaving {
    opacity: 0;
    pointer-events: none;
}

.logon-main {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.logon-main::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 75% 55% at 50% 100%, color-mix(in srgb, var(--lg-a) 28%, transparent), transparent 100%);
    transform-origin: 50% 100%;
    animation: lg-breathe 12s ease-in-out infinite;
    pointer-events: none;
}

@keyframes lg-breathe {
    0%, 100% { opacity: 0.3; transform: scaleY(0.85); }
    50% { opacity: 1; transform: scaleY(1.1); }
}

.logon-card {
    position: relative;
    z-index: 1;
    width: min(480px, 100%);
    padding: 18px 26px 24px;
    animation: lg-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition: transform 0.42s ease, filter 0.42s ease;
}

@keyframes lg-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.lg-id {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 20px;
}

.logon-glyph {
    position: relative;
    display: grid;
    place-items: center;
    width: 96px;
    height: 96px;
    overflow: hidden;
}

.logon-wolf {
    position: absolute;
    left: 50%;
    top: 50%;
    margin: 0;
    font: bold 10px/6.62px Consolas, 'Lucida Console', 'Courier New', monospace;
    letter-spacing: 0;
    white-space: pre;
    color: var(--lg-a);
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -50%) scale(var(--wolf-k, 0.29));
    transform-origin: center;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    user-select: none;
}

[data-theme="light"] .logon-wolf,
[data-theme="light"] .logon-role {
    color: var(--icon-text);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
}

.logon-name {
    margin: 0;
    font: bold 1.55rem / 1.1 var(--font-title);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--icon-text);
    text-shadow: var(--icon-shadow, none);
    white-space: nowrap;
}

.logon-role {
    margin: 8px 0 0;
    font: bold 12px/1 var(--font-ui);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--lg-a);
    text-shadow: var(--icon-shadow, none);
}

.logon-role::after {
    content: '';
    display: inline-block;
    width: 0.55em;
    height: 1em;
    margin-left: 4px;
    vertical-align: -2px;
    background: var(--lg-a);
    animation: lg-caret 1.05s steps(1) infinite;
}

@keyframes lg-caret {
    50% { opacity: 0; }
}

.logon-btn {
    display: flex;
    width: 170px;
    min-height: 44px;
    margin: 26px auto 0;
    padding: 8px 14px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    border-radius: 0;
}

.logon.leaving .logon-card {
    transform: scale(1.06);
    filter: blur(3px);
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: var(--panel);
    box-shadow: inset 1px 1px 0 var(--bevel-lo);
}

::-webkit-scrollbar-thumb {
    min-height: 28px;
    background: linear-gradient(90deg, var(--btn-a), var(--btn-b));
    border: 1px solid var(--btn-border);
    box-shadow: inset 1px 1px 0 var(--bevel-hi), inset -1px -1px 0 var(--bevel-mid);
}

::-webkit-scrollbar-thumb:horizontal {
    background: linear-gradient(180deg, var(--btn-a), var(--btn-b));
}

::-webkit-scrollbar-thumb:hover {
    background: var(--btn-a);
}

::-webkit-scrollbar-thumb:active {
    background: var(--select);
}

::-webkit-scrollbar-corner {
    background: var(--win-body);
}

@supports not selector(::-webkit-scrollbar) {
    html {
        scrollbar-color: var(--btn-a) var(--panel);
    }
}

@supports not (color: color-mix(in srgb, red, blue)) {
    .hero-name {
        --name-edge: rgba(0, 0, 0, 0.2);
    }
    [data-theme="dark"] .hero-name {
        --name-bottom: var(--accent);
        --name-edge: rgba(0, 0, 0, 0.45);
    }
    .droid {
        --droid-line: var(--muted);
    }
    .logon-main::after {
        background: radial-gradient(ellipse 75% 55% at 50% 100%, var(--lg-glow, transparent), transparent 100%);
    }
}

/* Tablet and small-laptop breakpoint (intermediate reflow state) */
@media (max-width: 900px) {
    .exp-split {
        grid-template-columns: 205px minmax(0, 1fr);
    }

    .honors-ledger {
        grid-template-columns: 1fr;
    }

    .task-buttons a {
        width: 118px;
        padding: 0 8px;
    }
}

/* Touch target sizing and mobile breakpoints */
@media (max-width: 760px), (pointer: coarse) {
    .btn,
    .btn-small,
    .filter-chip,
    .sys-tab,
    .start-list a,
    .skin-option {
        min-height: 44px;
    }

    .tray-btn {
        width: 44px;
        height: 44px;
    }

    .titlebar-buttons {
        gap: 8px;
    }

    button.tb-btn,
    [data-theme="dark"] button.tb-btn {
        width: 28px;
        height: 28px;
    }

    .tb-btn::before,
    .tb-btn::after {
        transform-origin: center;
    }

    .tb-min::before,
    [data-theme="dark"] .tb-min::before {
        left: 8px;
        bottom: 7px;
        width: 10px;
    }

    .tb-max::before,
    [data-theme="dark"] .tb-max::before {
        inset: 6px;
    }

    .tb-close::before,
    .tb-close::after,
    [data-theme="dark"] .tb-close::before,
    [data-theme="dark"] .tb-close::after {
        left: 12px;
        top: 6px;
        height: 14px;
    }

    .field input,
    .field textarea,
    .proj-search-label input,
    .skill-search-wrap input {
        font-size: 16px;
        min-height: 44px;
    }
}

@media (max-width: 760px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 16px;
        min-height: 0;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .exp-split {
        grid-template-columns: 1fr;
    }

    .exp-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        overflow-y: visible;
    }

    .exp-tab {
        flex: 1 1 180px;
    }

    .window-experience .window-body.exp-body,
    .window-education .window-body.edu-body {
        overflow-y: auto;
    }

    .exp-panel,
    .sys-panel {
        overflow-y: visible;
    }

    .archive-table,
    .archive-table tbody,
    .archive-table tr,
    .archive-table th,
    .archive-table td {
        display: block;
        width: 100%;
    }

    .archive-table thead {
        display: none;
    }

    .archive-table tbody tr {
        padding: 10px 12px;
        border-bottom: 1px solid var(--bevel-mid);
    }

    .archive-table tbody tr[hidden] {
        display: none;
    }

    .archive-table tbody th,
    .archive-table tbody td {
        padding: 2px 0;
        border: 0;
        white-space: normal;
    }

    .archive-table tbody td:last-child {
        margin-top: 4px;
        font-size: 12px;
        color: var(--muted);
    }

    .task-buttons {
        display: none;
    }

    .start-wrap {
        margin-right: auto;
    }
}

@media (max-width: 600px) {
    .desktop {
        padding: 0 max(10px, env(safe-area-inset-right, 0px)) 12px max(10px, env(safe-area-inset-left, 0px));
    }

    .hero {
        grid-template-rows: auto 1fr;
        gap: 8px;
    }

    .desktop-icons {
        position: static;
        justify-self: stretch;
        grid-auto-flow: row;
        grid-template-rows: none;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-auto-columns: auto;
        gap: 6px;
        padding: 8px 0 0;
    }

    .desk-icon {
        width: auto;
        height: auto;
        min-height: 58px;
        padding: 6px 4px;
        font-size: 11px;
    }

    .desk-icon svg {
        width: 32px;
        height: 32px;
    }

    .window-welcome {
        width: 100%;
    }

    .window-body,
    .hero-body {
        padding: 18px 16px;
    }

    .hero-name {
        font-size: clamp(2rem, 10.5vw, 2.8rem);
    }

    .hero-metrics {
        flex-direction: column;
        gap: 6px;
        width: 100%;
        max-width: none;
    }

    .metric-item {
        padding-right: 0;
        border-right: 0;
    }

    .hero-cta .btn {
        flex: 1 1 calc(50% - 6px);
    }

    .titlebar-buttons .tb-max {
        display: none;
    }

    .section.popup {
        padding: 6px;
    }

    .popup > .window,
    .popup > .window.window-experience,
    .popup > .window.window-projects,
    .popup > .window.window-education,
    .popup > .window.window-notepad {
        width: 100%;
        height: min(92%, 100%);
    }

    .exp-place,
    .edu-meta {
        justify-items: start;
    }

    .field {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .field > span {
        text-align: left;
    }

    .skill-search-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .start-menu {
        width: min(280px, calc(100vw - 16px));
    }

    .skin-menu {
        position: fixed;
        right: 8px;
        bottom: calc(var(--taskbar-h) + 4px);
        width: calc(100vw - 16px);
        max-width: 300px;
    }
}

@media (max-width: 600px) and (orientation: portrait) {
    .logon-main {
        padding: 24px max(12px, env(safe-area-inset-right, 0px)) 24px max(12px, env(safe-area-inset-left, 0px));
    }

    .logon-card {
        padding: 0;
        text-align: center;
    }

    .lg-id {
        grid-template-columns: minmax(0, 1fr);
        justify-items: center;
        row-gap: 20px;
    }

    .logon-glyph {
        width: 128px;
        height: 128px;
    }

    .logon-name {
        font-size: clamp(1.1rem, 6.8vw, 1.9rem);
    }

    .logon-role {
        margin-top: 10px;
        font-size: clamp(11px, 3.4vw, 13px);
        padding-left: calc(0.55em + 4px);
    }

    .logon-btn {
        width: min(210px, 74vw);
        margin-top: 30px;
    }
}

@media (max-height: 640px) and (min-width: 601px) {
    .hero-body {
        padding: 18px clamp(18px, 4vw, 40px);
    }

    .hero-name {
        font-size: clamp(1.9rem, 8vh, 3.2rem);
    }

    .hero-tagline {
        margin-top: 6px;
        font-size: 1.15rem;
    }

    .hero-lede {
        margin-top: 8px;
    }

    .hero-metrics {
        margin-top: 12px;
        padding: 6px 12px;
    }

    .hero-cta {
        margin-top: 14px;
    }

    .desktop {
        padding-top: 8px;
    }
}

@media (max-height: 520px) and (min-width: 601px) {
    .desktop-icons {
        --cell: 58px;
        grid-template-rows: repeat(auto-fill, min(var(--cell), calc((100dvh - var(--taskbar-h) - 8px) / 6)));
    }

    .desk-icon {
        height: auto;
        gap: 1px;
        padding-top: 2px;
        font-size: 10px;
    }

    .desk-icon svg {
        width: 26px;
        height: 26px;
    }

    .desktop {
        padding-left: calc(58px + 14px + env(safe-area-inset-left, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }

    .logon-main::after {
        opacity: 0.7;
    }
}
