/* ============================================
   MatisseOS 95 — Core Styles
   ============================================ */

:root {
  --win-bg: #c0c0c0;
  --win-dark: #808080;
  --win-light: #ffffff;
  --win-darkest: #404040;
  --titlebar-active: #000080;
  --titlebar-inactive: #808080;
  --titlebar-text: #ffffff;
  --desktop-bg: #008080;
  --taskbar-bg: #c0c0c0;
  --text-color: #000000;
  --highlight: #000080;
  --highlight-text: #ffffff;
  --accent: #000080;
  --font-system: 'VT323', monospace;
  --font-pixel: 'Press Start 2P', monospace;
}

/* Theme: High Contrast */
[data-theme="highcontrast"] {
  --win-bg: #000000;
  --win-dark: #00ff00;
  --win-light: #00ff00;
  --win-darkest: #00ff00;
  --titlebar-active: #800080;
  --titlebar-inactive: #333333;
  --titlebar-text: #ffffff;
  --desktop-bg: #000000;
  --taskbar-bg: #000000;
  --text-color: #ffffff;
  --highlight: #800080;
  --highlight-text: #ffffff;
  --accent: #800080;
}
[data-theme="highcontrast"] .os-window,
[data-theme="highcontrast"] .taskbar-app-btn,
[data-theme="highcontrast"] #taskbar,
[data-theme="highcontrast"] #start-menu {
  border-color: var(--win-dark);
}

/* Theme: Rose */
[data-theme="rose"] {
  --win-bg: #e8d0d0;
  --win-dark: #a08080;
  --win-light: #fff0f0;
  --win-darkest: #604040;
  --titlebar-active: #8b2252;
  --titlebar-inactive: #a08080;
  --titlebar-text: #ffffff;
  --desktop-bg: #4a2040;
  --taskbar-bg: #e8d0d0;
  --text-color: #200010;
  --highlight: #8b2252;
  --highlight-text: #ffffff;
  --accent: #8b2252;
}

/* Theme: Ocean */
[data-theme="ocean"] {
  --win-bg: #d0d8e8;
  --win-dark: #8090a0;
  --win-light: #f0f4ff;
  --win-darkest: #405060;
  --titlebar-active: #1a5276;
  --titlebar-inactive: #8090a0;
  --titlebar-text: #ffffff;
  --desktop-bg: #0c2d48;
  --taskbar-bg: #d0d8e8;
  --text-color: #001020;
  --highlight: #1a5276;
  --highlight-text: #ffffff;
  --accent: #1a5276;
}

/* Theme: Forest */
[data-theme="forest"] {
  --win-bg: #d0e0c8;
  --win-dark: #80a070;
  --win-light: #f0fff0;
  --win-darkest: #304020;
  --titlebar-active: #2d5a27;
  --titlebar-inactive: #80a070;
  --titlebar-text: #ffffff;
  --desktop-bg: #1a3a10;
  --taskbar-bg: #d0e0c8;
  --text-color: #002000;
  --highlight: #2d5a27;
  --highlight-text: #ffffff;
  --accent: #2d5a27;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: var(--font-system);
  font-size: 16px;
  color: var(--text-color);
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.hidden {
  display: none !important;
}

/* ========== POWER SCREEN ========== */
#power-screen {
  position: fixed;
  inset: 0;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#power-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  color: #999;
  font-family: var(--font-pixel);
  padding: 40px;
}

/* Beige PC case panel */
.power-case {
  width: 120px;
  height: 140px;
  background: #c8b898;
  border: 3px outset #d8c8a8;
  box-shadow:
    inset 1px 1px 0 #e0d0b8,
    inset -1px -1px 0 #a09078,
    4px 4px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  position: relative;
}

/* Vent lines on case */
.power-case::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  height: 20px;
  background: repeating-linear-gradient(
    0deg,
    #b0a080 0px,
    #b0a080 2px,
    #a09070 2px,
    #a09070 4px
  );
  border: 1px inset #a09078;
}

/* Physical push button */
.power-switch {
  width: 48px;
  height: 48px;
  background: linear-gradient(180deg, #e0d8c8 0%, #c0b090 100%);
  border: 3px outset #d0c0a0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-style 0.05s, transform 0.05s;
  margin-top: 12px;
}

.power-switch-face {
  font-family: var(--font-system);
  font-size: 22px;
  font-weight: bold;
  color: #555;
  line-height: 1;
}

#power-btn:hover .power-switch {
  background: linear-gradient(180deg, #e8e0d0 0%, #c8b898 100%);
}
#power-btn:hover .power-switch-face {
  color: #333;
}

#power-btn:active .power-switch {
  border-style: inset;
  transform: translateY(1px);
  background: linear-gradient(180deg, #b0a888 0%, #c0b890 100%);
}

/* Small green LED */
.power-led {
  width: 8px;
  height: 8px;
  background: #2a3a2a;
  border: 1px inset #888;
  border-radius: 50%;
  transition: background 0.3s, box-shadow 0.3s;
}
#power-btn:hover .power-led {
  background: #4a4;
  box-shadow: 0 0 6px #4a4, 0 0 12px rgba(68, 170, 68, 0.4);
}

.power-hint {
  font-family: var(--font-system);
  font-size: 13px;
  color: #444;
  letter-spacing: 1px;
  animation: hint-pulse 2.5s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* ========== SAFE TO SHUT DOWN SCREEN ========== */
#safe-to-shutdown {
  position: fixed;
  inset: 0;
  background: #e07000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  gap: 24px;
  transition: opacity 0.6s;
}
#safe-to-shutdown.fade-out {
  opacity: 0;
}
.safe-logo {
  font-family: var(--font-pixel);
  font-size: 28px;
  color: #fff;
  text-shadow: 2px 2px 0 #000;
}
.safe-msg {
  font-family: var(--font-system);
  font-size: 22px;
  color: #fff;
  text-align: center;
  line-height: 1.6;
  text-shadow: 1px 1px 0 #000;
}

/* ========== BIOS SCREEN ========== */
#bios-screen {
  position: fixed;
  inset: 0;
  background: #000;
  padding: 20px;
  font-family: var(--font-system);
  font-size: 18px;
  color: #aaa;
  z-index: 9998;
  overflow: hidden;
  line-height: 1.5;
}
#bios-text {
  white-space: pre-wrap;
  word-break: break-all;
}
#bios-text .bios-white { color: #fff; }
#bios-text .bios-yellow { color: #ffff00; }
#bios-text .bios-green { color: #00ff00; }
#bios-text .bios-cyan { color: #00ffff; }
#bios-text .bios-red { color: #ff4444; }

#bios-cursor {
  display: inline;
  color: #aaa;
  animation: blink 0.5s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ========== OS LOADING SCREEN ========== */
#os-load-screen {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 9997;
  transition: opacity 0.5s;
}
#os-load-screen.os-load-fadeout {
  opacity: 0;
}
.os-load-logo {
  font-family: var(--font-pixel);
  font-size: 22px;
  color: #fff;
  text-shadow: 0 0 20px rgba(100,150,255,0.4);
  letter-spacing: 3px;
}
.os-load-bar-track {
  width: 300px;
  height: 22px;
  border: 2px inset #555;
  background: #222;
  padding: 3px;
}
.os-load-bar-fill {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(
    90deg,
    #000080 0px,
    #000080 10px,
    #0000b0 10px,
    #0000b0 11px
  );
  transition: width 0.05s linear;
}
.os-load-text {
  font-family: var(--font-system);
  font-size: 14px;
  color: #aaa;
}

/* ========== DESKTOP ========== */
#desktop {
  position: fixed;
  inset: 0;
  background: var(--desktop-bg);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity 1.2s ease-in, background 0.5s ease;
}
#desktop.fade-in {
  opacity: 1;
}

/* Desktop backgrounds */
#desktop.wall-teal    { background: #008080; }
#desktop.wall-navy    { background: #000080; }
#desktop.wall-forest  { background: #2d5016; }
#desktop.wall-purple  { background: #4a0e4e; }
#desktop.wall-storm   { background: #3a3a5c; }
#desktop.wall-pattern { background: repeating-conic-gradient(#c0c0c0 0% 25%, #a0a0a0 0% 50%) 50% / 8px 8px; }
#desktop.wall-clouds  { background: linear-gradient(180deg, #87ceeb 0%, #e0f0ff 60%, #fff 100%); }
#desktop.wall-hatch   { background: repeating-linear-gradient(45deg, #008080 0px, #008080 2px, #006868 2px, #006868 4px); }
#desktop.wall-tiles   { background: repeating-conic-gradient(#b0c8c8 0% 25%, #90a8a8 0% 50%) 50% / 16px 16px; }
#desktop.wall-zigzag  { background: linear-gradient(135deg, #2c3e50 25%, transparent 25%) -10px 0, linear-gradient(225deg, #2c3e50 25%, transparent 25%) -10px 0, linear-gradient(315deg, #2c3e50 25%, transparent 25%), linear-gradient(45deg, #2c3e50 25%, transparent 25%); background-size: 20px 20px; background-color: #34495e; }
#desktop.wall-sunset  { background: linear-gradient(180deg, #1a0533 0%, #6b2fa0 30%, #e94e77 60%, #ff8c42 80%, #ffd700 100%); }
#desktop.wall-matrix  { background: #000a00; }

/* ========== DESKTOP ICONS ========== */
#desktop-icons {
  flex: 1;
  padding: 0;
  position: relative;
  pointer-events: all;
}
#desktop-select {
  position: fixed;
  border: 1px dashed rgba(255,255,255,0.8);
  background: rgba(0,0,128,0.15);
  pointer-events: none;
  z-index: 1;
  display: none;
}

.desktop-icon {
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, background 0.15s, filter 0.15s;
}
.desktop-icon:hover {
  background: rgba(0,0,128,0.2);
  transform: translateY(-3px);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.desktop-icon:focus,
.desktop-icon.selected {
  background: var(--highlight);
  border-color: rgba(255,255,255,0.3);
}
.desktop-icon.selected .icon-img {
  filter: brightness(1.3) saturate(1.2);
}
.desktop-icon.selected span {
  color: var(--highlight-text);
  background: var(--highlight);
}
.desktop-icon span {
  font-family: var(--font-system);
  font-size: 14px;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  line-height: 1.2;
  padding: 0 2px;
}

/* Pixel-art icons via CSS */
.icon-img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  transition: transform 0.15s ease;
}
.desktop-icon:hover .icon-img {
  transform: scale(1.12);
}

/* Small icon view toggle */
.small-icons .desktop-icon {
  width: 100%;
  flex-direction: row;
  gap: 6px;
  padding: 2px 6px;
  text-align: left;
}
.small-icons .icon-img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.small-icons .desktop-icon span {
  font-size: 12px;
}

.icon-mycomputer { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='6' y='4' width='36' height='26' rx='2' fill='%23c0c0c0' stroke='%23404040' stroke-width='2'/%3E%3Crect x='10' y='8' width='28' height='18' fill='%23000080'/%3E%3Crect x='16' y='30' width='16' height='4' fill='%23c0c0c0' stroke='%23808080'/%3E%3Crect x='12' y='34' width='24' height='4' rx='1' fill='%23c0c0c0' stroke='%23404040'/%3E%3Crect x='20' y='38' width='8' height='3' fill='%23808080'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-notepad { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='8' y='4' width='32' height='40' fill='%23fff' stroke='%23404040' stroke-width='2'/%3E%3Cline x1='14' y1='14' x2='34' y2='14' stroke='%23000' stroke-width='1'/%3E%3Cline x1='14' y1='20' x2='34' y2='20' stroke='%23000' stroke-width='1'/%3E%3Cline x1='14' y1='26' x2='30' y2='26' stroke='%23000' stroke-width='1'/%3E%3Cline x1='14' y1='32' x2='28' y2='32' stroke='%23000' stroke-width='1'/%3E%3Crect x='8' y='4' width='12' height='6' fill='%23008080' stroke='%23404040'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-folder { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M4 12 L4 40 L44 40 L44 16 L22 16 L18 12 Z' fill='%23ffcc00' stroke='%23997700' stroke-width='2'/%3E%3Cpath d='M4 16 L44 16 L44 40 L4 40 Z' fill='%23ffdd44'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-email { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='4' y='10' width='40' height='28' rx='2' fill='%23fff' stroke='%23404040' stroke-width='2'/%3E%3Cpolyline points='4,10 24,28 44,10' fill='none' stroke='%23404040' stroke-width='2'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-games { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='4' y='12' width='40' height='24' rx='12' fill='%23808080' stroke='%23404040' stroke-width='2'/%3E%3Ccircle cx='34' cy='20' r='3' fill='%23ff0000'/%3E%3Ccircle cx='30' cy='26' r='3' fill='%230000ff'/%3E%3Crect x='13' y='20' width='10' height='3' rx='1' fill='%23404040'/%3E%3Crect x='16.5' y='17' width='3' height='9' rx='1' fill='%23404040'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-trash { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='12' y='14' width='24' height='28' rx='2' fill='%23c0c0c0' stroke='%23404040' stroke-width='2'/%3E%3Crect x='8' y='10' width='32' height='4' rx='1' fill='%23c0c0c0' stroke='%23404040' stroke-width='2'/%3E%3Crect x='18' y='6' width='12' height='6' rx='1' fill='%23c0c0c0' stroke='%23404040' stroke-width='2'/%3E%3Cline x1='19' y1='19' x2='19' y2='37' stroke='%23808080' stroke-width='2'/%3E%3Cline x1='24' y1='19' x2='24' y2='37' stroke='%23808080' stroke-width='2'/%3E%3Cline x1='29' y1='19' x2='29' y2='37' stroke='%23808080' stroke-width='2'/%3E%3C/svg%3E") center/contain no-repeat; }

/* Small icons for menus */
.menu-icon { width: 20px; height: 20px; image-rendering: pixelated; flex-shrink: 0; }
.icon-notepad-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='8' y='4' width='32' height='40' fill='%23fff' stroke='%23404040' stroke-width='2'/%3E%3Cline x1='14' y1='14' x2='34' y2='14' stroke='%23000'/%3E%3Cline x1='14' y1='20' x2='34' y2='20' stroke='%23000'/%3E%3Crect x='8' y='4' width='12' height='6' fill='%23008080' stroke='%23404040'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-folder-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M4 12 L4 40 L44 40 L44 16 L22 16 L18 12 Z' fill='%23ffcc00' stroke='%23997700' stroke-width='2'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-email-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='4' y='10' width='40' height='28' rx='2' fill='%23fff' stroke='%23404040' stroke-width='2'/%3E%3Cpolyline points='4,10 24,28 44,10' fill='none' stroke='%23404040' stroke-width='2'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-games-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='4' y='12' width='40' height='24' rx='12' fill='%23808080' stroke='%23404040' stroke-width='2'/%3E%3Ccircle cx='34' cy='20' r='3' fill='%23ff0000'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-mycomputer-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='6' y='4' width='36' height='26' rx='2' fill='%23c0c0c0' stroke='%23404040' stroke-width='2'/%3E%3Crect x='10' y='8' width='28' height='18' fill='%23000080'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-shutdown-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Ccircle cx='24' cy='24' r='16' fill='none' stroke='%23ff4444' stroke-width='4' stroke-dasharray='70 20' stroke-dashoffset='10'/%3E%3Cline x1='24' y1='8' x2='24' y2='24' stroke='%23ff4444' stroke-width='4'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-terminal-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='4' y='6' width='40' height='36' rx='2' fill='%23000' stroke='%23808080' stroke-width='2'/%3E%3Ctext x='10' y='30' fill='%2300ff00' font-size='18' font-family='monospace'%3E%3E_%3C/text%3E%3C/svg%3E") center/contain no-repeat; }
.icon-paint-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='6' y='6' width='36' height='36' rx='2' fill='%23fff' stroke='%23404040' stroke-width='2'/%3E%3Ccircle cx='16' cy='20' r='4' fill='%23ff0000'/%3E%3Ccircle cx='28' cy='16' r='4' fill='%230000ff'/%3E%3Ccircle cx='22' cy='30' r='4' fill='%2300cc00'/%3E%3C/svg%3E") center/contain no-repeat; }
.icon-calc-sm { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Crect x='8' y='4' width='32' height='40' rx='2' fill='%23c0c0c0' stroke='%23404040' stroke-width='2'/%3E%3Crect x='12' y='8' width='24' height='10' fill='%23cfe8cf' stroke='%23808080'/%3E%3Crect x='12' y='22' width='6' height='6' fill='%23fff' stroke='%23808080'/%3E%3Crect x='21' y='22' width='6' height='6' fill='%23fff' stroke='%23808080'/%3E%3Crect x='30' y='22' width='6' height='6' fill='%234444ff' stroke='%23808080'/%3E%3C/svg%3E") center/contain no-repeat; }
.ql-iexplore { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Ccircle cx='24' cy='24' r='18' fill='%230078d4'/%3E%3Cellipse cx='24' cy='24' rx='18' ry='8' fill='none' stroke='%23fff' stroke-width='2.5' transform='rotate(-25 24 24)'/%3E%3Ctext x='24' y='30' text-anchor='middle' font-size='20' font-weight='bold' fill='%23fff' font-family='serif'%3Ee%3C/text%3E%3C/svg%3E") center/contain no-repeat; }

/* ========== TASKBAR ========== */
#taskbar {
  height: 36px;
  background: var(--taskbar-bg);
  border-top: 2px solid var(--win-light);
  display: flex;
  align-items: center;
  padding: 2px 4px;
  gap: 4px;
  z-index: 5000;
  flex-shrink: 0;
  transition: background 0.5s ease;
}

#start-btn {
  height: 28px;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-system);
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  color: var(--text-color);
  flex-shrink: 0;
}
#start-btn:hover {
  background: #d4d0c8;
}
#start-btn:active, #start-btn.active {
  border-style: inset;
  background: #a8a4a0;
}
.start-icon {
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Crect x='1' y='1' width='8' height='8' fill='%23ff0000'/%3E%3Crect x='11' y='1' width='8' height='8' fill='%2300ff00'/%3E%3Crect x='1' y='11' width='8' height='8' fill='%230000ff'/%3E%3Crect x='11' y='11' width='8' height='8' fill='%23ffff00'/%3E%3C/svg%3E") center/contain no-repeat;
}

#taskbar-apps {
  flex: 1;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--win-dark) var(--win-bg);
}
#taskbar-apps::-webkit-scrollbar {
  height: 6px;
}
#taskbar-apps::-webkit-scrollbar-track {
  background: var(--win-bg);
}
#taskbar-apps::-webkit-scrollbar-thumb {
  background: var(--win-dark);
  border: 1px outset var(--win-bg);
}

/* Quick Launch bar */
#quick-launch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 2px;
  margin-right: 2px;
  height: 28px;
}
.ql-btn {
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 0;
}
.ql-btn:hover {
  border: 1px outset var(--win-bg);
  background: var(--win-bg);
}
.ql-btn:active {
  border: 1px inset var(--win-bg);
}
.ql-icon {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  flex-shrink: 0;
}
.ql-separator {
  width: 2px;
  height: 22px;
  border-left: 1px solid var(--win-dark);
  border-right: 1px solid var(--win-light);
  margin-left: 2px;
}
.taskbar-app-btn {
  height: 26px;
  min-width: 80px;
  max-width: 160px;
  padding: 2px 8px;
  font-family: var(--font-system);
  font-size: 14px;
  cursor: pointer;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  color: var(--text-color);
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.taskbar-app-btn:hover {
  background: #d4d0c8;
}
.taskbar-app-btn.active {
  border-style: inset;
  background: repeating-conic-gradient(#b0b0b0 0% 25%, #c0c0c0 0% 50%) 50% / 2px 2px;
  font-weight: bold;
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.25);
}
.taskbar-app-btn .btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  image-rendering: pixelated;
}

#taskbar-tray {
  height: 28px;
  padding: 2px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 2px inset var(--win-bg);
  font-family: var(--font-system);
  font-size: 14px;
  position: relative;
  flex-shrink: 0;
}
.tray-icon {
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 2px;
  transition: background 0.15s;
}
.tray-icon:hover {
  background: rgba(0,0,0,0.08);
}

/* ========== START MENU ========== */
#start-menu {
  position: fixed;
  bottom: 36px;
  left: 4px;
  width: 220px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.35);
  z-index: 6000;
  display: flex;
  transform-origin: bottom left;
  animation: start-menu-in 0.12s ease-out;
}
@keyframes start-menu-in {
  0%   { transform: scaleY(0); opacity: 0; }
  100% { transform: scaleY(1); opacity: 1; }
}
.start-menu-sidebar {
  width: 28px;
  background: var(--titlebar-active);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
}
.sidebar-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: var(--titlebar-text);
  font-family: var(--font-system);
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 2px;
}
.start-menu-items {
  flex: 1;
  padding: 4px 0;
}
.start-menu-item {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}
.start-menu-item:hover {
  background: var(--highlight);
  color: var(--highlight-text);
}
.has-submenu {
  position: relative;
  background: transparent !important;
  color: var(--text-color) !important;
}
.has-submenu:hover > .menu-icon,
.has-submenu:hover > span {
  background-color: var(--highlight);
  color: var(--highlight-text);
}
.has-submenu::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.has-submenu:hover::before {
  background: var(--highlight);
}
/* Prevent highlight from bleeding into submenu panel */
.has-submenu:hover > .start-submenu {
  background: var(--win-bg);
}
.submenu-arrow {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.7;
}
.start-menu-item:hover > .submenu-arrow {
  opacity: 1;
}

/* Submenu — nested inside .has-submenu trigger */
.start-submenu {
  position: absolute;
  left: 100%;
  bottom: -4px;
  min-width: 180px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  padding: 4px 0;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
  z-index: 6010;
}
.start-submenu .start-menu-item {
  color: var(--text-color);
}
.start-submenu .start-menu-item:hover {
  background: var(--highlight);
  color: var(--highlight-text);
}

.menu-divider {
  border: none;
  border-top: 1px solid var(--win-dark);
  border-bottom: 1px solid var(--win-light);
  margin: 4px 8px;
}

/* ========== CONTEXT MENU ========== */
#context-menu,
#icon-context-menu,
#taskbar-context-menu,
.taskbar-btn-ctx,
.win-titlebar-ctx {
  position: fixed;
  min-width: 180px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  padding: 4px 0;
  z-index: 7000;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
  animation: menu-pop 0.1s ease-out;
}
@keyframes menu-pop {
  0%   { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.context-item {
  padding: 5px 20px 5px 28px;
  cursor: pointer;
  font-size: 15px;
  position: relative;
  white-space: nowrap;
}
.context-item:hover {
  background: var(--highlight);
  color: var(--highlight-text);
}
.context-item .ctx-icon {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  width: 16px;
  text-align: center;
}
.context-item.disabled {
  color: var(--win-dark);
  pointer-events: none;
}
.context-item .ctx-shortcut {
  float: right;
  margin-left: 20px;
  font-size: 12px;
  color: var(--win-dark);
}
.context-item:hover .ctx-shortcut {
  color: var(--highlight-text);
}
.menu-divider {
  border: none;
  border-top: 1px solid var(--win-dark);
  border-bottom: 1px solid var(--win-light);
  margin: 3px 2px;
}

/* ========== WALLPAPER DIALOG ========== */
#wallpaper-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
}
.dialog-box {
  width: 320px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
}
.dialog-titlebar {
  background: var(--titlebar-active);
  color: var(--titlebar-text);
  padding: 3px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: bold;
}
.dialog-close {
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.dialog-body {
  padding: 16px;
}
.dialog-body p {
  margin-bottom: 12px;
  font-size: 15px;
}
.wallpaper-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wallpaper-swatch {
  width: 48px;
  height: 36px;
  border: 2px inset var(--win-bg);
  cursor: pointer;
}
.wallpaper-swatch:hover {
  border-color: var(--highlight);
}

/* ========== SHUTDOWN DIALOG ========== */

/* ---- Login Screen ---- */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--desktop-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  transition: opacity 0.4s;
}
.login-box {
  width: 320px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
}
.login-titlebar {
  background: linear-gradient(90deg, var(--titlebar-active) 0%, #1084d0 60%, #20a0e8 100%);
  color: var(--titlebar-text);
  padding: 3px 8px;
  font-size: 14px;
  font-weight: bold;
}
.login-body {
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.login-icon {
  font-size: 40px;
  flex-shrink: 0;
}
.login-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.login-fields label {
  font-size: 13px;
}
.login-fields input {
  padding: 3px 4px;
  border: 2px inset #999;
  font-family: var(--font-system);
  font-size: 14px;
}
.login-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 0 16px 14px;
}
.login-btns button {
  padding: 4px 20px;
  font-family: var(--font-system);
  font-size: 14px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  cursor: pointer;
  min-width: 70px;
}
.login-btns button:active {
  border-style: inset;
}
.login-btns button:first-child {
  font-weight: bold;
  outline: 1px dotted #000;
  outline-offset: -4px;
}

/* ---- BSOD Easter Egg ---- */
#bsod-screen {
  position: fixed;
  inset: 0;
  background: #0000aa;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 40px;
}
.bsod-content {
  color: #fff;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  max-width: 600px;
  text-align: left;
}
.bsod-title {
  background: #aaa;
  color: #0000aa;
  display: inline-block;
  padding: 0 8px;
  font-weight: bold;
  margin-bottom: 12px;
}
.bsod-blink {
  animation: bsod-cursor 1s steps(1) infinite;
}
@keyframes bsod-cursor {
  50% { opacity: 0; }
}

#run-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8500;
}

/* Date/Time Popup */
.datetime-popup {
  position: fixed;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  padding: 8px;
  z-index: 8000;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  font-size: 13px;
}
.dt-header {
  text-align: center;
  font-weight: bold;
  margin-bottom: 6px;
  font-size: 14px;
}
.dt-cal {
  border-collapse: collapse;
  width: 100%;
}
.dt-cal th {
  background: var(--titlebar-active);
  color: var(--titlebar-text);
  padding: 2px 4px;
  font-size: 11px;
  text-align: center;
}
.dt-cal td {
  text-align: center;
  padding: 2px 4px;
  font-size: 12px;
  cursor: default;
}
.dt-today {
  background: var(--highlight);
  color: var(--highlight-text);
  font-weight: bold;
}
.dt-time {
  text-align: center;
  margin-top: 6px;
  font-size: 14px;
  border-top: 1px solid var(--win-dark);
  padding-top: 4px;
}

/* Win95 Yellow Tooltips */
.win95-tooltip {
  position: fixed;
  background: #ffffe1;
  border: 1px solid #000;
  padding: 2px 6px;
  font-family: var(--font-system);
  font-size: 13px;
  color: #000;
  z-index: 99999;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

#shutdown-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8500;
}
.shutdown-box {
  width: 340px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  text-align: center;
}
.shutdown-titlebar {
  background: linear-gradient(90deg, var(--titlebar-active) 0%, #1084d0 60%, #20a0e8 100%);
  color: var(--titlebar-text);
  padding: 3px 6px;
  font-size: 14px;
  font-weight: bold;
  text-align: left;
}
.shutdown-body {
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  text-align: left;
}
.shutdown-text p {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.4;
}
.shutdown-body .shutdown-icon {
  font-size: 32px;
  flex-shrink: 0;
}
.shutdown-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 0 20px 16px;
}
.shutdown-btns button {
  padding: 5px 20px;
  font-family: var(--font-system);
  font-size: 14px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  cursor: pointer;
  min-width: 80px;
}
.shutdown-btns button:active {
  border-style: inset;
}
.shutdown-btns button:first-child {
  font-weight: bold;
  outline: 1px dotted #000;
  outline-offset: -4px;
}

/* Screen-off CRT effect */
.crt-off {
  animation: crt-off 0.5s ease-in forwards;
}
@keyframes crt-off {
  0%   { filter: brightness(1); transform: scale(1,1); opacity: 1; }
  40%  { filter: brightness(3); transform: scale(1, 0.005); opacity: 1; }
  70%  { filter: brightness(3); transform: scale(0.4, 0.003); opacity: 0.8; }
  100% { filter: brightness(0); transform: scale(0, 0); opacity: 0; }
}

/* ========== TRAY ICONS ========== */
.tray-icon {
  cursor: pointer;
  padding: 0 3px;
  font-size: 14px;
  line-height: 1;
  user-select: none;
}
.tray-icon:hover {
  background: rgba(0,0,0,0.08);
}

/* Volume popup */
.tray-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 4px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  padding: 10px 14px;
  z-index: 6100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tray-popup.hidden { display: none; }
.vol-popup-label {
  font-size: 13px;
  font-weight: bold;
}
.vol-popup-val {
  font-size: 13px;
  text-align: center;
}
.vol-mute-label {
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}
#volume-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  height: 100px;
  width: 22px;
  cursor: pointer;
  accent-color: var(--titlebar-active);
}

.tray-divider {
  width: 2px;
  height: 20px;
  border-left: 1px solid var(--win-dark);
  border-right: 1px solid var(--win-light);
  margin: 0 3px;
}

/* ========== SCREENSAVER ========== */
#screensaver {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 7500;
  cursor: none;
}
.ss-logo {
  position: absolute;
  font-family: var(--font-pixel);
  font-size: 28px;
  color: #ff0;
  text-shadow: 0 0 12px currentColor, 0 0 30px currentColor;
  white-space: nowrap;
  pointer-events: none;
  will-change: transform;
}

/* ========== CLIPPY ASSISTANT ========== */
#clippy {
  position: fixed;
  bottom: 50px;
  right: 20px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 6500;
  animation: clippy-in 0.4s ease-out;
}
@keyframes clippy-in {
  from { transform: translateY(60px) scale(0.8); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
#clippy.clippy-exit {
  animation: clippy-out 0.4s ease-in forwards;
}
@keyframes clippy-out {
  to { transform: translateY(60px) scale(0.6); opacity: 0; }
}
.clippy-char {
  font-size: 52px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  animation: clippy-bounce 2s ease-in-out infinite;
}
@keyframes clippy-bounce {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.clippy-bubble {
  background: #ffffcc;
  border: 2px solid #000;
  border-radius: 8px;
  padding: 10px 14px;
  max-width: 280px;
  font-size: 13px;
  line-height: 1.4;
  color: #000;
  position: relative;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
}
.clippy-bubble::before {
  content: '';
  position: absolute;
  bottom: 12px;
  left: -10px;
  border: 6px solid transparent;
  border-right-color: #000;
}
.clippy-bubble::after {
  content: '';
  position: absolute;
  bottom: 14px;
  left: -7px;
  border: 4px solid transparent;
  border-right-color: #ffffcc;
}
.clippy-text {
  display: block;
  margin-bottom: 8px;
}
.clippy-actions {
  display: flex;
  gap: 6px;
}
.clippy-btn {
  padding: 3px 10px;
  font-family: var(--font-system);
  font-size: 13px;
  background: var(--win-bg);
  border: 2px outset var(--win-bg);
  cursor: pointer;
}
.clippy-btn:active {
  border-style: inset;
}

/* ========== BUSY CURSOR ========== */
body.busy, body.busy * {
  cursor: wait !important;
}

/* ========== NOTIFICATION TOASTS ========== */
#notification-container {
  position: fixed;
  bottom: 44px;
  right: 8px;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  z-index: 9999;
  pointer-events: none;
}
.notification-toast {
  background: #ffffcc;
  border: 2px outset var(--win-bg);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
  padding: 8px 16px 8px 12px;
  font-family: var(--font-system);
  font-size: 14px;
  color: #000;
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: auto;
  max-width: 300px;
  border-left: 4px solid var(--titlebar-active);
}
.notification-toast.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ========== ALT+TAB OVERLAY ========== */
#alt-tab-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--win-bg);
  border: 3px outset var(--win-bg);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.4);
  padding: 16px 20px;
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 500px;
  z-index: 99999;
}
#alt-tab-overlay.visible {
  display: flex;
}
.alt-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 2px solid transparent;
  min-width: 72px;
}
.alt-tab-item.active {
  border: 2px solid var(--highlight);
  background: rgba(0,0,128,0.12);
}
.alt-tab-icon {
  width: 32px;
  height: 32px;
}
.alt-tab-icon > div {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}
.alt-tab-item span {
  font-family: var(--font-system);
  font-size: 12px;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== THEME PICKER ========== */
.theme-picker {
  margin-top: 16px;
  padding: 10px;
  border-top: 1px solid #808080;
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-picker label {
  font-family: var(--font-system);
  font-size: 16px;
  font-weight: bold;
}
.theme-picker select {
  padding: 3px 6px;
  font-family: var(--font-system);
  font-size: 15px;
  background: #fff;
  border: 2px inset var(--win-bg);
  cursor: pointer;
}

/* ========== RESPONSIVE / MOBILE ========== */
@media (max-width: 768px) {
  /* Make windows fill screen on small devices */
  .os-window {
    min-width: unset !important;
    width: calc(100vw - 8px) !important;
    left: 4px !important;
    max-height: calc(100vh - 48px);
  }
  .os-window.maximized {
    width: 100% !important;
    left: 0 !important;
  }

  /* Desktop icons smaller and in a row */
  #desktop-icons {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 8px;
    gap: 4px;
  }
  .desktop-icon {
    width: 64px;
    position: static !important;
  }
  .desktop-icon span {
    font-size: 11px;
  }
  .icon-img {
    width: 36px;
    height: 36px;
  }

  /* Hide quick launch on smaller screens */
  #quick-launch {
    display: none;
  }

  /* Taskbar */
  .taskbar-app-btn {
    min-width: 36px;
    max-width: 36px;
    padding: 2px;
    font-size: 0;
  }
  .taskbar-app-btn .btn-icon {
    width: 20px;
    height: 20px;
  }

  /* Start menu needs to fit */
  #start-menu {
    max-height: 70vh;
    overflow-y: auto;
  }

  /* Smaller game canvases */
  .game-snake-container canvas,
  .game-tetris-container canvas,
  .game-breakout-container canvas {
    max-width: 100%;
    height: auto !important;
  }

  /* Calculator */
  .app-calculator {
    padding: 6px;
  }
  .calc-btn {
    padding: 8px 2px;
    font-size: 14px;
  }

  /* Game hub responsive */
  .games-list {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* About responsive */
  .about-tabs {
    flex-wrap: wrap;
  }
  .funfacts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .skill-name {
    width: 120px;
  }

  /* Projects responsive */
  .projects-grid {
    grid-template-columns: 1fr !important;
  }

  /* Contact responsive */
  .contact-app {
    flex-direction: column;
  }
  .contact-sidebar {
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 2px inset var(--win-bg);
    justify-content: center;
  }
  .contact-socials {
    flex-direction: row;
  }
}

@media (max-width: 480px) {
  .os-window {
    width: 100vw !important;
    left: 0 !important;
    top: 0 !important;
    max-height: calc(100vh - 36px);
  }

  #taskbar-tray {
    padding: 2px 4px;
    font-size: 12px;
  }

  .g2048-grid {
    width: 220px;
    height: 220px;
  }
  .gmem-grid {
    width: 220px;
  }
}
