*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  -webkit-font-smoothing: antialiased;
}
button {
  font: inherit;
  color: inherit;
}

:root {
  --pearl:     #ffda94;
  --pearl-rgb: 255, 218, 148;
  --rose:      #e69552;
  --rose-rgb:  230, 149, 82;
  --hotrose:   #a73e2c;
  --hotrose-rgb: 167, 62, 44;
  --aqua:      #ffd64a;
  --aqua-rgb:  255, 214, 74;
  --lilac:     #c58129;
  --lilac-rgb: 197, 129, 41;

  --text:       #ffda94;
  --text-soft:  #eeba73;
  --text-muted: #e69552;
  --text-dark:  #090706;

  --paper:      #ffda94;
  --paper-text: #090706;

  --border:        #e69552;
  --border-bright: #ffda94;

  --btn-bg:   #ffda94;
  --btn-bg2:  #ffd64a;
  --btn-bg3:  #eeba73;
  --btn-text: #090706;

  --win-bg:    #eeba73;
  --win-title: #732820;
  --win-text:  #090706;

  --wrap-a: #090706;
  --wrap-b: #1d1613;
  --wrap-c: #332923;

  --win-accent: color-mix(in oklch, var(--hotrose) 50%, var(--win-text));
  --win-text-soft: color-mix(in oklch, var(--win-text) 88%, var(--win-bg));

  --glass: linear-gradient(135deg, rgba(var(--pearl-rgb),0.20), rgba(var(--aqua-rgb),0.14), rgba(var(--rose-rgb),0.16));
  --glass-border: rgba(255,255,255,0.42);

  --desktop-gradient:
    radial-gradient(circle at 18% 20%, rgba(var(--hotrose-rgb),0.24), transparent 34%),
    radial-gradient(circle at 80% 22%, rgba(var(--aqua-rgb),0.20), transparent 36%),
    radial-gradient(circle at 50% 80%, rgba(var(--lilac-rgb),0.20), transparent 36%),
    linear-gradient(135deg, var(--wrap-a), var(--wrap-b) 48%, var(--wrap-c));
  --wallpaper-image: none;

  --font-main:   'Architects Daughter', 'Segoe Print', 'Comic Sans MS', cursive;
  --font-mono:   'Courier New', monospace;
  --font-accent: 'Architects Daughter', 'Segoe Print', 'Comic Sans MS', cursive;

  --fs-xs:   10px;
  --fs-sm:   12px;
  --fs-base: 14px;
  --fs-md:   16px;
  --fs-lg:   20px;

  --taskbar-height: 52px;
  --radius: 6px;
}

:root {
  --win-surface: color-mix(in oklch, white 38%, var(--win-bg));
  --win-sunken: color-mix(in oklch, var(--win-text) 7%, var(--win-bg));
  --win-hover: color-mix(in oklch, var(--win-text) 9%, transparent);
  --win-pressed: color-mix(in oklch, var(--win-text) 15%, transparent);
  --win-selected: color-mix(in oklch, var(--win-accent) 16%, transparent);
  --win-line: color-mix(in oklch, var(--win-text) 16%, transparent);
  --win-border-strong: color-mix(in oklch, var(--win-text) 68%, var(--win-bg));
  --win-focus-ring: 0 0 0 2px var(--win-bg), 0 0 0 4px var(--win-accent);

  --shell-bg: color-mix(in srgb, var(--wrap-a) 90%, transparent);
  --shell-glass: linear-gradient(135deg, rgba(var(--pearl-rgb),0.10), rgba(var(--aqua-rgb),0.07), rgba(var(--rose-rgb),0.08));
  --shell-panel: var(--shell-glass), var(--shell-bg);
  --shell-text-soft: color-mix(in oklch, var(--text) 88%, var(--wrap-a));
  --shell-border: var(--glass-border);
  --shell-blur: blur(18px) saturate(1.2);
  --shell-shadow: 0 16px 40px rgba(0,0,0,0.45);
  --shell-hover: rgba(255,255,255,0.12);
  --shell-pressed: rgba(255,255,255,0.18);
  --shell-selected: color-mix(in srgb, var(--pearl) 18%, transparent);
  --shell-danger: rgba(255,80,80,0.28);
  --shell-line: rgba(255,255,255,0.14);
  --shell-focus-ring: 0 0 0 2px var(--pearl);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius-sm: calc(var(--radius) - 2px);
  --radius-lg: calc(var(--radius) + 4px);
  --radius-pill: 999px;

  --control-h: 32px;
  --row-h: 36px;
  --toolbar-h: 44px;
  --statusbar-h: 30px;
  --titlebar-h: 34px;
  --icon-sm: 16px;
  --icon-md: 20px;
  --icon-lg: 32px;
  --icon-xl: 48px;

  --dur-fast: 120ms;
  --dur-med: 200ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  --compact: 0;
}

@media (pointer: coarse) {
  :root {
    --control-h: 44px;
    --row-h: 44px;
    --toolbar-h: 56px;
    --statusbar-h: 40px;
    --titlebar-h: 44px;
    --fs-xs: 12px;
  }
}

@media (max-width: 599px), (max-height: 499px) {
  :root {
    --compact: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

button, a, input, label, select, textarea, [role="button"] {
  touch-action: manipulation;
}

.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: var(--control-h);
  padding: 0 var(--space-3);
  border: 1px solid var(--win-line);
  border-radius: var(--radius);
  background: var(--win-surface);
  color: var(--win-text);
  font: var(--fs-sm) var(--font-main);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.ui-btn--primary {
  border-color: transparent;
  background: var(--win-text);
  color: var(--win-bg);
}

.ui-icon-btn {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  inline-size: var(--control-h);
  block-size: var(--control-h);
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--win-text);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.ui-icon-btn svg {
  inline-size: var(--icon-md);
  block-size: var(--icon-md);
  fill: currentColor;
}
.ui-icon-btn[aria-pressed="true"] {
  background: var(--win-selected);
  color: var(--win-accent);
}

.ui-field {
  min-block-size: var(--control-h);
  min-inline-size: 0;
  padding: 0 var(--space-3);
  border: 1px solid var(--win-border-strong);
  border-radius: var(--radius);
  background: var(--win-surface);
  color: var(--win-text);
  font: var(--fs-sm) var(--font-main);
}
.ui-field::placeholder {
  color: var(--win-text-soft);
  opacity: 1;
}

.ui-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--win-line);
  border-radius: var(--radius-pill);
  background: var(--win-sunken);
}
.ui-segmented > button {
  display: inline-grid;
  place-items: center;
  min-block-size: calc(var(--control-h) - 6px);
  min-inline-size: calc(var(--control-h) - 6px);
  padding: 0 var(--space-2);
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--win-text);
  font: var(--fs-sm) var(--font-main);
  cursor: pointer;
}
.ui-segmented > button svg {
  inline-size: var(--icon-sm);
  block-size: var(--icon-sm);
  fill: currentColor;
}
.ui-segmented > button[aria-pressed="true"] {
  background: var(--win-surface);
  box-shadow: 0 1px 2px rgba(0,0,0,0.18);
}

.ui-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-block-size: var(--toolbar-h);
  padding: 0 var(--space-2);
  border-block-end: 1px solid var(--win-line);
  background: var(--win-sunken);
}

.ui-toolbar-sep {
  flex-shrink: 0;
  align-self: stretch;
  inline-size: 1px;
  margin-block: var(--space-2);
  background: var(--win-line);
}

.ui-statusbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: var(--statusbar-h);
  padding: 0 var(--space-3);
  border-block-start: 1px solid var(--win-line);
  background: var(--win-sunken);
  color: var(--win-text-soft);
  font: var(--fs-sm) var(--font-main);
}

.ui-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  inline-size: 100%;
  min-block-size: var(--row-h);
  padding: 0 var(--space-3);
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--win-text);
  font: var(--fs-base) var(--font-main);
  text-align: start;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.ui-row[aria-current="true"],
.ui-row[aria-selected="true"],
.ui-row.is-selected {
  background: var(--win-selected);
  box-shadow: inset 3px 0 0 var(--win-text);
}

.ui-heading {
  margin: 0;
  color: var(--win-text-soft);
  font: var(--fs-xs) var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ui-range {
  --fill: 0%;
  appearance: none;
  inline-size: 100%;
  block-size: 20px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.ui-range::-webkit-slider-runnable-track {
  block-size: 4px;
  border-radius: var(--radius-pill);
  background: linear-gradient(to right, var(--win-accent) var(--fill), var(--win-line) var(--fill));
}
.ui-range::-webkit-slider-thumb {
  appearance: none;
  inline-size: 14px;
  block-size: 14px;
  margin-block-start: -5px;
  border: 2px solid var(--win-bg);
  border-radius: 50%;
  background: var(--win-accent);
}
.ui-range::-moz-range-track {
  block-size: 4px;
  border-radius: var(--radius-pill);
  background: var(--win-line);
}
.ui-range::-moz-range-progress {
  block-size: 4px;
  border-radius: var(--radius-pill);
  background: var(--win-accent);
}
.ui-range::-moz-range-thumb {
  inline-size: 10px;
  block-size: 10px;
  border: 2px solid var(--win-bg);
  border-radius: 50%;
  background: var(--win-accent);
}
.ui-range:focus-visible {
  outline: none;
}
.ui-range:focus-visible::-webkit-slider-thumb {
  box-shadow: var(--win-focus-ring);
}
.ui-range:focus-visible::-moz-range-thumb {
  box-shadow: var(--win-focus-ring);
}

.ui-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

@media (hover: hover) {
  .ui-btn:hover { border-color: var(--win-border-strong); }
  .ui-btn--primary:hover { background: color-mix(in oklch, var(--win-text) 85%, var(--win-bg)); }
  .ui-icon-btn:hover,
  .ui-segmented > button:hover,
  .ui-row:hover { background-color: var(--win-hover); }
  .ui-icon-btn[aria-pressed="true"]:hover { background: var(--win-selected); }
  .ui-segmented > button[aria-pressed="true"]:hover { background: var(--win-surface); }
}
.ui-btn:active,
.ui-icon-btn:active,
.ui-segmented > button:active {
  transform: scale(0.96);
}
.ui-row:active {
  background-color: var(--win-pressed);
}
.ui-btn:focus-visible,
.ui-icon-btn:focus-visible,
.ui-field:focus-visible,
.ui-segmented > button:focus-visible,
.ui-row:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--win-focus-ring);
}
.ui-row[aria-current="true"]:focus-visible,
.ui-row[aria-selected="true"]:focus-visible,
.ui-row.is-selected:focus-visible {
  box-shadow: inset 3px 0 0 var(--win-text), var(--win-focus-ring);
}
.ui-btn:disabled,
.ui-icon-btn:disabled,
.ui-segmented > button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}
@media (pointer: coarse) {
  .ui-field { font-size: 16px; }
  .ui-range { block-size: 28px; }
  .ui-range::-webkit-slider-thumb {
    inline-size: 18px;
    block-size: 18px;
    margin-block-start: -7px;
  }
  .ui-range::-moz-range-thumb {
    inline-size: 14px;
    block-size: 14px;
  }
}

.shell-panel {
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-lg);
  background: var(--shell-panel);
  backdrop-filter: var(--shell-blur);
  box-shadow: var(--shell-shadow);
  color: var(--text);
}

.shell-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  inline-size: 100%;
  min-block-size: var(--row-h);
  padding: 0 var(--space-3);
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: var(--fs-sm) var(--font-mono);
  letter-spacing: 0.5px;
  text-align: start;
  white-space: nowrap;
  cursor: pointer;
}
@media (hover: hover) {
  .shell-item:hover { background: var(--shell-hover); }
}
.shell-item:active { background: var(--shell-pressed); }
.shell-item:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--shell-focus-ring);
}
.shell-item[aria-current="true"],
.shell-item.is-active {
  background: var(--shell-selected);
}

.shell-icon-btn {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  inline-size: var(--control-h);
  block-size: var(--control-h);
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.shell-icon-btn svg,
.shell-icon-btn img {
  inline-size: var(--icon-sm);
  block-size: var(--icon-sm);
  object-fit: contain;
  fill: currentColor;
}

.shell-btn {
  min-block-size: var(--control-h);
  padding: 0 var(--space-4);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: var(--fs-sm) var(--font-mono);
  letter-spacing: 0.5px;
  cursor: pointer;
}
.shell-btn--primary {
  border-color: transparent;
  background: var(--text);
  color: var(--wrap-a);
  font-weight: 700;
}

.shell-field {
  inline-size: 100%;
  min-block-size: var(--control-h);
  padding: 0 var(--space-3);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.28);
  color: var(--text);
  font: var(--fs-sm) var(--font-mono);
}
.shell-field::placeholder {
  color: var(--shell-text-soft);
  opacity: 1;
}

.shell-heading {
  margin: 0;
  padding: var(--space-2) var(--space-3) var(--space-1);
  color: var(--shell-text-soft);
  font: var(--fs-xs) var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (hover: hover) {
  .shell-icon-btn:hover,
  .shell-btn:hover { background: var(--shell-hover); }
  .shell-btn--primary:hover { background: color-mix(in srgb, var(--text) 85%, var(--wrap-a)); }
}
.shell-icon-btn:active,
.shell-btn:active { background: var(--shell-pressed); }
.shell-btn--primary:active { background: color-mix(in srgb, var(--text) 75%, var(--wrap-a)); }
.shell-icon-btn:focus-visible,
.shell-btn:focus-visible,
.shell-field:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--shell-focus-ring);
}
@media (pointer: coarse) {
  .shell-field { font-size: 16px; }
}

.is-drop-target {
  outline: 2px dashed var(--win-accent);
  outline-offset: -3px;
  background-color: var(--win-selected);
}

.os-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1250;
  display: grid;
  justify-items: center;
  gap: var(--space-1);
  max-inline-size: 160px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-lg);
  background: var(--shell-panel);
  box-shadow: var(--shell-shadow);
  color: var(--text);
  font: var(--fs-xs) var(--font-mono);
  text-align: center;
  pointer-events: none;
  will-change: transform;
}
.os-drag-ghost img {
  inline-size: var(--icon-lg);
  block-size: var(--icon-lg);
  object-fit: contain;
}
.os-drag-ghost-hint {
  color: var(--shell-text-soft);
}

body {
  font-family: var(--font-main);
  font-size: var(--fs-base);
  color: var(--text);
  background: #121212;
  overflow: hidden;
}

.widget-instance {
  height: 100%;
}

.icon-glow {
  filter: drop-shadow(0 0 8px rgba(var(--hotrose-rgb),0.35));
}

#desktop {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--desktop-gradient);
}

#desktop-wallpaper {
  position: absolute;
  inset: 0;
  background-image: var(--wallpaper-image);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

#desktop-canvas {
  position: relative;
  flex: 1;
  overflow: hidden;
}

#app-grid-root {
  position: absolute;
  inset: 0;
}

#popup-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#taskbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  block-size: var(--taskbar-height);
  padding: 0 var(--space-2);
  border-block-start: 1px solid var(--shell-line);
  background: color-mix(in srgb, var(--wrap-a) 82%, transparent);
  backdrop-filter: var(--shell-blur);
  color: var(--text);
  font: var(--fs-sm) var(--font-mono);
}

.taskbar-icon-button,
.taskbar-tab,
.taskbar-clock-button,
.taskbar-show-desktop {
  flex-shrink: 0;
  block-size: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
  -webkit-touch-callout: none;
}
.taskbar-icon-button,
.taskbar-show-desktop {
  display: grid;
  place-items: center;
  inline-size: 40px;
  padding: 0;
}
.taskbar-icon-button img {
  inline-size: 22px;
  block-size: 22px;
  object-fit: contain;
}
.taskbar-show-desktop svg {
  inline-size: var(--icon-sm);
  block-size: var(--icon-sm);
  fill: currentColor;
}
@media (hover: hover) {
  .taskbar-icon-button:hover,
  .taskbar-tab:hover,
  .taskbar-clock-button:hover,
  .taskbar-show-desktop:hover { background: var(--shell-hover); }
}
.taskbar-icon-button:active,
.taskbar-tab:active,
.taskbar-clock-button:active,
.taskbar-show-desktop:active { background: var(--shell-pressed); }
.taskbar-icon-button.is-active,
.taskbar-clock-button.is-active {
  background: var(--shell-selected);
  border-color: var(--shell-border);
}
.taskbar-icon-button:focus-visible,
.taskbar-tab:focus-visible,
.taskbar-clock-button:focus-visible,
.taskbar-show-desktop:focus-visible,
.taskbar-scroll:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--shell-focus-ring);
}

.taskbar-divider {
  flex-shrink: 0;
  inline-size: 1px;
  block-size: 26px;
  margin: 0 var(--space-1);
  background: var(--shell-line);
}

.taskbar-clock-button {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  padding: 0 var(--space-3);
  font: var(--fs-sm) var(--font-mono);
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  text-align: end;
}
.taskbar-clock-date {
  color: var(--shell-text-soft);
  font-size: var(--fs-xs);
}
.taskbar-clock-time {
  min-inline-size: calc(8ch + 4px);
}
.taskbar-clock-date {
  min-inline-size: calc(11ch + 6px);
}

.taskbar-tabs-wrap {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}

#taskbar-tabs {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
#taskbar-tabs::-webkit-scrollbar {
  display: none;
}
#taskbar-tabs.fade-end {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
#taskbar-tabs.fade-start {
  -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
}
#taskbar-tabs.fade-start.fade-end {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}

.taskbar-scroll {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  inline-size: 24px;
  block-size: 40px;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--shell-text-soft);
  cursor: pointer;
}
.taskbar-scroll svg {
  inline-size: 18px;
  block-size: 18px;
  fill: currentColor;
}
.taskbar-scroll[hidden] {
  display: none;
}

.taskbar-tab {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 44px;
  padding: 0;
  touch-action: pan-x;
  user-select: none;
}
.taskbar-tab.is-active {
  background: var(--shell-selected);
}
.taskbar-tab.is-dragging {
  z-index: 2;
  cursor: grabbing;
}
.taskbar-tab-icon-img {
  inline-size: 24px;
  block-size: 24px;
  object-fit: contain;
}
.taskbar-tab-icon {
  font-size: 18px;
  line-height: 1;
}
.taskbar-tab.is-loading {
  cursor: progress;
}
.taskbar-tab.is-loading .taskbar-tab-icon-img {
  animation: taskbar-loading 0.8s ease-in-out infinite alternate;
}
@keyframes taskbar-loading {
  to { opacity: 0.45; }
}

.taskbar-tab-indicator {
  position: absolute;
  bottom: 2px;
  left: calc(50% - 8px);
  inline-size: 16px;
  block-size: 3px;
  border-radius: var(--radius-pill);
  background: var(--text-soft);
  opacity: 0;
  transform: scaleX(0.4);
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.taskbar-tab.is-running .taskbar-tab-indicator {
  opacity: 1;
}
.taskbar-tab.is-active .taskbar-tab-indicator {
  background: var(--pearl);
  transform: none;
}

.taskbar-tab-count {
  position: absolute;
  top: 2px;
  right: 3px;
  min-inline-size: 15px;
  block-size: 15px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--text);
  color: var(--wrap-a);
  font: 700 10px/15px var(--font-mono);
  text-align: center;
}
.taskbar-tab-count[hidden] {
  display: none;
}

.taskbar-group-menu {
  position: fixed;
  z-index: 1000;
  bottom: calc(var(--taskbar-height) + var(--space-2));
  inline-size: min(240px, calc(100vw - 16px));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-1);
}
.taskbar-group-menu[hidden] {
  display: none;
}

.taskbar-group-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.taskbar-group-item {
  flex: 1;
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.taskbar-group-item.is-minimized {
  color: var(--shell-text-soft);
}
@media (hover: hover) {
  .taskbar-group-close:hover { background: var(--shell-danger); }
}

.context-menu {
  position: fixed;
  z-index: 1000;
  min-inline-size: 210px;
  max-inline-size: calc(100vw - 16px);
  padding: var(--space-1);
}
.context-menu[hidden] {
  display: none;
}
.context-menu-icon {
  flex-shrink: 0;
  inline-size: 18px;
  block-size: 18px;
  object-fit: contain;
  fill: currentColor;
}
.context-menu-separator {
  block-size: 1px;
  margin: var(--space-1) var(--space-2);
  background: var(--shell-line);
}

.start-menu {
  position: fixed;
  z-index: 1000;
  left: var(--space-2);
  bottom: calc(var(--taskbar-height) + var(--space-2));
  inline-size: min(340px, calc(100vw - 16px));
  max-block-size: min(560px, calc(100dvh - var(--taskbar-height) - 24px));
  display: flex;
  flex-direction: column;
  padding: var(--space-2);
}
.start-menu[hidden] {
  display: none;
}

.start-menu-search-wrap {
  position: relative;
  flex-shrink: 0;
  margin-block-end: var(--space-1);
}
.start-menu-search-icon {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  inline-size: var(--icon-sm);
  block-size: var(--icon-sm);
  margin-block-start: calc(var(--icon-sm) / -2);
  fill: var(--shell-text-soft);
  pointer-events: none;
}
.start-menu-search {
  padding-inline-start: calc(var(--space-3) + var(--icon-sm) + var(--space-2));
}

.start-menu-apps {
  flex: 1;
  min-block-size: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.start-menu-app-icon {
  flex-shrink: 0;
  inline-size: 24px;
  block-size: 24px;
  object-fit: contain;
}
.start-menu-app-name {
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.start-menu-empty {
  margin: 0;
  padding: var(--space-3);
  color: var(--shell-text-soft);
  font: var(--fs-sm) var(--font-mono);
}

.start-menu-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-block-start: var(--space-2);
  padding-block-start: var(--space-2);
  border-block-start: 1px solid var(--shell-line);
}
.start-menu-user {
  flex: 1;
  min-inline-size: 0;
}
.start-menu-avatar {
  flex-shrink: 0;
  inline-size: 28px;
  block-size: 28px;
  border-radius: 50%;
  object-fit: cover;
}
.start-menu-power img {
  inline-size: 20px;
  block-size: 20px;
}
@media (hover: hover) {
  .start-menu-power:hover { background: var(--shell-danger); }
}

.start-menu,
.context-menu,
.taskbar-group-menu,
.notification-history-menu {
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
@starting-style {
  .start-menu,
  .taskbar-group-menu,
  .notification-history-menu {
    opacity: 0;
    transform: translateY(8px);
  }
  .context-menu {
    opacity: 0;
    transform: scale(0.97);
  }
}

.confirm-dialog {
  inline-size: min(380px, calc(100vw - 32px));
  max-inline-size: none;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text);
  overflow: visible;
}
.confirm-dialog::backdrop {
  background: rgba(0,0,0,0.5);
}
.confirm-dialog-panel {
  padding: var(--space-5);
}
.confirm-dialog[open] .confirm-dialog-panel {
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
@starting-style {
  .confirm-dialog[open] .confirm-dialog-panel {
    opacity: 0;
    transform: scale(0.96);
  }
}
.confirm-dialog-message {
  margin: 0 0 var(--space-4);
  color: var(--text);
  font: var(--fs-base) var(--font-main);
  line-height: 1.5;
}
.confirm-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}
.password-dialog-input {
  margin-block-end: var(--space-2);
}
.password-dialog-error {
  margin: 0 0 var(--space-3);
  color: #ffb4b4;
  font: var(--fs-sm) var(--font-mono);
}
.password-dialog-error[hidden] {
  display: none;
}

.power-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  transition: opacity 0.4s ease;
}
@starting-style {
  .power-overlay {
    opacity: 0;
  }
}
.power-overlay[hidden] {
  display: none;
}
.power-overlay.is-leaving {
  opacity: 0;
}
.is-booting .power-overlay[hidden] {
  display: flex;
}
.is-booting .power-overlay {
  transition: none;
}

.power-on-button {
  inline-size: 84px;
  block-size: 84px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  animation: power-pulse 2.2s ease-in-out infinite;
}
.power-on-button[hidden] {
  display: none;
}
.power-on-button:focus-visible {
  outline: 2px solid rgba(80,255,120,0.9);
  outline-offset: 4px;
}
.power-on-button img {
  inline-size: 64px;
  block-size: 64px;
  object-fit: contain;
}
@keyframes power-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(80,255,120,0.5)); transform: scale(1); }
  50%      { filter: drop-shadow(0 0 18px rgba(80,255,120,0.85)); transform: scale(1.06); }
}

.power-boot-log {
  inline-size: min(560px, 86vw);
  min-block-size: calc(14px * 1.6 * 7 + 32px);
  max-block-size: 70vh;
  overflow-y: auto;
  margin: 0;
  padding: 16px;
  color: #4dff6a;
  font: 14px/1.6 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: break-word;
}
.power-boot-log[hidden] {
  display: none;
}
.power-boot-log:not([hidden])::after {
  content: '█';
  animation: power-cursor-blink 1s step-end infinite;
}
@keyframes power-cursor-blink {
  50% { opacity: 0; }
}

.clock-panel {
  position: fixed;
  z-index: 1000;
  right: var(--space-2);
  bottom: calc(var(--taskbar-height) + var(--space-2));
  inline-size: min(300px, calc(100vw - 16px));
  max-block-size: calc(100dvh - var(--taskbar-height) - 24px);
  overflow-y: auto;
  padding: var(--space-4);
  transition: transform var(--dur-med) var(--ease-out);
}
@starting-style {
  .clock-panel {
    transform: translateX(calc(100% + 24px));
  }
}
.clock-panel[hidden] {
  display: none;
}
.clock-panel.is-leaving {
  transform: translateX(calc(100% + 24px));
}

.clock-panel-time {
  color: var(--text);
  font: 32px var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}
.clock-panel-date {
  margin-block-start: 2px;
  color: var(--shell-text-soft);
  font: var(--fs-sm) var(--font-main);
}

.clock-panel-calendar {
  margin-block-start: var(--space-4);
  padding-block-start: var(--space-3);
  border-block-start: 1px solid var(--shell-line);
}
.clock-panel-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-block-end: var(--space-2);
}
.clock-panel-cal-month {
  color: var(--text);
  font: var(--fs-sm) var(--font-mono);
  letter-spacing: 0.5px;
  text-align: center;
}
.clock-panel-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.clock-panel-cal-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block-end: 4px;
  color: var(--shell-text-soft);
  font: var(--fs-xs) var(--font-mono);
}
.clock-panel-cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font: var(--fs-xs) var(--font-mono);
}
.clock-panel-cal-day.is-holiday {
  box-shadow: inset 0 0 0 2px rgba(var(--aqua-rgb), 0.85);
  cursor: pointer;
}
.clock-panel-cal-day.is-birthday {
  background: rgba(var(--lilac-rgb), 0.55);
  font-weight: 700;
  cursor: pointer;
}
.clock-panel-cal-day.is-today {
  background: rgba(var(--hotrose-rgb), 0.6);
  font-weight: 700;
}
.clock-panel-cal-day.is-empty {
  visibility: hidden;
}
.clock-panel-cal-day.is-popped,
.clock-panel-cal-day:focus-visible {
  outline: 2px solid var(--pearl);
  outline-offset: 1px;
}

.clock-panel-day-popup {
  position: fixed;
  z-index: 1000;
  inline-size: 200px;
  padding: var(--space-2) var(--space-3);
}
.clock-panel-day-popup[hidden] {
  display: none;
}
.clock-panel-day-popup-text {
  margin: 0;
  color: var(--text);
  font: var(--fs-sm) var(--font-mono);
  line-height: 1.4;
}

.notification-toast {
  position: fixed;
  z-index: 1200;
  top: var(--space-4);
  right: var(--space-4);
  inline-size: min(320px, calc(100vw - 32px));
  padding: var(--space-4);
  transition: transform var(--dur-med) var(--ease-out);
}
@starting-style {
  .notification-toast {
    transform: translateX(calc(100% + 32px));
  }
}
.notification-toast[hidden] {
  display: none;
}
.notification-toast.is-leaving {
  transform: translateX(calc(100% + 32px));
}
.notification-toast-close {
  position: absolute;
  top: var(--space-1);
  right: var(--space-1);
}
.notification-toast-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 var(--space-6) var(--space-2) 0;
}
.notification-toast-icon {
  flex-shrink: 0;
  inline-size: 24px;
  block-size: 24px;
  object-fit: contain;
}
.notification-toast-icon[hidden] {
  display: none;
}
.notification-toast-title {
  margin: 0;
  min-inline-size: 0;
  color: var(--text);
  font: 600 var(--fs-md) var(--font-accent);
}
.notification-toast-text {
  margin: 0;
  color: var(--text);
  font: var(--fs-sm) var(--font-main);
  line-height: 1.5;
}
.notification-toast-action {
  display: block;
  margin: var(--space-3) 0 0 auto;
  padding: 0 var(--space-5);
}
.notification-toast-action[hidden] {
  display: none;
}

.notification-history-menu {
  position: fixed;
  z-index: 1000;
  right: var(--space-2);
  bottom: calc(var(--taskbar-height) + var(--space-2));
  inline-size: min(300px, calc(100vw - 16px));
  max-block-size: min(60vh, calc(100dvh - var(--taskbar-height) - 24px));
  overflow-y: auto;
  padding: var(--space-1);
}
.notification-history-menu[hidden] {
  display: none;
}
.notification-history-empty {
  margin: 0;
  padding: var(--space-2) var(--space-3) var(--space-3);
  color: var(--shell-text-soft);
  font: var(--fs-sm) var(--font-mono);
}
.notification-history-empty[hidden] {
  display: none;
}
.notification-history-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.notification-history-item {
  flex: 1;
  min-inline-size: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  padding-block: var(--space-2);
  white-space: normal;
}
.notification-history-item-title {
  font-weight: 600;
}
.notification-history-item-time {
  color: var(--shell-text-soft);
  font-size: var(--fs-xs);
}
@media (hover: hover) {
  .notification-history-remove:hover { background: var(--shell-danger); }
}

@media (pointer: coarse) {
  .taskbar-icon-button,
  .taskbar-tab,
  .taskbar-clock-button,
  .taskbar-show-desktop,
  .taskbar-scroll {
    block-size: 44px;
  }
  .taskbar-icon-button,
  .taskbar-show-desktop {
    inline-size: 44px;
  }
}
@media (max-width: 599px), (max-height: 499px) {
  #taskbar {
    gap: 2px;
    padding: 0 var(--space-1);
  }
  .taskbar-divider,
  .taskbar-clock-date {
    display: none;
  }
  .taskbar-clock-button {
    padding: 0 var(--space-2);
  }
  .notification-toast {
    top: auto;
    left: var(--space-2);
    right: var(--space-2);
    bottom: calc(var(--taskbar-height) + var(--space-2));
    inline-size: auto;
  }
  @starting-style {
    .notification-toast {
      transform: translateY(calc(100% + var(--taskbar-height) + 16px));
    }
  }
  .notification-toast.is-leaving {
    transform: translateY(calc(100% + var(--taskbar-height) + 16px));
  }
}

.paint-text-input {
  position: fixed;
  z-index: 1200;
  min-width: 90px;
  padding: 2px 4px;
  border: 1px dashed #888;
  border-radius: 2px;
  background: rgba(255,255,255,0.92);
  color: #111;
  font: 16px sans-serif;
}

.popup-snap-preview {
  position: absolute;
  inset: var(--space-2);
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--pearl) 16%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.popup-snap-preview.is-visible {
  opacity: 1;
}
.popup-snap-preview[data-zone="left"] {
  right: calc(50% + var(--space-1));
}
.popup-snap-preview[data-zone="right"] {
  left: calc(50% + var(--space-1));
}
