/* 桌面仅在宽屏启用；小屏继续使用原有的纵向主页。 */
.desktop-shell { display: none; }
[hidden] { display: none !important; }

@media (min-width: 1121px) {
    body.desktop-mode { --desktop-ink: #34466b; --desktop-blue: #4c83df; }
    .desktop-mode .desktop-shell { display: block; color: var(--desktop-ink); }
    .desktop-mode #bg::after { background-image: linear-gradient(120deg, rgba(52, 90, 160, .12), rgba(172, 192, 232, .06)); }
    /* Desktop windows share the same stacking context as the music window. */
    .desktop-mode #box { z-index: auto; }
    body.desktop-mode :where(.meBox, #cmdBox .cmd, .music-window) { z-index: 4; }
    .desktop-mode .meBox { position: fixed; left: clamp(146px, 15vw, 260px); top: max(120px, 20vh); margin: 0; width: 320px; height: 400px; }
    .desktop-mode .meBox:hover { margin: 0; width: 320px; height: 400px; }
    /* 三个终端沿用 nutssss.css 的原版容器和错位叠放布局。 */
    .desktop-mode #cmdBox .cmd.full { inset: 0 0 64px; width: 100vw; height: calc(100vh - 64px); z-index: 990 !important; }
    .desktop-mode #cmdBox .cmd.pop { left: 50%; top: 50%; width: min(760px, 94vw); height: min(520px, 80vh); }
    .desktop-mode .desktop-concealed { display: none !important; }
    /* 底部入口与任务栏低于应用窗口；菜单仍保留在窗口上方。 */
    .desktop-mode .corner-stack { bottom: 18px; right: 20px; z-index: 3; }
    /* 只统一配色，保留原有胶囊形状、文字、尺寸和排列。 */
    .desktop-mode .ciallo-btn,
    .desktop-mode .wallpaper-btn:not(.is-error),
    .desktop-mode .music-launcher { background: rgba(239,245,255,.88); color: #34466b; border-color: #ffffffb8; }
    .desktop-mode .ciallo-btn:focus-visible,
    .desktop-mode .wallpaper-btn:focus-visible,
    .desktop-mode .music-launcher:focus-visible { outline-color: #6b9ade; }
    .desktop-mode .dock-bar .term-dock:not(.wallpaper-btn):not(.music-launcher) { display: none; }
    .desktop-mode .site-footer { bottom: 14px; left: 24px; font-size: 10px; background: rgba(255,255,255,.45); }
    .desktop-mode .meBox.dragging,
    .desktop-mode #cmdBox .cmd.dragging,
    .desktop-mode .music-window.dragging,
    .desktop-mode .murasame-win.dragging { z-index: 9999 !important; }

    .desktop-topbar { height: 58px; position: fixed; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; z-index: 1; text-shadow: 0 1px 12px #fff; }
    .desktop-brand { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; letter-spacing: 2px; }
    .desktop-brand b { font-weight: 400; opacity: .55; margin-left: -5px; }
    .desktop-brand-dot { width: 7px; height: 7px; background: #518dd1; border-radius: 50%; box-shadow: 0 0 0 4px #ffffff50; display: inline-block; }
    .desktop-version { font-size: 10px; font-weight: 400; letter-spacing: .4px; opacity: .65; margin-left: 10px; }
    .desktop-top-hint { font-size: 11px; letter-spacing: 2px; opacity: .75; }
    .desktop-icons { --desktop-icon-height: 88px; position: fixed; top: 78px; left: 20px; right: 20px; bottom: 115px; display: grid; grid-auto-flow: column; grid-template-columns: repeat(auto-fill, 90px); grid-template-rows: repeat(var(--desktop-icon-rows, 7), var(--desktop-icon-height)); gap: 5px 8px; align-content: start; z-index: 3; pointer-events: none; }
    .desktop-icons .desktop-icon { height: var(--desktop-icon-height); pointer-events: auto; touch-action: none; }
    .desktop-icons .desktop-icon.is-icon-dragging { background: #8fc5ff40; border-color: #83a5de80; }
    .desktop-icons .desktop-icon.is-icon-dragging > span { opacity: .5; }
    .desktop-icons .desktop-icon.is-icon-dragging .desktop-app-icon { transform: none; }
    .desktop-icon-ghost { position: fixed; top: 0; left: 0; margin: 0; z-index: 10040; opacity: .65; pointer-events: none; background: transparent; border-color: transparent; transition: none; will-change: transform; }
    .desktop-icon-ghost .desktop-app-icon { transform: none; }
    html.is-icon-dragging, html.is-icon-dragging * { cursor: default !important; user-select: none !important; -webkit-user-select: none !important; }
    html.icon-drop-blocked, html.icon-drop-blocked * { cursor: no-drop !important; }
    .desktop-icon { width: 90px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #253b64; font: inherit; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 7px; text-decoration: none; cursor: pointer; padding: 8px 3px; box-sizing: border-box; transition: background .15s, border-color .15s; }
    .desktop-icon:hover, .desktop-icon:focus-visible { background: #ffffff5c; border-color: #ffffff90; outline: none; }
    .desktop-icon:active .desktop-app-icon { transform: scale(.92); }
    .desktop-icon > span:last-child { font-size: 11px; text-shadow: 0 1px 5px #fff, 0 1px 8px #fff; }
    .desktop-app-icon { width: 44px; height: 44px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; color: white; background: linear-gradient(145deg, var(--icon-top, #6e9ce7), var(--icon-bottom, #4569c1)); box-shadow: inset 0 1px 1px #ffffff70, 0 4px 10px #243f7429; flex-shrink: 0; transition: transform .16s; }
    .desktop-app-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
    .desktop-welcome { position: fixed; bottom: 150px; left: 155px; z-index: 1; text-shadow: 0 2px 16px #fff; pointer-events: none; }
    .desktop-welcome > span { font-size: 9px; letter-spacing: 3px; opacity: .6; }
    .desktop-welcome p { font: 300 25px/1.8 "Microsoft YaHei", sans-serif; letter-spacing: 3px; }
    .desktop-welcome p span { color: #5689d9; }
    .desktop-welcome small { font-size: 11px; opacity: .7; letter-spacing: 1px; }
    .desktop-mode.desktop-occupied .desktop-welcome { opacity: 0; }

    .desktop-taskbar { position: fixed; inset: auto auto 8px 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); height: 56px; box-sizing: border-box; padding: 0 12px; display: flex; align-items: center; gap: 16px; background: rgba(239,245,255,.88); border: 1px solid #ffffffb8; border-radius: 17px; backdrop-filter: blur(28px) saturate(1.4); box-shadow: 0 6px 30px #203b6b26; z-index: 3; }
    .desktop-taskbar-label { display: none; }
    .desktop-taskbar-apps { display: flex; align-items: center; gap: 7px; }
    #desktopTasks { display: flex; gap: 7px; }
    .desktop-task { position: relative; width: 46px; height: 48px; border-radius: 9px; background: transparent; border: 1px solid transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: inherit; }
    .desktop-task:hover, .desktop-task:focus-visible { background: #ffffffb3; outline: 2px solid #6b9ade50; outline-offset: -2px; }
    .desktop-task.is-current { background: #ffffffc7; border-color: #ffffffc7; }
    .desktop-task .desktop-app-icon { width: 30px; height: 30px; border-radius: 9px; box-shadow: inset 0 1px 1px #ffffff60, 0 2px 5px #243f741a; }
    .desktop-task .desktop-app-icon svg { width: 20px; height: 20px; }
    .desktop-task.is-running::after { content: ""; position: absolute; bottom: 1px; width: 5px; height: 3px; border-radius: 3px; background: #8298b8; }
    .desktop-task.is-current::after { width: 16px; background: #4e83db; }
    .desktop-task-divider { width: 1px; height: 24px; background: #7f9abd36; margin: 0 3px; }
    .desktop-start-logo { width: 25px; height: 25px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; transform: perspective(70px) rotateY(-10deg); }
    .desktop-start-logo i { background: linear-gradient(140deg,#69aaed,#4976d5); border-radius: 2px; }
    .desktop-tray { display: flex; gap: 17px; align-items: center; }
    #desktopClock { text-align: right; font-size: 11px; line-height: 1.6; white-space: pre-line; font-variant-numeric: tabular-nums; }
    #desktopShow { width: 30px; height: 42px; border: 0; border-left: 1px solid #8ba1c331; background: transparent; color: #5a7094; cursor: pointer; font-size: 21px; padding-left: 10px; }
    #desktopShow:hover { color: #397bd3; }

    .desktop-start { position: fixed; z-index: 10015; bottom: 76px; left: 50%; transform: translateX(-50%); width: 530px; box-sizing: border-box; padding: 30px 28px 0; border: 1px solid #ffffffc9; border-radius: 20px; background: rgba(240,246,255,.96); backdrop-filter: blur(32px); box-shadow: 0 20px 80px #1f36513d; animation: desktop-menu-in .2s ease; }
    .desktop-start-heading { display: flex; flex-direction: column; gap: 8px; font-size: 20px; font-family: "Microsoft YaHei",sans-serif; }
    .desktop-start-heading > span > span { color: #7398d9; font-size: 18px; }
    .desktop-start-heading small { font-size: 11px; color: #8191ae; }
    .desktop-search { margin-top: 24px; display: flex; gap: 9px; align-items: center; padding: 10px 14px; background: #ffffffc9; border: 1px solid #cbd9ee; border-bottom: 2px solid #83a5de; border-radius: 9px; }
    .desktop-search > span { font-size: 23px; line-height: 1; color: #6d87b1; }
    .desktop-search input { background: none; border: 0; outline: 0; width: 100%; color: #34466b; font: 12px "Microsoft YaHei",sans-serif; }
    .desktop-section-label { margin: 25px 0 16px; font-size: 11px; display: flex; justify-content: space-between; }
    .desktop-section-label span { font-size: 8px; letter-spacing: 1px; color: #8b9ab4; }
    .desktop-start-apps { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; padding-bottom: 25px; }
    .desktop-start-apps .desktop-icon { width: 100%; min-height: 88px; }
    .desktop-start-apps .desktop-icon > span:last-child { text-shadow: none; }
    .desktop-search-empty { padding: 10px 0 30px; font-size: 12px; color: #7a8ba7; }
    .desktop-start-footer { margin: 0 -28px; padding: 17px 24px; background: #e1eaf680; border-top: 1px solid #c8d7eb65; border-radius: 0 0 20px 20px; display: flex; align-items: center; justify-content: space-between; }
    .desktop-user { display: flex; gap: 9px; align-items: center; font-size: 12px; }
    .desktop-user > span { width: 30px; height: 30px; border-radius: 50%; background: #769ad8; color: #fff; display: grid; place-items: center; }
    .desktop-user small { font-size: 9px; color: #8a9bb6; margin-left: 4px; }
    .desktop-start-footer button { font: inherit; font-size: 11px; color: #4b6e9e; background: transparent; border: 0; cursor: pointer; padding: 8px; border-radius: 6px; }
    .desktop-start-footer button:hover { background: #fff9; }
    .desktop-context { position: fixed; min-width: 208px; padding: 8px; z-index: 10030; border-radius: 12px; background: #f4f8fff5; border: 1px solid #fff; box-shadow: 0 10px 40px #233c6533; backdrop-filter: blur(20px); }
    .desktop-context-title { display: block; padding: 9px 12px; font-size: 9px; letter-spacing: 1px; color: #8a9bb5; }
    .desktop-context button { display: block; text-align: left; width: 100%; padding: 11px 12px; border: 0; border-radius: 6px; background: transparent; color: #40567a; font: 12px "Microsoft YaHei", sans-serif; cursor: pointer; }
    .desktop-context button:hover, .desktop-context button:focus-visible { background: #e0eafb; outline: none; }
    @keyframes desktop-menu-in { from { opacity: 0; margin-bottom: -10px; } to { opacity: 1; margin-bottom: 0; } }
}

@media (min-width: 1121px) and (max-height: 760px) {
    .desktop-icons { --desktop-icon-height: 65px; gap: 2px; top: 65px; }
    .desktop-icon { gap: 4px; padding: 4px; }
    .desktop-icon .desktop-app-icon { width: 36px; height: 36px; border-radius: 10px; }
    .desktop-welcome { bottom: 115px; }
    .desktop-start { padding-top: 20px; max-height: calc(100vh - 95px); overflow-y: auto; }
    .desktop-start-apps { gap: 3px; padding-bottom: 10px; }
    .desktop-section-label { margin-top: 15px; }
    .desktop-search { margin-top: 15px; }
}
@media (prefers-reduced-motion: reduce) {
    .desktop-shell *, .desktop-shell *::after { animation: none !important; transition: none !important; }
}
