:root {
  --desktop-bg: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0d0d2b 100%);
  --window-bg: rgba(20, 20, 40, 0.85);
  --window-border: rgba(100, 100, 255, 0.3);
  --window-active-border: #6c63ff;
  --accent: #6c63ff;
  --accent-hover: #7c73ff;
  --accent-glow: rgba(108, 99, 255, 0.4);
  --accent-secondary: #00d4ff;
  --text-primary: #e8e8f0;
  --text-secondary: #8888aa;
  --text-muted: #555577;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --surface: rgba(30, 30, 60, 0.9);
  --surface-hover: rgba(40, 40, 70, 0.9);
  --overlay: rgba(0, 0, 0, 0.5);
  --titlebar-height: 36px;
  --taskbar-height: 48px;
  --taskbar-bg: rgba(15, 15, 35, 0.95);
  --border-radius: 8px;
  --border-radius-sm: 4px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  width: 100vw;
  height: 100vh;
  height: 100dvh;   /* the visible viewport: on a phone 100vh is the screen with the browser's bar hidden */
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background: #000;
}

#desktop {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--desktop-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
}

#window-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;   /* the layer lies over the whole desk, the icons too; only its windows take a press */
}
#window-layer > * { pointer-events: auto; }
#window-layer > .minimized { pointer-events: none; }

::-moz-selection {
  background: var(--accent-glow);
  color: #fff;
}

::selection {
  background: var(--accent-glow);
  color: #fff;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.hidden {
  display: none !important;
}

/* Theme Classes */
.theme-win95 {
  font-family: 'MS Sans Serif', Arial, sans-serif;
}
.theme-mac-classic {
  font-family: 'Charcoal', 'Geneva', system-ui, sans-serif;
}
.theme-kde {
  font-family: 'Inter', sans-serif;
}
.theme-modern {
  font-family: 'Inter', sans-serif;
}

/* The apps' icons on the desk; a click, a tap or Enter opens one. */
.desk-icons { position: absolute; top: 16px; left: 16px; display: flex; flex-direction: column; gap: 12px; z-index: 0; }
.desk-icon { width: 88px; padding: 8px 4px; background: none; border: 1px solid transparent; border-radius: var(--border-radius-sm); color: var(--text-primary); font: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; text-shadow: 0 1px 2px var(--overlay); }
.desk-icon:hover, .desk-icon:focus { border-color: var(--window-active-border); background: var(--surface); outline: none; }
.desk-icon-glyph { font-size: 36px; line-height: 1; }
.desk-icon-label { font-size: 12px; text-align: center; }

/* The strips over the desk while the canvas's box is held (main.js onBox). */
.desk-shield { position: fixed; z-index: 150000; cursor: grabbing; }

/* A choice in words: the dialog the desk asks with. */
dialog.desk-dialog { background: var(--surface); color: var(--text-primary); border: 1px solid var(--window-border); border-radius: var(--border-radius); padding: 20px; max-width: 440px; font: inherit; line-height: 1.5; }
dialog.desk-dialog::backdrop { background: var(--overlay); }
dialog.desk-dialog p { margin: 0; }
dialog.desk-dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
dialog.desk-dialog button { padding: 8px 14px; font: inherit; border-radius: var(--border-radius-sm); border: 1px solid var(--window-border); background: var(--surface-hover); color: var(--text-primary); cursor: pointer; }
dialog.desk-dialog button.yes { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Every load boots: until the BIOS, or the phone's startup, is through, the page is black and the desk under its screen is not drawn. */
html.desk-booting, html.desk-booting body { background: #000; }
html.desk-booting body > :not(#bios-screen):not(#phone-boot) { visibility: hidden; }
