/* ThreadCode OS — macOS-flavored skeleton */

:root {
    --os-accent: #2f7df0;
    --os-accent-soft: rgba(47, 125, 240, 0.18);
    --os-text: #f5f6f8;
    --os-text-dim: rgba(245, 246, 248, 0.65);
    --os-text-faint: rgba(245, 246, 248, 0.4);

    --os-window-bg: rgba(40, 40, 44, 0.74);
    --os-window-bg-inactive: rgba(40, 40, 44, 0.55);
    --os-window-border: rgba(255, 255, 255, 0.13);
    --os-window-shadow: 0 22px 70px rgba(0, 0, 0, 0.55), 0 6px 20px rgba(0, 0, 0, 0.35), inset 0 0 0 0.5px rgba(255, 255, 255, 0.05);

    --os-titlebar-h: 28px;
    --os-menubar-h: 28px;
    --os-dock-h: 70px;
    --os-radius-window: 12px;
    --os-radius-app: 14px;

    --os-font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    --os-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-theme="light"] {
    --os-text: #1a1a1c;
    --os-text-dim: rgba(26, 26, 28, 0.65);
    --os-text-faint: rgba(26, 26, 28, 0.4);
    --os-window-bg: rgba(245, 246, 248, 0.78);
    --os-window-bg-inactive: rgba(245, 246, 248, 0.6);
    --os-window-border: rgba(0, 0, 0, 0.1);
    --os-window-shadow: 0 22px 70px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.15), inset 0 0 0 0.5px rgba(255, 255, 255, 0.7);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: var(--os-font);
    color: var(--os-text);
    background: #000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }

/* --- Boot screen --------------------------------------------------------- */

.boot-screen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 80px;
    transition: opacity 0.7s ease;
}

.boot-screen__logo {
    display: grid;
    place-items: center;
    color: #fff;
    animation: bootPulse 1.6s ease-in-out infinite;
}

@keyframes bootPulse {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; }
}

.boot-screen__progress {
    width: 220px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.boot-screen__progress span {
    display: block;
    height: 100%;
    width: 0;
    background: #fff;
    border-radius: 2px;
    animation: bootProgress 1.6s ease-out forwards;
}

@keyframes bootProgress {
    to { width: 100%; }
}

body:not(.boot) .boot-screen {
    opacity: 0;
    pointer-events: none;
}

/* --- OS shell ----------------------------------------------------------- */

.os-root {
    position: relative;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/* --- Wallpaper ---------------------------------------------------------- */

.os-wallpaper {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(47, 125, 240, 0.55), transparent 55%),
        radial-gradient(ellipse at 75% 80%, rgba(180, 80, 255, 0.45), transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(34, 68, 125, 0.6), transparent 70%),
        linear-gradient(160deg, #0c1224 0%, #1a1140 50%, #0b1a3a 100%);
    z-index: 0;
}

[data-theme="light"] .os-wallpaper {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(120, 180, 255, 0.7), transparent 55%),
        radial-gradient(ellipse at 75% 80%, rgba(255, 180, 220, 0.65), transparent 55%),
        radial-gradient(ellipse at 50% 50%, rgba(180, 200, 255, 0.7), transparent 70%),
        linear-gradient(160deg, #c8d6ff 0%, #f5e0ff 50%, #b8d0ff 100%);
}

/* --- Menubar ------------------------------------------------------------ */

.os-menubar {
    position: relative;
    z-index: 50;
    height: var(--os-menubar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    color: #fff;
    font-size: 13px;
    user-select: none;
}

[data-theme="light"] .os-menubar {
    background: rgba(255, 255, 255, 0.55);
    color: #1a1a1c;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.os-menubar__group { display: flex; align-items: center; gap: 2px; }
.os-menubar__group--right { gap: 14px; }

.os-menubar__apple {
    width: 28px;
    height: 24px;
    border: none;
    background: transparent;
    color: currentColor;
    cursor: pointer;
    display: grid;
    place-items: center;
    border-radius: 5px;
    padding: 0;
}

.os-menubar__apple::before {
    content: "";
    width: 14px;
    height: 17px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20'><path d='M11.96 10.42c-.02-2.18 1.78-3.23 1.86-3.28-1.01-1.48-2.58-1.68-3.14-1.7-1.34-.13-2.6.78-3.27.78-.69 0-1.74-.76-2.86-.74-1.47.02-2.83.85-3.59 2.17-1.54 2.66-.39 6.6 1.1 8.76.74 1.06 1.62 2.25 2.77 2.21 1.11-.04 1.53-.72 2.88-.72 1.34 0 1.72.72 2.9.7 1.2-.02 1.96-1.08 2.69-2.14.85-1.22 1.21-2.43 1.22-2.49-.03-.01-2.36-.91-2.39-3.55ZM9.79 4.07C10.39 3.36 10.8 2.36 10.69 1.36c-.85.03-1.89.57-2.5 1.27-.55.62-1.04 1.62-.91 2.6.96.08 1.93-.49 2.51-1.16Z'/></svg>") center / contain no-repeat;
            mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 20'><path d='M11.96 10.42c-.02-2.18 1.78-3.23 1.86-3.28-1.01-1.48-2.58-1.68-3.14-1.7-1.34-.13-2.6.78-3.27.78-.69 0-1.74-.76-2.86-.74-1.47.02-2.83.85-3.59 2.17-1.54 2.66-.39 6.6 1.1 8.76.74 1.06 1.62 2.25 2.77 2.21 1.11-.04 1.53-.72 2.88-.72 1.34 0 1.72.72 2.9.7 1.2-.02 1.96-1.08 2.69-2.14.85-1.22 1.21-2.43 1.22-2.49-.03-.01-2.36-.91-2.39-3.55ZM9.79 4.07C10.39 3.36 10.8 2.36 10.69 1.36c-.85.03-1.89.57-2.5 1.27-.55.62-1.04 1.62-.91 2.6.96.08 1.93-.49 2.51-1.16Z'/></svg>") center / contain no-repeat;
}

.os-menubar__app-name {
    font-weight: 700;
    background: transparent;
    border: none;
    color: currentColor;
    padding: 3px 9px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.os-menubar__menu {
    background: transparent;
    border: none;
    color: currentColor;
    padding: 3px 9px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
}

.os-menubar__apple:hover,
.os-menubar__app-name:hover,
.os-menubar__menu:hover,
.os-menubar__menu.is-open,
.os-menubar__app-name.is-open,
.os-menubar__apple.is-open {
    background: rgba(255, 255, 255, 0.18);
}

[data-theme="light"] .os-menubar__apple:hover,
[data-theme="light"] .os-menubar__app-name:hover,
[data-theme="light"] .os-menubar__menu:hover,
[data-theme="light"] .os-menubar__menu.is-open,
[data-theme="light"] .os-menubar__app-name.is-open,
[data-theme="light"] .os-menubar__apple.is-open {
    background: rgba(0, 0, 0, 0.08);
}

.os-menubar__icon {
    background: transparent;
    border: none;
    color: currentColor;
    padding: 4px;
    border-radius: 5px;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.os-menubar__icon:hover { background: rgba(255, 255, 255, 0.18); }
[data-theme="light"] .os-menubar__icon:hover { background: rgba(0, 0, 0, 0.08); }

.os-menubar__clock {
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    font-weight: 500;
}

/* --- Menu dropdown ------------------------------------------------------ */

.os-menu {
    position: absolute;
    top: calc(var(--os-menubar-h) + 2px);
    left: 0;
    z-index: 200;
    min-width: 220px;
    background: rgba(40, 40, 44, 0.85);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--os-window-border);
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    font-size: 13px;
    color: #fff;
}

[data-theme="light"] .os-menu {
    background: rgba(245, 246, 248, 0.92);
    color: #1a1a1c;
}

.os-menu__item {
    padding: 5px 14px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.os-menu__item:hover {
    background: var(--os-accent);
    color: #fff;
}

.os-menu__shortcut {
    font-size: 12px;
    opacity: 0.65;
}

.os-menu__separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

[data-theme="light"] .os-menu__separator { background: rgba(0, 0, 0, 0.08); }

/* --- Desktop ------------------------------------------------------------ */

.os-desktop {
    position: absolute;
    top: var(--os-menubar-h);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.os-desktop__icons {
    list-style: none;
    margin: 0;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 96px);
    grid-auto-rows: 100px;
    grid-auto-flow: column dense;
    gap: 8px;
    height: calc(100% - var(--os-dock-h) - 20px);
    align-content: start;
    justify-content: end;
}

.os-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    border-radius: 8px;
    padding: 8px 6px;
    cursor: pointer;
    background: transparent;
    border: 1.5px solid transparent;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    font: inherit;
    font-size: 12px;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.os-icon:hover, .os-icon:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.os-icon--selected {
    background: rgba(47, 125, 240, 0.28);
    border-color: rgba(47, 125, 240, 0.55);
}

.os-icon__glyph {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.25));
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    overflow: hidden;
}

/* Per-app icon backgrounds (macOS-like color identity) */
.os-icon__glyph[data-app="finder"],
.os-dock__item[data-app="finder"] { background: linear-gradient(160deg, #5fa8ff, #2f7df0); }

.os-icon__glyph[data-app="about"],
.os-dock__item[data-app="about"] { background: linear-gradient(160deg, #6b8bff, #2f4fdc); }

.os-icon__glyph[data-app="notes"],
.os-dock__item[data-app="notes"] { background: linear-gradient(160deg, #ffd54e, #ff9f0a); color: #5a3a00; }

.os-icon__glyph[data-app="mail"],
.os-dock__item[data-app="mail"] { background: linear-gradient(160deg, #5fc8ff, #1d8de8); }

.os-icon__glyph[data-app="safari"],
.os-dock__item[data-app="safari"] { background: linear-gradient(160deg, #4cd2ff, #0a84ff); }

.os-icon__glyph[data-app="terminal"],
.os-dock__item[data-app="terminal"] { background: linear-gradient(160deg, #555, #1a1a1a); }

.os-icon__glyph img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.os-icon__label {
    text-align: center;
    line-height: 1.2;
    max-width: 88px;
}

/* --- Windows ------------------------------------------------------------ */

.os-windows {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.os-window {
    position: absolute;
    min-width: 360px;
    min-height: 240px;
    background: var(--os-window-bg-inactive);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 0.5px solid var(--os-window-border);
    border-radius: var(--os-radius-window);
    box-shadow: var(--os-window-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease, background 0.18s ease;
    color: var(--os-text);
    transform-origin: bottom center;
}

.os-window--focused {
    background: var(--os-window-bg);
}

.os-window--opening {
    animation: windowOpen 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes windowOpen {
    from { transform: scale(0.88) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.os-window--minimized {
    transform: scale(0.2) translateY(120vh);
    opacity: 0;
    pointer-events: none;
}

.os-window__titlebar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--os-titlebar-h);
    padding: 0 10px;
    background: transparent;
    border-bottom: 0.5px solid var(--os-window-border);
    cursor: grab;
    user-select: none;
    position: relative;
}

.os-window__titlebar:active { cursor: grabbing; }

.os-window__controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.os-window__control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 0.5px solid rgba(0, 0, 0, 0.18);
    cursor: pointer;
    padding: 0;
    display: grid;
    place-items: center;
    font-size: 8px;
    font-weight: bold;
    color: transparent;
    line-height: 1;
    transition: color 0.12s ease;
}

.os-window__controls:hover .os-window__control { color: rgba(0, 0, 0, 0.6); }

.os-window__control--close { background: #ff5f57; }
.os-window__control--minimize { background: #febc2e; }
.os-window__control--maximize { background: #28c840; }

.os-window:not(.os-window--focused) .os-window__control {
    background: rgba(255, 255, 255, 0.18);
    border-color: transparent;
}

[data-theme="light"] .os-window:not(.os-window--focused) .os-window__control {
    background: rgba(0, 0, 0, 0.18);
}

.os-window__title {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    text-align: center;
    color: var(--os-text);
    opacity: 0.85;
}

.os-window__body {
    flex: 1;
    overflow: auto;
    background: transparent;
}

/* --- Dock --------------------------------------------------------------- */

.os-dock-wrapper {
    position: absolute;
    left: 50%;
    bottom: 8px;
    transform: translateX(-50%);
    z-index: 60;
    pointer-events: none;
}

.os-dock {
    display: flex;
    align-items: end;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(40, 40, 44, 0.5);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 18px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
    pointer-events: auto;
}

[data-theme="light"] .os-dock {
    background: rgba(255, 255, 255, 0.55);
    border-color: rgba(0, 0, 0, 0.08);
}

.os-dock__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 6px;
    align-items: end;
}

.os-dock__divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 4px;
}

[data-theme="light"] .os-dock__divider { background: rgba(0, 0, 0, 0.1); }

.os-dock__item {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.25));
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 24px;
    color: #fff;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), margin 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
    position: relative;
    overflow: hidden;
}

.os-dock__item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.os-dock__item:hover {
    transform: translateY(-12px) scale(1.4);
    margin: 0 14px;
}

.os-dock__item:hover + li .os-dock__item,
li:has(+ li > .os-dock__item:hover) .os-dock__item {
    transform: translateY(-4px) scale(1.15);
    margin: 0 4px;
}

.os-dock__item--active::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
}

[data-theme="light"] .os-dock__item--active::after { background: rgba(0, 0, 0, 0.7); }

.os-dock__item[aria-label]::before {
    content: attr(aria-label);
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.os-dock__item:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Spotlight ---------------------------------------------------------- */

.os-spotlight[hidden] { display: none !important; }
.os-menu[hidden] { display: none !important; }

.os-spotlight {
    position: absolute;
    inset: 0;
    z-index: 300;
    display: grid;
    place-items: start center;
    padding-top: 18vh;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.os-spotlight__panel {
    width: 580px;
    max-width: calc(100vw - 40px);
    background: rgba(40, 40, 44, 0.85);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 0.5px solid var(--os-window-border);
    border-radius: 16px;
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    color: #fff;
    animation: spotlightDrop 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .os-spotlight__panel {
    background: rgba(245, 246, 248, 0.92);
    color: #1a1a1c;
}

@keyframes spotlightDrop {
    from { transform: translateY(-12px) scale(0.96); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.os-spotlight__inputrow {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 0.5px solid var(--os-window-border);
}

.os-spotlight__inputrow svg { opacity: 0.6; }

#spotlight-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    font-size: 22px;
    font-family: inherit;
}

.os-spotlight__results {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 320px;
    overflow: auto;
}

.os-spotlight__result {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.os-spotlight__result.is-active,
.os-spotlight__result:hover {
    background: var(--os-accent);
    color: #fff;
}

.os-spotlight__result-glyph {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.2));
}

/* --- Apps: shared ------------------------------------------------------- */

.app {
    height: 100%;
    width: 100%;
}

/* Finder */
.app--finder {
    display: grid;
    grid-template-columns: 180px 1fr;
    height: 100%;
}

.finder__sidebar {
    background: rgba(0, 0, 0, 0.18);
    padding: 14px 8px;
    overflow: auto;
    border-right: 0.5px solid var(--os-window-border);
    font-size: 13px;
}

[data-theme="light"] .finder__sidebar { background: rgba(0, 0, 0, 0.05); }

.finder__section {
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 700;
    color: var(--os-text-faint);
    letter-spacing: 0.5px;
    padding: 12px 10px 6px;
}

.finder__sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--os-text);
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
}

.finder__sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    color: var(--os-accent);
}

.finder__sidebar-item.is-active .finder__sidebar-icon { color: #fff; }

.finder__sidebar-item.is-active {
    background: var(--os-accent);
    color: #fff;
}

.finder__sidebar-item:not(.is-active):hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .finder__sidebar-item:not(.is-active):hover { background: rgba(0, 0, 0, 0.05); }

.finder__tag {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.finder__tag--blue   { background: #5fa8ff; }
.finder__tag--green  { background: #4ed16e; }
.finder__tag--orange { background: #ffa54e; }

.finder__main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.finder__toolbar {
    padding: 10px 14px;
    border-bottom: 0.5px solid var(--os-window-border);
}

.finder__search {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 0.5px solid var(--os-window-border);
    color: inherit;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

[data-theme="light"] .finder__search { background: rgba(0, 0, 0, 0.05); }

.finder__grid {
    flex: 1;
    overflow: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, 100px);
    gap: 14px;
    align-content: start;
}

.finder__file {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 12px;
}

.finder__file:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .finder__file:hover { background: rgba(0, 0, 0, 0.05); }

.finder__file img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 12px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.15));
    padding: 6px;
}

/* About */
.app--about {
    padding: 32px;
    text-align: center;
}

.about__hero { margin-bottom: 24px; }

.about__logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px;
    border-radius: 22px;
    background: linear-gradient(160deg, #5fa8ff, #2f7df0);
    display: grid;
    place-items: center;
    font-size: 44px;
    color: #fff;
    box-shadow: 0 8px 20px rgba(47, 125, 240, 0.4);
}

.about__hero h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
}

.about__tag {
    margin: 0;
    color: var(--os-text-dim);
    font-size: 14px;
}

.about__spec {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 18px;
    text-align: left;
    border-top: 0.5px solid var(--os-window-border);
    padding-top: 18px;
    font-size: 13px;
}

.about__spec dt { color: var(--os-text-dim); }
.about__spec dd { margin: 0; font-weight: 500; }
.about__spec a { color: var(--os-accent); text-decoration: none; }
.about__spec a:hover { text-decoration: underline; }

.about__actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 22px;
}

.about__btn {
    padding: 7px 16px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 0.5px solid var(--os-window-border);
}

[data-theme="light"] .about__btn { background: rgba(0, 0, 0, 0.06); }

.about__btn--primary {
    background: var(--os-accent);
    color: #fff;
    border-color: transparent;
}

.about__btn:hover { filter: brightness(1.1); }

/* Notes */
.app--notes {
    display: grid;
    grid-template-columns: 160px 1fr;
    height: 100%;
}

.notes__sidebar {
    background: rgba(0, 0, 0, 0.18);
    padding: 10px 6px;
    border-right: 0.5px solid var(--os-window-border);
    overflow: auto;
}

[data-theme="light"] .notes__sidebar { background: rgba(0, 0, 0, 0.04); }

.notes__item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--os-text);
    padding: 7px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.notes__item.is-active { background: rgba(255, 255, 255, 0.1); }
[data-theme="light"] .notes__item.is-active { background: rgba(0, 0, 0, 0.08); }
.notes__item:hover:not(.is-active) { background: rgba(255, 255, 255, 0.05); }

.notes__body {
    padding: 28px 32px;
    overflow: auto;
    line-height: 1.6;
    font-size: 14px;
    color: var(--os-text);
}

.notes__body h2 { margin: 0 0 12px; font-size: 22px; font-weight: 700; }
.notes__body p { margin: 0 0 12px; color: var(--os-text-dim); }
.notes__body strong { color: var(--os-text); }

/* Mail */
.app--mail {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.mail__header {
    padding: 14px 20px;
    border-bottom: 0.5px solid var(--os-window-border);
}

.mail__header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--os-text-dim);
}

.mail__form {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.mail__form label {
    display: grid;
    grid-template-columns: 60px 1fr;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--os-text-dim);
    border-bottom: 0.5px solid var(--os-window-border);
    padding-bottom: 6px;
}

.mail__form input,
.mail__form textarea {
    background: transparent;
    border: none;
    outline: none;
    color: var(--os-text);
    font: inherit;
    font-size: 13px;
}

.mail__form textarea {
    flex: 1;
    resize: none;
    line-height: 1.5;
}

.mail__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mail__send {
    padding: 6px 16px;
    background: var(--os-accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.mail__hint { font-size: 11px; color: var(--os-text-faint); }

/* Safari */
.app--safari {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.safari__toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 0.5px solid var(--os-window-border);
}

.safari__nav { display: flex; gap: 4px; }

.safari__btn {
    width: 26px;
    height: 26px;
    border: 0.5px solid var(--os-window-border);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    display: grid;
    place-items: center;
}

[data-theme="light"] .safari__btn { background: rgba(0, 0, 0, 0.05); }

.safari__address {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 0.5px solid var(--os-window-border);
    border-radius: 5px;
}

[data-theme="light"] .safari__address { background: rgba(0, 0, 0, 0.05); }

#safari-url {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: inherit;
    font-size: 13px;
}

.safari__lock { font-size: 10px; opacity: 0.6; }

.safari__frame {
    flex: 1;
    border: none;
    background: #fff;
}

/* Terminal */
.app--terminal {
    font-family: var(--os-mono);
    font-size: 12.5px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.55);
    color: #f5f6f8;
}

.app--terminal pre {
    margin: 0;
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: auto;
}

.app__terminal-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app__terminal-prompt {
    color: #5fa8ff;
    white-space: nowrap;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    outline: none;
}

/* --- Mobile fallback --------------------------------------------------- */

.os-mobile-fallback { display: none; }

@media (max-width: 820px), (pointer: coarse) {
    .os-menubar, .os-desktop, .os-dock-wrapper, .os-spotlight, .os-menu, .boot-screen {
        display: none !important;
    }

    .os-wallpaper { display: block; }

    .os-mobile-fallback {
        position: absolute;
        inset: 0;
        z-index: 10;
        display: grid;
        place-items: start center;
        padding: 40px 20px;
        overflow: auto;
        color: #fff;
    }

    .os-mobile-fallback__card {
        background: rgba(40, 40, 44, 0.75);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        border: 0.5px solid rgba(255, 255, 255, 0.15);
        border-radius: 18px;
        padding: 26px 22px;
        text-align: center;
        max-width: 380px;
        width: 100%;
    }

    .os-mobile-fallback__logo {
        width: 56px;
        height: 56px;
        margin: 0 auto 12px;
        border-radius: 16px;
        background: linear-gradient(160deg, #5fa8ff, #2f7df0);
        display: grid;
        place-items: center;
        font-size: 28px;
    }

    .os-mobile-fallback__card h1 {
        margin: 0 0 8px;
        font-size: 20px;
    }

    .os-mobile-fallback__card p {
        margin: 0 0 16px;
        color: rgba(255, 255, 255, 0.7);
        line-height: 1.5;
        font-size: 14px;
    }

    .os-mobile-fallback__apps {
        list-style: none;
        margin: 0 0 18px;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }

    .os-mobile-fallback__apps li {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        font-size: 11px;
        color: rgba(255, 255, 255, 0.85);
    }

    .os-mobile-fallback__apps li .glyph {
        width: 52px;
        height: 52px;
        border-radius: 14px;
        background: linear-gradient(160deg, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.25));
        display: grid;
        place-items: center;
        font-size: 24px;
    }

    .os-mobile-fallback__cta {
        display: inline-block;
        padding: 10px 20px;
        background: var(--os-accent);
        color: #fff;
        border-radius: 999px;
        font-weight: 600;
        text-decoration: none;
        font-size: 14px;
    }
}
