.desktop {
    position: relative;
    min-height: calc(100vh - 84px);
    overflow: hidden;
}

.desktop::before,
.desktop::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    transition: background 220ms ease, opacity 220ms ease;
}

.desktop::after {
    background:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 118px 118px;
    opacity: var(--desktop-grid-layer-opacity);
}

.desktop-icons {
    position: absolute;
    inset: 24px auto 108px 22px;
    width: max-content;
    max-height: calc(100vh - 132px);
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(var(--desktop-icon-rows), minmax(var(--desktop-shortcut-row), auto));
    grid-auto-columns: calc(var(--desktop-icon-size) + 58px);
    gap: 12px 14px;
    align-content: start;
    z-index: 2;
}

.desktop-shortcut {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: var(--desktop-shortcut-row);
    padding: 8px 6px 10px;
    border: 1px solid transparent;
    border-radius: 18px;
    background: transparent;
    color: var(--shell-text);
    text-align: center;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.desktop-shortcut:focus-visible {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.12);
    outline: none;
}

.desktop-shortcut:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.12);
}

.shortcut-label {
    display: block;
    max-width: calc(var(--desktop-icon-size) + 34px);
    font-size: 0.78rem;
    line-height: 1.25;
    text-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
}

.widgets-rail {
    position: absolute;
    top: 24px;
    right: 22px;
    width: min(360px, calc(100vw - 188px));
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    z-index: 2;
    max-height: calc(100vh - 132px);
    overflow: auto;
    padding-right: 4px;
    transition: transform 200ms ease, opacity 200ms ease;
}

.widgets-rail::-webkit-scrollbar {
    width: 8px;
}

.widgets-rail::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
}

body.widgets-hidden .widgets-rail {
    opacity: 0;
    pointer-events: none;
    transform: translateX(22px);
}

body.widgets-split .widgets-rail {
    width: min(734px, calc(100vw - 220px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.widget-card {
    padding: 20px;
    border-radius: calc(var(--window-radius) + 2px);
    background: rgba(15, 23, 42, 0.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 22px 40px rgba(0, 0, 0, 0.22);
}

.widget-card .chip {
    color: rgba(248, 250, 252, 0.96);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
}

.widget-card .pill {
    color: rgba(248, 250, 252, 0.9);
    background: rgba(255, 255, 255, 0.08);
}

.hero-head {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: flex-start;
    text-align: left;
}

.hero-head > div:last-child {
    display: grid;
    gap: 6px;
    justify-items: start;
    width: 100%;
    text-wrap: balance;
}

.avatar-orb {
    position: relative;
    width: 112px;
    height: 112px;
    flex: 0 0 auto;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 1.9rem;
    font-weight: 800;
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.32), transparent 35%),
        linear-gradient(135deg, rgba(var(--accent-rgb), 1), rgba(15, 23, 42, 0.95));
}

.avatar-orb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-orb.has-image span {
    display: none;
}

.hero-role {
    display: none;
}

.hero-summary {
    margin-top: 18px;
    text-align: left;
    text-wrap: pretty;
}

.hero-role,
.hero-subrole,
.hero-summary {
    max-width: 28ch;
}

.widget-actions {
    justify-content: flex-start;
    gap: 12px;
    margin-top: 18px;
}

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

.stats-grid article {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-grid strong {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.start-menu {
    position: fixed;
    left: 50%;
    bottom: 96px;
    transform: translateX(-50%);
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100vh - 112px);
    padding: 18px;
    border-radius: var(--window-radius);
    background: rgba(239, 244, 251, 0.88);
    backdrop-filter: blur(26px);
    -webkit-backdrop-filter: blur(26px);
    box-shadow:
        0 24px 70px rgba(15, 23, 42, 0.2),
        0 12px 28px rgba(15, 23, 42, 0.12);
    color: var(--ink);
    overflow: auto;
    z-index: 120;
}

.start-menu:not([hidden]) {
    animation: startMenuIn 180ms ease both;
}

.start-search {
    position: relative;
    margin-bottom: 16px;
}

.start-search input {
    width: 100%;
    min-height: 52px;
    padding: 0 18px 0 48px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.start-search-glyph {
    position: absolute;
    top: 50%;
    left: 16px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    border: 2px solid #c0c8d6;
    border-radius: 999px;
}

.start-search-glyph::after {
    content: "";
    position: absolute;
    right: -5px;
    bottom: -5px;
    width: 7px;
    height: 2px;
    border-radius: 999px;
    background: #c0c8d6;
    transform: rotate(45deg);
    transform-origin: center;
}

.launcher-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.launcher-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 78px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.22);
    color: var(--ink);
    text-align: left;
}

.launcher-copy {
    display: grid;
    gap: 2px;
}

.launcher-copy strong {
    font-size: 0.96rem;
}

.launcher-copy small {
    color: var(--muted-ink);
    font-size: 0.78rem;
}

.start-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 0.92rem;
    font-weight: 700;
}

.start-grid,
.recommended-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px 10px;
}

body[data-launcher-density="compact"] .start-grid,
body[data-launcher-density="compact"] .recommended-grid {
    gap: 10px 8px;
}

.start-app.app-tile,
.start-link-tile,
.recommended-item.start-card-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 120px;
    padding: 10px 8px 12px;
    border-radius: 18px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink);
    text-align: center;
}

body[data-launcher-density="compact"] .start-app.app-tile,
body[data-launcher-density="compact"] .start-link-tile,
body[data-launcher-density="compact"] .recommended-item.start-card-link {
    min-height: 108px;
    padding: 8px 6px 10px;
}

.app-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
}

.app-meta {
    display: block;
    font-size: 0.74rem;
    color: var(--muted-ink);
    line-height: 1.2;
}

.recommended-grid {
    padding-top: 4px;
}

.recommended-item.start-card-link {
    min-height: 104px;
    gap: 7px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.recommended-item.start-card-link strong {
    font-size: 0.88rem;
}

.recommended-item.start-card-link span:last-child {
    color: var(--muted-ink);
    font-size: 0.74rem;
    line-height: 1.3;
}

.launcher-chip:hover,
.start-app.app-tile:hover,
.start-link-tile:hover,
.recommended-item.start-card-link:hover {
    background: rgba(255, 255, 255, 0.68);
    border-color: rgba(148, 163, 184, 0.24);
}

.start-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.26);
}

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

.start-user strong {
    display: block;
    font-size: 0.92rem;
}

.start-user span:last-child {
    color: var(--muted-ink);
    font-size: 0.78rem;
}

.taskbar {
    position: fixed;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    width: min(780px, calc(100vw - 24px));
    min-height: 74px;
    padding: 10px 14px;
    border-radius: calc(var(--window-radius) - 2px);
    background: rgba(232, 240, 250, 0.76);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    box-shadow:
        0 24px 56px rgba(var(--accent-rgb), calc(0.08 + (var(--taskbar-glow) * 0.14))),
        0 12px 26px rgba(15, 23, 42, 0.14);
    z-index: 110;
}

body[data-taskbar-align="left"] .taskbar {
    left: 14px;
    transform: none;
}

body[data-taskbar-align="left"] .start-menu {
    left: 16px;
    transform: none;
}

body[data-taskbar-align="left"] .start-menu:not([hidden]) {
    animation: startMenuInLeft 180ms ease both;
}

.taskbar-left,
.taskbar-center,
.taskbar-right,
.taskbar-running {
    display: flex;
    align-items: center;
    gap: 10px;
}

.taskbar-center {
    justify-content: center;
    min-width: 0;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.taskbar-running {
    min-width: 0;
    gap: 8px;
}

.taskbar-center::-webkit-scrollbar {
    display: none;
}

.taskbar-core,
.taskbar-app {
    min-height: 52px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
}

.taskbar-core {
    width: 52px;
    padding: 0;
}

.taskbar-app {
    width: 54px;
    padding: 0;
}

.taskbar-app::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 16px;
    height: 3px;
    border-radius: 999px;
    background: rgba(var(--accent-rgb), 0.86);
    transform: translateX(-50%) scaleX(0);
    transform-origin: center;
    transition: transform 160ms ease;
}

.taskbar-app span:last-child {
    display: none;
}

.taskbar-app.is-active {
    background: rgba(255, 255, 255, 0.94);
}

.taskbar-app.is-active::after {
    transform: translateX(-50%) scaleX(1);
}

.windows-glyph,
.widgets-glyph {
    display: inline-block;
    width: 18px;
    height: 18px;
    position: relative;
}

.windows-glyph::before,
.widgets-glyph::before {
    content: "";
    position: absolute;
    inset: 0;
    background: currentColor;
}

.windows-glyph::before {
    clip-path: polygon(0 0, 44% 0, 44% 44%, 0 44%, 0 0, 56% 0, 100% 0, 100% 44%, 56% 44%, 56% 0, 0 56%, 44% 56%, 44% 100%, 0 100%, 0 56%, 56% 56%, 100% 56%, 100% 100%, 56% 100%, 56% 56%);
}

.widgets-glyph::before {
    border-radius: 6px;
    box-shadow:
        inset 0 0 0 2px currentColor,
        inset 8px 0 0 -4px currentColor,
        inset 0 8px 0 -4px currentColor;
}

.start-shutdown-button,
.tray-power-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    color: var(--ink);
}

.start-shutdown-button {
    min-height: 46px;
    padding: 0 18px;
}

.tray-power-button {
    width: 42px;
    height: 42px;
    padding: 0;
}

.power-glyph {
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 999px;
    position: relative;
}

.power-glyph::before {
    content: "";
    position: absolute;
    top: -7px;
    left: 50%;
    width: 2px;
    height: 10px;
    background: currentColor;
    transform: translateX(-50%);
    border-radius: 999px;
}

.system-clock {
    display: grid;
    justify-items: end;
    color: var(--ink);
    font-size: 0.82rem;
}

@keyframes startMenuIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes startMenuInLeft {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 98px;
    max-width: 340px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    transform: translateY(12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 140;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.boot-screen,
.shutdown-screen {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    z-index: 200;
}

.boot-screen {
    background:
        radial-gradient(circle at center, rgba(59, 130, 246, 0.14), transparent 28%),
        linear-gradient(180deg, #02050c 0%, #020617 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 280ms ease;
}

body.is-booting .boot-screen {
    opacity: 1;
    pointer-events: auto;
}

.boot-shell {
    width: min(480px, 100%);
    text-align: center;
    color: #e5edf8;
    transform: translateY(12px);
    animation: bootRise 500ms ease forwards;
}

.boot-kicker {
    margin: 0 0 10px;
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(226, 232, 240, 0.78);
}

.boot-shell h2 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 3vw, 2.6rem);
    color: #f8fafc;
}

.boot-shell p:last-of-type {
    margin: 0 auto 22px;
    max-width: 380px;
    line-height: 1.7;
    color: rgba(226, 232, 240, 0.82);
}

.xp-mark {
    width: 96px;
    height: 96px;
    margin: 0 auto 22px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    transform: rotate(-8deg);
    filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.3));
}

.xp-pane {
    border-radius: 16px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 10px 18px rgba(0, 0, 0, 0.18);
}

.xp-pane--red {
    background: linear-gradient(145deg, #f97316, #ef4444);
}

.xp-pane--green {
    background: linear-gradient(145deg, #84cc16, #22c55e);
}

.xp-pane--blue {
    background: linear-gradient(145deg, #38bdf8, #2563eb);
}

.xp-pane--gold {
    background: linear-gradient(145deg, #facc15, #f59e0b);
}

.xp-loader {
    width: min(320px, 100%);
    height: 24px;
    margin: 0 auto;
    padding: 4px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.xp-loader span {
    display: block;
    width: 140px;
    height: 100%;
    border-radius: 999px;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent),
        linear-gradient(90deg, #0ea5e9, #60a5fa 35%, #2563eb 72%, #1d4ed8);
    animation: xpLoad 1.2s linear infinite;
}

.shutdown-screen {
    background:
        radial-gradient(circle at center, rgba(var(--accent-rgb), 0.2), transparent 30%),
        linear-gradient(180deg, #02050c 0%, #020617 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 260ms ease;
    z-index: 200;
}

body.is-powering-off .shutdown-screen,
body.is-shutdown .shutdown-screen {
    opacity: 1;
    pointer-events: auto;
}

.shutdown-progress,
.shutdown-card {
    width: min(440px, 100%);
    text-align: center;
    color: #e2e8f0;
}

.shutdown-progress {
    display: none;
}

body.is-powering-off .shutdown-progress {
    display: block;
    animation: bootRise 420ms ease forwards;
}

body.is-powering-off .shutdown-card {
    display: none;
}

.shutdown-card {
    display: none;
    padding: 36px 30px;
    border-radius: 30px;
    background: rgba(15, 23, 42, 0.54);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

body.is-shutdown .shutdown-card {
    display: block;
    animation: bootRise 420ms ease forwards;
}

.shutdown-card h2 {
    margin: 10px 0 12px;
    font-size: 2rem;
    color: #f8fafc;
}

.shutdown-card p {
    margin: 0 0 20px;
    line-height: 1.7;
}

.shutdown-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    margin-bottom: 12px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.96), rgba(15, 23, 42, 0.9));
    color: #f8fafc;
}

.shutdown-mark .windows-glyph {
    width: 24px;
    height: 24px;
}

.xp-loader--shutdown {
    margin-top: 22px;
}

body.is-booting .desktop,
body.is-booting .taskbar,
body.is-booting .start-menu,
body.is-booting .toast,
body.is-booting .shutdown-screen,
body.is-powering-off .desktop,
body.is-powering-off .taskbar,
body.is-powering-off .start-menu,
body.is-powering-off .toast,
body.is-shutdown .desktop,
body.is-shutdown .taskbar,
body.is-shutdown .start-menu,
body.is-shutdown .toast {
    opacity: 0;
    pointer-events: none;
}

@keyframes bootRise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes xpLoad {
    from {
        transform: translateX(-150px);
    }
    to {
        transform: translateX(330px);
    }
}
