/* ==========================================================================
   Shell — desktop, icons, taskbar, tray, Start menu
   ========================================================================== */
#machine { position: fixed; inset: 0; overflow: hidden; visibility: hidden; background: #000; }
#machine.on { visibility: visible; }
#desktop { position: absolute; inset: 0; overflow: hidden; background: #3A6EA5; transition: filter 2.2s ease; }
#machine.dim #desktop, #machine.dim #taskbar { filter: grayscale(1) brightness(.92); }
#wallpaper { position: absolute; inset: 0; background-color: var(--desk-color, #004E98); background-repeat: no-repeat; background-position: center; background-size: cover; }
#desktop-icons { position: absolute; inset: 0 0 var(--tb-h) 0; }
body.explorer-dead #desktop-icons, body.explorer-dead #taskbar { display: none; }

/* desktop icons */
.dicon { position: absolute; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 0; touch-action: none; cursor: var(--cur-arrow); }
.dicon .dicon-img { position: relative; width: 32px; height: 32px; }
.dicon .dicon-img .ico { width: 32px; height: 32px; }
.dicon .dicon-img .lnk-arrow { position: absolute; left: 0; bottom: 0; width: 11px; height: 11px; background: #fff; border: 1px solid #555; display: grid; place-items: center; }
.dicon .dicon-img .lnk-arrow::after { content: ''; width: 5px; height: 5px; border: solid #1E3C9A; border-width: 2px 2px 0 0; transform: rotate(0deg); margin: 1px 0 0 -1px; }
.dicon .dicon-label {
  max-width: 74px; padding: 0 2px 1px; color: #fff; text-align: center; line-height: 13px; font-size: 11px;
  text-shadow: 1px 1px 1px #000, 1px 1px 2px rgba(0,0,0,.8); word-wrap: break-word; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dicon.sel .dicon-img .ico, .xp-sel-tint { filter: url(#xp-sel); }
.dicon.sel .dicon-label { background: #0B61FF; text-shadow: none; -webkit-line-clamp: unset; }
#desktop.unfocused .dicon.sel .dicon-label { background: transparent; text-shadow: 1px 1px 1px #000; }
#desktop.unfocused .dicon.sel .dicon-img .ico { filter: none; }
.dicon.focus .dicon-label { outline: 1px dotted #fff; outline-offset: -1px; }
.dicon.cut .dicon-img { opacity: .5; }
.dicon.drop-target .dicon-img .ico { filter: url(#xp-sel); }
.dicon.dragging { opacity: .6; }
.dicon .rename { width: 74px; font-size: 11px; text-align: center; border: 1px solid #000; padding: 0 1px; resize: none; overflow: hidden; height: 28px; line-height: 13px; }
.marquee { position: absolute; z-index: 5; border: 1px solid #3169C6; background: rgba(49,106,198,.28); pointer-events: none; }

/* ---------- taskbar ---------- */
#taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--tb-h); z-index: 90000; display: flex; align-items: stretch;
  background: linear-gradient(to bottom, #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%);
  transition: transform .2s ease, filter 2.2s ease;
}
#taskbar.autohide { transform: translateY(calc(var(--tb-h) - 3px)); }
#taskbar.autohide.peek, #taskbar.autohide:hover { transform: none; }
.start-button {
  flex: none; display: flex; align-items: center; gap: 5px; height: 100%; padding: 0 22px 0 8px; margin-right: 8px; border: 0; position: relative;
  border-radius: 0 10px 10px 0; color: #fff; font: italic bold 18px/1 var(--font-title); letter-spacing: .3px;
  text-shadow: 1px 1px 3px rgba(0,0,0,.6);
  background: radial-gradient(ellipse at 50% 170%, #1C6A1A 0%, transparent 55%) , linear-gradient(to bottom, #3D8A3B 0%, #62C35E 8%, #4AB142 18%, #3AA132 50%, #37A12E 80%, #2F8B2B 92%, #266F21 100%);
  box-shadow: inset -2px 0 3px rgba(0,0,0,.35), inset 0 1px 2px rgba(255,255,255,.4), 2px 0 3px rgba(0,0,0,.35);
  cursor: var(--cur-arrow);
}
.start-button .ico { filter: drop-shadow(1px 1px 1px rgba(0,0,0,.5)); }
.start-button:hover { filter: brightness(1.1); }
.start-button.pressed { background: linear-gradient(to bottom, #245A22 0%, #2F7F2A 10%, #2C8526 50%, #2A7C24 90%, #1E5E1B 100%); box-shadow: inset 2px 2px 4px rgba(0,0,0,.45); }
.start-button span { padding-bottom: 2px; }
.quicklaunch { display: flex; align-items: center; gap: 1px; padding: 0 6px 0 4px; position: relative; flex: none; }
.quicklaunch::before, .tasks::before { content: ''; width: 3px; height: 22px; margin-right: 5px; flex: none;
  background: radial-gradient(circle, rgba(255,255,255,.7) 0.8px, transparent 1.2px) 0 0 / 3px 4px, radial-gradient(circle, rgba(0,0,40,.6) 0.8px, transparent 1.2px) 1px 1px / 3px 4px; }
.ql-btn { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 3px; background: none; padding: 0; cursor: var(--cur-arrow); }
.ql-btn:hover { border-color: rgba(255,255,255,.45) rgba(0,0,60,.4) rgba(0,0,60,.4) rgba(255,255,255,.45); background: rgba(255,255,255,.12); }
.ql-btn:active { border-color: rgba(0,0,60,.5) rgba(255,255,255,.4) rgba(255,255,255,.4) rgba(0,0,60,.5); background: rgba(0,0,60,.15); }
.tasks { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; padding-right: 4px; overflow: hidden; }
.task-btn {
  flex: 0 1 160px; min-width: 36px; height: 24px; display: flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 3px; border: 0;
  color: #fff; font-size: 11px; text-align: left; position: relative; cursor: var(--cur-arrow); white-space: nowrap;
  background: linear-gradient(to bottom, #3C81F3 0%, #3F87F7 12%, #3A82F2 50%, #3A7DEE 90%, #2F6ED6 100%);
  box-shadow: inset -1px -1px 0 rgba(0,0,0,.28), inset 1px 1px 0 rgba(255,255,255,.35), 0 0 1px rgba(0,0,0,.4);
}
.task-btn:hover { background: linear-gradient(to bottom, #56A0FD 0%, #5AA4FE 12%, #509AFA 50%, #4C94F7 90%, #3F7FE6 100%); }
.task-btn.active { background: linear-gradient(to bottom, #1A4DAF 0%, #1D56BF 30%, #1E5AC6 100%); box-shadow: inset 1px 1px 3px rgba(0,0,0,.55), inset -1px -1px 0 rgba(255,255,255,.12); }
.task-btn.active:hover { background: linear-gradient(to bottom, #1E57C0 0%, #2461CF 100%); }
.task-btn .t-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.task-btn .t-count { font-weight: normal; }
.task-btn.group .t-arrow { width: 0; height: 0; border: 4px solid transparent; border-top: 4px solid #fff; margin: 4px 0 0 2px; flex: none; }
.task-btn.flash { animation: task-flash 1s steps(1) 6; }
.task-btn.flash.flash-stay { background: linear-gradient(to bottom, #FBB764, #F7A13C 50%, #EE8E23); }
@keyframes task-flash { 0% { background: linear-gradient(to bottom, #FBB764, #F7A13C 50%, #EE8E23); } 50% { background: linear-gradient(to bottom, #3C81F3, #3A7DEE); } }
.tray {
  flex: none; display: flex; align-items: center; gap: 2px; padding: 0 10px 0 6px; color: #fff; position: relative;
  background: linear-gradient(to bottom, #0C59B9 1%, #139EE9 6%, #18B5F2 10%, #139BEB 14%, #1290E8 19%, #0D8DEA 63%, #0D9FF1 81%, #0F9EED 88%, #119BE9 91%, #1392E2 94%, #137ED7 97%, #095BC9 100%);
  border-left: 1px solid #1042AF; box-shadow: inset 1px 0 1px #18BBFF;
}
.tray-chevron { width: 15px; height: 15px; border-radius: 50%; border: 1px solid rgba(255,255,255,.6); background: radial-gradient(circle at 40% 30%, #6BC3FF, #1A7EE2); display: grid; place-items: center; padding: 0; margin-right: 3px; cursor: var(--cur-arrow); }
.tray-chevron::before { content: ''; width: 4px; height: 4px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(45deg); margin-left: 2px; }
.tray-chevron.open::before { transform: rotate(-135deg); margin: 0 2px 0 0; }
.tray-icons { display: flex; align-items: center; gap: 2px; }
.tray-icon { width: 18px; height: 18px; display: grid; place-items: center; cursor: var(--cur-arrow); position: relative; }
.tray-icon.pop { animation: tray-pop .3s ease-out; }
@keyframes tray-pop { from { transform: scale(.3); opacity: 0; } }
.tray-icon.hidden-inactive { display: none; }
.tray.expanded .tray-icon.hidden-inactive { display: grid; }
.clock { padding: 0 2px 0 6px; font-size: 11px; white-space: nowrap; cursor: var(--cur-arrow); text-shadow: 0 0 1px rgba(0,0,0,.2); }

.volume-pop { position: fixed; z-index: 99100; width: 70px; height: 150px; background: var(--xp-face); border: 1px solid #000; box-shadow: inset 1px 1px #fff, 2px 2px 4px rgba(0,0,0,.3); display: flex; flex-direction: column; align-items: center; padding: 8px 4px; gap: 6px; }
.volume-pop input[type=range] { writing-mode: vertical-lr; direction: rtl; height: 90px; width: 22px; }

/* ---------- Start menu ---------- */
#startmenu-root { position: absolute; left: 0; bottom: var(--tb-h); z-index: 95000; }
.startmenu {
  position: absolute; left: 0; bottom: 0; width: 380px; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 7px 7px 0 0; background: #4282D6; box-shadow: 2px 0 4px rgba(0,0,0,.45), 0 -1px 2px rgba(0,0,0,.2);
  border: 1px solid #1A51B3; border-bottom: 0; transform-origin: bottom left;
}
.startmenu.opening { animation: sm-slide .16s ease-out; }
@keyframes sm-slide { from { clip-path: inset(100% 0 0 0); } to { clip-path: inset(0 0 0 0); } }
.sm-head {
  height: 60px; display: flex; align-items: center; gap: 7px; padding: 6px 8px; flex: none;
  background: linear-gradient(to bottom, #1868CE 0%, #0E60CB 12%, #0E60CB 20%, #1164CF 32%, #1667CF 33%, #1B6CD3 47%, #1E70D9 54%, #2476DC 60%, #297AE0 65%, #3482E3 77%, #3786E5 79%, #428EE9 90%, #4791EB 100%);
  box-shadow: inset 0 1px #6FA4F0; border-radius: 6px 6px 0 0;
}
.sm-head .sm-pic { width: 48px; height: 48px; border: 2px solid #fff; border-radius: 3px; overflow: hidden; background: #fff; box-shadow: 1px 1px 3px rgba(0,0,0,.45); flex: none; display: grid; place-items: center; cursor: var(--cur-hand); }
.sm-head .sm-pic .ico { width: 44px; height: 44px; }
.sm-head .sm-name { color: #fff; font: bold 14px var(--font-title); text-shadow: 1px 1px 2px #102A7A; }
.sm-orange { height: 2px; flex: none; background: linear-gradient(to right, transparent 0%, #DA884A 30%, #F8C290 50%, #DA884A 70%, transparent 100%); }
.sm-body { display: flex; min-height: 0; background: #fff; border-left: 1px solid #FFF; }
.sm-left { width: 50%; background: #fff; padding: 6px 0 0; display: flex; flex-direction: column; }
.sm-right { width: 50%; background: #D3E5FA; border-left: 1px solid #95BDEE; padding: 6px 0; display: flex; flex-direction: column; }
.sm-item { display: flex; align-items: center; gap: 6px; padding: 3px 6px; margin: 0 4px; color: #000; cursor: var(--cur-arrow); min-height: 22px; position: relative; border-radius: 0; }
.sm-left .sm-item { min-height: 36px; padding: 2px 6px; }
.sm-left .sm-item .ico { width: 32px; height: 32px; }
.sm-item .sm-text { display: flex; flex-direction: column; line-height: 13px; min-width: 0; }
.sm-item .sm-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-item .sm-sub { color: #808080; font-size: 11px; }
.sm-item:hover, .sm-item.hot { background: #316AC5; color: #fff; }
.sm-item:hover .sm-sub, .sm-item.hot .sm-sub { color: #fff; }
.sm-right .sm-item { color: #00136B; min-height: 26px; }
.sm-right .sm-item:hover, .sm-right .sm-item.hot { color: #fff; }
.sm-right .sm-item.strong { font-weight: bold; }
.sm-right .sm-item.arrow::after, .sm-allprog::after { content: ''; position: absolute; right: 8px; top: 50%; margin-top: -4px; border: 4px solid transparent; border-left: 4px solid currentColor; border-right: 0; }
.sm-sep { height: 1px; margin: 4px 10px; background: linear-gradient(to right, transparent, #C3C3C3 20%, #C3C3C3 80%, transparent); flex: none; }
.sm-right .sm-sep { background: linear-gradient(to right, transparent, #A7C3EA 20%, #A7C3EA 80%, transparent); }
.sm-mfu { flex: 1; }
.sm-allprog { justify-content: center; font-weight: bold; gap: 8px; min-height: 28px !important; margin-bottom: 5px !important; position: relative; }
.sm-allprog::after { display: none; }
.sm-allprog .green-arrow { width: 22px; height: 18px; border-radius: 3px; background: linear-gradient(to bottom, #72D05C, #3A9B24); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(0,60,0,.35); }
.sm-allprog .green-arrow::after { content: ''; border: 5px solid transparent; border-left: 7px solid #fff; border-right: 0; margin-left: 3px; }
.sm-foot {
  height: 40px; flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 0 6px;
  background: linear-gradient(to bottom, #4282D6 0%, #3B85E0 3%, #418AE3 5%, #418AE3 17%, #3C87E2 21%, #3786E4 26%, #3482E3 29%, #2E7EE1 39%, #2375DE 49%, #1C6FDA 57%, #196EDB 62%, #176BD8 72%, #1468D6 75%, #1266D5 83%, #1165D2 88%, #1063D0 95%, #0E61CF 100%);
}
.sm-foot button { display: flex; align-items: center; gap: 5px; background: transparent; border: 0; color: #fff; font-size: 11px; padding: 3px 6px; cursor: var(--cur-arrow); border-radius: 3px; }
.sm-foot button:hover { background: rgba(255,255,255,.15); }
.xp-menu.start-cascade { padding: 1px; border-color: #A0A0A0; background: #fff; }
.xp-menu.start-cascade .mi { height: 22px; }
.xp-menu.start-cascade .mi .mi-check { width: 26px; }
.xp-menu.start-cascade .mi.hot { background: #316AC5; }

/* phone */
@media (max-width: 640px) {
  .startmenu { width: 100vw; max-height: calc(100dvh - var(--tb-h)); }
  .sm-body { overflow-y: auto; }
  .sm-left .sm-item { min-height: 34px; }
  .sm-right .sm-item { min-height: 32px; }
  .quicklaunch { display: none; }
  .start-button { padding-right: 14px; font-size: 17px; }
  .task-btn { flex: 0 1 44px; padding: 0 6px; justify-content: center; }
  .task-btn .t-label, .task-btn .t-count { display: none; }
  .task-btn.group .t-arrow { display: none; }
  .tray { padding: 0 6px 0 4px; }
  .dicon .dicon-label { font-size: 11px; }
}
@media (max-width: 380px) { .sm-body { flex-direction: column; } .sm-left, .sm-right { width: 100%; } }
.ptr-trail { position: fixed; left: 0; top: 0; width: 32px; height: 32px; pointer-events: none; z-index: 300000; display: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M1 1v17l4-4 3 7 3-1-3-7h6z' fill='%23fff' stroke='%23000'/%3E%3C/svg%3E") no-repeat; }
