/* ---------- Base: reset, palette, typography, shared controls ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Yaru palette */
  --orange: #E95420;
  --orange-dark: #C8410D;
  --orange-light: #F5793F;
  --aubergine: #77216F;
  --aubergine-dark: #5E2750;
  --ink: #111111;
  --warm-gray: #AEA79F;
  --cool-gray: #333333;
  --paper: #FAFAFA;

  /* accent (accent color setting) */
  --accent: #E95420;
  --accent-contrast: #ffffff;
  --accent-low: rgba(233, 84, 32, .18);

  /* shell surfaces (light) */
  --shell-bg: rgba(28, 28, 30, .92);
  --shell-fg: #f2f2f2;
  --topbar-bg: rgba(18, 18, 20, .72);
  --window-bg: #f6f5f4;
  --window-fg: #262626;
  --headerbar-bg: linear-gradient(to bottom, #484440, #383633 45%, #33312e);
  --headerbar-fg: #f2efec;
  --headerbar-inactive-bg: linear-gradient(to bottom, #f2f1f0, #ebe9e8);
  --headerbar-inactive-fg: #58524e;
  --sidebar-bg: #ebebeb;
  --card-bg: #ffffff;
  --card-border: rgba(0,0,0,.10);
  --control-bg: #ffffff;
  --control-border: rgba(0,0,0,.28);
  --control-fg: #2b2b2b;
  --subtle-fg: #6e6a67;
  --hover-bg: rgba(0,0,0,.06);
  --active-bg: rgba(0,0,0,.09);
  --divider: rgba(0,0,0,.12);
  --tooltip-bg: rgba(24, 24, 24, .94);
  --menu-bg: rgba(37, 37, 39, .97);
  --menu-fg: #eee;
  --pop-bg: #f7f5f3;
  --pop-fg: #201f1e;
  --shadow-menu: 0 4px 18px rgba(0,0,0,.35), 0 1px 4px rgba(0,0,0,.25);
  --window-radius: 12px;
  --font-scale: 1;
  --trash-debris: none;
}

html.dark, .dark-scope {
  --window-bg: #2e2e30;
  --window-fg: #e8e6e3;
  --headerbar-inactive-bg: linear-gradient(to bottom, #3b3b3d, #353537);
  --headerbar-inactive-fg: #98948f;
  --sidebar-bg: #2a2a2c;
  --card-bg: #38383a;
  --card-border: rgba(255,255,255,.10);
  --control-bg: #454547;
  --control-border: rgba(255,255,255,.22);
  --control-fg: #e8e6e3;
  --subtle-fg: #a49e99;
  --hover-bg: rgba(255,255,255,.07);
  --active-bg: rgba(255,255,255,.11);
  --divider: rgba(255,255,255,.12);
  --pop-bg: #353538;
  --pop-fg: #ecebe9;
  --accent-low: rgba(233, 84, 32, .30);
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Ubuntu", "Ubuntu Sans", "Noto Sans", "Cantarell", "Segoe UI", "DejaVu Sans", sans-serif;
  font-size: calc(15px * var(--font-scale));
  color: var(--window-fg);
  background: #000;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  cursor: default;
}
input, textarea, select { font-family: inherit; user-select: text; }

#os-root { position: fixed; inset: 0; overflow: hidden; }
#session { position: absolute; inset: 0; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,.45); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(128,128,128,.7); background-clip: padding-box; border: 2px solid transparent; }
.dark-scope ::-webkit-scrollbar-thumb, html.dark ::-webkit-scrollbar-thumb { background: rgba(200,200,200,.28); background-clip: padding-box; border: 2px solid transparent; }

/* generic buttons / controls inside apps */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--control-bg); color: var(--control-fg);
  border: 1px solid var(--control-border); border-radius: 6px;
  padding: 5px 14px; font-size: calc(14px * var(--font-scale));
  cursor: default; transition: background .12s, box-shadow .12s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.btn:hover { filter: brightness(.96); }
.dark-scope .btn:hover, html.dark .btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(.5px); filter: brightness(.9); }
.btn.suggested { background: linear-gradient(to bottom, var(--orange-light), var(--accent) 30%); background-color: var(--accent); color: var(--accent-contrast); border-color: rgba(0,0,0,.2); font-weight: 500; }
.btn.destructive { background: linear-gradient(to bottom, #e5634c, #c7162b 40%); background-color: #c7162b; color: #fff; border-color: rgba(0,0,0,.2); font-weight: 500; }
.btn.flat { background: transparent; border-color: transparent; box-shadow: none; }
.btn.flat:hover { background: var(--hover-bg); }
.btn:disabled, .btn.disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 16px; height: 16px; }

:where(input[type="text"], input[type="search"], input[type="password"], input[type="number"], textarea, select) {
  background: var(--control-bg); color: var(--control-fg);
  border: 1px solid var(--control-border); border-radius: 6px;
  padding: 6px 10px; font-size: calc(14px * var(--font-scale));
  outline: none;
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-low);
}
.terminal-input:focus-visible, .editor-textarea:focus-visible, .browser-omnibox:focus-visible,
.set-search-input:focus-visible, .ov-search-input:focus-visible, .lock-pass:focus-visible {
  border-color: transparent; box-shadow: none;
}
.lock-pass:focus-visible { border-color: var(--accent); }

/* switch */
.switch { position: relative; width: 46px; height: 25px; flex: none; border-radius: 999px; background: rgba(120,118,114,.55); transition: background .18s; }
.switch::after { content: ""; position: absolute; top: 2.5px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .18s cubic-bezier(.3,1.2,.4,1); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.switch.disabled { opacity: .4; pointer-events: none; }

/* slider */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 26px; background: transparent; border: none; padding: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--fill,50%), rgba(128,120,116,.4) var(--fill,50%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: #fff; border: 1px solid rgba(0,0,0,.25); box-shadow: 0 1px 3px rgba(0,0,0,.35); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(128,120,116,.4); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 1px solid rgba(0,0,0,.25); box-shadow: 0 1px 3px rgba(0,0,0,.35); }

/* checkbox & radio */
input[type="checkbox"], input[type="radio"] { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--control-border); border-radius: 4px; background: var(--control-bg); position: relative; flex: none; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 5px; height: 9px; border: solid #fff; border-width: 0 2.4px 2.4px 0; transform: rotate(45deg); }
input[type="radio"]:checked::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounceDock { 0% { transform: translateY(0); } 35% { transform: translateY(-13px); } 70% { transform: translateY(2px); } 100% { transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
html.reduced-motion *, html.reduced-motion *::before, html.reduced-motion *::after {
  animation-duration: .01ms !important; transition-duration: .01ms !important;
}
