/* ============================================================
   windows 11 WebV — Fluent Design stylesheet
   ============================================================ */

/* ============================================================
   THEME TOKENS — Light (default :root) vs Dark
   Every surface in the shell reads these variables, so flipping
   <html data-theme="dark"> re-skins the whole OS at once.
   ============================================================ */
:root {
  --accent: #0067c0;              /* Windows 11 active blue (light) */
  --accent-hover: #1975c5;
  --accent-active: #005ba8;
  --accent-bright: #4cc2ff;       /* the lighter "glow" accent */
  --accent-text-on: #ffffff;

  --desktop-wash: #0078d4;        /* tint behind the wallpaper */
  --wallpaper-dim: 0;             /* darkens bloom.jpg in dark mode */

  --text-primary: #1f1f1f;
  --text-secondary: #444444;
  --text-muted: #616161;
  --text-disabled: #b0b0b0;
  --icon-color: #1c1c1c;

  --surface-window: #f9f9f9;
  --surface-titlebar: #f0f0f0;
  --surface-body: #ffffff;
  --surface-sidebar: #f3f3f3;
  --surface-card: #ffffff;
  --surface-elevated: #ffffff;

  --flyout-bg: rgba(245, 245, 245, 0.85);
  --flyout-border: rgba(255, 255, 255, 0.6);
  --flyout-hover: rgba(0, 0, 0, 0.07);

  --taskbar-bg: rgba(243, 243, 243, 0.85);
  --taskbar-border: rgba(255, 255, 255, 0.5);
  --taskbar-shadow: 0 -1px 4px rgba(0, 0, 0, 0.06);

  --control-bg: rgba(255, 255, 255, 0.55);
  --control-hover: rgba(0, 0, 0, 0.06);
  --control-active: rgba(0, 0, 0, 0.12);

  --stroke-soft: rgba(0, 0, 0, 0.06);
  --stroke: rgba(0, 0, 0, 0.12);
  --stroke-strong: #888888;

  --shadow-window: 0 8px 32px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.2);

  /* Smooth cross-fade between themes. */
  --theme-transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

/* ---------- Windows 11 Dark Theme (Fluent specs) ---------- */
[data-theme="dark"] {
  --accent: #60cdff;              /* Windows 11 dark accent blue */
  --accent-hover: #7bd6ff;
  --accent-active: #4ab8eb;
  --accent-bright: #60cdff;
  --accent-text-on: #0b0b0b;

  --desktop-wash: #0a0a0a;        /* deep acrylic dark behind wallpaper */
  --wallpaper-dim: 0.55;

  --text-primary: #ffffff;
  --text-secondary: #e5e5e5;
  --text-muted: #b9b9b9;
  --text-disabled: #6b6b6b;
  --icon-color: #ffffff;

  --surface-window: #202020;
  --surface-titlebar: #1c1c1c;
  --surface-body: #202020;
  --surface-sidebar: #2c2c2c;
  --surface-card: #2c2c2c;
  --surface-elevated: #2c2c2c;

  --flyout-bg: rgba(32, 32, 32, 0.85);
  --flyout-border: rgba(255, 255, 255, 0.08);
  --flyout-hover: rgba(255, 255, 255, 0.08);

  --taskbar-bg: rgba(28, 28, 28, 0.85);
  --taskbar-border: rgba(255, 255, 255, 0.08);
  --taskbar-shadow: 0 -1px 4px rgba(0, 0, 0, 0.4);

  --control-bg: rgba(255, 255, 255, 0.06);
  --control-hover: rgba(255, 255, 255, 0.08);
  --control-active: rgba(255, 255, 255, 0.14);

  --stroke-soft: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.14);
  --stroke-strong: #8a8a8a;

  --shadow-window: 0 8px 32px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
}
html,
body {
  height: 100%;
  overflow: hidden;
  background: #000;
}
button {
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

/* Apply the theme cross-fade to the shell chrome (bounded to the big
   surfaces so animations elsewhere are unaffected). */
#desktop,
#taskbar,
.popup,
.window,
.win-titlebar,
.win-body,
.ctx-menu,
.ctx-sub,
.desk-icon span {
  transition: var(--theme-transition);
}

/* ==================== SCREENS ==================== */
.screen {
  position: absolute;
  inset: 0;
  transition:
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.35s ease,
    filter 0.35s ease;
}
.hidden {
  display: none !important;
}

/* ==================== BOOT FLOW ==================== */
#boot-screen,
#desktop {
  background-color: var(--desktop-wash);
  background-image: url("bloom.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* Dark theme keeps the Bloom wallpaper but dims it into the deep
     acrylic-dark look of Windows 11 Dark mode. */
  filter: brightness(calc(1 - var(--wallpaper-dim) * 0.45));
  transition:
    var(--theme-transition),
    filter 0.35s ease;
}
#boot-screen {
  isolation: isolate;
  display: flex;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(115deg, rgba(5, 9, 18, .78), rgba(7, 18, 37, .62)),
    url("bloom.jpg") center / cover no-repeat,
    #070b13;
  color: #fff;
  transition: opacity 0.72s cubic-bezier(.2,.7,.2,1);
}
#boot-screen::before {
  position: absolute;
  z-index: -1;
  inset: -28px;
  content: "";
  background: inherit;
  filter: blur(22px) saturate(1.25);
  transform: scale(1.08);
}
#boot-screen::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background:
    radial-gradient(ellipse at 50% 42%, rgba(39, 106, 184, .2), transparent 34%),
    linear-gradient(180deg, rgba(4, 8, 15, .18), rgba(4, 7, 14, .57));
  backdrop-filter: blur(10px) saturate(125%);
  -webkit-backdrop-filter: blur(10px) saturate(125%);
}
.boot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}
.boot-logo {
  width: 66px;
  height: 66px;
  overflow: visible;
  filter: drop-shadow(0 0 15px rgba(29, 133, 255, .3));
}
.boot-spinner {
  position: relative;
  width: 34px;
  height: 34px;
  margin-top: 2px;
}
.fluent-spinner::before,
.fluent-spinner::after {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  content: "";
}
.fluent-spinner::before {
  border: 2px solid rgba(255, 255, 255, .15);
  border-top-color: #f4f8ff;
  border-right-color: #83baff;
  box-shadow: 0 0 12px rgba(87, 161, 255, .25);
  animation: fluentRingSpin .95s cubic-bezier(.55,.1,.35,.9) infinite;
}
.fluent-spinner::after {
  inset: 5px;
  border: 1px solid rgba(255, 255, 255, .09);
  animation: fluentRingPulse 1.8s ease-in-out infinite;
}
@keyframes fluentRingSpin {
  to { transform: rotate(360deg); }
}
@keyframes fluentRingPulse {
  0%, 100% { opacity: .35; transform: scale(.96); }
  50% { opacity: .85; transform: scale(1.04); }
}
.boot-status {
  margin-top: 1px;
  color: rgba(244, 247, 252, .9);
  font-family: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, sans-serif;
  font-size: .9rem;
  font-weight: 400;
  letter-spacing: .015em;
  animation: fluentTextIn .8s ease both;
}
.boot-power-prompt {
  display: none;
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, .74);
  font-family: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, sans-serif;
  font-size: .86rem;
  letter-spacing: .015em;
  animation: powerPromptPulse 3.2s ease-in-out infinite;
}
@keyframes fluentTextIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
#boot-screen.away {
  opacity: 0;
  pointer-events: none;
}
#boot-screen.gone {
  display: none;
}
#boot-screen.powered-off,
#boot-screen.transition-blackout {
  z-index: 26000;
  background: #000;
  filter: none;
}
#boot-screen.powered-off::before,
#boot-screen.powered-off::after,
#boot-screen.transition-blackout::before,
#boot-screen.transition-blackout::after {
  display: none;
}
#boot-screen.powered-off .boot-content,
#boot-screen.transition-blackout .boot-content {
  display: none;
}
#boot-screen.powered-off .boot-power-prompt {
  display: block;
}
#boot-screen.powered-off {
  cursor: pointer;
}
#boot-screen.powered-off:focus-visible {
  outline: 2px solid rgba(255,255,255,.8);
  outline-offset: -6px;
}

/* ==================== DESKTOP ==================== */
#desktop {
  z-index: 100;
  background-color: var(--desktop-wash);
  background-image: url("bloom.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* brightness is driven by --wallpaper-dim; the inline brightness from the
     Quick Settings slider still wins because it is set on the element. */
}
#desktop.hidden {
  display: none !important;
}
#desktop.reveal {
  animation: deskIn 0.72s cubic-bezier(.2,.7,.2,1);
}
@keyframes deskIn {
  from {
    opacity: .45;
    filter: blur(8px);
  }
  to {
    opacity: 1;
    filter: blur(0px);
  }
}

/* ---------- Desktop icons (vertical columns) ---------- */
#desktop-icons {
  position: absolute;
  top: 12px;
  left: 8px;
  right: 8px;
  bottom: 60px;
}
.desk-icon {
  position: absolute;
  width: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: default;
  text-align: center;
  touch-action: none;
  transition: background 0.12s, outline-color 0.12s;
}
.desk-icon.dragging {
  z-index: 20;
  opacity: 0.88;
  cursor: grabbing;
  transition: none;
}
.desk-icon span {
  /* Desktop labels sit on the wallpaper in both themes, so they stay white
     with a dark shadow — exactly like Windows 11. */
  color: #ffffff;
  font-family: 'Segoe UI Variable', sans-serif;
  font-size: 12px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  max-width: 84px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.desk-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  outline: 1px solid rgba(255, 255, 255, 0.25);
}
.desk-icon.selected {
  background: rgba(120, 190, 255, 0.35);
  outline: 1px solid rgba(160, 210, 255, 0.6);
}
.desk-icon-img {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
.desk-icon-img > svg {
  display: block;
  flex: 0 0 auto;
}
.desk-icon-img img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

/* ==================== TASKBAR (full-width Windows 11 dock) ==================== */
#taskbar {
  width: 100%;
  height: 48px;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 9999;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  font-family: "Segoe UI", "Segoe UI Variable", system-ui, sans-serif;
  background: var(--taskbar-bg);
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  border-top: 1px solid var(--taskbar-border);
  box-shadow: var(--taskbar-shadow);
  color: var(--text-primary);
}

/* ---------- LEFT: Widgets / Weather ---------- */
.tb-left {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.tb-widgets {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.12s;
}
.tb-widgets:hover {
  background: var(--control-hover);
}
.tb-widgets-temp {
  font-weight: 600;
}
.tb-widgets-desc {
  opacity: 0.8;
}

/* ---------- CENTER: Pinned & running apps ---------- */
.tb-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
}
.tb-btn {
  width: 40px;
  height: 38px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transform: translateY(0) scale(1);
  transform-origin: bottom center;
  color: var(--text-primary);
  transition:
    transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
    background 0.12s;
}
.tb-btn:hover {
  z-index: 2;
  transform: translateY(-10px) scale(1.4);
  background: var(--control-hover);
}
.tb-btn:active {
  background: var(--control-active);
}
.tb-btn.running {
  position: relative;
}
.tb-btn.running::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent-bright);
  transition:
    width 0.2s var(--fluent-standard, cubic-bezier(0.1, 0.9, 0.2, 1)),
    background 0.2s linear;
}
/* Focused window → long accent pill. */
.tb-btn.active::after {
  width: 16px;
  background: var(--accent);
}
/* Still running but minimized/behind → short, dimmed pill stays lit, so an
   app that is open never loses its indicator on the centered taskbar. */
.tb-btn.running.minimized::after {
  width: 6px;
  background: var(--accent);
  opacity: 0.45;
}
.tb-btn.running.minimized:hover::after {
  opacity: 1;
}

/* ---------- RIGHT: System tray & clock ---------- */
.tb-right {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
  color: var(--text-primary);
}
.tray-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 8px;
  border-radius: 4px;
  color: var(--text-primary);
  transition: background 0.12s;
}
.tray-btn:hover {
  background: var(--control-hover);
}
.tray-clock {
  text-align: right;
  font-size: 0.72rem;
  line-height: 1.3;
  padding: 6px 8px;
  border-radius: 4px;
  color: var(--text-primary);
}
.tray-clock:hover {
  background: var(--control-hover);
}
#tb-time,
#tb-date {
  font-family: "Segoe UI", "Segoe UI Variable", system-ui, sans-serif;
}
#tb-date {
  font-size: 0.72rem;
}
.show-desktop {
  width: 6px;
  height: 44px;
  margin-left: 2px;
  border-radius: 0;
  border-left: 1px solid var(--stroke);
  background: transparent;
}
.show-desktop:hover {
  background: var(--control-hover);
}

/* ==================== POPUPS ==================== */
.popup {
  position: absolute;
  z-index: 10000;
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  background: var(--flyout-bg);
  border: 1px solid var(--flyout-border);
  border-radius: 16px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    opacity 0.18s ease;
}
.popup.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
/* hidden class kept for initial load */
.popup.hidden {
  display: block;
  visibility: hidden;
}
.popup.hidden:not(.open) {
  display: block;
}

/* ---------- Start Menu ---------- */
#start-menu {
  bottom: 54px;
  left: 50%;
  margin-left: -300px;
  width: 600px;
  padding: 24px 28px 0;
  display: flex;
  flex-direction: column;
}
.sm-search input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid var(--stroke);
  background: var(--surface-body);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
}
.sm-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.sm-section-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 20px 2px 10px;
  color: var(--text-primary);
}
.sm-pinned {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 1fr;
  gap: 6px;
}
.sm-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: 8px;
  transition: background 0.12s;
  cursor: pointer;
}
.sm-app:hover {
  background: var(--flyout-hover);
}
.sm-app-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: visible;
  border-radius: 10px;
  font-size: 2rem;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}
.sm-app-icon svg {
  display: block;
  width: 40px;
  height: 40px;
}
.sm-app span {
  font-size: 0.72rem;
  color: var(--text-primary);
  text-align: center;
}

/* Fluent-inspired system app marks, shared by Start pins and installed
   desktop shortcuts so an app keeps the same identity on either surface. */
:is(
  .sm-app[data-app="edge"] .sm-app-icon,
  .desk-icon[data-app="edge"] .desk-icon-img,
  .sm-app[data-app="calc"] .sm-app-icon,
  .desk-icon[data-app="calc"] .desk-icon-img,
  .sm-app[data-app="photos"] .sm-app-icon,
  .desk-icon[data-app="photos"] .desk-icon-img,
  .sm-app[data-app="music"] .sm-app-icon,
  .desk-icon[data-app="music"] .desk-icon-img,
  .sm-app[data-app="camera"] .sm-app-icon,
  .desk-icon[data-app="camera"] .desk-icon-img,
  .sm-app[data-app="snipping"] .sm-app-icon,
  .desk-icon[data-app="snipping"] .desk-icon-img,
  .sm-app[data-app="mail"] .sm-app-icon,
  .desk-icon[data-app="mail"] .desk-icon-img,
  .sm-app[data-app="stickynotes"] .sm-app-icon,
  .desk-icon[data-app="stickynotes"] .desk-icon-img
) {
  position: relative;
  isolation: isolate;
  color: transparent;
  font-size: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}
:is(
  .sm-app[data-app="edge"] .sm-app-icon,
  .desk-icon[data-app="edge"] .desk-icon-img,
  .sm-app[data-app="calc"] .sm-app-icon,
  .desk-icon[data-app="calc"] .desk-icon-img,
  .sm-app[data-app="photos"] .sm-app-icon,
  .desk-icon[data-app="photos"] .desk-icon-img,
  .sm-app[data-app="music"] .sm-app-icon,
  .desk-icon[data-app="music"] .desk-icon-img,
  .sm-app[data-app="camera"] .sm-app-icon,
  .desk-icon[data-app="camera"] .desk-icon-img,
  .sm-app[data-app="snipping"] .sm-app-icon,
  .desk-icon[data-app="snipping"] .desk-icon-img,
  .sm-app[data-app="mail"] .sm-app-icon,
  .desk-icon[data-app="mail"] .desk-icon-img,
  .sm-app[data-app="stickynotes"] .sm-app-icon,
  .desk-icon[data-app="stickynotes"] .desk-icon-img
)::before {
  content: "";
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 10px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}
:is(
  .sm-app[data-app="edge"] .sm-app-icon,
  .desk-icon[data-app="edge"] .desk-icon-img,
  .sm-app[data-app="calc"] .sm-app-icon,
  .desk-icon[data-app="calc"] .desk-icon-img,
  .sm-app[data-app="photos"] .sm-app-icon,
  .desk-icon[data-app="photos"] .desk-icon-img,
  .sm-app[data-app="music"] .sm-app-icon,
  .desk-icon[data-app="music"] .desk-icon-img,
  .sm-app[data-app="camera"] .sm-app-icon,
  .desk-icon[data-app="camera"] .desk-icon-img,
  .sm-app[data-app="snipping"] .sm-app-icon,
  .desk-icon[data-app="snipping"] .desk-icon-img,
  .sm-app[data-app="mail"] .sm-app-icon,
  .desk-icon[data-app="mail"] .desk-icon-img,
  .sm-app[data-app="stickynotes"] .sm-app-icon,
  .desk-icon[data-app="stickynotes"] .desk-icon-img
) > * {
  opacity: 0;
}
:is(.sm-app[data-app="edge"] .sm-app-icon, .desk-icon[data-app="edge"] .desk-icon-img)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='e' x1='7' y1='8' x2='40' y2='40' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%2309c8e8'/%3E%3Cstop offset='.52' stop-color='%2300a4b8'/%3E%3Cstop offset='1' stop-color='%230764d5'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x1='9' y1='38' x2='36' y2='13' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23077bea'/%3E%3Cstop offset='1' stop-color='%2309c8ce'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23e)' d='M39.6 31.1c-2.3 7.6-9.1 12.2-17.2 11.2C13.7 41.2 7.8 34.7 7.8 26.6c0-9.7 7.7-17.5 17.3-17.5 7.4 0 13.7 4.6 16.2 11.1-3.1-3.3-7.2-5-12.1-4.6-6.8.6-11.6 5.5-12.2 11.4-.5 5.2 3 8.6 8.1 8.6 5.6 0 10.5-2 14.5-4.5z'/%3E%3Cpath fill='url(%23b)' d='M7.4 27.8c2.3-5.9 7.7-9.5 14.2-9.5 6.1 0 10.8 3.5 12.1 8.6H20.4c-4.1 0-7.1 2.3-7.1 5.6 0 2.3 1.1 4.2 3 5.5-5.5-1.7-9.1-5.5-8.9-10.2z'/%3E%3C/svg%3E");
}
:is(.sm-app[data-app="calc"] .sm-app-icon, .desk-icon[data-app="calc"] .desk-icon-img)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='c' x1='8' y1='4' x2='41' y2='45' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%230b8df5'/%3E%3Cstop offset='1' stop-color='%23004ec4'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='3' y='3' width='42' height='42' rx='10' fill='url(%23c)'/%3E%3Crect x='11' y='8' width='26' height='10' rx='2' fill='%230c367e'/%3E%3Crect x='11' y='22' width='7' height='7' rx='2' fill='%23fff'/%3E%3Crect x='21' y='22' width='7' height='7' rx='2' fill='%23d7efff'/%3E%3Crect x='31' y='22' width='7' height='7' rx='2' fill='%23ffad48'/%3E%3Crect x='11' y='32' width='7' height='7' rx='2' fill='%23fff'/%3E%3Crect x='21' y='32' width='7' height='7' rx='2' fill='%23fff'/%3E%3Crect x='31' y='32' width='7' height='7' rx='2' fill='%23ffad48'/%3E%3C/svg%3E");
}
:is(.sm-app[data-app="photos"] .sm-app-icon, .desk-icon[data-app="photos"] .desk-icon-img)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='p' x1='5' y1='5' x2='44' y2='44' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23eef9ff'/%3E%3Cstop offset='1' stop-color='%23d8e6ff'/%3E%3C/linearGradient%3E%3ClinearGradient id='petal' x1='17' y1='7' x2='33' y2='40' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%2300c9f2'/%3E%3Cstop offset='.48' stop-color='%234b76ff'/%3E%3Cstop offset='1' stop-color='%23a14bfa'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='2' y='2' width='44' height='44' rx='12' fill='url(%23p)'/%3E%3Cpath fill='url(%23petal)' d='M24 22C14 20 11 16 13 11c2-5 8-5 11 3 3-8 9-8 11-3 2 5-1 9-11 11 10 2 13 6 11 11-2 5-8 5-11-3-3 8-9 8-11 3-2-5 1-9 11-11z'/%3E%3Ccircle cx='24' cy='24' r='3.3' fill='%23fff'/%3E%3C/svg%3E");
}
:is(.sm-app[data-app="music"] .sm-app-icon, .desk-icon[data-app="music"] .desk-icon-img)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='m' x1='5' y1='4' x2='43' y2='46' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23007cf0'/%3E%3Cstop offset='.55' stop-color='%234e55df'/%3E%3Cstop offset='1' stop-color='%23943fce'/%3E%3C/linearGradient%3E%3ClinearGradient id='n' x1='17' y1='12' x2='34' y2='38' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23fff'/%3E%3Cstop offset='1' stop-color='%23c8eaff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='2' y='2' width='44' height='44' rx='12' fill='url(%23m)'/%3E%3Cpath d='M29 10v21.3a6 6 0 1 1-3.5-5.4V15l12-3v16.3a6 6 0 1 1-3.5-5.4V10z' fill='url(%23n)'/%3E%3C/svg%3E");
}
:is(.sm-app[data-app="camera"] .sm-app-icon, .desk-icon[data-app="camera"] .desk-icon-img)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='k' x1='6' y1='8' x2='43' y2='43' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%235b687a'/%3E%3Cstop offset='1' stop-color='%23232d3b'/%3E%3C/linearGradient%3E%3CradialGradient id='l' cx='0' cy='0' r='1' gradientTransform='matrix(13 0 0 13 24 25)' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%2397eaff'/%3E%3Cstop offset='.38' stop-color='%231982d4'/%3E%3Cstop offset='.7' stop-color='%230b3158'/%3E%3Cstop offset='1' stop-color='%230b1726'/%3E%3C/radialGradient%3E%3C/defs%3E%3Crect x='2' y='8' width='44' height='34' rx='9' fill='url(%23k)'/%3E%3Cpath d='M15 8l3-4h12l3 4' fill='%237e8b9b'/%3E%3Ccircle cx='24' cy='25' r='13' fill='%23131c29'/%3E%3Ccircle cx='24' cy='25' r='10' fill='url(%23l)' stroke='%23d4f7ff' stroke-width='1.4'/%3E%3Ccircle cx='20' cy='21' r='2' fill='%23fff' fill-opacity='.8'/%3E%3C/svg%3E");
}
:is(.sm-app[data-app="snipping"] .sm-app-icon, .desk-icon[data-app="snipping"] .desk-icon-img)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='s' x1='6' y1='4' x2='43' y2='45' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23f3fbff'/%3E%3Cstop offset='1' stop-color='%23cfe8ff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='2' y='2' width='44' height='44' rx='12' fill='url(%23s)'/%3E%3Ccircle cx='14' cy='34' r='5' fill='none' stroke='%23ef596b' stroke-width='3'/%3E%3Ccircle cx='34' cy='34' r='5' fill='none' stroke='%230e83d8' stroke-width='3'/%3E%3Cpath d='M17 30L34 10M31 30L15 13' fill='none' stroke='%234f647b' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='M7 7h8M7 7v8M41 7h-8M41 7v8' fill='none' stroke='%237cb8ed' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
:is(.sm-app[data-app="mail"] .sm-app-icon, .desk-icon[data-app="mail"] .desk-icon-img)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='a' x1='6' y1='5' x2='42' y2='44' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%230aa8ff'/%3E%3Cstop offset='1' stop-color='%23005bc9'/%3E%3C/linearGradient%3E%3ClinearGradient id='w' x1='11' y1='15' x2='37' y2='35' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23fff'/%3E%3Cstop offset='1' stop-color='%23dcefff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='2' y='2' width='44' height='44' rx='12' fill='url(%23a)'/%3E%3Crect x='9' y='13' width='30' height='23' rx='4' fill='url(%23w)'/%3E%3Cpath d='M10 16l14 11 14-11' fill='none' stroke='%230574c8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M10 33l10-9m18 9-10-9' fill='none' stroke='%238bc8f5' stroke-width='1.5'/%3E%3C/svg%3E");
}
:is(.sm-app[data-app="stickynotes"] .sm-app-icon, .desk-icon[data-app="stickynotes"] .desk-icon-img)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cdefs%3E%3ClinearGradient id='y' x1='7' y1='4' x2='41' y2='44' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23fff47a'/%3E%3Cstop offset='1' stop-color='%23ffc928'/%3E%3C/linearGradient%3E%3Cfilter id='d' x='-20%25' y='-20%25' width='140%25' height='150%25'%3E%3CfeDropShadow dx='0' dy='2' stdDeviation='2' flood-color='%23845a00' flood-opacity='.3'/%3E%3C/filter%3E%3C/defs%3E%3Cpath d='M9 4h24l8 8v27a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5V9a5 5 0 0 1 5-5z' fill='url(%23y)' filter='url(%23d)'/%3E%3Cpath d='M33 4v8h8' fill='%23fff8b4'/%3E%3Cpath d='M12 19h18M12 25h21M12 31h15' stroke='%23d49b09' stroke-width='2' stroke-linecap='round' opacity='.8'/%3E%3C/svg%3E");
}
.sm-recommended {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sm-recent {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-primary);
  transition: background 0.12s;
}
.sm-recent:hover {
  background: var(--flyout-hover);
}
.sm-recent-icon {
  font-size: 1.4rem;
}
.sm-recent-name {
  font-size: 0.82rem;
}
.sm-recent-meta {
  font-size: 0.7rem;
  opacity: 0.6;
}
.sm-footer {
  margin: 18px -28px 0;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--control-hover);
  border-top: 1px solid var(--stroke-soft);
  border-radius: 0 0 16px 16px;
}
.sm-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-primary);
}
.sm-avatar {
  width: 34px;
  height: 34px;
}
.sm-avatar::after {
  font-size: 17px;
}
.sm-brand {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-right: 12px;
}
.sm-power {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}
.sm-power:hover {
  background: var(--control-hover);
}

/* ---------- Quick Settings ---------- */
#quick-panel {
  bottom: 54px;
  right: 14px;
  width: 360px;
  padding: 18px;
  color: var(--text-primary);
}
.qs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.qs-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 76px;
  padding: 12px 6px;
  border-radius: 8px;
  background: var(--control-bg);
  border: 1px solid var(--stroke-soft);
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: center;
  color: var(--text-primary);
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.qs-btn:hover {
  background: var(--control-hover);
}
.qs-btn svg {
  flex-shrink: 0;
}
.qs-btn.active {
  background: var(--accent);
  color: var(--accent-text-on);
  border-color: var(--accent-active);
}
.qs-btn.active:hover {
  background: var(--accent-hover);
}
/* The theme toggle card mirrors the Windows 11 "Dark mode" tile:
   a sun in Light mode, a crescent moon in Dark mode. */
.qs-btn.qs-theme .qs-theme-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.qs-btn.qs-theme .qs-theme-icon svg {
  transition: transform 0.35s cubic-bezier(0.1, 0.9, 0.2, 1);
}
[data-theme="dark"] .qs-btn.qs-theme .qs-theme-icon svg {
  transform: rotate(180deg);
}
/* Sun chrome is visible in Light; the moon path takes over in Dark. */
[data-theme="dark"] .qs-theme-sun,
[data-theme="dark"] .qs-theme-rays {
  display: none;
}
:root:not([data-theme="dark"]) .qs-theme-moon {
  display: none;
}
.qs-theme-hint {
  margin-top: 8px;
  font-size: 0.68rem;
  text-align: center;
  opacity: 0.7;
}
.qs-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.qs-slider .qs-ico {
  width: 20px;
  text-align: center;
  font-size: 0.9rem;
}
.qs-slider .qs-brightness-icon {
  display: grid;
  place-items: center;
  color: var(--text-primary);
}
.qs-brightness-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.qs-brightness-icon svg circle {
  fill: var(--accent);
  stroke: none;
}
.qs-brightness-icon svg path {
  fill: none;
}
.qs-slider input {
  flex: 1;
  accent-color: var(--accent);
}
.qs-slider .qs-val {
  width: 40px;
  text-align: right;
  font-size: 0.7rem;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
.qs-footer {
  margin-top: 14px;
  font-size: 0.72rem;
  opacity: 0.7;
  text-align: center;
}

/* ---------- Calendar flyout ---------- */
#calendar-panel {
  bottom: 54px;
  right: 14px;
  width: 320px;
  padding: 16px 18px 12px;
  color: var(--text-primary);
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-title {
  font-size: 0.86rem;
  font-weight: 600;
}
.cal-nav {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--text-primary);
}
.cal-nav:hover {
  background: var(--flyout-hover);
}
.cal-dow,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow span {
  text-align: center;
  font-size: 0.66rem;
  opacity: 0.6;
  padding-bottom: 6px;
}
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}
.cal-day.other {
  opacity: 0.32;
}
.cal-day:hover:not(.other) {
  background: var(--flyout-hover);
}
.cal-day.today {
  background: var(--accent);
  color: var(--accent-text-on);
  font-weight: 600;
}
.cal-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--stroke-soft);
  font-size: 0.74rem;
}
.cal-clock {
  font-weight: 600;
}

/* ---------- Notification centre ---------- */
#notif-panel {
  bottom: 54px;
  right: 14px;
  width: 340px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 16px 18px;
  color: var(--text-primary);
}
.np-head {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.55;
  margin: 4px 0 10px;
}
.np-empty {
  font-size: 0.78rem;
  opacity: 0.6;
  padding: 6px 0 16px;
}
.np-item {
  background: var(--control-bg);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.np-item-title {
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 3px;
}
.np-item-body {
  font-size: 0.74rem;
  opacity: 0.8;
}
.np-item-time {
  font-size: 0.66rem;
  opacity: 0.5;
  margin-top: 5px;
}
.np-agenda {
  font-size: 0.78rem;
  opacity: 0.6;
}

/* ---------- Night light filter ---------- */
#desktop.night-light {
  transition: filter 0.35s ease;
}
#desktop.night-light #window-layer,
#desktop.night-light #taskbar {
  filter: sepia(0.28) saturate(1.15) hue-rotate(-12deg);
}

/* ---------- Desktop refresh pulse ---------- */
@keyframes deskRefresh {
  from {
    opacity: 0.72;
  }
  to {
    opacity: 1;
  }
}
.refreshing {
  animation: deskRefresh 0.32s ease;
}

/* ---------- Toast ---------- */
#shell-toast {
  position: absolute;
  left: 50%;
  bottom: 66px;
  transform: translate(-50%, 14px);
  z-index: 10001;
  padding: 10px 18px;
  border-radius: 8px;
  background: rgba(32, 32, 32, 0.92);
  color: #fff;
  font-size: 0.78rem;
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.2s ease,
    transform 0.2s cubic-bezier(0.1, 0.9, 0.2, 1);
}
#shell-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Start menu "no results" ---------- */
.sm-empty {
  grid-column: 1 / -1;
  padding: 18px 4px;
  font-size: 0.78rem;
  opacity: 0.6;
}

/* ---------- Power menu ---------- */
#power-menu {
  position: absolute;
  bottom: 50px;
  right: 15px;
  width: 180px;
  padding: 6px;
  color: var(--text-primary);
  /* Stacked list of actions; revealed via the `.show` class that the
     Power button toggles. */
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 10000;
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  background: var(--flyout-bg);
  border: 1px solid var(--flyout-border);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    opacity 0.16s ease,
    visibility 0s linear 0.16s;
}
/* Visible state toggled by the Power button click handler. */
#power-menu.show {
  display: flex;
  flex-direction: column;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2),
    opacity 0.16s ease,
    visibility 0s;
}
#power-menu.hidden {
  display: flex;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.pm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 18px;
  text-align: left;
  white-space: nowrap;
  transition: background-color .14s ease, color .14s ease;
}
.pm-item .pm-icon {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: rgba(255, 255, 255, 0.9);
}
.pm-item .pm-icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pm-item:hover {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}
.pm-item:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: -2px;
}

/* ==================== WINDOWS ==================== */
/* Fluent easing — Windows 11 uses these two curves everywhere. */
:root {
  --fluent-standard: cubic-bezier(0.1, 0.9, 0.2, 1);
  --fluent-decel: cubic-bezier(0, 0, 0, 1);
  --win-open-dur: 0.25s;
  --win-close-dur: 0.2s;
}

.window {
  position: absolute;
  min-width: 320px;
  min-height: 200px;
  background: var(--surface-window);
  color: var(--text-primary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-window);
  display: flex;
  flex-direction: column;
  /* Continuous transition on the geometry properties is what makes
     maximize / restore / snap glide instead of jump. `transform` and
     `opacity` are here for open + close. */
  transition:
    width 0.25s cubic-bezier(0.1, 0.9, 0.2, 1),
    height 0.25s cubic-bezier(0.1, 0.9, 0.2, 1),
    top 0.25s cubic-bezier(0.1, 0.9, 0.2, 1),
    left 0.25s cubic-bezier(0.1, 0.9, 0.2, 1),
    transform 0.2s ease,
    opacity 0.2s ease;
  animation: windowOpen var(--win-open-dur) cubic-bezier(0, 0, 0, 1) both;
}

/* Open: fade in while scaling 95% → 100%, drifting up 10px. */
@keyframes windowOpen {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
/* Kept for backwards compatibility with the old class name. */
@keyframes winOpen {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Close: fade out while scaling down to 95%. */
.window.closing {
  opacity: 0;
  transform: scale(0.95);
  transition: all 0.2s cubic-bezier(0, 0, 0, 1);
  pointer-events: none;
}

.window.minimized {
  display: none;
}

/* Maximize / restore: geometry is animated by the base `transition`
   above, but the open keyframes must be released first, otherwise the
   animation's `transform` wins and the window snaps. */
.window.maximized {
  animation: none;
  will-change: width, height, top, left;
}
.window.restoring {
  animation: none;
}
/* Snapped windows glide into their region and drop the open keyframes. */
.window.snapped {
  animation: none;
  will-change: width, height, top, left;
}

.win-titlebar {
  height: 36px;
  display: flex;
  align-items: center;
  padding-left: 14px;
  background: var(--surface-titlebar);
  cursor: default;
  flex-shrink: 0;
}
.win-title {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-primary);
}
.win-controls {
  display: flex;
  height: 100%;
}
.win-controls button {
  width: 46px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}
.win-controls button:hover {
  background: var(--control-hover);
}
.win-controls button.close:hover {
  background: #c42b1c;
  color: #fff;
}
.win-controls svg {
  width: 11px;
  height: 11px;
}

.win-body {
  flex: 1;
  overflow: auto;
  background: var(--surface-body);
  color: var(--text-primary);
}
.win-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 5;
}

/* ---------- File Explorer (Windows 11 Fluent) ---------- */
.app-explorer {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-window);
  font-size: 0.82rem;
  color: var(--text-primary);
  overflow: hidden;
}
.exp-cmdbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--stroke-soft);
  background: var(--surface-sidebar);
}
.exp-cmd {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--text-primary);
  cursor: pointer;
  font-family: inherit;
}
.exp-cmd:hover { background: var(--control-hover); }
.exp-cmd:active { background: var(--control-active); }
.exp-cmd-sep {
  width: 1px;
  height: 18px;
  background: var(--stroke);
  margin: 0 4px;
}
.exp-addrbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--surface-sidebar);
  border-bottom: 1px solid var(--stroke-soft);
}
.exp-crumbs {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-body);
  border: 1px solid var(--stroke-soft);
  border-radius: 4px;
  padding: 4px 8px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.exp-crumb {
  padding: 1px 5px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.78rem;
}
.exp-crumb:hover { background: var(--control-hover); }
.exp-crumb.current { color: var(--text-secondary); }
.exp-crumb-sep { color: var(--text-muted); font-size: 0.75rem; }
.exp-search {
  width: 160px;
  padding: 4px 10px;
  border: 1px solid var(--stroke-soft);
  border-radius: 4px;
  font-size: 0.78rem;
  outline: none;
  background: var(--surface-body);
  color: var(--text-primary);
}
.exp-search:focus { border-color: var(--accent); }
.exp-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}
.exp-nav-btn:hover:not(:disabled) { background: var(--control-hover); }
.exp-nav-btn:disabled { color: var(--text-disabled); cursor: default; }
.exp-cols { flex: 1; min-height: 0; display: flex; }
.exp-cols-main { flex: 1; display: flex; min-width: 0; }
.exp-side {
  width: 178px;
  flex-shrink: 0;
  background: var(--surface-sidebar);
  padding: 8px 6px;
  overflow-y: auto;
  border-right: 1px solid var(--stroke-soft);
}
.exp-side-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px 4px;
}
.exp-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}
.exp-nav-item:hover { background: var(--control-hover); }
.exp-nav-item.active { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.exp-nav-item svg { flex-shrink: 0; }
.exp-main {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  overflow-y: auto;
}
.exp-section-title {
  font-weight: 600;
  font-size: 0.8rem;
  margin: 4px 0 10px;
}
.exp-folder-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.exp-item {
  width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  user-select: none;
}
.exp-item:hover { background: var(--control-hover); }
.exp-item.selected { background: color-mix(in srgb, var(--accent) 16%, transparent); outline: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.exp-item span {
  font-size: 0.74rem;
  max-width: 88px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exp-rename-input {
  width: 100%;
  min-width: 0;
  padding: 3px 4px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--surface-body);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.72rem;
  text-align: center;
  outline: none;
}
.exp-item svg { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15)); }
.exp-drive-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  max-width: 420px;
}
.exp-drive-row:hover { background: var(--control-hover); }
.exp-drive-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  font-size: 0.78rem;
}
.exp-drive-bar {
  height: 12px;
  width: 220px;
  max-width: 100%;
  background: var(--control-active);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--stroke-soft);
}
.exp-drive-bar div {
  height: 100%;
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
}
.exp-drive-free { font-size: 0.7rem; color: var(--text-muted); }
.exp-statusbar {
  padding: 4px 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--stroke-soft);
  background: var(--surface-sidebar);
}
.app-terminal {
  background: #0c0c0c;
  color: #ccc;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.85rem;
  padding: 10px;
  height: 100%;
  cursor: text;
}
.app-terminal pre {
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  font-family: inherit;
  user-select: text;
  -webkit-user-select: text;
}
.app-notepad textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 12px;
  font-size: 0.9rem;
  font-family: inherit;
  background: transparent;
  color: var(--text-primary);
  user-select: text;
  -webkit-user-select: text;
}
/* ---------- Google Chrome browser (Fluent + Google home) ---------- */
.app-chrome {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
}
.chrome-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  background: #f1f1f1;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.chrome-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 50%;
  color: #5f6368;
  cursor: pointer;
  flex-shrink: 0;
}
.chrome-nav:hover:not(:disabled) { background: rgba(0, 0, 0, 0.07); }
.chrome-nav:disabled { color: #b5b5b5; cursor: default; }
.chrome-urlbar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 5px 14px;
  min-width: 0;
}
.chrome-urlbar span {
  font-size: 0.78rem;
  color: #202124;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chrome-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: #fff;
}

/* Google-style page */
.chrome-page {
  min-height: 100%;
  box-sizing: border-box;
}
.chrome-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 12%;
}
.chrome-logo { margin-bottom: 26px; }
.google-wordmark {
  display: inline-flex;
  font-family: Arial, sans-serif;
  font-size: 4rem;
  font-weight: 500;
  letter-spacing: -0.075em;
  line-height: 1;
}
.google-wordmark span:nth-child(1),
.google-wordmark span:nth-child(4) { color: #4285f4; }
.google-wordmark span:nth-child(2),
.google-wordmark span:nth-child(6) { color: #ea4335; }
.google-wordmark span:nth-child(3) { color: #fbbc05; }
.google-wordmark span:nth-child(5) { color: #34a853; }
.chrome-searchwrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(560px, 86%);
  padding: 0 18px;
  height: 46px;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.12);
}
.chrome-searchwrap:focus-within { box-shadow: 0 1px 10px rgba(32, 33, 36, 0.2); }
.chrome-searchwrap input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: #202124;
  background: transparent;
  min-width: 0;
}
.chrome-btnrow {
  position: relative;
  z-index: 21;
  display: flex;
  gap: 12px;
  margin-top: 28px;
}
.chrome-btnrow button {
  padding: 9px 18px;
  border: 1px solid #f1f3f4;
  border-radius: 4px;
  background: #f8f9fa;
  color: #3c4043;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
}
.chrome-btnrow button:hover {
  border-color: #dadce0;
  box-shadow: 0 1px 3px rgba(60, 64, 67, 0.2);
}

.chrome-search-results {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #fff;
}
.chrome-search-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 8px 14px;
  border-bottom: 1px solid #e5e7eb;
  background: #f8f9fa;
  color: #3c4043;
  font-size: 0.8rem;
}
.chrome-search-results-head strong {
  color: #3c4043;
  font-weight: 600;
  white-space: nowrap;
}
.chrome-search-results-head span {
  min-width: 0;
  overflow: hidden;
  color: #5f6368;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chrome-search-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #fff;
}
.chrome-search-frame.video-search-frame {
  background: #111;
}
.chrome-embed-note {
  padding: 9px 14px;
  background: #f8f9fa;
  color: #5f6368;
  font-size: 0.75rem;
}
.app-settings {
  /* Settings now follows the global theme tokens, so it re-skins the
     moment <html data-theme> flips — no per-window .dark class needed. */
  --settings-bg: var(--surface-sidebar);
  --settings-surface: var(--surface-body);
  --settings-text: var(--text-primary);
  --settings-muted: var(--text-muted);
  --settings-accent: var(--accent);
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: var(--settings-bg);
  color: var(--settings-text);
  font: 14px "Segoe UI Variable", "Segoe UI", sans-serif;
  transition: var(--theme-transition);
}
.settings-sidebar {
  width: 270px;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  overflow: auto;
  background: var(--settings-bg);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
}
.settings-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 10px 17px;
}
.settings-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d9e8f6;
  font-size: 24px;
}
.settings-profile strong, .settings-profile span {
  display: block;
}
.settings-profile strong { font-size: 15px; font-weight: 600; }
.settings-profile span { margin-top: 3px; color: var(--settings-muted); font-size: 12px; }
.settings-search {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  border: 1px solid #888;
  border-radius: 4px;
  background: var(--settings-surface);
}
.settings-search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.settings-search svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
.settings-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 15px;
}
.settings-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 7px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 120ms ease;
}
.settings-nav-item:hover { background: var(--control-hover); }
.settings-nav-item.active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.settings-nav-item.active::before {
  position: absolute;
  left: 0;
  width: 3px;
  height: 22px;
  border-radius: 3px;
  background: var(--settings-accent);
  content: "";
}
.settings-nav-item svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.settings-main {
  flex: 1;
  min-width: 0;
  overflow: auto;
  background: var(--settings-surface);
}
.settings-page {
  width: min(100%, 950px);
  margin: 0 auto;
  padding: 28px clamp(22px, 4vw, 54px) 44px;
}
.settings-hero {
  min-height: 150px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 26px 30px;
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  background: linear-gradient(115deg, #eaf4fd, #f4f8fc 63%, #e8f2fa);
}
[data-theme="dark"] .settings-hero {
  background: linear-gradient(115deg, #263744, #30383f);
}
.settings-device-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #d5eafa;
  color: #0067b8;
}
.settings-device-mark svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.settings-device-copy { flex: 1; }
.settings-device-copy h1 { margin: 0; font-size: 26px; font-weight: 600; }
.settings-device-copy p { margin: 6px 0 0; color: var(--settings-muted); font-size: 13px; }
.settings-update-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid #c7e4d0;
  border-radius: 18px;
  background: #f2fbf4;
  color: #246b36;
  font-size: 12px;
  white-space: nowrap;
}
.settings-update-badge span { width: 8px; height: 8px; border-radius: 50%; background: #2aa34a; }
.settings-section-heading { margin: 28px 0 14px; font-size: 21px; font-weight: 600; }
.settings-page > h1 { margin: 4px 0 4px; font-size: 28px; font-weight: 600; }
.settings-page-description { margin: 0 0 20px; color: var(--settings-muted); }
.settings-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.settings-card {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  background: var(--settings-surface);
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}
.settings-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--settings-surface));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}
.settings-card-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.settings-card-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.settings-card-copy { flex: 1; min-width: 0; }
.settings-card-copy strong, .settings-card-copy > span { display: block; }
.settings-card-copy strong { margin-bottom: 4px; font-size: 15px; font-weight: 600; }
.settings-card-copy > span { color: var(--settings-muted); font-size: 12px; line-height: 1.35; }
.settings-card-arrow { color: var(--text-muted); font-size: 24px; }
.settings-empty { grid-column: 1 / -1; padding: 12px 0; color: var(--settings-muted); }
.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 22px;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--settings-accent);
  font: inherit;
  cursor: pointer;
}
.settings-back:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.settings-back:first-letter { font-size: 22px; }
.settings-detail-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.settings-detail-heading > svg { width: 42px; height: 42px; fill: none; stroke: var(--settings-accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.settings-detail-heading h1 { margin: 0; font-size: 26px; font-weight: 600; }
.settings-detail-heading p { margin: 4px 0 0; color: var(--settings-muted); }
.settings-detail-panel { max-width: 680px; padding: 20px 22px; border: 1px solid var(--stroke-soft); border-radius: 8px; }
.settings-detail-panel h2 { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
.settings-detail-panel p { color: var(--settings-muted); }
.settings-detail-panel select { min-width: 210px; padding: 8px 10px; border: 1px solid var(--stroke-strong); border-radius: 4px; background: var(--settings-surface); color: inherit; font: inherit; }

/* ---------- Personalization: theme picker cards ---------- */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  max-width: 560px;
  margin: 4px 0 18px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--settings-surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: var(--theme-transition), transform 0.12s ease;
}
.theme-card:hover { transform: translateY(-1px); }
.theme-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.theme-card-preview {
  height: 84px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}
.theme-card-preview::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 34%;
}
.theme-card-preview::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18%;
}
.theme-card-preview.light {
  background: linear-gradient(135deg, #6cc5ff, #0b6bbd 60%, #0a4f8a);
}
.theme-card-preview.light::before { background: #ffffff; }
.theme-card-preview.light::after { background: rgba(243, 243, 243, 0.92); }
.theme-card-preview.dark {
  background: linear-gradient(135deg, #2b2b2b, #101010 60%, #050505);
}
.theme-card-preview.dark::before { background: #202020; }
.theme-card-preview.dark::after { background: rgba(28, 28, 28, 0.92); }
.theme-card-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}
.theme-card-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--stroke-strong);
  color: transparent;
  font-size: 11px;
}
.theme-card.selected .theme-card-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text-on);
}
.settings-control-row, .settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-top: 1px solid var(--stroke-soft);
}
.settings-control-row input[type="range"] { width: min(48%, 280px); accent-color: var(--accent); }
.settings-toggle-row span strong, .settings-toggle-row span small { display: block; }
.settings-toggle-row span small { margin-top: 4px; color: var(--settings-muted); }
.settings-toggle-row input { width: 38px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.settings-storage-meter { height: 9px; overflow: hidden; border-radius: 8px; background: var(--control-active); }
.settings-storage-meter span { display: block; width: 34%; height: 100%; border-radius: inherit; background: var(--accent); }
.settings-action { padding: 8px 14px; border: 0; border-radius: 4px; background: var(--accent); color: var(--accent-text-on); font: inherit; cursor: pointer; }
.settings-action:hover { background: var(--accent-hover); }

/* ---------- Personalization › Themes / Colors: sun-moon theme toggle ---------- */
.theme-glyph {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}
.theme-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--settings-muted);
}
.theme-state-value {
  color: var(--settings-text);
  font-weight: 600;
}
/* ==================== WINDOWS 10 CONTROL PANEL ==================== */
.control-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-body);
  color: var(--text-primary);
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  transition: var(--theme-transition);
}
.cp-toolbar {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 14px;
  border-bottom: 1px solid var(--stroke-soft);
  background: var(--surface-sidebar);
}
.cp-nav { display: flex; gap: 3px; }
.cp-nav button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-secondary);
  font: 22px/1 "Segoe UI", sans-serif;
  cursor: pointer;
}
.cp-nav button:hover:not(:disabled) { background: var(--control-hover); }
.cp-nav button:disabled { color: var(--text-disabled); cursor: default; }
.cp-breadcrumb {
  flex: 1;
  min-width: 90px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text-secondary);
}
.cp-breadcrumb span:last-child { overflow: hidden; text-overflow: ellipsis; }
.cp-crumb-sep { color: var(--text-muted); }
.cp-search-wrap {
  width: 225px;
  max-width: 35%;
  display: flex;
  align-items: center;
  border: 1px solid var(--stroke-strong);
  background: var(--surface-body);
}
.cp-search-wrap:focus-within { border-color: var(--accent); }
.cp-search-wrap input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  outline: 0;
  font: inherit;
  background: transparent;
  color: var(--text-primary);
}
.cp-search-wrap span { padding: 0 8px; color: var(--text-muted); font-size: 18px; }
.cp-options {
  min-height: 36px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  background: var(--surface-body);
}
.cp-options select {
  min-width: 112px;
  padding: 3px 5px;
  border: 1px solid var(--stroke-strong);
  background: var(--surface-card);
  color: var(--text-primary);
  font: inherit;
}
.cp-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 26px 24px;
}
.cp-categories {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  column-gap: 48px;
  row-gap: 28px;
  max-width: 900px;
}
.cp-category { min-width: 0; }
.cp-category-title {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 0 0 7px;
  border: 0;
  border-bottom: 1px solid var(--stroke);
  background: transparent;
  color: var(--accent);
  text-align: left;
  font: 20px "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}
.cp-category-title:hover span, .cp-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
.cp-category-title svg { flex: 0 0 auto; }
.cp-category-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 9px 0 0 49px;
}
.cp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  text-align: left;
  font: inherit;
  line-height: 1.35;
  cursor: pointer;
}
.cp-link svg { flex: 0 0 auto; }
.cp-category-page h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--text-primary);
  font-size: 23px;
  font-weight: 400;
}
.cp-category-page .cp-category-links { padding-left: 54px; gap: 12px; }
.cp-no-results { grid-column: 1 / -1; color: var(--text-muted); }
.cp-applets {
  display: grid;
  align-content: start;
  justify-content: start;
}
.cp-applets.large {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 7px 16px;
}
.cp-applets.small {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 2px 12px;
}
.cp-applet {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--accent);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.cp-applet:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.cp-applet svg { flex: 0 0 auto; }
.cp-applets.small .cp-applet { gap: 7px; padding: 4px 6px; }
.cp-detail {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  max-width: 700px;
  padding: 15px 10px;
}
.cp-detail-icon { flex: 0 0 auto; }
.cp-detail h1, .cp-programs h1 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 23px;
  font-weight: 400;
}
.cp-detail p, .cp-programs > p { color: var(--text-muted); line-height: 1.5; }
.cp-programs { max-width: 840px; }
.cp-programs > p { margin: 0 0 16px; }
.cp-program-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--stroke);
  border-bottom: 0;
  background: var(--surface-sidebar);
}
.cp-program-toolbar button {
  padding: 5px 12px;
  border: 1px solid var(--stroke-strong);
  border-radius: 2px;
  background: var(--control-bg);
  color: var(--text-primary);
  font: inherit;
}
.cp-program-toolbar button:disabled { color: var(--text-disabled); }
.cp-program-table { border: 1px solid var(--stroke); }
.cp-program-row {
  display: grid;
  grid-template-columns: 1.6fr 1.2fr 0.5fr;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--stroke-soft);
  background: var(--surface-body);
  color: var(--text-primary);
  text-align: left;
  font: inherit;
}
button.cp-program-row { cursor: pointer; }
button.cp-program-row:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
button.cp-program-row.selected {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  outline: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
}
.cp-program-heading { background: var(--surface-sidebar); font-weight: 600; }
@media (max-width: 700px) {
  .cp-toolbar { gap: 6px; padding-inline: 8px; }
  .cp-search-wrap { width: 165px; }
  .cp-content { padding: 14px; }
  .cp-categories { grid-template-columns: 1fr; }
  .cp-category-title { font-size: 18px; }
}
.app-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
}
.ph-icon {
  font-size: 3rem;
}
.ph-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.ph-sub {
  font-size: 0.78rem;
  opacity: 0.65;
}

/* ==================== MINECRAFT APP ==================== */

/* ---------- Grass block icon (desktop + start menu + titlebar) ---------- */
.mc-block {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  position: relative;
  background: linear-gradient(180deg, #6faa3c 0 28%, #7c4a2a 28% 100%);
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.25),
    inset 0 -8px 12px rgba(0, 0, 0, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.35);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4));
  image-rendering: pixelated;
}
/* grass overhang strip */
.mc-block::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 24%;
  height: 8%;
  background: #5e9030;
}
/* dirt speckles */
.mc-block::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 28%;
  bottom: 0;
  background-image:
    radial-gradient(circle at 20% 30%, #8f5a35 0 12%, transparent 14%),
    radial-gradient(circle at 65% 55%, #63381e 0 12%, transparent 14%),
    radial-gradient(circle at 40% 75%, #8f5a35 0 12%, transparent 14%),
    radial-gradient(circle at 82% 82%, #63381e 0 10%, transparent 12%);
}
.sm-app-icon .mc-block {
  width: 36px;
  height: 36px;
}
.win-title .mc-block {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.desk-icon-img .mc-block {
  width: 46px;
  height: 46px;
}

/* ---------- Dark Fluent window frame ----------
   `.window.dark` is an explicit per-app request (e.g. Minecraft) to stay
   dark regardless of the system theme. */
.window.dark {
  background: #202020;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.window.dark .win-titlebar {
  background: #1c1c1c;
  color: #fff;
}
.window.dark .win-title {
  color: #fff;
}
.window.dark .win-controls button {
  color: #fff;
}
.window.dark .win-controls button:hover {
  background: rgba(255, 255, 255, 0.08);
}
.window.dark .win-controls button.close:hover {
  background: #c42b1c;
  color: #fff;
}
.window.dark .win-body {
  background: #101010;
}

/* ---------- Explicit LIGHT theme overrides ----------
   When the system theme is Light these pin the surfaces back to light
   values, overriding the .window.dark rules above for a window that opts
   in with `.window.force-light` (kept for completeness / future apps). */
[data-theme="light"] .window.force-light {
  background: #f9f9f9;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

/* ---------- Minecraft window body ---------- */
.app-minecraft {
  position: relative;
  height: 100%;
  background: #101010;
  overflow: hidden;
}
.mc-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #101010;
}
/* ---------- Minecraft dark loader overlay ---------- */
.mc-loader {
  position: absolute;
  inset: 0;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: auto;
}
.mc-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}
.mc-loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  user-select: none;
}
.mc-loader-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mc-logo-text {
  font-family: 'Segoe UI Black', Impact, sans-serif;
  font-size: 2.4rem;
  letter-spacing: 0.22em;
  font-weight: 900;
  color: #f1f1f1;
  text-shadow: 3px 3px 0 #2b2b2b, -2px -2px 0 #111;
  text-transform: uppercase;
}

/* Windows 11 style smooth indeterminate dot spinner */
.win11-spinner {
  position: relative;
  width: 44px;
  height: 44px;
}
.win11-spinner-dot {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  animation: win11Spin 3.5s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
.win11-spinner-dot::after {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: #60cdff;
  box-shadow: 0 0 6px rgba(96, 205, 255, 0.6);
}
.win11-spinner-dot:nth-child(1) { animation-delay: 0.12s; }
.win11-spinner-dot:nth-child(2) { animation-delay: 0.24s; }
.win11-spinner-dot:nth-child(3) { animation-delay: 0.36s; }
.win11-spinner-dot:nth-child(4) { animation-delay: 0.48s; }
.win11-spinner-dot:nth-child(5) { animation-delay: 0.60s; }
.win11-spinner-dot:nth-child(6) { animation-delay: 0.72s; }

@keyframes win11Spin {
  0% {
    transform: rotate(0deg);
    opacity: 1;
  }
  70% {
    transform: rotate(720deg);
    opacity: 1;
  }
  75% {
    opacity: 0;
  }
  100% {
    transform: rotate(720deg);
    opacity: 0;
  }
}

/* ---------- In-window fullscreen (F11 / title-bar button) ---------- */
.window.win-fullscreen {
  position: fixed;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 9998;
  border-radius: 0;
  border: none;
  animation: none;
}
.window.win-fullscreen .win-titlebar {
  height: 32px;
}

/* ============================================================
   WINDOWS 11 CONTEXT MENU
   ============================================================ */
.ctx-menu {
  position: fixed;
  z-index: 10002;
  min-width: 220px;
  padding: 5px;
  border-radius: 8px;
  background: var(--flyout-bg);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--flyout-border);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.22),
    0 1px 2px rgba(0, 0, 0, 0.12);
  color: var(--text-primary);
  font-size: 0.79rem;
  /* Fluent entrance: scale up from the corner plus a slight rise. */
  transform-origin: top left;
  animation: ctxIn 0.14s cubic-bezier(0.1, 0.9, 0.2, 1);
}
.jump-list {
  position: fixed;
  z-index: 10005;
  min-width: 190px;
  padding: 5px;
  border: 1px solid var(--flyout-border);
  border-radius: 9px;
  background: var(--flyout-bg);
  color: var(--text-primary);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  animation: ctxIn 0.14s cubic-bezier(0.1, 0.9, 0.2, 1);
}
.jump-list.hidden { display: none; }
.jump-list-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border-radius: 5px;
  color: inherit;
  font: inherit;
  font-size: 0.82rem;
  text-align: left;
  white-space: nowrap;
}
.jump-list-item:hover:not(:disabled) { background: var(--flyout-hover); }
.jump-list-item:disabled { opacity: 0.4; cursor: default; }
.ctx-menu.hidden {
  display: none;
}
@keyframes ctxIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px 0 8px;
  border-radius: 5px;
  cursor: default;
  white-space: nowrap;
}
.ctx-item:hover {
  background: var(--flyout-hover);
}
.ctx-item.disabled {
  opacity: 0.4;
  pointer-events: none;
}
.ctx-ico {
  width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.72rem;
}
.ctx-arrow {
  margin-left: auto;
  opacity: 0.55;
  font-size: 0.9rem;
  line-height: 1;
}
.ctx-sep {
  height: 1px;
  margin: 5px 8px;
  background: var(--stroke);
}
/* Cascading submenu (View / Sort by / New) */
.ctx-sub {
  position: absolute;
  z-index: 10003;
  min-width: 190px;
  padding: 5px;
  border-radius: 8px;
  background: var(--flyout-bg);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--flyout-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  display: none;
}
/* Opened by the JS mouseover handler. JS owns this state (rather than a
   pure :hover rule) so the cascade stays open while the pointer travels
   from the parent row into the submenu. */
.ctx-menu.sub-open .ctx-sub {
  display: block;
}

/* ============================================================
   EXPLORER — file grid, glyphs, empty state
   ============================================================ */
.exp-folder-grid.size-small .exp-item {
  width: 96px;
  font-size: 0.72rem;
}
.exp-folder-grid.size-large .exp-item {
  width: 130px;
  font-size: 0.82rem;
}
.exp-file-glyph {
  line-height: 1;
  display: block;
}
.exp-item.selected {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  outline: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}
.exp-empty {
  padding: 40px 8px;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0.55;
}

/* ============================================================
   CHROME — omnibox address bar + result pages
   ============================================================ */
.chrome-urlbar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  background: #f1f3f4;
  min-width: 0;
}
.chrome-urlbar:focus-within {
  background: #fff;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.22);
}
.chrome-urlbar input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.78rem;
  color: #202124;
  font-family: inherit;
}
.chrome-urlbar input.is-home {
  color: #5f6368;
}
.chrome-lock {
  flex-shrink: 0;
}

/* ---------- SERP: Google results header (logo + search + tabs) ---------- */
.chrome-serp {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: #fff;
  color: #202124;
  font-family: Arial, "Segoe UI", sans-serif;
}
.serp-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px 0;
  background: #fff;
  border-bottom: 1px solid #ebebeb;
}
.serp-toprow {
  display: flex;
  align-items: center;
  gap: 22px;
}
.serp-logo {
  flex: 0 0 auto;
  font-size: 1.7rem;
}
.serp-searchbox {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 690px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.1);
}
.serp-searchbox:focus-within {
  box-shadow: 0 1px 10px rgba(32, 33, 36, 0.2);
}
.serp-searchbox input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.92rem;
  color: #202124;
  font-family: inherit;
}
.serp-searchbox svg { flex: 0 0 auto; }
.serp-user {
  margin-left: auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1a73e8;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  flex: 0 0 auto;
}
.serp-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
}
.serp-tab {
  position: relative;
  padding: 9px 12px 12px;
  border: 0;
  background: transparent;
  color: #5f6368;
  font: inherit;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
}
.serp-tab:hover { color: #202124; }
.serp-tab.active {
  color: #1a73e8;
  font-weight: 600;
}
.serp-tab.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #1a73e8;
}

/* ---------- SERP body / layout ---------- */
.serp-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 26px;
  padding: 16px 24px 40px;
}
.serp-results {
  flex: 1;
  min-width: 0;
  max-width: 660px;
}
.serp-side {
  width: 300px;
  flex: 0 0 auto;
}
@media (max-width: 900px) {
  .serp-side { display: none; }
}
.serp-stats {
  margin-bottom: 12px;
  color: #70757a;
  font-size: 0.75rem;
}

/* Highlighted "direct site match" card */
.serp-direct {
  margin-bottom: 22px;
  padding: 16px 18px;
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.1);
}
.serp-direct-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.serp-direct-favicon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1f3f4;
  font-size: 15px;
  flex: 0 0 auto;
}
.serp-direct-titles { min-width: 0; }
.serp-direct-titles strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #202124;
}
.serp-direct-titles span {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.serp-direct-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.serp-action {
  padding: 8px 16px;
  border: 1px solid #dadce0;
  border-radius: 18px;
  background: #fff;
  color: #1a73e8;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.serp-action:hover {
  border-color: #c6dafc;
  background: #f8fbff;
}
.serp-action.primary {
  border-color: #1a73e8;
  background: #1a73e8;
  color: #fff;
}
.serp-action.primary:hover { background: #1669d1; }
.serp-video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 12px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.serp-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Organic results */
.serp-result {
  margin-bottom: 26px;
  max-width: 620px;
}
.serp-result-cite {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.75rem;
  color: #5f6368;
  line-height: 1.3;
}
.serp-result-cite .serp-favicon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f1f3f4;
  font-size: 11px;
  flex: 0 0 auto;
}
.serp-result-cite .serp-cite-lines { min-width: 0; }
.serp-result-cite .serp-cite-host {
  display: block;
  color: #202124;
  font-size: 0.78rem;
}
.serp-result-cite .serp-cite-url {
  display: block;
  color: #4d5156;
  font-size: 0.72rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.serp-result-title {
  display: inline-block;
  margin-bottom: 4px;
  color: #1a0dab;
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}
.serp-result-title:hover { text-decoration: underline; }
.serp-result-snippet {
  margin: 0;
  color: #4d5156;
  font-size: 0.82rem;
  line-height: 1.58;
}
.serp-result-snippet em {
  color: #202124;
  font-style: normal;
  font-weight: 600;
}
.serp-sitelinks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-top: 8px;
}
.serp-sitelink {
  padding: 0;
  border: 0;
  background: transparent;
  color: #1a0dab;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
.serp-sitelink:hover { text-decoration: underline; }

/* Video carousel (Images/Videos tabs + inline section) */
.serp-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 26px 0 12px;
  color: #202124;
  font-size: 1rem;
  font-weight: 600;
}
.serp-section-head::before {
  content: "▶";
  color: #ea4335;
  font-size: 0.8rem;
}
.serp-carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 160px;
  gap: 12px;
  margin-bottom: 8px;
  padding-bottom: 10px;
  overflow-x: auto;
}
.serp-video-card { cursor: pointer; }
.serp-video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #3c4043, #202124);
}
.serp-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.serp-video-thumb .serp-video-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.serp-video-thumb .serp-video-play span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  padding-left: 3px;
}
.serp-video-meta {
  margin-top: 7px;
  font-size: 0.74rem;
  color: #5f6368;
  line-height: 1.4;
}
.serp-video-meta strong {
  display: block;
  color: #202124;
  font-weight: 500;
  font-size: 0.78rem;
  margin-bottom: 2px;
}
.serp-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.serp-image-card {
  border-radius: 8px;
  overflow: hidden;
  background: #f1f3f4;
  cursor: pointer;
}
.serp-image-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.serp-image-card span {
  display: block;
  padding: 6px 8px;
  font-size: 0.72rem;
  color: #3c4043;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Right rail: knowledge panel + live web fallback */
.serp-panel {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid #dadce0;
  border-radius: 12px;
  background: #fff;
}
.serp-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  color: #202124;
}
.serp-panel p {
  margin: 0 0 10px;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #4d5156;
}
.serp-panel-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 0.76rem;
}
.serp-panel-facts dt { color: #5f6368; }
.serp-panel-facts dd { margin: 0; color: #202124; }

/* Live web iframe (DuckDuckGo html fallback) */
.serp-live { margin-bottom: 24px; }
.serp-live-frame {
  width: 100%;
  height: 420px;
  border: 1px solid #dadce0;
  border-radius: 10px;
  background: #fff;
}
.serp-live-note {
  margin-top: 8px;
  font-size: 0.74rem;
  color: #70757a;
}

/* Related searches + pagination */
.serp-related {
  max-width: 620px;
  margin: 30px 0 10px;
}
.serp-related h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}
.serp-related-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.serp-related-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #dadce0;
  border-radius: 20px;
  background: #fff;
  color: #202124;
  font: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}
.serp-related-chip:hover { background: #f8f9fa; }
.serp-related-chip::after { content: "🔍"; font-size: 0.75rem; }
.serp-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 26px 0 4px;
  font-size: 1.1rem;
  color: #1a73e8;
  user-select: none;
}
.serp-pagination .serp-page {
  color: #1a73e8;
  cursor: pointer;
}
.serp-pagination .serp-page.current {
  color: #202124;
  font-weight: 700;
  cursor: default;
}
.serp-noresult {
  padding: 26px 4px;
  font-size: 0.86rem;
  color: #4d5156;
}

/* Dark theme: Google keeps its own colours, so only the shell adapts. */
[data-theme="dark"] .chrome-serp {
  background: #202124;
  color: #e8eaed;
}
[data-theme="dark"] .serp-header {
  background: #202124;
  border-bottom-color: #3c4043;
}
[data-theme="dark"] .serp-searchbox {
  background: #303134;
  border-color: #5f6368;
  box-shadow: none;
}
[data-theme="dark"] .serp-searchbox input { color: #e8eaed; }
[data-theme="dark"] .serp-tab { color: #9aa0a6; }
[data-theme="dark"] .serp-tab:hover { color: #e8eaed; }
[data-theme="dark"] .serp-tab.active { color: #8ab4f8; }
[data-theme="dark"] .serp-tab.active::after { background: #8ab4f8; }
[data-theme="dark"] .serp-stats,
[data-theme="dark"] .serp-video-meta { color: #9aa0a6; }
[data-theme="dark"] .serp-result-cite .serp-favicon,
[data-theme="dark"] .serp-direct-favicon,
[data-theme="dark"] .serp-image-card { background: #303134; }
[data-theme="dark"] .serp-result-cite .serp-cite-host { color: #bdc1c6; }
[data-theme="dark"] .serp-result-cite .serp-cite-url { color: #9aa0a6; }
[data-theme="dark"] .serp-result-title,
[data-theme="dark"] .serp-sitelink { color: #8ab4f8; }
[data-theme="dark"] .serp-result-snippet { color: #bdc1c6; }
[data-theme="dark"] .serp-result-snippet em { color: #e8eaed; }
[data-theme="dark"] .serp-direct,
[data-theme="dark"] .serp-panel {
  background: #303134;
  border-color: #5f6368;
}
[data-theme="dark"] .serp-direct-titles strong,
[data-theme="dark"] .serp-related-chip,
[data-theme="dark"] .serp-panel h3,
[data-theme="dark"] .serp-section-head,
[data-theme="dark"] .serp-related h3 { color: #e8eaed; }
[data-theme="dark"] .serp-direct-titles span,
[data-theme="dark"] .serp-panel p,
[data-theme="dark"] .serp-panel-facts dd { color: #bdc1c6; }
[data-theme="dark"] .serp-action {
  background: #303134;
  border-color: #5f6368;
  color: #8ab4f8;
}
[data-theme="dark"] .serp-action:hover { background: #3c4043; }
[data-theme="dark"] .serp-action.primary {
  background: #8ab4f8;
  border-color: #8ab4f8;
  color: #202124;
}
[data-theme="dark"] .serp-related-chip { background: #303134; border-color: #5f6368; }
[data-theme="dark"] .serp-live-frame { border-color: #5f6368; background: #303134; }
[data-theme="dark"] .serp-image-card span { color: #bdc1c6; }

.chrome-site {
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.chrome-site-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  background: #f1f3f4;
  border-bottom: 1px solid #e0e0e0;
  font-size: 0.72rem;
}
.chrome-site-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chrome-site-url {
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chrome-save-link {
  color: #3c4043;
  font: inherit;
  white-space: nowrap;
}
.chrome-save-link:hover { color: #1a73e8; text-decoration: underline; }
.chrome-open {
  color: #1a73e8;
  text-decoration: none;
  flex-shrink: 0;
}
.chrome-open:hover {
  text-decoration: underline;
}
.chrome-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

/* ---------- Calculator ---------- */
.app-calculator {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  padding: 18px;
  color: var(--text-primary);
  background: var(--surface-window);
}
.calculator-display {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  min-height: 88px;
  padding: 8px 4px 16px;
  overflow: hidden;
  font-size: clamp(2rem, 9vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.calculator-display.calculator-error {
  font-size: 1.8rem;
}
.calculator-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(5, minmax(48px, 1fr));
  gap: 8px;
}
.calc-key {
  border: 1px solid var(--stroke-soft);
  border-radius: 7px;
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 1.15rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: background 0.12s ease, transform 0.08s ease;
}
.calc-key:hover {
  background: var(--control-hover);
}
.calc-key:active {
  transform: scale(0.96);
  background: var(--control-active);
}
.calc-key.utility {
  background: var(--surface-sidebar);
}
.calc-key.operator {
  color: var(--accent);
  font-size: 1.3rem;
}
.calc-key.equals {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text-on);
  font-weight: 600;
}
.calc-key.equals:hover {
  background: var(--accent-hover);
}

/* ---------- Camera ---------- */
.app-camera {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: #101010;
}
.camera-preview {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #080808;
}
.camera-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.camera-status {
  position: absolute;
  bottom: 14px;
  left: 50%;
  max-width: calc(100% - 24px);
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.78rem;
  text-align: center;
  transform: translateX(-50%);
}
.camera-controls {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  padding: 12px;
  background: #171717;
}
.camera-shutter {
  min-width: 148px;
  padding: 9px 20px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 22px;
  background: #f8f8f8;
  color: #1a1a1a;
  font-size: 0.88rem;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.camera-shutter:not(:disabled):hover {
  transform: scale(1.04);
}
.camera-shutter:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

/* ---------- Photos ---------- */
.app-photos {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: var(--surface-window);
  color: var(--text-primary);
}
.photos-heading,
.media-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.photos-heading strong,
.media-heading strong { font-size: 1.08rem; }
.photos-count,
.media-heading > span { color: var(--text-secondary); font-size: 0.78rem; }
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
}
.photos-thumbnail {
  min-width: 0;
  padding: 6px;
  overflow: hidden;
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  background: var(--surface-sidebar);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.photos-thumbnail:hover {
  z-index: 1;
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);
}
.photos-thumbnail img {
  display: block;
  width: 100%;
  height: 98px;
  border-radius: 5px;
  background: var(--surface-body);
  object-fit: cover;
}
.photos-thumbnail span {
  display: block;
  overflow: hidden;
  padding: 7px 3px 2px;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.photos-empty,
.media-empty { padding: 28px; color: var(--text-secondary); text-align: center; }
.photo-viewer {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 58px 56px;
  background: rgba(0, 0, 0, 0.94);
}
.photo-viewer.hidden { display: none; }
.photo-viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.photo-viewer-close,
.photo-viewer-nav {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(40, 40, 40, 0.78);
  color: white;
  cursor: pointer;
}
.photo-viewer-close {
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  font-size: 1.5rem;
}
.photo-viewer-nav { top: 50%; width: 40px; height: 40px; font-size: 1.8rem; transform: translateY(-50%); }
.photo-viewer-nav.previous { left: 12px; }
.photo-viewer-nav.next { right: 12px; }
.photo-viewer-caption {
  position: absolute;
  right: 12px;
  bottom: 14px;
  left: 12px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.78rem;
  text-align: center;
}

/* ---------- Media Player ---------- */
.app-media-player {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 16px;
  overflow: hidden;
  background: var(--surface-window);
  color: var(--text-primary);
}
.media-heading { flex: 0 0 auto; margin-bottom: 12px; }
.media-playback {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 145px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--stroke-soft);
  border-radius: 10px;
  background: #11151e;
}
.media-audio-view {
  display: flex;
  width: min(400px, 90%);
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.media-album-art {
  display: grid;
  width: 116px;
  height: 116px;
  place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, #2463eb, #9b4de0);
  color: white;
  font-size: 3.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.media-audio-view audio { width: 100%; }
.media-video-view {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 145px;
  flex-direction: column;
  background: #000;
}
.media-video-view.hidden,
.media-audio-view.hidden { display: none; }
.media-video-canvas { width: 100%; min-height: 0; flex: 1 1 auto; object-fit: contain; }
.media-video-controls {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: #171717;
  color: white;
}
.media-video-controls button {
  width: 28px;
  height: 26px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: white;
  cursor: pointer;
}
.media-video-controls button:hover { background: rgba(255, 255, 255, 0.14); }
.media-video-controls input { flex: 1; accent-color: #60a5fa; }
.media-video-controls span { min-width: 76px; font-size: 0.68rem; text-align: right; }
.media-status {
  position: absolute;
  bottom: 8px;
  left: 10px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.68rem;
  pointer-events: none;
}
.media-track-list {
  display: flex;
  flex: 0 0 auto;
  max-height: 112px;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  overflow: auto;
}
.media-track {
  display: flex;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  padding: 5px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.media-track:hover,
.media-track.active { background: var(--control-hover); }
.media-track-icon { width: 20px; color: var(--accent); text-align: center; }
.media-track small { margin-left: auto; color: var(--text-secondary); }
.exp-cmd:disabled { cursor: default; opacity: 0.42; }

/* ============================================================
   NOTEPAD — toolbar + save/download
   ============================================================ */
.app-notepad-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-window);
}
.np-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--surface-titlebar);
  border-bottom: 1px solid var(--stroke-soft);
  flex-shrink: 0;
}
.np-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.74rem;
  color: var(--text-primary);
}
.np-btn:hover {
  background: var(--control-hover);
}
.np-name {
  flex: 1;
  min-width: 0;
  margin-left: auto;
  max-width: 190px;
  padding: 5px 9px;
  border: 1px solid var(--stroke);
  border-radius: 5px;
  font-size: 0.74rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--surface-body);
  outline: none;
}
.np-name:focus {
  border-color: var(--accent);
}
.app-notepad {
  flex: 1;
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  padding: 14px 16px;
  font-family: "Consolas", "Cascadia Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--surface-window);
}

/* ============================================================
   DESKTOP VIEW DENSITY (context menu > View)
   ============================================================ */
#desktop-icons[data-view="small"] .desk-icon {
  width: 74px;
  font-size: 0.66rem;
}
#desktop-icons[data-view="small"] .desk-icon-img svg {
  width: 32px;
  height: 32px;
}
#desktop-icons[data-view="large"] .desk-icon {
  width: 104px;
  font-size: 0.78rem;
}
#desktop-icons[data-view="large"] .desk-icon-img svg {
  width: 60px;
  height: 60px;
}
/* ============================================================
   WINDOWS 11 SNAP LAYOUTS
   A translucent flyout that appears when the pointer rests on a
   window's Maximize button. It offers a 50/50 split, a 2/3 split
   and a 2×2 quadrant grid; hovering a zone previews it and
   clicking snaps the active window into that region.
   ============================================================ */
.snap-layouts {
  position: fixed;
  z-index: 20000;
  padding: 8px;
  border-radius: 10px;
  background: var(--flyout-bg);
  border: 1px solid var(--flyout-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top center;
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
}
.snap-layouts.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.snap-grid {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.snap-option {
  display: grid;
  gap: 4px;
  width: 104px;
  height: 66px;
  padding: 4px;
  border-radius: 7px;
  background: rgba(127, 127, 127, 0.14);
  transition: background 0.12s ease;
}
.snap-option:hover {
  background: rgba(127, 127, 127, 0.22);
}
/* Layout templates for each preset. */
.snap-option[data-layout="two-columns"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr;
}
.snap-option[data-layout="two-thirds"] {
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr;
}
.snap-option[data-layout="quadrants"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.snap-zone {
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: background 0.1s ease, box-shadow 0.1s ease;
}
[data-theme="dark"] .snap-zone {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.12);
}
.snap-zone:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 10px rgba(0, 103, 192, 0.55);
}

/* ============================================================
   TASK MANAGER
   ============================================================ */
.app-taskmanager {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-body);
  color: var(--text-primary);
  font-size: 0.82rem;
}
.tm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--stroke-soft);
  background: var(--surface-titlebar);
}
.tm-toolbar strong {
  font-weight: 600;
  font-size: 0.85rem;
}
.tm-toolbar .tm-spacer {
  flex: 1;
}
.tm-endtask {
  padding: 6px 14px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text-on);
  font-weight: 600;
  transition: background 0.12s ease, opacity 0.12s ease;
}
.tm-endtask:hover {
  background: var(--accent-hover);
}
.tm-endtask:disabled {
  opacity: 0.45;
  cursor: default;
  background: var(--stroke-strong);
}
.tm-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px;
}
.tm-metric {
  background: var(--surface-card);
  border: 1px solid var(--stroke-soft);
  border-radius: 8px;
  padding: 10px 12px;
}
.tm-metric-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.tm-metric-title {
  font-weight: 600;
}
.tm-metric-value {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
}
.tm-meter {
  height: 6px;
  border-radius: 3px;
  background: var(--stroke-soft);
  overflow: hidden;
}
.tm-meter > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.tm-meter.cpu > span { background: #4cc2ff; }
.tm-meter.mem > span { background: #a56eff; }
.tm-meter.disk > span { background: #ffb02e; }
.tm-sub {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
}
.tm-list-head {
  display: grid;
  grid-template-columns: 2.4fr 0.9fr 1fr 1fr;
  gap: 8px;
  padding: 8px 16px;
  border-top: 1px solid var(--stroke-soft);
  border-bottom: 1px solid var(--stroke-soft);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tm-list {
  flex: 1;
  overflow: auto;
}
.tm-row {
  display: grid;
  grid-template-columns: 2.4fr 0.9fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 9px 16px;
  cursor: default;
  border-bottom: 1px solid var(--stroke-soft);
}
.tm-row:hover {
  background: var(--control-hover);
}
.tm-row.selected {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.tm-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.tm-name-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.tm-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.tm-empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--text-muted);
}/* ============================================================
   PERSONALIZATION: WALLPAPER PICKER
   A responsive grid of built-in Windows 11 wallpapers shown on
   Settings › Personalization and on the Background detail page.
   ============================================================ */
.wallpaper-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin: 8px 0 20px;
}
.wallpaper-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--surface-card);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.wallpaper-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.wallpaper-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.wallpaper-thumb {
  height: 88px;
  border-radius: 5px;
  background-size: cover;
  background-position: center;
  background-color: var(--stroke-soft);
}
.wallpaper-card-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-primary);
}
.wallpaper-card-check {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--stroke-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  flex-shrink: 0;
}
.wallpaper-card.selected .wallpaper-card-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text-on);
}

/* Recommended: show a friendly empty state when there is no history. */
.sm-recent-empty {
  padding: 10px 12px;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.sm-recent {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  font: inherit;
}/* ============================================================
   DRAG-TO-SNAP EDGE PREVIEW
   A translucent overlay that appears when a dragged window nears
   the left/right screen edge, previewing the half-screen target.
   ============================================================ */
.snap-preview {
  position: fixed;
  z-index: 15000;
  pointer-events: none;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 70%, transparent);
  box-shadow: inset 0 0 40px color-mix(in srgb, var(--accent) 22%, transparent);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: opacity 0.12s ease;
  opacity: 0;
}
.snap-preview.show {
  opacity: 1;
}

/* ============================================================
   FILE EXPLORER: UPLOAD FILE
   ============================================================ */
.fs-upload-input {
  display: none;
}
.exp-cmd.accent {
  color: var(--accent);
}

/* ============================================================
   MICROSOFT STORE
   ============================================================ */
.app-store {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-body);
  color: var(--text-primary);
}
.store-hero {
  padding: 20px 22px 14px;
  background: linear-gradient(135deg, var(--accent) 0%, #7b2ff7 130%);
  color: #fff;
}
.store-hero h1 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}
.store-hero p {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.9;
}
.store-grid {
  flex: 1;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  padding: 18px 22px;
}
.store-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--stroke-soft);
  border-radius: 10px;
  background: var(--surface-card);
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.store-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.16);
}
.store-card-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  border-radius: 12px;
  background: var(--control-hover);
}
.store-card-title {
  font-weight: 600;
  font-size: 0.9rem;
}
.store-card-desc {
  font-size: 0.74rem;
  color: var(--text-muted);
  flex: 1;
}
.store-btn {
  align-self: flex-start;
  padding: 6px 18px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-text-on);
  font-weight: 600;
  font-size: 0.78rem;
  transition: background 0.12s ease;
}
.store-btn:hover {
  background: var(--accent-hover);
}
.store-btn.installed {
  background: var(--stroke-soft);
  color: var(--text-secondary);
}
.store-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--stroke-soft);
  overflow: hidden;
}
.store-progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}

/* ============================================================
   WIDGETS BOARD (sliding acrylic left panel)
   ============================================================ */
.widgets-scrim {
  position: absolute;
  inset: 0;
  z-index: 8998;
  background: rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.widgets-scrim.show {
  opacity: 1;
}
.widgets-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: var(--taskbar-h);
  width: 360px;
  max-width: 88vw;
  z-index: 8999;
  display: flex;
  flex-direction: column;
  background: var(--flyout-bg);
  border-right: 1px solid var(--flyout-border);
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  color: var(--text-primary);
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(0.1, 0.9, 0.2, 1);
}
.widgets-panel.open {
  transform: translateX(0);
}
.wg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  font-size: 1.05rem;
}
.wg-close {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 18px;
  color: var(--text-primary);
}
.wg-close:hover {
  background: var(--control-hover);
}
.wg-body {
  flex: 1;
  overflow: auto;
  padding: 0 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wg-card {
  background: var(--surface-card);
  border: 1px solid var(--stroke-soft);
  border-radius: 12px;
  padding: 14px;
}
.wg-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  margin-bottom: 10px;
}
.wg-clock {
  font-size: 2rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.wg-clock-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.wg-clock-tz {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 8px;
}
.wg-todo-add {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.wg-todo-add input {
  flex: 1;
  min-width: 0;
  padding: 6px 9px;
  border-radius: 5px;
  border: 1px solid var(--stroke);
  background: var(--surface-body);
  color: var(--text-primary);
  font-size: 0.8rem;
}
.wg-todo-add button {
  padding: 6px 12px;
  border-radius: 5px;
  background: var(--accent);
  color: var(--accent-text-on);
  font-weight: 600;
  font-size: 0.78rem;
}
.wg-todo-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wg-todo-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 6px;
  border-radius: 6px;
  font-size: 0.82rem;
}
.wg-todo-item:hover {
  background: var(--control-hover);
}
.wg-todo-item input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.wg-todo-item span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wg-todo-item.done span {
  text-decoration: line-through;
  opacity: 0.55;
}
.wg-todo-del {
  color: var(--text-muted);
  font-size: 15px;
  padding: 0 4px;
  opacity: 0;
}
.wg-todo-item:hover .wg-todo-del {
  opacity: 1;
}
.wg-notes {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.5;
  outline: none;
}
.wg-empty {
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 4px 6px;
}

/* Store-installed app icons inherit the app icon markup. */
.desk-icon-img .installed-glyph {
  font-size: 40px;
  line-height: 1;
}/* Native <video> used by Media Player for real imported video files. */
.media-video-el {
  width: 100%;
  max-height: 320px;
  border-radius: 8px;
  background: #000;
  display: block;
}
.media-video-el.hidden {
  display: none !important;
}/* ============================================================
   STORE MINI-APPS (installed web apps)
   ============================================================ */
.store-mini-app {
  height: 100%;
  padding: 18px;
  overflow: auto;
  background: var(--surface-body);
  color: var(--text-primary);
}
.weather-now {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent) 0%, #4cc2ff 130%);
  color: #fff;
  margin-bottom: 14px;
}
.weather-big {
  font-size: 48px;
}
.weather-now strong {
  font-size: 1.8rem;
}
.weather-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.weather-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-card);
  border: 1px solid var(--stroke-soft);
  font-size: 0.85rem;
}
.game-app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
}
.game-app canvas {
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  max-width: 100%;
  outline: none;
}
.game-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}
.todo-app .todo-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
}
.paint-app {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.paint-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}
.paint-tools input[type="color"] {
  width: 34px;
  height: 30px;
  border: 1px solid var(--stroke);
  border-radius: 5px;
  background: transparent;
}
.paint-tools button {
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.78rem;
}
.paint-tools button:hover {
  background: var(--control-hover);
}
.paint-canvas {
  border-radius: 10px;
  border: 1px solid var(--stroke);
  background: #fff;
  cursor: crosshair;
  max-width: 100%;
}
.clock-app .world-clock-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* The widget timezone select. */
.wg-clock-tz select {
  margin-left: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid var(--stroke);
  background: var(--surface-body);
  color: var(--text-primary);
  font-size: 0.76rem;
}/* ============================================================
   PAINT APP — full canvas editor
   ============================================================ */
.paint-app {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  padding: 12px;
  background: var(--surface-body);
}
.paint-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.paint-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.paint-tool:hover {
  background: var(--control-hover);
}
.paint-tool.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text-on);
}
.paint-tool svg {
  width: 15px;
  height: 15px;
}
.paint-swatches {
  display: inline-flex;
  gap: 5px;
  align-items: center;
}
.paint-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px var(--stroke);
  cursor: pointer;
  padding: 0;
}
.paint-swatch.active {
  border-color: var(--text-primary);
  box-shadow: 0 0 0 2px var(--accent);
}
.paint-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-secondary);
}
.paint-field input[type="range"] {
  width: 110px;
  accent-color: var(--accent);
}
.paint-field input[type="color"] {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.paint-spacer {
  flex: 1;
}
.paint-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-conic-gradient(#e8e8e8 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  overflow: auto;
}
.paint-canvas {
  background: #ffffff;
  cursor: crosshair;
  touch-action: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  max-width: 100%;
}

/* ============================================================
   MINESWEEPER
   ============================================================ */
.minesweeper {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-body);
  color: var(--text-primary);
}
.ms-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface-titlebar);
  border-bottom: 1px solid var(--stroke-soft);
}
.ms-stat {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 7px;
  background: var(--surface-card);
  border: 1px solid var(--stroke-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.9rem;
}
.ms-stat .ms-ico {
  font-size: 0.95rem;
}
.ms-spacer {
  flex: 1;
}
.ms-face {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.ms-face:hover {
  background: var(--control-hover);
}
.ms-levels {
  display: flex;
  gap: 6px;
}
.ms-level {
  padding: 5px 11px;
  border-radius: 6px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.74rem;
  cursor: pointer;
}
.ms-level.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text-on);
}
.ms-board-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 18px;
}
.ms-board {
  display: grid;
  gap: 2px;
  background: var(--stroke);
  padding: 4px;
  border-radius: 8px;
  touch-action: manipulation;
}
.ms-cell {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: none;
  background: linear-gradient(160deg, #c9d6e2 0%, #aab9c9 100%);
  color: #1a2b3c;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  padding: 0;
  transition: background 0.08s ease;
}
[data-theme="dark"] .ms-cell {
  background: linear-gradient(160deg, #3a4757 0%, #2b3542 100%);
  color: #eaeaea;
}
.ms-cell:hover:not(.revealed) {
  background: linear-gradient(160deg, #dbe6f0 0%, #bccadb 100%);
}
.ms-cell.revealed {
  background: var(--surface-card);
  cursor: default;
}
.ms-cell.mine {
  background: #c42b1c;
  color: #fff;
}
.ms-cell.flag {
  background: linear-gradient(160deg, #ffd76a 0%, #f0b400 100%);
}
.ms-cell.wrong {
  background: #7a2020;
  color: #fff;
}
.ms-n1 { color: #1976d2; }
.ms-n2 { color: #388e3c; }
.ms-n3 { color: #d32f2f; }
.ms-n4 { color: #7b1fa2; }
.ms-n5 { color: #e65100; }
.ms-n6 { color: #0097a7; }
.ms-n7 { color: #455a64; }
.ms-n8 { color: #000000; }
.ms-banner {
  padding: 10px 16px;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
}
.ms-banner.win { background: #2e7d32; color: #fff; }
.ms-banner.lose { background: #c42b1c; color: #fff; }

/* ============================================================
   STICKY NOTES (desktop cards)
   ============================================================ */
#sticky-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}
.sticky-note {
  position: absolute;
  width: 200px;
  height: 180px;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
  overflow: hidden;
  color: #1f1f1f;
}
.sticky-note.yellow { background: #fff275; }
.sticky-note.blue   { background: #a5d8ff; }
.sticky-note.green  { background: #b2f2bb; }
.sticky-note.pink   { background: #ffc9de; }
.sticky-note.dragging {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  transform: scale(1.03);
}
.sticky-head {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 6px;
  background: rgba(0, 0, 0, 0.07);
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}
.sticky-head:active {
  cursor: grabbing;
}
.sticky-grip {
  flex: 1;
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.45;
  user-select: none;
}
.sticky-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 0;
  cursor: pointer;
}
.sticky-dot.yellow { background: #fff275; }
.sticky-dot.blue   { background: #a5d8ff; }
.sticky-dot.green  { background: #b2f2bb; }
.sticky-dot.pink   { background: #ffc9de; }
.sticky-del {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  color: #333;
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.sticky-del:hover {
  background: rgba(0, 0, 0, 0.14);
}
.sticky-body {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: #1f1f1f;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 8px 10px;
}

/* Sticky Notes app window (list of notes + colour picker) */
.sticky-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-body);
  color: var(--text-primary);
}
.sticky-app-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke-soft);
  background: var(--surface-titlebar);
}
.sticky-app-bar strong {
  font-size: 0.85rem;
}
.sticky-app-spacer {
  flex: 1;
}
.sticky-add {
  padding: 6px 14px;
  border-radius: 5px;
  background: var(--accent);
  color: var(--accent-text-on);
  font-weight: 600;
  font-size: 0.78rem;
}
.sticky-add:hover {
  background: var(--accent-hover);
}
.sticky-colors {
  display: flex;
  gap: 6px;
}
.sticky-hint {
  padding: 10px 16px;
  font-size: 0.76rem;
  color: var(--text-muted);
}
.sticky-list {
  flex: 1;
  overflow: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sticky-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--stroke-soft);
  background: var(--surface-card);
  font-size: 0.8rem;
}
.sticky-row-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
}
.sticky-row-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}
.sticky-row button {
  font-size: 0.74rem;
  color: var(--accent);
  padding: 4px 8px;
  border-radius: 5px;
}
.sticky-row button:hover {
  background: var(--control-hover);
}
.sticky-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ============================================================
   TOUCH / TABLET SUPPORT
   Disable the tap-highlight flash and make interactive chrome
   usable with a finger. Drag handles opt into touch-action:none.
   ============================================================ */
#desktop, #taskbar, .window, .desk-icon, .sticky-note,
.tb-btn, .app-launch, .tray-btn, .ms-cell, .paint-tool,
.paint-swatch, .sticky-dot, .sticky-del, .qs-btn {
  -webkit-tap-highlight-color: transparent;
}
.win-titlebar {
  touch-action: none; /* the titlebar is the window drag handle */
}
.desk-icon {
  touch-action: none; /* desktop icons are draggable by finger */
}
/* Comfortable finger targets on small screens. */
@media (max-width: 820px) {
  .tb-btn, .app-launch, .tray-btn {
    min-width: 40px;
  }
  .win-controls button {
    width: 44px;
  }
  .ms-cell {
    width: 26px;
    height: 26px;
  }
  .sticky-note {
    width: 170px;
    height: 160px;
  }
}
/* Taskbar compaction so it never overflows a narrow viewport. */
@media (max-width: 640px) {
  .tb-widgets-temp,
  .tb-widgets-desc {
    display: none;
  }
  #tb-date {
    display: none;
  }
}

/* ============================================================
   RECYCLE BIN
   ============================================================ */
.recycle-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--surface-body);
  color: var(--text-primary);
}
.rb-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--surface-body) 84%, transparent);
}
.rb-btn {
  border: 1px solid var(--stroke);
  border-radius: 7px;
  padding: 8px 12px;
  background: var(--control-bg);
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  font-size: .78rem;
}
.rb-btn:hover:not(:disabled) { background: var(--control-hover); }
.rb-btn:disabled { opacity: .45; cursor: default; }
.rb-btn.danger { color: #c43b31; }
.rb-spacer { flex: 1; }
.rb-note { min-height: 18px; padding: 10px 16px 0; color: var(--text-muted); font-size: .74rem; }
.rb-list { overflow: auto; flex: 1; padding: 10px 14px 16px; }
.rb-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.rb-row:hover { background: var(--flyout-hover); }
.rb-row.selected { background: color-mix(in srgb, var(--accent) 18%, transparent); outline: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); }
.rb-row-ico { font-size: 1.45rem; text-align: center; }
.rb-row-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rb-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.rb-row-origin, .rb-row-date { color: var(--text-muted); font-size: .68rem; }
.rb-row-date { white-space: nowrap; }
.rb-empty { display: grid; place-items: center; min-height: 220px; color: var(--text-muted); font-size: .9rem; }

/* ============================================================
   LIVE SYSTEM TOASTS — above the taskbar's right tray
   ============================================================ */
.toast-host {
  position: fixed;
  z-index: 30000;
  right: 16px;
  bottom: calc(var(--taskbar-h) + 14px);
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 12px 14px 14px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 12px;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--surface-window) 78%, rgba(255,255,255,.35));
  box-shadow: 0 14px 35px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.25);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(28px) scale(.97);
  transition: opacity .22s ease, transform .28s cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
}
.toast.show { opacity: 1; transform: translateX(0) scale(1); }
.toast.hide { opacity: 0; transform: translateX(28px) scale(.97); }
.toast-ico { flex: 0 0 27px; font-size: 1.35rem; line-height: 1.1; text-align: center; }
.toast-text { min-width: 0; flex: 1; }
.toast-title { font-size: .8rem; font-weight: 650; margin-bottom: 3px; }
.toast-body { font-size: .74rem; line-height: 1.35; color: var(--text-secondary); }
.toast-close { border: 0; background: transparent; color: var(--text-muted); font-size: 1.1rem; line-height: 1; cursor: pointer; padding: 0 2px; }
.toast-close:hover { color: var(--text-primary); }

/* ============================================================
   ACRYLIC LOCK SCREEN
   ============================================================ */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 25000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  background: rgba(10, 18, 34, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .42s ease;
}
.lock-screen.shown { opacity: 1; pointer-events: auto; }
.lock-bg {
  position: absolute;
  inset: -42px;
  background: inherit;
  background-image: var(--wallpaper-image, url("bloom.jpg"));
  background-position: center;
  background-size: cover;
  filter: blur(30px) brightness(.72) saturate(1.32);
  transform: scale(1.1);
}
.lock-bg::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(ellipse at 50% 25%, rgba(74, 132, 199, .23), transparent 48%),
    linear-gradient(145deg, rgba(7, 13, 25, .42), rgba(13, 21, 38, .64));
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-backdrop-filter: blur(12px) saturate(125%);
}
.lock-sheet {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0,0,0,.45);
}
.lock-time { font-family: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, sans-serif; font-size: clamp(4.6rem, 13vw, 9rem); font-weight: 300; letter-spacing: -.05em; line-height: .95; }
.lock-date { margin-top: 14px; font-size: clamp(1rem, 2vw, 1.45rem); font-weight: 400; }
.lock-hint { position: static; display: flex; flex-direction: column; align-items: center; gap: 24px; margin-top: clamp(34px, 8vh, 72px); }
.lock-user { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.lock-user strong,.lock-user small { display: block; text-align: left; }
.lock-user strong { font-size: .9rem; font-weight: 600; }
.lock-user small { margin-top: 3px; color: rgba(255,255,255,.75); font-size: .72rem; }
.lock-avatar { width: 42px; height: 42px; border: 2px solid rgba(255,255,255,.8); box-shadow: 0 0 0 4px rgba(255,255,255,.09), 0 5px 20px rgba(0,0,0,.3); }
.lock-swipe { display: flex; flex-direction: column; align-items: center; gap: 7px; color: rgba(255,255,255,.8); font-size: .78rem; cursor: pointer; animation: lockFloat 1.8s ease-in-out infinite; }
.lock-swipe:focus-visible { outline: 2px solid #fff; outline-offset: 6px; border-radius: 6px; }
@keyframes lockFloat { 50% { transform: translateY(-7px); color: #fff; } }
.lock-screen.shown .lock-sheet { animation: fluentTextIn .65s cubic-bezier(.2,.7,.2,1) both; }
#desktop.powering-down {
  z-index: 200;
  transform: scale(.98);
  transform-origin: center center;
  opacity: 0;
  transition:
    transform .4s cubic-bezier(.2,.7,.2,1),
    opacity .4s ease;
  pointer-events: none;
}
@keyframes powerPromptPulse {
  0%, 100% { opacity: .5; }
  50% { opacity: .92; }
}

@media (prefers-reduced-motion: reduce) {
  #boot-screen,
  #desktop.reveal,
  #desktop.powering-down,
  .fluent-spinner::before,
  .fluent-spinner::after,
  .boot-status,
  .boot-power-prompt,
  .lock-screen.shown .lock-sheet,
  .lock-swipe {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 640px) {
  .rb-toolbar { flex-wrap: wrap; }
  .rb-row { grid-template-columns: 32px minmax(0, 1fr); }
  .rb-row-date { display: none; }
  .toast-host { right: 10px; bottom: calc(var(--taskbar-h) + 10px); width: min(360px, calc(100vw - 20px)); }
}


/* ============================================================
   DESKTOP AUTO-ARRANGE GRID
   Strict Windows-style column layout: icons fill top-to-bottom
   first, then wrap into the next column. Sized to sit exactly
   above the 48px taskbar with no vertical scroll.
   ============================================================ */
#desktop-icons {
  position: absolute;
  inset: 0 0 48px 0;
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 90px);
  grid-auto-columns: 90px;
  gap: 6px;
  padding: 12px;
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  box-sizing: border-box;
  align-content: start;
  justify-content: start;
}
#desktop-icons .desk-icon {
  position: relative;
  left: auto !important;
  top: auto !important;
  width: 90px;
  height: 90px;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
}
#desktop-icons .desk-icon > span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  width: 86px;
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Windows wraps a long desktop label onto a second line instead of
     cutting it off, so “Command Prompt” stays readable. */
  white-space: normal;
  line-height: 1.15;
  word-break: break-word;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 2px rgba(0, 0, 0, .8);
}

/* Six evenly sized columns and compact, consistent pinned tiles. */
#start-menu .sm-pinned {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  align-items: start;
}
#start-menu .sm-app {
  min-width: 0;
  padding: 8px 2px;
  gap: 0;
}
#start-menu .sm-app-icon {
  width: 32px;
  height: 32px;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#start-menu .sm-app-icon svg {
  width: 32px;
  height: 32px;
}
#start-menu .sm-app > span {
  display: block;
  width: 100%;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#start-menu .sm-footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px;
  margin: 18px -28px 0;
  border-top: 1px solid rgba(255, 255, 255, .1);
}
#start-menu .sm-user {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}
#start-menu .sm-brand {
  margin: 0 auto;
}
#start-menu .sm-power {
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The power popup is positioned relative to the Start menu footer,
   immediately above the power button rather than against the viewport.
   Anchored bottom:50px / right:15px and raised above every other Start
   menu layer so it always floats on top. */
#start-menu #power-menu {
  position: absolute;
  bottom: 50px;
  right: 15px;
  left: auto;
  top: auto;
  width: 180px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
}

/* Preserve finger/mouse dragging without disturbing the resting grid flow. */
#desktop-icons .desk-icon.dragging {
  position: absolute !important;
  z-index: 20;
}

/* An icon the user has dragged to a free spot stays absolutely positioned so
   its inline left/top continue to govern the rendered box. Without this the
   icon falls back to `position: relative` and the saved left/top offset it
   from its grid slot instead — sliding it under the taskbar. The inline
   left/top (set with priority "important") already outrank the grid rule's
   `left/top: auto !important`, so only `position` needs forcing here. */
#desktop-icons .desk-icon.placed {
  position: absolute !important;
  margin: 0;
}
#desktop-icons .desk-icon.placed.dragging {
  z-index: 20;
}
/* ============================================================
   GEMINI AI — native chat assistant
   Rendered with our own markup (no iframe, no address bar) so it
   reads as a built-in system app. Header is acrylic, the stream
   scrolls, and the composer is pinned to the bottom.
   ============================================================ */
.gemini-app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--surface-body);
  color: var(--text-primary);
}
.gemini-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--stroke);
  background: var(--flyout-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
}
.gemini-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(120, 150, 255, 0.14);
  flex: 0 0 auto;
}
.gemini-head-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.gemini-head-text strong {
  font-size: 0.95rem;
  font-weight: 600;
}
.gemini-head-text span {
  font-size: 0.72rem;
  opacity: 0.65;
}
.gemini-clear {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.12s ease;
}
.gemini-clear:hover {
  background: var(--control-hover);
}
/* Gear (API-key settings) button in the header. */
.gemini-gear {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease, transform 0.2s ease;
}
.gemini-gear:hover {
  background: var(--control-hover);
}
.gemini-gear[aria-expanded="true"] {
  background: var(--control-hover);
  transform: rotate(45deg);
}

.gemini-stream {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.gemini-msg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 100%;
}
.gemini-msg.user {
  flex-direction: row-reverse;
}
.gemini-avatar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--control-hover);
  color: var(--text-primary);
}
.gemini-msg.user .gemini-avatar {
  background: #0b6cff;
  color: #fff;
}
.gemini-bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 78%;
  background: var(--surface-card);
  border: 1px solid var(--stroke);
}
.gemini-msg.user .gemini-bubble {
  background: #0b6cff;
  border-color: #0b6cff;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.gemini-msg.ai .gemini-bubble {
  border-bottom-left-radius: 4px;
}
/* Three-dot “thinking” indicator. */
.gemini-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 1.2em;
}
.gemini-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  animation: geminiPulse 1.1s ease-in-out infinite;
}
.gemini-dots i:nth-child(2) {
  animation-delay: 0.18s;
}
.gemini-dots i:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes geminiPulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

.gemini-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 18px 12px;
}
.gemini-suggest.hidden {
  display: none;
}
.gemini-suggest button {
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.gemini-suggest button:hover {
  background: var(--control-hover);
  border-color: #0b6cff;
}

.gemini-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--stroke);
  background: var(--surface-body);
}
.gemini-input {
  flex: 1 1 auto;
  resize: none;
  min-height: 42px;
  max-height: 120px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.4;
  outline: none;
}
.gemini-input:focus {
  border-color: #0b6cff;
}
.gemini-send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: #0b6cff;
  color: #fff;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.gemini-send:hover {
  background: #0a5fe0;
}
.gemini-send:active {
  transform: scale(0.94);
}

/* ============================================================
   SNIPPING TOOL — capture window
   ============================================================ */
.snip-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--surface-body);
  color: var(--text-primary);
}
.snip-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--stroke);
  background: var(--flyout-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
}
.snip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}
.snip-btn:hover:not(:disabled) {
  background: var(--control-hover);
}
.snip-btn.primary {
  background: #0b6cff;
  border-color: #0b6cff;
  color: #fff;
}
.snip-btn.primary:hover {
  background: #0a5fe0;
}
.snip-btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.snip-mode-label {
  font-size: 0.74rem;
  opacity: 0.7;
  padding-left: 4px;
}
.snip-status {
  margin-left: auto;
  font-size: 0.74rem;
  opacity: 0.75;
}

.snip-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  background:
    repeating-conic-gradient(rgba(128, 128, 128, 0.08) 0% 25%, transparent 0% 50%)
    50% / 22px 22px;
}
.snip-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  opacity: 0.55;
  max-width: 320px;
}
.snip-placeholder p {
  margin: 6px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
}
.snip-placeholder span {
  font-size: 0.76rem;
  line-height: 1.45;
}
.snip-placeholder.hidden {
  display: none;
}
.snip-preview {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  background: #fff;
}
.snip-preview.hidden {
  display: none;
}
.snip-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--stroke);
  font-size: 0.72rem;
  opacity: 0.7;
}

/* ---------- Full-screen capture overlay (crosshair selector) ---------- */
.snip-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}
.snip-overlay.hidden {
  display: none;
}
.snip-dim {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 22, 0.45);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
/* The selection box is cut out of the dim layer with a huge outer shadow,
   which is how real snip tools keep the selected area at full brightness. */
.snip-select {
  position: absolute;
  border: 1.5px solid #4cc2ff;
  box-shadow: 0 0 0 100vmax rgba(10, 14, 22, 0.45);
  background: transparent;
  pointer-events: none;
}
.snip-select::before,
.snip-select::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1.5px solid #4cc2ff;
  background: #fff;
  border-radius: 2px;
}
.snip-select::before { left: -5px; top: -5px; }
.snip-select::after { right: -5px; bottom: -5px; }
.snip-hint {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(20, 26, 38, 0.82);
  color: #fff;
  font-size: 0.78rem;
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}/* ---------- Gemini API-key setup card ---------- */
.gemini-setup {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(12, 18, 30, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: geminiSetupIn 0.18s ease both;
}
.gemini-setup.hidden {
  display: none;
}
@keyframes geminiSetupIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.gemini-setup-card {
  width: min(430px, 100%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px;
  border-radius: 16px;
  background: var(--flyout-bg);
  border: 1px solid var(--flyout-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  color: var(--text-primary);
  text-align: left;
  animation: geminiCardIn 0.22s cubic-bezier(0.1, 0.9, 0.2, 1) both;
}
@keyframes geminiCardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.gemini-setup-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(120, 150, 255, 0.14);
  margin-bottom: 2px;
}
.gemini-setup-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 600;
}
.gemini-setup-lead {
  margin: 0 0 6px;
  font-size: 0.82rem;
  line-height: 1.55;
  opacity: 0.78;
}
.gemini-setup-lead code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--control-hover);
  font-size: 0.78rem;
}
.gemini-setup-label {
  font-size: 0.76rem;
  font-weight: 600;
  opacity: 0.85;
}
.gemini-setup-row {
  display: flex;
  gap: 8px;
}
.gemini-key-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
  outline: none;
}
.gemini-key-input:focus {
  border-color: #0b6cff;
  box-shadow: 0 0 0 3px rgba(11, 108, 255, 0.18);
}
.gemini-key-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  border-radius: 9px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  cursor: pointer;
}
.gemini-key-toggle:hover {
  background: var(--control-hover);
}
.gemini-setup-hint {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.72;
  line-height: 1.5;
}
.gemini-setup-hint a {
  color: #3b82f6;
  text-decoration: none;
}
.gemini-setup-hint a:hover {
  text-decoration: underline;
}
.gemini-setup-error {
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(220, 60, 60, 0.12);
  border: 1px solid rgba(220, 60, 60, 0.35);
  color: #e0605f;
  font-size: 0.76rem;
  line-height: 1.45;
}
.gemini-setup-error.hidden {
  display: none;
}
.gemini-setup-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 6px;
}
.gemini-btn {
  padding: 9px 15px;
  border-radius: 8px;
  border: 1px solid var(--stroke);
  background: var(--surface-card);
  color: var(--text-primary);
  font-size: 0.79rem;
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
}
.gemini-btn:hover {
  background: var(--control-hover);
}
.gemini-btn.primary {
  background: #0b6cff;
  border-color: #0b6cff;
  color: #fff;
}
.gemini-btn.primary:hover {
  background: #0a5fe0;
}
.gemini-btn.danger {
  color: #e0605f;
  border-color: rgba(220, 60, 60, 0.4);
}
.gemini-btn.danger:hover {
  background: rgba(220, 60, 60, 0.12);
}
.gemini-btn.hidden {
  display: none;
}
.gemini-btn.danger {
  margin-right: auto;
}

/* ---------- “Gemini is typing…” indicator ---------- */
.gemini-typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  opacity: 0.8;
}
.gemini-typing .gemini-dots {
  margin-left: 2px;
}

/* ---------- Assistant markdown output ---------- */
.gemini-bubble strong {
  font-weight: 650;
}
.gemini-md-h {
  font-weight: 650;
  font-size: 0.94rem;
  margin: 6px 0 2px;
}
.gemini-list {
  margin: 4px 0;
  padding-left: 20px;
  list-style: disc;
}
.gemini-list li {
  margin: 2px 0;
}
.gemini-code {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-x: auto;
}
.gemini-code code {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre;
  color: #e6edf3;
}
.gemini-inline-code {
  padding: 1.5px 5px;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.22);
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 0.8rem;
}
.gemini-bubble a {
  color: #3b82f6;
  text-decoration: none;
}
.gemini-bubble a:hover {
  text-decoration: underline;
}
/* The user's own bubble is solid blue, so links there need white. */
.gemini-msg.user .gemini-bubble a {
  color: #fff;
  text-decoration: underline;
}

/* ==================== UEFI BOOT MANAGER & BIOS ==================== */
.uefi-boot-screen,
.uefi-bios {
  position: fixed;
  inset: 0;
  z-index: 20000;
  overflow: auto;
  color: #e8e9ed;
  background:
    radial-gradient(ellipse at 78% 16%, rgba(119, 22, 28, .18), transparent 34%),
    linear-gradient(135deg, #08090c 0%, #111318 48%, #090a0d 100%);
  font-family: "Segoe UI", system-ui, sans-serif;
}
.uefi-boot-screen::before,
.uefi-bios::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: .14;
  background: repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(255,255,255,.025) 4px);
}
.uefi-boot-screen {
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(26, 31, 40, .55), transparent 52%),
    #050608;
}
.uefi-boot-panel {
  width: min(100%, 660px);
  padding: 48px 52px 30px;
  border: 1px solid #34373e;
  background: linear-gradient(145deg, rgba(24,26,31,.96), rgba(11,12,15,.98));
  box-shadow: 0 26px 100px rgba(0,0,0,.7), inset 0 1px rgba(255,255,255,.07);
}
.uefi-brand-mark {
  color: #f1f1f2;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .12em;
}
.uefi-brand-mark span { padding-left: 8px; color: #e52331; font-size: 13px; }
.uefi-kicker,
.bios-section-index {
  color: #db3340;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .18em;
}
.uefi-kicker { margin-top: 38px; }
.uefi-boot-panel h1 {
  margin-top: 8px;
  color: #fff;
  font-size: clamp(25px, 4vw, 34px);
  font-weight: 650;
  letter-spacing: -.035em;
}
.uefi-boot-copy { margin-top: 8px; color: #92969f; font-size: 13px; }
.uefi-boot-options { display: grid; gap: 10px; margin-top: 30px; }
.uefi-boot-choice {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 76px;
  padding: 12px 16px;
  border: 1px solid #353941;
  color: #e6e7eb;
  background: linear-gradient(110deg, rgba(35,37,43,.92), rgba(19,20,24,.92));
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.uefi-boot-choice:hover,
.uefi-boot-choice.is-selected {
  border-color: #e12d3b;
  background: linear-gradient(110deg, rgba(74,29,34,.72), rgba(26,22,25,.95));
}
.uefi-boot-choice.is-selected { box-shadow: inset 3px 0 #e12d3b; }
.uefi-boot-choice:focus-visible,
.bios-tab:focus-visible,
.bios-action-button:focus-visible,
.bios-control-row :focus-visible,
.bios-profile:focus-visible,
.bios-boot-device:focus-visible,
.bios-save-exit:focus-visible {
  outline: 2px solid #f34b56;
  outline-offset: 2px;
}
.uefi-choice-icon { color: #f04450; font-size: 20px; text-align: center; }
.uefi-boot-choice strong,
.uefi-boot-choice small { display: block; }
.uefi-boot-choice strong { font-size: 14px; font-weight: 650; }
.uefi-boot-choice small { margin-top: 4px; color: #9498a2; font-size: 11px; }
.uefi-choice-enter { color: #858994; font-size: 9px; letter-spacing: .1em; }
.uefi-boot-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 27px;
  padding-top: 18px;
  border-top: 1px solid #2e3036;
  color: #8a8e97;
  font-size: 10px;
}
.uefi-boot-footer kbd,
.uefi-bios kbd {
  padding: 3px 5px;
  border: 1px solid #454951;
  border-radius: 3px;
  color: #d1d3d8;
  background: #22242a;
  font: 600 9px ui-monospace, Consolas, monospace;
}
.uefi-boot-build { position: fixed; right: 24px; bottom: 17px; color: #666a73; font: 10px ui-monospace, Consolas, monospace; }
.uefi-boot-build span { padding: 0 6px; color: #e12d3b; }

.uefi-bios {
  z-index: 20001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 80% 0%, rgba(94,17,24,.17), transparent 42%),
    linear-gradient(135deg, #15171b, #0d0e12 65%, #151619);
  font-size: 13px;
}
.bios-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 12px 30px;
  border-bottom: 1px solid #3a3c42;
  background: linear-gradient(110deg, #222429, #17181d 55%, #24252a);
  box-shadow: 0 4px 20px rgba(0,0,0,.26), inset 0 1px rgba(255,255,255,.07);
}
.bios-heading { display: flex; align-items: center; gap: 13px; }
.bios-emblem { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid #92232c; color: #f14350; background: linear-gradient(145deg,#322126,#191a1e); font-size: 17px; }
.bios-heading strong,
.bios-heading small { display: block; }
.bios-heading strong { color: #f3f3f5; font-size: 16px; font-weight: 650; }
.bios-heading small { margin-top: 3px; color: #a0a2a9; font: 10px ui-monospace, Consolas, monospace; letter-spacing: .08em; }
.bios-system-readouts { display: flex; align-items: center; gap: clamp(12px, 2vw, 34px); }
.bios-language { display: grid; gap: 5px; color: #90939b; font-size: 8px; letter-spacing: .1em; }
.bios-language select,
.bios-control-row select,
.bios-control-row input[type="date"],
.bios-control-row input[type="time"] {
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid #44464d;
  border-radius: 2px;
  color: #e5e6e8;
  background: #202126;
  font: inherit;
}
.bios-readout { display: grid; gap: 5px; white-space: nowrap; }
.readout-label { color: #92949c; font-size: 8px; letter-spacing: .12em; }
.bios-readout strong { color: #e7e7e9; font: 600 11px ui-monospace, Consolas, monospace; }
.bios-temp strong { color: #f0646b; }
.bios-temp i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #e8414c; box-shadow: 0 0 8px #e8414c; vertical-align: 1px; }
.bios-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 49px;
  padding: 0 30px;
  border-bottom: 1px solid #3c3e44;
  background: linear-gradient(#24262b,#1b1c21);
}
.bios-tab { position: relative; padding: 0 clamp(13px, 2vw, 26px); color: #a5a7ad; font-size: 11px; white-space: nowrap; }
.bios-tab:hover { color: #fff; background: rgba(255,255,255,.035); }
.bios-tab.active { color: #fff; background: rgba(212,41,52,.11); }
.bios-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; content: ""; background: #e23a45; box-shadow: 0 0 9px rgba(226,58,69,.6); }
.bios-workspace { position: relative; z-index: 1; display: grid; grid-template-columns: 230px minmax(0,1fr); flex: 1; min-height: 0; }
.bios-sidebar { padding: 25px 18px; border-right: 1px solid #33353b; background: linear-gradient(140deg,rgba(26,27,31,.93),rgba(18,19,22,.78)); }
.bios-side-title { display: block; margin-bottom: 18px; color: #a2a4aa; font-size: 9px; font-weight: 700; letter-spacing: .15em; }
.bios-status-card { display: flex; align-items: center; gap: 10px; padding: 12px 10px; border: 1px solid #36383f; background: rgba(255,255,255,.025); }
.bios-status-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #7ac697; box-shadow: 0 0 8px rgba(122,198,151,.6); }
.bios-status-card strong,.bios-status-card small { display: block; }
.bios-status-card strong { color: #dddfe2; font-size: 10px; }
.bios-status-card small { margin-top: 3px; color: #858891; font-size: 9px; }
.bios-side-metric { display: flex; justify-content: space-between; gap: 8px; padding: 13px 1px; border-bottom: 1px solid #303238; font-size: 9px; }
.bios-side-metric span { color: #878a93; }
.bios-side-metric strong { color: #d5d6da; font-weight: 550; text-align: right; }
.bios-side-hint { margin-top: 27px; color: #858891; font-size: 9px; line-height: 2.3; }
.bios-content { position: relative; overflow: auto; padding: clamp(22px,4vh,42px) clamp(22px,4vw,54px) 35px; }
.bios-panel { max-width: 940px; margin: 0 auto; }
.bios-panel-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; padding-bottom: 17px; border-bottom: 1px solid #3b3d43; }
.bios-panel-title h2 { margin-top: 5px; color: #f0f0f2; font-size: clamp(22px,3vw,28px); font-weight: 550; letter-spacing: -.025em; }
.bios-version-tag { padding: 6px 8px; border: 1px solid #514047; color: #d9858c; background: rgba(193,47,58,.08); font: 9px ui-monospace, Consolas, monospace; letter-spacing: .08em; white-space: nowrap; }
.bios-info-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.bios-info-card { min-height: 92px; padding: 15px 17px; border: 1px solid #393b41; background: linear-gradient(135deg,rgba(39,41,46,.8),rgba(25,26,30,.8)); box-shadow: inset 0 1px rgba(255,255,255,.025); }
.bios-info-card span,.bios-info-card strong,.bios-info-card small { display: block; }
.bios-info-card span { color: #989ba3; font-size: 8px; letter-spacing: .12em; }
.bios-info-card strong { margin-top: 9px; color: #ededf0; font-size: 13px; font-weight: 600; }
.bios-info-card small { margin-top: 4px; color: #898c95; font-size: 10px; }
.bios-settings-block { margin-top: 24px; border: 1px solid #383a40; background: rgba(24,25,29,.78); }
.bios-block-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 12px 15px; border-bottom: 1px solid #393b41; background: linear-gradient(100deg,rgba(255,255,255,.035),transparent); }
.bios-block-heading h3 { color: #e1e2e5; font-size: 11px; font-weight: 650; }
.bios-block-heading > span { color: #858891; font-size: 9px; }
.bios-control-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 46px; padding: 7px 15px; border-bottom: 1px solid rgba(255,255,255,.055); }
.bios-control-row:last-child { border-bottom: 0; }
.bios-control-row > label { color: #c8c9ce; font-size: 10px; }
.bios-control-row input[type="date"],
.bios-control-row input[type="time"],
.bios-control-row select { min-width: 170px; font-size: 10px; }
.bios-toggle { display: inline-flex; align-items: center; gap: 8px; min-width: 95px; color: #9b9da4; font-size: 9px; text-align: left; }
.bios-toggle > span { position: relative; width: 30px; height: 16px; border: 1px solid #585a60; border-radius: 12px; background: #292a2f; transition: .15s ease; }
.bios-toggle > span::after { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; content: ""; background: #a4a5ab; transition: .15s ease; }
.bios-toggle.is-on > span { border-color: #d74550; background: #9d2832; }
.bios-toggle.is-on > span::after { left: 16px; background: #fff; }
.bios-toggle.is-on b { color: #e98a91; }
.bios-toggle b { font-weight: 500; }
.bios-range-row { position: relative; flex-wrap: wrap; padding-bottom: 15px; }
.bios-range-row > label { display: flex; justify-content: space-between; width: 100%; }
.bios-range-row output { padding-left: 18px; color: #e8858d; font: 10px ui-monospace,Consolas,monospace; }
.bios-range-row input[type="range"] { width: 100%; height: 5px; margin: 1px 0; accent-color: #dd3440; }
.bios-range-limits { display: flex; justify-content: space-between; width: 100%; color: #81848d; font: 8px ui-monospace,Consolas,monospace; }
.bios-choice-group { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; padding: 15px; }
.bios-profile { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 10px; border: 1px solid #42444a; color: #aeb0b6; background: #222328; text-align: left; font-size: 13px; }
.bios-profile span { font-size: 10px; }
.bios-profile:hover,.bios-profile.is-active { border-color: #b8343e; color: #f1c3c6; background: rgba(160,38,48,.16); }
.bios-boot-priority { display: grid; gap: 8px; padding: 13px; }
.bios-boot-device { display: grid; grid-template-columns: 30px 22px minmax(0,1fr) auto; align-items: center; gap: 11px; min-height: 58px; padding: 8px 11px; border: 1px solid #3d3f45; color: #dddfe2; background: #222328; text-align: left; }
.bios-boot-device:hover,.bios-boot-device.is-priority { border-color: #a8333c; background: linear-gradient(90deg,rgba(141,34,43,.16),rgba(35,35,40,.8)); }
.bios-device-number { color: #9d9fa6; font: 10px ui-monospace,Consolas,monospace; }
.bios-drive-icon { color: #e14a55; font-size: 16px; }
.bios-boot-device strong,.bios-boot-device small { display: block; }
.bios-boot-device strong { font-size: 10px; }
.bios-boot-device small { margin-top: 4px; color: #858891; font-size: 9px; }
.bios-priority-label { color: #c78287; font-size: 8px; letter-spacing: .09em; }
.bios-exit-copy { margin: -7px 0 17px; color: #9a9ca4; font-size: 11px; }
.bios-exit-actions { display: grid; gap: 8px; }
.bios-action-button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 13px; border: 1px solid #3b3d43; color: #c9cacf; background: linear-gradient(110deg,#25262b,#1b1c20); text-align: left; }
.bios-action-button:hover { border-color: #a63b44; background: linear-gradient(110deg,#382328,#222126); }
.bios-action-button.primary { border-color: #a5353f; background: linear-gradient(110deg,rgba(139,34,44,.35),rgba(36,28,31,.8)); }
.bios-action-button > span:first-child { width: 21px; color: #e2535d; font-size: 16px; text-align: center; }
.bios-action-button > span:nth-child(2) { flex: 1; }
.bios-action-button strong,.bios-action-button small { display: block; }
.bios-action-button strong { color: #e5e5e8; font-size: 10px; font-weight: 600; }
.bios-action-button small { margin-top: 4px; color: #92949c; font-size: 9px; }
.bios-action-button kbd { margin-left: auto; }
.bios-override-heading { margin: 12px 0 0; padding: 10px 1px 2px; color: #d58b90; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.bios-override-heading small { margin-left: 8px; color: #858891; font-size: 9px; font-weight: 400; letter-spacing: 0; }
.bios-notice { position: absolute; right: 24px; bottom: 15px; max-width: calc(100% - 48px); padding: 9px 13px; border: 1px solid #8e343d; color: #f0c4c7; background: #271b1e; box-shadow: 0 7px 24px rgba(0,0,0,.3); font-size: 10px; opacity: 0; pointer-events: none; transform: translateY(5px); transition: .18s ease; }
.bios-notice.visible { opacity: 1; transform: translateY(0); }
.bios-footer { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; min-height: 51px; padding: 7px 23px; border-top: 1px solid #393b41; background: linear-gradient(#202126,#17181c); color: #95979e; font-size: 9px; }
.bios-footer > span { display: flex; align-items: center; gap: 7px; }
.bios-key-separator { padding: 0 3px; color: #5e6067; }
.bios-save-exit { padding: 7px 11px; border: 1px solid #7f323b; color: #f0d3d5; background: rgba(156,40,50,.2); font-size: 10px; }
.bios-save-exit:hover { border-color: #db4651; background: rgba(156,40,50,.38); }
.bios-save-exit kbd { margin-left: 8px; }

@media (max-width: 760px) {
  .bios-header { align-items: flex-start; gap: 12px; padding: 12px 16px; }
  .bios-system-readouts { flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; }
  .bios-workspace { grid-template-columns: 155px minmax(0,1fr); }
  .bios-sidebar { padding: 18px 12px; }
  .bios-tabs { overflow-x: auto; padding: 0 8px; }
  .bios-tab { padding: 0 12px; }
  .bios-content { padding: 22px 18px 35px; }
}
@media (max-width: 540px) {
  .uefi-boot-panel { padding: 32px 22px 24px; }
  .uefi-kicker { margin-top: 28px; }
  .uefi-boot-footer { gap: 11px; }
  .uefi-choice-enter { display: none; }
  .bios-header { flex-direction: column; }
  .bios-system-readouts { width: 100%; justify-content: space-between; }
  .bios-language { display: flex; align-items: center; }
  .bios-workspace { grid-template-columns: 1fr; }
  .bios-sidebar { display: none; }
  .bios-info-grid { grid-template-columns: 1fr; }
  .bios-content { padding: 18px 13px 35px; }
  .bios-panel-title { align-items: flex-start; }
  .bios-version-tag { font-size: 8px; }
  .bios-footer { padding: 7px 10px; }
  .bios-footer > span { gap: 4px; font-size: 8px; }
  .bios-footer kbd { font-size: 8px; }
  .bios-choice-group { grid-template-columns: 1fr; }
}

/* ==================== LIGHT MODE SHELL CONTRAST ==================== */
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) {
  --icon-color: #1c1c1c;
  --taskbar-bg: rgba(243, 243, 243, 0.85);
  --taskbar-border: rgba(0, 0, 0, 0.08);
  --taskbar-shadow: 0 -1px 4px rgba(0, 0, 0, 0.06);
  --flyout-bg: rgba(243, 243, 243, 0.85);
  --flyout-border: rgba(0, 0, 0, 0.08);
  --flyout-hover: rgba(0, 0, 0, 0.05);
}

:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar {
  color: var(--icon-color);
  background: var(--taskbar-bg);
  border-top-color: var(--taskbar-border);
  box-shadow: var(--taskbar-shadow);
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar .tb-btn,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar .tray-btn,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar .tray-clock,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar .tb-widgets,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar .show-desktop,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-power {
  color: var(--icon-color);
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar .tb-btn.running::after,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar .tb-btn.active::after,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #taskbar .tb-btn.running.minimized::after {
  background: var(--accent);
}

:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu {
  color: #1c1c1c;
  background: rgba(243, 243, 243, 0.88);
  border-color: rgba(0, 0, 0, 0.08);
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-section-label,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-app > span,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-recent,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-recent-name,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-user,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-brand {
  color: #1c1c1c;
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-search input {
  border-color: rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.7);
  color: #1c1c1c;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-search input::placeholder {
  color: rgba(28, 28, 28, 0.62);
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #start-menu .sm-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
}

:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #power-menu,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .power-menu,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .power-flyout {
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(243, 243, 243, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #1a1a1a !important;
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #power-menu *,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .power-menu *,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .power-flyout * {
  color: #1a1a1a !important;
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #power-menu .pm-icon svg,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .power-menu .pm-icon svg,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .power-flyout .pm-icon svg {
  fill: none !important;
  stroke: #1a1a1a !important;
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) #power-menu .pm-item:hover,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .power-menu .pm-item:hover,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .power-flyout .pm-item:hover {
  background: rgba(0, 0, 0, 0.05);
}
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .ctx-menu,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .ctx-sub,
:is(html[data-theme="light"], html.light-mode, body.light-mode, body.light-theme) .jump-list {
  color: var(--text-primary);
}

/* ==================== REGISTRY EDITOR ==================== */
#desktop-icons.registry-hidden { display: none; }
#desktop .window,
#desktop .popup,
#desktop .ctx-menu,
#desktop .ctx-sub,
#desktop .tb-btn {
  transition-duration: var(--registry-animation-duration, .3s);
}
.app-regedit {
  position: relative;
  --regedit-tree-width: 34%;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: var(--text-primary);
  background: var(--surface-body);
  font-size: 12px;
}
.regedit-menu {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 8px;
  border-bottom: 1px solid var(--stroke-soft);
  background: var(--surface-window);
}
.regedit-menu button {
  height: 27px;
  padding: 0 9px;
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 11px;
}
.regedit-menu button:hover { background: var(--control-hover); }
.regedit-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--stroke);
  background: var(--surface-window);
}
.regedit-toolbar > label {
  flex: 0 0 auto;
  padding: 0 4px;
  color: var(--text-secondary);
  font-size: 11px;
}
.regedit-toolbar > button {
  flex: 0 0 auto;
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid var(--stroke-soft);
  border-radius: 4px;
  color: var(--text-primary);
  background: var(--surface-body);
  font-size: 10px;
}
.regedit-toolbar > button:hover { background: var(--control-hover); }
.regedit-toolbar .regedit-nav-button {
  width: 28px;
  padding: 0;
  font-size: 17px;
}
.regedit-address {
  flex: 1 1 auto;
  width: 80px;
  min-width: 60px;
  height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  color: var(--text-primary);
  background: var(--surface-body);
  font-size: 11px;
}
.regedit-address:focus { border-color: var(--accent); outline: 1px solid var(--accent); }
.regedit-main {
  display: grid;
  grid-template-columns: minmax(190px, var(--regedit-tree-width)) 6px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.regedit-tree-pane {
  min-width: 0;
  padding: 8px 5px;
  overflow: auto;
  background: var(--surface-body);
}
.regedit-tree-row {
  display: flex;
  align-items: center;
  min-width: max-content;
  height: 25px;
  padding-right: 8px;
  border-radius: 3px;
  color: var(--text-primary);
  cursor: default;
  white-space: nowrap;
}
.regedit-tree-row:hover { background: var(--control-hover); }
.regedit-tree-row.selected { color: var(--text-primary); background: color-mix(in srgb, var(--accent) 19%, transparent); }
.regedit-tree-row:focus-visible { outline: 1px solid var(--accent); }
.regedit-tree-toggle {
  display: grid;
  flex: 0 0 19px;
  width: 19px;
  height: 22px;
  place-items: center;
  color: var(--text-secondary);
  font-size: 11px;
}
.regedit-tree-toggle.leaf { cursor: default; }
.regedit-key-icon { width: 19px; color: #d6a63b; font-size: 12px; text-align: center; }
.regedit-tree-label { padding-left: 3px; }
.regedit-tree-children { padding-left: 16px; }
.regedit-tree-children.collapsed { display: none; }
.regedit-splitter {
  position: relative;
  z-index: 1;
  cursor: col-resize;
  background: var(--stroke-soft);
  touch-action: none;
}
.regedit-splitter:hover,
.regedit-splitter:focus-visible { background: var(--accent); outline: 0; }
.regedit-values-pane { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.regedit-values-path {
  flex: 0 0 31px;
  overflow: hidden;
  padding: 8px 10px;
  border-bottom: 1px solid var(--stroke-soft);
  color: var(--text-secondary);
  background: var(--surface-window);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.regedit-values-scroll { position: relative; flex: 1; min-height: 0; overflow: auto; }
.regedit-values-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.regedit-values-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  height: 28px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--stroke);
  color: var(--text-secondary);
  background: var(--surface-window);
  font-size: 10px;
  font-weight: 500;
  text-align: left;
}
.regedit-values-table th:first-child { width: 34%; }
.regedit-values-table th:nth-child(2) { width: 20%; }
.regedit-values-table td {
  height: 27px;
  overflow: hidden;
  padding: 4px 8px;
  color: var(--text-primary);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.regedit-values-table td:first-child { display: flex; align-items: center; gap: 7px; }
.regedit-values-table tr { cursor: default; }
.regedit-values-table tbody tr:hover { background: var(--control-hover); }
.regedit-values-table tbody tr.selected { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.regedit-values-table tbody tr:focus-visible { outline: 1px solid var(--accent); }
.regedit-value-icon { color: var(--accent); font-size: 11px; }
.regedit-empty { padding: 20px 12px; color: var(--text-muted); font-size: 11px; }
.regedit-status {
  flex: 0 0 25px;
  padding: 6px 9px;
  border-top: 1px solid var(--stroke-soft);
  color: var(--text-muted);
  background: var(--surface-window);
  font-size: 9px;
}
.regedit-status.error { color: #b4232e; }
.regedit-modal {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.34);
  backdrop-filter: blur(3px);
}
.regedit-modal.hidden,
.regedit-form-field.hidden { display: none; }
.regedit-dialog {
  display: flex;
  flex-direction: column;
  gap: 13px;
  width: min(390px, 100%);
  padding: 22px;
  border: 1px solid var(--flyout-border);
  border-radius: 9px;
  color: var(--text-primary);
  background: var(--surface-window);
  box-shadow: var(--shadow-window);
}
.regedit-dialog h2 { margin-bottom: 3px; font-size: 16px; font-weight: 600; }
.regedit-form-field { display: grid; gap: 6px; color: var(--text-secondary); font-size: 11px; }
.regedit-form-field input,
.regedit-form-field select {
  width: 100%;
  height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  color: var(--text-primary);
  background: var(--surface-body);
  font-size: 12px;
}
.regedit-form-field input:focus,
.regedit-form-field select:focus { border-color: var(--accent); outline: 1px solid var(--accent); }
.regedit-dialog-error { min-height: 15px; color: #b4232e; font-size: 10px; }
.regedit-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.regedit-dialog-actions button {
  min-width: 76px;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  color: var(--text-primary);
  background: var(--surface-body);
  font-size: 11px;
}
.regedit-dialog-actions button:hover { background: var(--control-hover); }
.regedit-dialog-actions button.primary { border-color: var(--accent); color: var(--accent-text-on); background: var(--accent); }
.run-prompt-scrim {
  position: absolute;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, .22);
  backdrop-filter: blur(6px);
}
.run-prompt-scrim.hidden { display: none; }
.run-prompt-dialog {
  display: flex;
  flex-direction: column;
  gap: 11px;
  width: min(450px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--flyout-border);
  border-radius: 10px;
  color: var(--text-primary);
  background: var(--surface-window);
  box-shadow: var(--shadow-window);
  font-size: 12px;
}
.run-prompt-dialog h2 { font-size: 17px; font-weight: 600; }
.run-prompt-dialog p { color: var(--text-secondary); line-height: 1.5; }
.run-prompt-dialog label { color: var(--text-secondary); }
.run-prompt-dialog input {
  height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  color: var(--text-primary);
  background: var(--surface-body);
}
.run-prompt-dialog input:focus { border-color: var(--accent); outline: 1px solid var(--accent); }
.run-prompt-error { min-height: 15px; color: #b4232e; font-size: 10px; }
.run-prompt-actions { display: flex; justify-content: flex-end; gap: 8px; }
.run-prompt-actions button {
  min-width: 76px;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  color: var(--text-primary);
  background: var(--surface-body);
}
.run-prompt-actions button:hover { background: var(--control-hover); }
.run-prompt-actions button.primary { border-color: var(--accent); color: var(--accent-text-on); background: var(--accent); }
@media (max-width: 680px) {
  .regedit-toolbar { flex-wrap: wrap; }
  .regedit-main { grid-template-columns: minmax(165px, 40%) 6px minmax(0,1fr); }
}

/* ==================== CHESS ==================== */
.chess-app {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: var(--text-primary);
  background:
    radial-gradient(ellipse at 25% 20%, rgba(76, 143, 203, .09), transparent 48%),
    var(--surface-body);
  font-family: "Segoe UI Variable", "Segoe UI", sans-serif;
}
.chess-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--stroke-soft);
  background: color-mix(in srgb, var(--surface-window) 88%, transparent);
  backdrop-filter: blur(20px);
}
.chess-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.chess-brand svg { flex: 0 0 auto; }
.chess-brand div { display: grid; gap: 2px; }
.chess-brand strong { font-size: 15px; font-weight: 650; }
.chess-brand span { color: var(--text-muted); font-size: 10px; }
.chess-mode-label { display: grid; gap: 4px; color: var(--text-muted); font-size: 9px; }
.chess-mode,
.chess-new-game,
.chess-play-again {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  color: var(--text-primary);
  background: var(--surface-body);
  font: inherit;
  font-size: 11px;
}
.chess-mode:focus-visible,
.chess-new-game:focus-visible,
.chess-play-again:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chess-new-game,
.chess-play-again { border-color: var(--accent); color: var(--accent-text-on); background: var(--accent); font-weight: 600; cursor: pointer; }
.chess-new-game:hover,
.chess-play-again:hover { filter: brightness(1.08); }
.chess-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  flex: 1;
  min-height: 0;
}
.chess-board-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 12px 18px;
  background:
    radial-gradient(ellipse at center, rgba(75, 115, 150, .1), transparent 72%);
}
.chess-player {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(100%, min(62vh, 620px));
  min-height: 32px;
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 550;
}
.chess-player-note { margin-left: auto; color: var(--text-muted); font-size: 9px; font-weight: 400; }
.chess-player-piece { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 50%; color: #dcecff; background: rgba(255,255,255,.1); font-family: "Segoe UI Symbol", serif; font-size: 19px; }
.chess-player-bottom .chess-player-piece { color: #fff; background: rgba(70, 135, 190, .2); }
.chess-board-frame {
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 19px;
  width: auto;
  height: min(62vh, calc(100% - 64px));
  max-width: 100%;
  aspect-ratio: 1;
  padding: 5px;
  border: 1px solid rgba(218, 227, 235, .18);
  border-radius: 10px;
  background: linear-gradient(145deg, #263544, #16222d);
  box-shadow: 0 14px 42px rgba(0, 0, 0, .23), inset 0 1px rgba(255,255,255,.1);
}
.chess-rank-labels {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  align-items: center;
  justify-items: center;
  color: #d9e3ec;
  font-size: 9px;
}
.chess-file-labels {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: center;
  justify-items: center;
  color: #d9e3ec;
  font-size: 9px;
}
.chess-board {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.chess-square {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: filter .12s ease, box-shadow .12s ease;
}
.chess-square.light { background: linear-gradient(145deg, #e4e9eb, #cbd4d8); }
.chess-square.dark { background: linear-gradient(145deg, #668397, #4d687b); }
.chess-square:hover { filter: brightness(1.09); }
.chess-square:focus-visible { z-index: 2; outline: 3px solid #65c4ff; outline-offset: -3px; }
.chess-square.selected { box-shadow: inset 0 0 0 4px rgba(85, 183, 255, .94); }
.chess-square.in-check { background: radial-gradient(circle, #d94a52 0%, #b83845 76%); }
.chess-square.move-target::after {
  position: absolute;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(35, 52, 69, .36);
  content: "";
}
.chess-square.capture-target::after {
  position: absolute;
  inset: 4px;
  border: max(3px, .42vw) solid rgba(35, 52, 69, .42);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}
.chess-piece { z-index: 1; width: 91%; height: 91%; overflow: visible; pointer-events: none; }
.chess-piece text {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", serif;
  font-size: 53px;
  paint-order: stroke fill;
}
.white-piece text { fill: #fff; stroke: rgba(39, 52, 62, .8); stroke-width: 1.2px; filter: drop-shadow(0 2px 1px rgba(0,0,0,.45)); }
.black-piece text { fill: #1b2a36; stroke: rgba(244, 249, 251, .75); stroke-width: .75px; filter: drop-shadow(0 2px 1px rgba(0,0,0,.35)); }
.chess-square-coord { position: absolute; right: 3px; bottom: 1px; color: rgba(22, 36, 48, .55); font-size: 8px; line-height: 1; pointer-events: none; }
.chess-square.dark .chess-square-coord { color: rgba(255,255,255,.58); }
.chess-sidebar {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 0;
  padding: 17px 15px;
  border-left: 1px solid var(--stroke-soft);
  background: color-mix(in srgb, var(--surface-window) 90%, transparent);
}
.chess-turn-card { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--stroke-soft); border-radius: 8px; background: var(--surface-card); }
.chess-live-dot { width: 9px; height: 9px; border-radius: 50%; background: #4fb783; box-shadow: 0 0 0 4px rgba(79,183,131,.13); }
.chess-turn-card div { display: grid; gap: 3px; }
.chess-turn-card small { color: var(--text-muted); font-size: 8px; letter-spacing: .1em; }
.chess-turn-status { font-size: 13px; font-weight: 600; }
.chess-captured h2,
.chess-section-heading h2 { margin: 0; font-size: 11px; font-weight: 600; }
.chess-captured { display: grid; gap: 8px; }
.chess-captured-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 7px; color: var(--text-muted); font-size: 9px; }
.chess-captured-list { display: flex; min-height: 19px; flex-wrap: wrap; align-items: center; gap: 0 2px; }
.chess-captured-list span { color: var(--text-primary); font-family: "Segoe UI Symbol", serif; font-size: 18px; line-height: 1; }
.chess-moves { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.chess-section-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; border-bottom: 1px solid var(--stroke-soft); }
.chess-move-count { color: var(--text-muted); font-size: 9px; }
.chess-move-list { display: flex; flex: 1; flex-direction: column; gap: 2px; min-height: 40px; overflow: auto; padding-top: 5px; }
.chess-history-empty { margin: auto; color: var(--text-muted); font-size: 10px; text-align: center; }
.chess-history-row { display: grid; grid-template-columns: 27px 1fr 1fr; gap: 4px; padding: 5px 6px; border-radius: 4px; font-size: 10px; }
.chess-history-row:nth-child(odd) { background: var(--control-hover); }
.chess-history-row > span:first-child { color: var(--text-muted); }
.chess-sidebar-footer { display: grid; gap: 5px; padding-top: 10px; border-top: 1px solid var(--stroke-soft); color: var(--text-muted); font-size: 9px; line-height: 1.45; }
.chess-mode-caption { color: var(--text-secondary); font-size: 10px; font-weight: 550; }
.chess-result {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 15, 23, .62);
  backdrop-filter: blur(12px);
}
.chess-result.hidden { display: none; }
.chess-result-card { display: flex; flex-direction: column; align-items: center; width: min(320px, 100%); padding: 27px 24px 23px; border: 1px solid var(--flyout-border); border-radius: 14px; color: var(--text-primary); background: var(--surface-window); box-shadow: var(--shadow-window); text-align: center; animation: chess-result-in .2s ease-out both; }
.chess-result-icon { color: var(--accent); font-family: "Segoe UI Symbol", serif; font-size: 42px; line-height: 1; }
.chess-result-eyebrow { margin: 12px 0 5px; color: var(--text-muted); font-size: 9px; letter-spacing: .17em; }
.chess-result-card h2 { margin: 0; font-size: 20px; font-weight: 650; }
.chess-result-detail { margin: 8px 0 19px; color: var(--text-secondary); font-size: 11px; }
.chess-play-again { min-width: 120px; }
@keyframes chess-result-in { from { opacity: 0; transform: translateY(7px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 760px) {
  .chess-layout { grid-template-columns: minmax(0, 1fr) 220px; }
  .chess-board-area { padding: 8px; }
  .chess-board-frame { height: min(58vh, calc(100% - 64px)); }
  .chess-player { width: min(100%, 58vh); }
  .chess-sidebar { gap: 10px; padding: 12px 10px; }
}
@media (max-width: 570px) {
  .chess-toolbar { flex-wrap: wrap; gap: 7px; padding: 8px 10px; }
  .chess-brand { flex: 1 1 100%; }
  .chess-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 190px; }
  .chess-board-frame { height: min(43vh, calc(100% - 50px)); width: auto; max-height: 100%; }
  .chess-player { width: min(100%, calc(100vw - 40px), 43vh); }
  .chess-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; overflow: auto; border-top: 1px solid var(--stroke-soft); border-left: 0; padding: 9px 12px; }
  .chess-turn-card { padding: 6px 8px; }
  .chess-captured { grid-row: span 2; }
  .chess-moves { min-height: 70px; }
  .chess-sidebar-footer { grid-column: 1 / -1; }
}

/* ==================== VS CODE WEB IDE ==================== */
.window[data-app="code"] { min-width: 680px; min-height: 460px; background: #1e1e1e; color: #d4d4d4; }
.window[data-app="code"] .win-titlebar { background: #181818; }
.window[data-app="code"] .win-title,
.window[data-app="code"] .win-controls button { color: #d4d4d4; }
.window[data-app="code"] .win-body { overflow: hidden; background: #1e1e1e; color: #d4d4d4; }
.code-app {
  display: flex;
  position: relative;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  color: #d4d4d4;
  background: #1e1e1e;
  font: 12px/1.45 "Segoe UI Variable", "Segoe UI", sans-serif;
  --code-bg: #1e1e1e;
  --code-panel: #181818;
  --code-sidebar: #181818;
  --code-hover: #2a2d2e;
  --code-border: #303031;
  --code-muted: #858585;
  --code-accent: #0078d4;
}
.code-app button,
.code-app select { color: inherit; font: inherit; }
.code-titlebar {
  display: flex;
  flex: 0 0 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 0 12px;
  border-bottom: 1px solid #111;
  background: #181818;
}
.code-app-mark { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; color: #d4d4d4; font-size: 11px; }
.code-app-mark svg { display: block; }
.code-title-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.code-title-actions > button,
.code-title-actions > select {
  height: 27px;
  padding: 3px 9px;
  border: 1px solid #3b3b3b;
  border-radius: 4px;
  color: #d4d4d4;
  background: #252526;
  font-size: 10px;
}
.code-title-actions > button:hover,
.code-title-actions > select:hover { background: #333; }
.code-title-actions > button.code-run { border-color: #1687dc; color: #fff; background: #0877c9; font-weight: 600; }
.code-title-actions > button.code-run:hover { background: #1688dc; }
.code-title-actions select.code-saved-files { max-width: 138px; }
.code-main {
  display: grid;
  grid-template-columns: 46px 205px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.code-main.code-preview-visible {
  grid-template-columns: 46px 205px minmax(300px, 1fr) minmax(280px, 40%);
}
.code-activity { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 0; border-right: 1px solid #272727; background: #181818; }
.code-activity button { display: grid; position: relative; width: 44px; height: 42px; place-items: center; color: #858585; }
.code-activity button:hover { color: #ddd; }
.code-activity button.active { color: #fff; }
.code-activity button.active::before { position: absolute; inset: 5px auto 5px 0; width: 2px; background: #fff; content: ""; }
.code-activity button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.code-activity > span { flex: 1; }
.code-explorer { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-right: 1px solid #303031; background: #181818; }
.code-explorer-heading { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 12px; color: #bbb; font-size: 9px; letter-spacing: .08em; }
.code-explorer-heading button { padding: 3px; color: #aaa; font-size: 16px; }
.code-explorer-heading button:hover { color: #fff; }
.code-workspace-name { height: 29px; padding: 7px 10px; border-top: 1px solid #292929; border-bottom: 1px solid #292929; color: #ddd; font-size: 9px; font-weight: 650; letter-spacing: .04em; }
.code-file-list { display: flex; flex-direction: column; gap: 1px; padding: 6px 0; overflow: auto; }
.code-file { display: flex; align-items: center; gap: 8px; min-width: 0; height: 27px; padding: 0 12px 0 19px; color: #c4c4c4; font-size: 10px; text-align: left; white-space: nowrap; }
.code-file:hover,
.code-file.active { background: #2a2d2e; }
.code-file.active { color: #fff; }
.code-file-icon { display: inline-grid; flex: 0 0 18px; width: 18px; height: 18px; place-items: center; font-size: 9px; font-weight: 700; }
.code-file-icon.html { color: #e37933; }
.code-file-icon.css { color: #42a5f5; }
.code-file-icon.javascript { color: #e8c547; }
.code-file-icon.cpp { color: #519bd3; }
.code-file-icon.csharp { color: #b180d7; }
.code-explorer-footer { margin-top: auto; padding: 8px 12px; border-top: 1px solid #303031; color: #aaa; font-size: 9px; }
.code-explorer-hint { padding: 2px 12px 12px; color: #777; font-size: 9px; line-height: 1.5; }
.code-workbench { display: grid; grid-template-rows: 35px minmax(0, 1fr) 190px; min-width: 0; min-height: 0; overflow: hidden; background: var(--code-bg); }
.code-tabs { display: flex; min-width: 0; overflow: auto hidden; border-bottom: 1px solid #252526; background: #181818; }
.code-tab { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; min-width: 100px; max-width: 170px; height: 34px; padding: 0 9px; border-right: 1px solid #252526; color: #999; font-size: 10px; white-space: nowrap; }
.code-tab.active { border-top: 1px solid #0078d4; color: #fff; background: #1e1e1e; }
.code-tab .code-tab-dirty { display: none; margin-left: auto; color: #e8e8e8; font-size: 8px; }
.code-editor-row { display: flex; min-height: 0; overflow: hidden; background: #1e1e1e; }
.code-gutter { flex: 0 0 49px; overflow: hidden; padding: 10px 10px 10px 0; color: #6e7681; background: #1e1e1e; font: 12px/21px Consolas, "Cascadia Code", monospace; text-align: right; white-space: pre; user-select: none; }
.code-editor-surface { position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden; background: #1e1e1e; }
.code-highlight,
.code-textarea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 10px 14px;
  border: 0;
  font: 12px/21px Consolas, "Cascadia Code", monospace;
  tab-size: 2;
  white-space: pre;
}
.code-highlight { overflow: hidden; color: #d4d4d4; pointer-events: none; }
.code-highlight code { font: inherit; }
.code-textarea { z-index: 1; overflow: auto; resize: none; outline: none; color: transparent; caret-color: #aeafad; background: transparent; -webkit-text-fill-color: transparent; }
.code-textarea::selection { color: transparent; background: rgba(38, 79, 120, .8); }
.code-token-string { color: #ce9178; }
.code-token-comment { color: #6a9955; }
.code-token-keyword { color: #c586c0; }
.code-token-number { color: #b5cea8; }
.code-token-builtin { color: #4ec9b0; }
.code-token-tag { color: #569cd6; }
.code-token-attribute { color: #9cdcfe; }
.code-bottom { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-top: 1px solid #303031; background: #181818; }
.code-panel-tabs { display: flex; flex: 0 0 30px; align-items: stretch; gap: 15px; padding: 0 12px; border-bottom: 1px solid #303031; }
.code-panel-tabs button { position: relative; color: #999; font-size: 9px; letter-spacing: .04em; }
.code-panel-tabs button:hover,
.code-panel-tabs button.active { color: #eee; }
.code-panel-tabs button.active::after { position: absolute; right: 0; bottom: 0; left: 0; height: 1px; background: #ddd; content: ""; }
.code-output-status { align-self: center; margin-left: auto; color: #858585; font-size: 9px; }
.code-output,
.code-terminal { flex: 1; min-height: 0; margin: 0; overflow: auto; padding: 10px 13px; color: #ccc; background: #181818; font: 11px/1.6 Consolas, "Cascadia Code", monospace; white-space: pre-wrap; }
.code-terminal { color: #c5c5c5; }
.code-terminal.code-terminal-error { color: #f48771; }
.code-app .hidden { display: none !important; }
.code-preview { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border-left: 1px solid #303031; background: #1e1e1e; }
.code-preview-header { display: flex; flex: 0 0 35px; align-items: center; justify-content: space-between; padding: 0 11px; border-bottom: 1px solid #303031; color: #bbb; font-size: 9px; letter-spacing: .08em; }
.code-preview-header button { color: #aaa; font-size: 16px; }
.code-preview-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.code-statusbar { display: flex; flex: 0 0 23px; align-items: center; gap: 12px; padding: 0 9px; color: #fff; background: #007acc; font-size: 9px; }
.code-statusbar > span:first-child { color: #b8f1d0; }
.code-status-file { margin-right: auto; }
.code-save-dialog { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.55); backdrop-filter: blur(5px); }
.code-save-dialog.hidden { display: none; }
.code-save-card { display: flex; flex-direction: column; gap: 12px; width: min(360px, 100%); padding: 20px; border: 1px solid #454545; border-radius: 8px; color: #eee; background: #252526; box-shadow: 0 16px 48px #0008; }
.code-save-card h2 { margin: 0; font-size: 15px; font-weight: 600; }
.code-save-card label { display: grid; gap: 5px; color: #bbb; font-size: 10px; }
.code-save-card input,
.code-save-card select { height: 31px; padding: 5px 8px; border: 1px solid #555; border-radius: 4px; color: #eee; background: #1e1e1e; font: inherit; font-size: 11px; }
.code-save-error { min-height: 15px; margin: 0; color: #ff9992; font-size: 10px; }
.code-save-card > div { display: flex; justify-content: flex-end; gap: 8px; }
.code-save-card button { min-width: 70px; height: 29px; border: 1px solid #555; border-radius: 4px; color: #eee; background: #333; font-size: 10px; }
.code-save-card button.primary { border-color: #1687dc; background: #0877c9; }
@media (max-width: 850px) {
  .window[data-app="code"] { min-width: 0; }
  .code-main { grid-template-columns: 40px 175px minmax(0, 1fr); }
  .code-main.code-preview-visible { grid-template-columns: 40px 175px minmax(250px, 1fr) minmax(220px, 42%); }
  .code-explorer-hint { font-size: 8px; }
}
@media (max-width: 620px) {
  .code-titlebar { padding: 0 6px; }
  .code-app-mark span { display: none; }
  .code-title-actions { gap: 3px; }
  .code-title-actions > button,
  .code-title-actions > select { padding: 3px 5px; font-size: 9px; }
  .code-main { grid-template-columns: 37px 150px minmax(0, 1fr); }
  .code-main.code-preview-visible { grid-template-columns: 37px 150px minmax(210px, 1fr) minmax(190px, 42%); }
}