:root {
  color-scheme: light dark;
  font: 16px/1.5 system-ui, "Microsoft YaHei", sans-serif;
  --desk-page: #f3f5fb;
  --desk-surface: #fff;
  --desk-text: #16213a;
  --desk-muted: #53617a;
  --desk-border: #dbe1ef;
  --desk-accent: #4d4ad9;
  --desk-tile: #e9e9fe;
}
@media (prefers-color-scheme: dark) {
  :root {
    --desk-page: #161b2b;
    --desk-surface: #222b40;
    --desk-text: #eef2ff;
    --desk-muted: #b7c2d9;
    --desk-border: #3a4560;
    --desk-accent: #a9abff;
    --desk-tile: #333762;
  }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--desk-page); color: var(--desk-text); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--desk-accent); outline-offset: 2px; }
.desktop-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  min-height: 66px;
  padding: 10px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--desk-border);
  background: var(--desk-surface);
}
.desktop-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.desktop-mark { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: white; background: #5550e6; font-size: 1.6rem; }
.desktop-bar h1 { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.desktop-viewer { color: var(--desk-muted); font-size: .9rem; overflow-wrap: anywhere; }
.desktop-account { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.desktop-account details { position: relative; }
.desktop-account summary, .desktop-account button {
  padding: 5px 9px;
  border: 1px solid var(--desk-border);
  border-radius: 8px;
  background: var(--desk-surface);
  color: var(--desk-text);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
}
.desktop-account-panel {
  position: absolute;
  z-index: 2;
  top: calc(100% + 6px);
  right: 0;
  width: min(255px, calc(100vw - 36px));
  max-height: 45vh;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--desk-border);
  border-radius: 12px;
  background: var(--desk-surface);
  box-shadow: 0 10px 28px #10182d1c;
}
.desktop-account-panel button { text-align: left; overflow-wrap: anywhere; }
.desktop-account-panel p { margin: 0; color: var(--desk-muted); font-size: .86rem; }
@media (max-width: 620px) {
  .desktop-account-panel { left: 0; right: auto; }
}
.desktop { padding: clamp(14px, 2.5vw, 32px); }
#desktop-message { margin: 0 0 12px; color: var(--desk-muted); }
#desktop-message:empty { margin: 0; }

/* The system desktop's icon grid. The project can style these tiles independently. */
#apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 112px), 136px)); gap: 16px; align-items: start; }
.desktop-tile {
  position: relative;
  min-width: 0;
  min-height: 124px;
  border: 1px solid transparent;
  border-radius: 18px;
  transition: background-color .16s, border-color .16s, box-shadow .16s, transform .16s;
}
.desktop-tile:is(:hover, :focus-within, .is-moving, .is-target) { background: var(--desk-surface); border-color: var(--desk-border); }
.desktop-tile.is-moving { transform: scale(.96); opacity: .7; }
.desktop-tile.is-target { border-color: var(--desk-accent); box-shadow: 0 0 0 2px var(--desk-accent); }
.desktop-open {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  width: 100%;
  min-height: 124px;
  padding: 23px 7px 10px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  text-align: center;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.desktop-icon { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 17px; color: var(--desk-accent); background: var(--desk-tile); box-shadow: 0 3px 8px #10182c18; font-size: 1.5rem; }
.desktop-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
[data-icon="marketplace"] { background: #e3edff; color: #2149b4; }
[data-icon="workspace-file-manager"] { background: #dff4ed; color: #11644e; }
[data-icon="users"] { background: #efe7fb; color: #663ba0; }
[data-icon="workspace-traffic"] { background: #faeed9; color: #845418; }
.desktop-tool {
  position: absolute;
  top: 2px;
  min-width: 28px;
  min-height: 28px;
  padding: 1px 5px;
  border: 1px solid var(--desk-border);
  border-radius: 8px;
  background: var(--desk-surface);
  color: var(--desk-muted);
  font-size: .72rem;
}
.desktop-grip { left: 2px; cursor: grab; touch-action: none; user-select: none; }
.desktop-properties { right: 2px; }
.desktop-pin { position: absolute; bottom: 8px; right: 8px; color: var(--desk-accent); font-size: .7rem; pointer-events: none; }
.desktop-tile:has(.desktop-pin) .desktop-open { padding-bottom: 21px; }
.desktop-tile.is-moving .desktop-grip { cursor: grabbing; }
@media (hover: hover) {
  .desktop-tile:not(:is(:hover, :focus-within, .is-moving)) .desktop-tool { opacity: 0; }
}
@media (max-width: 620px) {
  #apps { grid-template-columns: repeat(auto-fill, minmax(min(100%, 90px), 1fr)); gap: 8px; }
  .desktop-open, .desktop-tile { min-height: 112px; }
  .desktop-icon { width: 52px; height: 52px; border-radius: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .desktop-tile { transition: none; }
}

#hidden-apps { max-width: 540px; margin: 22px 0; padding: 10px 14px; background: var(--desk-surface); border: 1px solid var(--desk-border); border-radius: 12px; }
#hidden-apps summary { cursor: pointer; }
#hidden-apps ul { list-style: none; padding: 0; margin: 8px 0 0; }
#hidden-apps li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 0; overflow-wrap: anywhere; }
#hidden-apps button, #properties button { padding: 5px 10px; border: 1px solid var(--desk-border); border-radius: 8px; background: var(--desk-surface); }
#hidden-apps button { white-space: nowrap; }
#properties { width: min(420px, calc(100% - 32px)); padding: 18px; color: var(--desk-text); background: var(--desk-surface); border: 1px solid var(--desk-border); border-radius: 16px; }
#properties::backdrop { background: #151c345c; }
#properties header { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
#properties h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
#properties dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 15px; }
#properties dt { color: var(--desk-muted); }
#properties dd { margin: 0; overflow-wrap: anywhere; }
.property-actions { display: flex; gap: 8px; }
