/* Bensham.NET fun modes: Mac, Windows XP and hacker desktops (opened from the header buttons) */

/*
 * --- MAC MODE (pseudo macOS desktop) ---
 */
body.mode-open { overflow: hidden; }
.mac {
    position: fixed;
    inset: 0;
    z-index: 5000;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
    color: #1d1d1f;
    background: #1b1b1f center / cover no-repeat;
    user-select: none;
    -webkit-user-select: none;
    opacity: 0;
    transform: scale(1.04);
    transition: opacity 0.45s ease, transform 0.45s ease;
}
.mac[hidden] { display: none; }
.mac.show { opacity: 1; transform: none; }

/* start-up screen */
.mac-boot {
    position: absolute;
    inset: 0;
    z-index: 30;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 56px;
    cursor: pointer;
    transition: opacity 0.6s ease;
}
.mac-boot svg { width: 84px; height: 84px; fill: #fff; }
.mac-boot-bar {
    width: 200px;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.25);
    overflow: hidden;
}
.mac-boot-bar div { width: 0; height: 100%; border-radius: 3px; background: #fff; }
.mac.booting .mac-boot-bar div { animation: mac-boot 1.4s ease-in-out forwards; }
@keyframes mac-boot {
    0% { width: 0; }
    30% { width: 35%; }
    60% { width: 55%; }
    100% { width: 100%; }
}
.mac-boot.done { opacity: 0; pointer-events: none; }

/* menu bar */
.mac-menubar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 13.5px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(24px) saturate(1.6);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}
.mac-menu-left, .mac-menu-right { display: flex; align-items: center; height: 100%; }
.mac-menubar button, .mac-menu-item, .mac-status {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    height: 22px;
    padding: 0 9px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    cursor: default;
    white-space: nowrap;
}
.mac-menubar button:hover, .mac-apple-btn[aria-expanded="true"] { background: rgba(0, 0, 0, 0.1); }
.mac-apple-btn svg { width: 15px; height: 15px; fill: currentColor; margin-top: -2px; }
.mac-app-name { font-weight: 700; padding: 0 9px; }
.mac-status svg { width: 18px; height: 18px; fill: currentColor; }

/* Apple menu */
.mac-dropdown {
    position: absolute;
    top: 26px;
    left: 6px;
    z-index: 25;
    min-width: 230px;
    padding: 5px;
    border-radius: 9px;
    font-size: 13.5px;
    background: rgba(246, 246, 246, 0.85);
    backdrop-filter: blur(30px) saturate(1.8);
    -webkit-backdrop-filter: blur(30px) saturate(1.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(0, 0, 0, 0.2);
}
.mac-dropdown[hidden] { display: none; }
.mac-dropdown button, .mac-dropdown a {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px;
    line-height: 1.2;
    text-box: trim-both cap alphabetic;   /* even highlight above and below the text, whatever the font */
    border: 0;
    border-radius: 5px;
    background: none;
    font: inherit;
    text-align: left;
    text-decoration: none;
    color: #1d1d1f;
    cursor: default;
}
.mac-dropdown button:hover, .mac-dropdown a:hover { background: #0a64d8; color: #fff; }
.mac-dropdown hr { border: 0; height: 1px; margin: 5px 8px; background: rgba(0, 0, 0, 0.12); }

/* desktop + icons */
.mac-desktop { position: absolute; inset: 28px 0 0 0; touch-action: none; }
.mac-icon {
    position: absolute;
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #fff;
    text-decoration: none;
    outline: none;
    touch-action: none;
    -webkit-user-drag: none;
}
.mac-icon-img {
    width: 64px;
    height: 64px;
    padding: 4px;
    border: 1px solid transparent;
    border-radius: 8px;
}
.mac-icon img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}
.mac-icon span {
    max-width: 92px;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.mac-icon.selected .mac-icon-img { background: rgba(0, 0, 0, 0.28); border-color: rgba(255, 255, 255, 0.25); }
.mac-icon.selected span { background: #0a64d8; text-shadow: none; }
.mac-icon:focus-visible .mac-icon-img { border-color: #fff; }
.mac-icon.dragging { z-index: 5; opacity: 0.85; }
.mac-marquee {
    position: absolute;
    display: none;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.15);
}

/* dock */
.mac-dock {
    --dock: clamp(16px, calc((100vw - 120px) / 19), 54px);   /* fits the screen even when magnified */
    position: absolute;
    left: 50%;
    bottom: 6px;
    z-index: 15;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 5px 6px 3px;
    /* fixed heights so the glass doesn't jump as icons grow: resting, then tall enough for magnified icons */
    height: var(--dock);
    justify-content: center;
    transition: height 0.22s ease-out, width 0.22s ease-out;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(22px) saturate(1.6);
    -webkit-backdrop-filter: blur(22px) saturate(1.6);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.mac-dock-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    border: 0;
    background: none;
    text-decoration: none;
    cursor: pointer;
}
.mac-dock-item img {
    display: block;
    width: calc(var(--dock) * var(--s, 1));
    height: calc(var(--dock) * var(--s, 1));
    object-fit: contain;
    filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.3));
    transition: width 0.18s ease-out, height 0.18s ease-out;
}
.mac-dock.magnifying { height: calc(var(--dock) * 1.55); }
.mac-dock.magnifying .mac-dock-item img { transition: none; }
.mac-dock-home img { border-radius: 22%; background: #fff; }
.mac-tip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    color: #1d1d1f;
    background: rgba(235, 235, 235, 0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
}
.mac-dock-item:hover .mac-tip, .mac-dock-item:focus-visible .mac-tip { opacity: 1; }
.mac-dock-sep { width: 1px; align-self: stretch; margin: 6px 4px 8px; background: rgba(0, 0, 0, 0.25); }
.mac-dock-item.bounce img { animation: mac-bounce 0.9s ease; }
@keyframes mac-bounce {
    0%, 50%, 100% { translate: 0 0; }
    25% { translate: 0 -22px; }
    72% { translate: 0 -10px; }
}

/* About This Mac window */
.mac-window {
    position: absolute;
    left: 50%;
    top: 20%;
    z-index: 18;
    width: min(320px, 90vw);
    transform: translateX(-50%);
    overflow: hidden;
    border-radius: 12px;
    text-align: center;
    background: rgba(240, 240, 240, 0.92);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(0, 0, 0, 0.25);
}
.mac-window[hidden] { display: none; }
.mac-titlebar { height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 12px; cursor: grab; }
.mac-light { width: 12px; height: 12px; padding: 0; border: 0; border-radius: 50%; }
.mac-light.red { background: #ff5f57; cursor: pointer; }
.mac-light.yellow { background: #febc2e; }
.mac-light.green { background: #28c840; }
.mac-window-body { padding: 0 24px 22px; font-size: 12px; color: #555; }
.mac-window-body img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; }
.mac-window-body h2 { margin: 8px 0 2px; font-size: 20px; color: #1d1d1f; }
.mac-window-body p { margin: 2px 0; }

@media (max-width: 600px), (max-height: 500px) {
    .mac-menu-item, .mac-wifi { display: none; }
    .mac-dock { display: none; }   /* too small to use on a phone; everything is on the desktop and in the Apple menu */
    .mac-icon { width: 80px; }
    .mac-icon-img { width: 52px; height: 52px; }
    .mac-icon span { max-width: 78px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
    .mac, .mac-boot { transition: none; }
    .mac-dock-item.bounce img { animation: none; }
}

/*
 * --- WINDOWS XP MODE ---
 */
.xp {
    position: fixed;
    inset: 0;
    z-index: 5000;
    overflow: hidden;
    font-family: Tahoma, "Segoe UI", Verdana, sans-serif;
    font-size: 11px;
    color: #000;
    background: #3a6ea5 center / cover no-repeat;
    user-select: none;
    -webkit-user-select: none;
    opacity: 0;
    transition: opacity 0.45s ease;
}
.xp[hidden] { display: none; }
.xp.show { opacity: 1; }

/* start-up screen */
.xp-boot {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 44px;
    color: #fff;
    background: #000;
    cursor: pointer;
    transition: opacity 0.6s ease;
}
.xp-boot.done { opacity: 0; pointer-events: none; }
.xp-boot-logo { display: flex; align-items: center; gap: 12px; }
.xp-boot-logo svg { width: 72px; height: 72px; }
.xp-boot-word {
    display: flex;
    flex-direction: column;
    line-height: 1;
    font-family: "Franklin Gothic Medium", "Trebuchet MS", Arial, sans-serif;
}
.xp-boot-word small { margin-left: 2px; font-size: 15px; font-weight: 600; }
.xp-boot-word span { font-size: 48px; font-weight: 700; letter-spacing: -1px; }
.xp-boot-word b { margin-left: 4px; vertical-align: top; font-size: 26px; font-style: italic; color: #ff7d00; }
.xp-boot-bar {
    position: relative;
    width: 150px;
    height: 16px;
    overflow: hidden;
    border: 2px solid #b2b2b2;
    border-radius: 5px;
}
.xp-boot-blocks {
    position: absolute;
    top: 2px;
    left: 0;
    display: flex;
    gap: 2px;
    animation: xp-blocks 1.6s linear infinite;
}
.xp-boot-blocks i { width: 9px; height: 12px; border-radius: 2px; background: linear-gradient(#2838c7, #7c9cf6 50%, #2838c7); }
@keyframes xp-blocks {
    from { transform: translateX(-35px); }
    to { transform: translateX(155px); }
}
.xp-boot-foot { position: absolute; bottom: 24px; font-size: 12px; color: #9a9a9a; }

/* desktop + icons */
.xp-desktop { position: absolute; inset: 0 0 30px 0; touch-action: none; }
.xp-icon {
    position: absolute;
    width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #fff;
    text-decoration: none;
    outline: none;
    touch-action: none;
    -webkit-user-drag: none;
}
.xp-icon-img { position: relative; width: 64px; height: 64px; }
.xp-icon img {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
    filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.45));
}
.xp-icon span {
    max-width: 92px;
    padding: 1px 3px;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
    text-shadow: 1px 1px 2px #000, 0 0 2px #000;
}
.xp-icon.selected .xp-icon-img::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(49, 106, 197, 0.45);
}
.xp-icon.selected span { background: #316ac5; text-shadow: none; outline: 1px dotted #fff; }
.xp-icon:focus-visible span { outline: 1px dotted #fff; }
.xp-icon.dragging { z-index: 5; opacity: 0.75; }
.xp-marquee {
    position: absolute;
    display: none;
    pointer-events: none;
    border: 1px solid #316ac5;
    background: rgba(49, 106, 197, 0.3);
}

/* taskbar */
.xp-taskbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: 30px;
    display: flex;
    align-items: stretch;
    background: linear-gradient(#1f2f86 0%, #3165c4 3%, #3682e5 6%, #4490e6 10%, #3883e5 12%, #2b71e0 15%, #2663da 18%, #235bd6 20%, #2258d5 23%, #2157d6 38%, #245ddb 54%, #2562df 86%, #245fdc 89%, #2158d4 92%, #1d4ec0 95%, #1941a5 98%);
}
.xp-start-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-right: 8px;
    padding: 0 22px 2px 10px;
    border: 0;
    border-radius: 0 12px 12px 0;
    color: #fff;
    font: italic bold 18px "Franklin Gothic Medium", "Trebuchet MS", Arial, sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
    background: linear-gradient(#3c8f3c 0%, #5bbf5b 8%, #44a644 40%, #3c9a3c 80%, #2f7f2f 100%);
    box-shadow: inset -1px -1px 2px rgba(0, 0, 0, 0.35), inset 1px 1px 2px rgba(255, 255, 255, 0.35), 2px 0 3px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}
.xp-start-btn svg { width: 20px; height: 20px; filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.5)); }
.xp-start-btn:hover { filter: brightness(1.1); }
.xp-start-btn[aria-expanded="true"] { filter: brightness(0.85); }
.xp-tasks { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; padding: 0 4px; overflow: hidden; }
.xp-task {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 160px;
    min-width: 0;
    flex-shrink: 1;
    height: 24px;
    padding: 0 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    color: #fff;
    font: 11px Tahoma, sans-serif;
    text-align: left;
    white-space: nowrap;
    background: linear-gradient(#3c81f3, #2b6ce8);
    box-shadow: inset 1px 1px 1px rgba(255, 255, 255, 0.3);
    cursor: pointer;
}
.xp-task:hover { background: linear-gradient(#5a9bff, #3b7cf0); }
.xp-task.active { background: linear-gradient(#1e52b7, #1948a6); box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.4); }
.xp-task img { width: 16px; height: 16px; flex-shrink: 0; }
.xp-task span { overflow: hidden; text-overflow: ellipsis; }
.xp-tray {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    color: #fff;
    font-size: 11px;
    white-space: nowrap;
    border-left: 1px solid #1042af;
    background: linear-gradient(#0c59b9 1%, #139ee9 6%, #18b5f2 10%, #139beb 14%, #1290e8 19%, #0d8dea 63%, #0d9ff1 81%, #0f9eed 88%, #119be9 91%, #1392e2 94%, #137ed7 97%, #095bc9);
    box-shadow: inset 1px 0 1px #18bbff;
}
.xp-tray a { font-size: 14px; text-decoration: none; }

/* start menu */
.xp-start-menu {
    position: absolute;
    left: 0;
    bottom: 30px;
    z-index: 25;
    width: 390px;
    max-width: 100vw;
    max-height: calc(100vh - 32px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #0b52c4;
    border-radius: 8px 8px 0 0;
    background: #fff;
    box-shadow: 3px 0 8px rgba(0, 0, 0, 0.45);
}
.xp-start-menu[hidden] { display: none; }
.xp-start-head, .xp-start-foot {
    background: linear-gradient(#1868ce, #0e60cb 12%, #0e60cb 20%, #1164cf 32%, #1b6cd3 47%, #2476dc 60%, #3482e3 77%, #428ee9 90%, #4791eb 100%);
}
.xp-start-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
}
.xp-start-head img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border: 2px solid #fff;
    border-radius: 4px;
    background: #fff;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
}
.xp-start-body {
    flex: 1;
    display: flex;
    min-height: 0;
    border-top: 2px solid;
    border-image: linear-gradient(to right, transparent, #f3a33a 50%, transparent) 1;
}
.xp-start-left { flex: 1.15; padding: 6px 4px; overflow-y: auto; background: #fff; }
.xp-start-right {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 4px;
    border-left: 1px solid #95bdee;
    background: #d3e5fa;
}
.xp-start-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 4px 6px;
    border: 0;
    border-radius: 2px;
    color: #000;
    font: 11px Tahoma, sans-serif;
    text-align: left;
    text-decoration: none;
    background: none;
    cursor: pointer;
}
.xp-start-item img { width: 24px; height: 24px; }
.xp-start-sep { margin: 4px 6px; border: 0; border-top: 1px solid #95bdee; }
.xp-start-emoji { width: 24px; text-align: center; font-size: 16px; }
.xp-start-right .xp-start-item { color: #0a246a; font-weight: 700; }
.xp-start-item:hover, .xp-start-item:focus-visible { color: #fff !important; background: #316ac5; outline: none; }
.xp-start-foot { display: flex; justify-content: flex-end; gap: 4px; padding: 6px 8px; }
.xp-start-foot button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border: 0;
    border-radius: 3px;
    color: #fff;
    font: 11px Tahoma, sans-serif;
    background: none;
    cursor: pointer;
}
.xp-start-foot button:hover { background: rgba(255, 255, 255, 0.15); }
.xp-foot-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    font-size: 12px;
}
.xp-foot-ico.logoff { background: linear-gradient(#f5c64b, #e1a521); }
.xp-foot-ico.power { background: linear-gradient(#e9663c, #c4401a); }
.xp-foot-ico svg { width: 14px; height: 14px; }

/* XP window */
.xp-window {
    position: absolute;
    left: 50%;
    top: 20%;
    z-index: 18;
    width: min(340px, 92vw);
    transform: translateX(-50%);
    border: 3px solid #0831d9;
    border-top: 0;
    border-radius: 8px 8px 0 0;
    background: #ece9d8;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.45);
}
.xp-window[hidden] { display: none; }
.xp-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 28px;
    margin: 0 -3px;
    padding: 0 4px 0 8px;
    border-radius: 8px 8px 0 0;
    color: #fff;
    font: bold 13px "Trebuchet MS", Tahoma, sans-serif;
    text-shadow: 1px 1px #0f1089;
    background: linear-gradient(#0997ff, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7);
    cursor: grab;
}
.xp-close {
    width: 21px;
    height: 21px;
    padding: 0;
    border: 1px solid #fff;
    border-radius: 3px;
    color: #fff;
    font: bold 12px Tahoma, sans-serif;
    background: linear-gradient(#e5714b, #c4401a);
    cursor: pointer;
}
.xp-close:hover { filter: brightness(1.15); }
.xp-window-body { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 16px 12px; text-align: center; }
.xp-window-body img { width: 150px; height: 150px; border: 1px solid #aca899; background: #fff; }
.xp-window-body h2 { margin: 8px 0 2px; font: bold 16px Tahoma, sans-serif; }
.xp-window-body p { margin: 0; }
.xp-ok {
    min-width: 75px;
    margin-top: 12px;
    padding: 4px 12px;
    border: 1px solid #003c74;
    border-radius: 3px;
    font: 11px Tahoma, sans-serif;
    background: linear-gradient(#fff, #ecebe6 86%, #d6d0c5);
    cursor: pointer;
}
.xp-ok:hover, .xp-ok:focus-visible { box-shadow: inset 0 0 0 2px #fbc761; outline: none; }

@media (max-width: 600px), (max-height: 500px) {
    .xp-icon { width: 80px; }
    .xp-icon-img { width: 52px; height: 52px; }
    .xp-icon span { max-width: 78px; font-size: 11px; }
}
@media (max-width: 600px) {
    .xp-start-menu { width: 100vw; }
}
/* short screens: About windows sit higher with a smaller logo so they fit */
@media (max-height: 500px) {
    .mac-window { top: 36px; }
    .xp-window { top: 8px; }
    .mac-window-body img, .xp-window-body img { width: 90px; height: 90px; }
}

/* Mac and XP read better slightly larger on a normal desktop or laptop screen (like 110% browser zoom) */
@media (min-width: 1024px) and (min-height: 640px) {
    .mac, .xp { zoom: 1.1; }
    .mac-dock { --dock: clamp(16px, calc((100vw - 115px) / 20), 54px); }   /* same, allowing for the zoom */
}

/*
 * --- HACKER MODE (green-on-black desktop) ---
 */
.hacker {
    position: fixed;
    inset: 0;
    z-index: 5000;
    overflow: hidden;
    color: #33ff66;
    font-family: "Cascadia Mono", Consolas, "Lucida Console", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.45;
    text-shadow: 0 0 5px rgba(51, 255, 102, 0.55);
    background: #000;
    user-select: none;
    -webkit-user-select: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}
.hacker[hidden] { display: none; }
.hacker.show { opacity: 1; }
.hacker-rain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hacker::after {
    /* CRT scanlines */
    content: "";
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    background: repeating-linear-gradient(rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.2) 2px 3px);
}

/* top bar */
.hacker-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 6;
    height: 34px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 14px;
    font-size: 13px;
    letter-spacing: 1px;
    background: rgba(0, 0, 0, 0.85);
    border-bottom: 1px solid rgba(51, 255, 102, 0.45);
}
.hacker-bar a, .hacker-bar button {
    padding: 2px 4px;
    border: 0;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-decoration: none;
    text-shadow: inherit;
    background: none;
    cursor: pointer;
}
.hacker-bar a:hover, .hacker-bar button:hover, .hacker-bar a:focus-visible, .hacker-bar button:focus-visible {
    color: #000;
    text-shadow: none;
    background: #33ff66;
    outline: none;
}

/* desktop icons */
/* app tiles fill the space to the left of the clock and terminal */
.hacker { --term-w: min(640px, 45vw); }
.hk-grid {
    position: absolute;
    top: 58px;
    left: 24px;
    bottom: 24px;
    right: calc(var(--term-w) + 48px);
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 12px;
}
.hk-tile {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgba(51, 255, 102, 0.35);
    border-radius: 6px;
    color: inherit;
    text-decoration: none;
    background: rgba(0, 0, 0, 0.72);
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.hk-tile:hover, .hk-tile:focus-visible {
    border-color: #33ff66;
    background: rgba(0, 20, 6, 0.85);
    box-shadow: 0 0 18px rgba(51, 255, 102, 0.35), inset 0 0 18px rgba(51, 255, 102, 0.12);
    outline: none;
}
/* number and icon scale with the tile itself (container units), so they never overlap on narrow tiles */
.hk-tile { container-type: size; }
.hk-tile-num { position: absolute; top: 5px; left: 9px; font-size: clamp(14px, 15cqw, 22px); line-height: 1; color: #1fae4b; }
.hk-tile-img {
    width: min(128px, 12vh, 9vw, calc(100cqw - 24px), calc(100cqh - 50px));
    height: min(128px, 12vh, 9vw, calc(100cqw - 24px), calc(100cqh - 50px));
    padding: 3px;
    border: 1px solid rgba(51, 255, 102, 0.7);
    border-radius: 50%;
    background: #000;
    box-shadow: 0 0 12px rgba(51, 255, 102, 0.35);
}
.hk-tile img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(4) brightness(0.95);
    transition: filter 0.2s;
}
.hk-tile:hover img, .hk-tile:focus-visible img { filter: none; }
button.hk-tile { font: inherit; text-shadow: inherit; cursor: pointer; }
.hk-tile-tool { border-style: dashed; }
.hk-tile-label { max-width: 100%; font-size: 14px; line-height: 1.2; text-align: center; }

/* big clock */
.hacker-clock {
    position: absolute;
    top: 58px;
    right: 40px;
    z-index: 3;
    padding: 14px 24px;
    border-radius: 8px;
    text-align: right;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.78);
    box-shadow: 0 0 40px 24px rgba(0, 0, 0, 0.6);
}
.hacker-time {
    font-size: clamp(64px, 10vw, 140px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    color: #5dff85;
    text-shadow: 0 0 10px rgba(51, 255, 102, 0.9), 0 0 32px rgba(51, 255, 102, 0.5);
}
.hacker-time span { margin-left: 6px; font-size: 0.42em; opacity: 0.75; }
.hacker-date { margin-top: 10px; font-size: clamp(14px, 1.5vw, 20px); letter-spacing: 4px; }
.hacker-motto { margin-top: 4px; font-size: clamp(11px, 1.1vw, 14px); letter-spacing: 6px; color: #1fae4b; }

/* terminal window */
.hacker-term {
    position: absolute;
    right: 24px;
    bottom: 24px;
    z-index: 4;
    width: var(--term-w);
    height: min(46vh, 420px);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(51, 255, 102, 0.55);
    border-radius: 6px;
    background: rgba(0, 8, 0, 0.9);
    box-shadow: 0 0 28px rgba(51, 255, 102, 0.25), inset 0 0 30px rgba(51, 255, 102, 0.06);
    user-select: text;
    -webkit-user-select: text;
}
.hacker-term-bar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(51, 255, 102, 0.35);
    font-size: 12px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.hacker-screen { flex: 1; overflow-y: auto; padding: 10px 12px; }
.hk-line { min-height: 1.45em; white-space: pre-wrap; word-break: break-word; }
.hk-title { font-weight: 700; color: #7dffa0; }
.hk-dim { color: #1fae4b; }
.hk-ok { color: #7dffa0; }
.hk-cmd { color: #b8ffcc; }
.hk-err { color: #ff5f56; text-shadow: 0 0 5px rgba(255, 95, 86, 0.6); }
.hacker-prompt { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.hacker-prompt[hidden] { display: none; }
.hacker-prompt label { color: #7dffa0; white-space: nowrap; }
.hacker-prompt input {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: none;
    color: inherit;
    font: inherit;
    text-shadow: inherit;
    caret-color: #33ff66;
    background: none;
}

@media (max-width: 700px), (orientation: portrait) and (max-width: 1100px) {
    .hacker { font-size: 12.5px; --clock: clamp(48px, 13vw, 96px); }
    .hacker-clock {
        left: 0;
        right: 0;
        top: 40px;
        padding: 6px;
        text-align: center;
        background: none;
        box-shadow: none;
    }
    .hacker-time { font-size: var(--clock); text-shadow: 0 0 10px rgba(51, 255, 102, 0.9), 0 0 4px #000, 0 0 24px #000; }
    .hacker-date { margin-top: 4px; font-size: 12px; letter-spacing: 2px; }
    .hacker-motto { font-size: 10px; letter-spacing: 4px; }
    .hk-grid {
        top: calc(var(--clock) + 98px);   /* just under the clock */
        left: 6px;
        right: 6px;
        bottom: calc(30vh + 12px);
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(4, 1fr);
        gap: 6px;
    }
    .hk-tile { gap: 4px; padding: 4px; }
    .hk-tile-num { display: none; }
    .hk-tile-img {
        width: min(80px, calc(100cqh - 28px), calc(100cqw - 8px));
        height: min(80px, calc(100cqh - 28px), calc(100cqw - 8px));
    }
    .hk-tile-label { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .hacker-term { left: 6px; right: 6px; bottom: 6px; width: auto; height: 30vh; }
    .hk-host { display: none; }
}
/* short screens (phones on their side): compact clock top-right, terminal under it, tiles on the left */
@media (max-height: 500px) {
    .hacker { --term-w: min(520px, 40vw); font-size: 12px; }
    .hacker-clock {
        left: auto;
        right: 16px;
        top: 42px;
        width: var(--term-w);
        box-sizing: border-box;
        padding: 6px 12px;
        text-align: right;
        background: rgba(0, 0, 0, 0.8);
        box-shadow: none;
    }
    .hacker-time { font-size: 40px; }
    .hacker-date { margin-top: 4px; font-size: 11px; letter-spacing: 2px; }
    .hacker-motto { display: none; }
    .hacker-term { left: auto; right: 16px; top: 116px; bottom: 12px; width: var(--term-w); height: auto; }
    .hk-grid {
        top: 44px;
        left: 12px;
        right: calc(var(--term-w) + 28px);
        bottom: 12px;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(4, 1fr);
        gap: 6px;
    }
    .hk-tile { gap: 3px; padding: 4px; }
    .hk-tile-num { display: none; }
    .hk-tile-img {
        width: min(44px, calc(100cqh - 24px), calc(100cqw - 8px));
        height: min(44px, calc(100cqh - 24px), calc(100cqw - 8px));
        padding: 2px;
    }
    .hk-tile-label { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .hk-host { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .xp, .xp-boot, .hacker { transition: none; }
    .xp-boot-blocks { animation: none; }
}

/*
 * --- MINI APP WINDOWS (Notepad, Paint, Weather, Snake) ---
 * One set of apps; each mode supplies the colours (--fm-* / --sn-*) and the window frame.
 */
.fm-layer { position: absolute; inset: 0; pointer-events: none; }
.mac .fm-layer { z-index: 14; }      /* under the dock and menu bar */
.xp .fm-layer { z-index: 17; }       /* under the taskbar and Start menu */
.hacker .fm-layer { z-index: 5; }    /* over the tiles and terminal, under the top bar */
.fm-win {
    position: absolute;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
    pointer-events: auto;
    color: var(--fm-fg);
    font-family: var(--fm-font);
    font-size: var(--fm-size);
    background: var(--fm-bg);
    outline: none;
    user-select: none;
    -webkit-user-select: none;
}
.fm-win[hidden] { display: none; }
.fm-titlebar { flex-shrink: 0; display: flex; align-items: center; gap: 8px; cursor: grab; }
.fm-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-title-icon { width: 16px; height: 16px; flex-shrink: 0; }
.fm-ctls { flex-shrink: 0; display: flex; align-items: center; gap: 8px; }
.fm-ctl { padding: 0; border: 0; font: inherit; cursor: default; }
.fm-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* pieces shared by the apps */
.fm-toolbar { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--fm-line); }
.fm-spacer { flex: 1; }
.fm-hint { color: var(--fm-muted); font-size: 0.92em; }
.fm-status { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-top: 1px solid var(--fm-line); color: var(--fm-muted); font-size: 0.92em; }
.fm-btn {
    padding: 4px 11px;
    border: 1px solid var(--fm-btn-border);
    border-radius: var(--fm-radius);
    color: var(--fm-fg);
    font: inherit;
    white-space: nowrap;
    background: var(--fm-btn-bg);
    cursor: pointer;
}
.fm-btn:hover { filter: brightness(0.95); }
.fm-btn.active { color: var(--fm-accent-fg); border-color: var(--fm-accent); background: var(--fm-accent); }
.fm-btn:disabled { opacity: 0.5; cursor: default; }
.fm-btn:focus-visible { outline: 2px solid var(--fm-accent); outline-offset: 1px; }
.fm-btn-sm { padding: 2px 9px; }

/* Notepad */
.np-text {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 10px 12px;
    border: 0;
    outline: none;
    resize: none;
    color: var(--fm-fg);
    font: var(--fm-np-font);
    background: var(--fm-field);
    user-select: text;
    -webkit-user-select: text;
}

/* Paint */
.pt-sizes { display: flex; gap: 4px; }
.pt-size { width: 32px; height: 28px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.pt-size i { display: block; border-radius: 50%; background: currentColor; }
.pt-palette { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 8px; border-bottom: 1px solid var(--fm-line); }
.pt-swatch { width: 22px; height: 22px; padding: 0; border: 1px solid rgba(0, 0, 0, 0.35); border-radius: 50%; cursor: pointer; }
.pt-swatch.active { outline: 2px solid var(--fm-accent); outline-offset: 2px; }
.pt-custom { width: 34px; height: 26px; padding: 0 2px; border: 1px solid var(--fm-btn-border); border-radius: 4px; background: var(--fm-btn-bg); cursor: pointer; }
.pt-canvas-wrap { flex: 1; min-height: 0; padding: 8px; background: var(--fm-well); }
.pt-canvas { display: block; width: 100%; height: 100%; box-shadow: 0 0 0 1px var(--fm-line); cursor: crosshair; touch-action: none; }

/* Weather */
.wx { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; user-select: text; -webkit-user-select: text; }
.wx-place { margin-bottom: 10px; font-size: 1.15em; font-weight: 700; }
.wx-body { display: flex; flex-direction: column; gap: 12px; }
.wx-now { display: flex; align-items: center; gap: 14px; }
.wx-icon { font-size: 54px; line-height: 1; }
.wx-temp { font-size: 2.6em; font-weight: 700; line-height: 1; }
.wx-desc { margin-top: 4px; color: var(--fm-muted); }
.wx-details { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--fm-muted); }
.wx-days { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wx-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 2px;
    border: 1px solid var(--fm-line);
    border-radius: var(--fm-radius);
    text-align: center;
    background: var(--fm-field);
}
.wx-icon-sm { font-size: 24px; line-height: 1.2; }
.wx-day small { color: var(--fm-muted); }
.wx-msg { padding: 24px 0; text-align: center; color: var(--fm-muted); }
.wx-msg p { margin: 4px 0; }

/* Snake */
.sn-bar { flex-shrink: 0; display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--fm-line); font-variant-numeric: tabular-nums; }
.sn-board { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px; background: var(--fm-well); touch-action: none; }
.sn-board canvas { display: block; border-radius: 4px; box-shadow: 0 0 0 1px var(--fm-line); }
.sn-msg {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    max-width: 80%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border-radius: var(--fm-radius);
    text-align: center;
    color: var(--fm-fg);
    background: var(--fm-bg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}
.sn-msg[hidden] { display: none; }
.sn-msg b { font-size: 1.2em; }
.sn-msg small { color: var(--fm-muted); }

/* --- Mac look --- */
.mac .fm-win {
    --fm-bg: #f6f6f6; --fm-fg: #1d1d1f; --fm-muted: #6e6e73; --fm-line: rgba(0, 0, 0, 0.12);
    --fm-field: #ffffff; --fm-well: #e8e8ea; --fm-btn-bg: #ffffff; --fm-btn-border: rgba(0, 0, 0, 0.18);
    --fm-accent: #0a64d8; --fm-accent-fg: #ffffff; --fm-radius: 6px;
    --fm-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Arial, sans-serif;
    --fm-size: 13px; --fm-np-font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
    --sn-bg: #f2f2f7; --sn-grid: #e8e8ef; --sn-body: #34c759; --sn-head: #248a3d; --sn-food: #ff3b30;
    border-radius: 10px;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(0, 0, 0, 0.3);
}
.mac .fm-titlebar { position: relative; height: 30px; padding: 0 10px; border-bottom: 1px solid rgba(0, 0, 0, 0.12); background: linear-gradient(#ededed, #dfdfdf); }
.mac .fm-title { position: absolute; left: 76px; right: 76px; text-align: center; font-size: 13px; font-weight: 600; color: #4d4d4d; pointer-events: none; }
.mac .fm-win:not(.active) .fm-title { color: #a6a6a6; }
.mac .fm-title-icon { display: none; }
.mac .fm-ctl { width: 12px; height: 12px; border-radius: 50%; background: #cfcfcf; }
.mac .fm-close, .mac .fm-min { cursor: pointer; }
.mac .fm-win.active .fm-close { background: #ff5f57; }
.mac .fm-win.active .fm-min { background: #febc2e; }
.mac .fm-win.active .fm-max { background: #28c840; }

/* --- Windows XP look --- */
.xp .fm-win {
    --fm-bg: #ece9d8; --fm-fg: #000000; --fm-muted: #555555; --fm-line: #aca899;
    --fm-field: #ffffff; --fm-well: #808080; --fm-btn-bg: linear-gradient(#ffffff, #ecebe6 86%, #d6d0c5); --fm-btn-border: #003c74;
    --fm-accent: #316ac5; --fm-accent-fg: #ffffff; --fm-radius: 3px;
    --fm-font: Tahoma, "Segoe UI", Verdana, sans-serif; --fm-size: 12px; --fm-np-font: 13px/1.45 "Lucida Console", Consolas, monospace;
    --sn-bg: #ffffff; --sn-grid: #eef2fb; --sn-body: #316ac5; --sn-head: #0a246a; --sn-food: #e03c31;
    border: 3px solid #0831d9;
    border-top: 0;
    border-radius: 8px 8px 0 0;
    box-shadow: 2px 4px 12px rgba(0, 0, 0, 0.45);
}
.xp .fm-win:not(.active) { border-color: #7a96df; }
.xp .fm-titlebar {
    height: 28px;
    margin: 0 -3px;
    padding: 0 4px 0 8px;
    gap: 6px;
    border-radius: 8px 8px 0 0;
    color: #ffffff;
    font: bold 13px "Trebuchet MS", Tahoma, sans-serif;
    text-shadow: 1px 1px #0f1089;
    background: linear-gradient(#0997ff, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7);
}
.xp .fm-win:not(.active) .fm-titlebar { color: #dbe5f8; text-shadow: none; background: linear-gradient(#a8bff4, #8aa7ee 40%, #94b0f2); }
.xp .fm-ctls { order: 3; gap: 2px; }
.xp .fm-ctl {
    width: 21px;
    height: 21px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ffffff;
    border-radius: 3px;
    color: #ffffff;
    font: bold 12px Tahoma, sans-serif;
    background: linear-gradient(#3c8cf6, #1d5fd6);
}
.xp .fm-ctl::before { content: ""; display: block; }
.xp .fm-min { order: 1; cursor: pointer; }
.xp .fm-min::before { width: 8px; height: 3px; margin-top: 8px; background: #ffffff; }
.xp .fm-max { order: 2; opacity: 0.6; }
.xp .fm-max::before { width: 9px; height: 7px; border: 1px solid #ffffff; border-top-width: 3px; }
.xp .fm-close { order: 3; background: linear-gradient(#e5714b, #c4401a); cursor: pointer; }
.xp .fm-close::before { content: "\2715"; }
.xp .fm-ctl:hover { filter: brightness(1.15); }
.xp .fm-max:hover { filter: none; }

/* --- Hacker look --- */
.hacker .fm-win {
    --fm-bg: rgba(0, 8, 0, 0.95); --fm-fg: #33ff66; --fm-muted: #1fae4b; --fm-line: rgba(51, 255, 102, 0.35);
    --fm-field: rgba(0, 0, 0, 0.6); --fm-well: #000000; --fm-btn-bg: transparent; --fm-btn-border: rgba(51, 255, 102, 0.6);
    --fm-accent: #33ff66; --fm-accent-fg: #000000; --fm-radius: 3px;
    --fm-font: "Cascadia Mono", Consolas, "Lucida Console", "Courier New", monospace;
    --fm-size: 13px; --fm-np-font: 14px/1.5 "Cascadia Mono", Consolas, "Lucida Console", monospace;
    --sn-bg: #000000; --sn-grid: #021a08; --sn-body: #33ff66; --sn-head: #b8ffcc; --sn-food: #ff5f56;
    border: 1px solid rgba(51, 255, 102, 0.6);
    border-radius: 6px;
    box-shadow: 0 0 28px rgba(51, 255, 102, 0.25);
}
.hacker .fm-win:not(.active) { border-color: rgba(51, 255, 102, 0.3); }
.hacker .fm-titlebar { padding: 5px 10px; border-bottom: 1px solid var(--fm-line); font-size: 12px; }
.hacker .fm-title-icon, .hacker .fm-min, .hacker .fm-max { display: none; }
.hacker .fm-ctls { order: 3; }
.hacker .fm-close { padding: 0 4px; color: inherit; text-shadow: inherit; background: none; cursor: pointer; }
.hacker .fm-close::before { content: "[ x ]"; }
.hacker .fm-close:hover, .hacker .fm-close:focus-visible { color: #000000; text-shadow: none; background: #33ff66; outline: none; }
.hacker .fm-btn { text-shadow: inherit; }
.hacker .fm-btn:hover { filter: none; background: rgba(51, 255, 102, 0.15); }
.hacker .fm-btn.active { text-shadow: none; background: #33ff66; }
.hacker .np-text { caret-color: #33ff66; text-shadow: inherit; }
.hacker .pt-swatch { border-color: rgba(51, 255, 102, 0.5); }
.hacker .wx-icon, .hacker .wx-icon-sm { filter: grayscale(1) sepia(1) hue-rotate(70deg) saturate(4); }
