/* ============================================================================
   VelvetOS — base styles + Material Design component library
   ========================================================================== */

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

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #111;
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  /* the browser's pinch-zoom is blocked here so our own zoom gesture wins;
     two-finger scroll still works */
  touch-action: pan-x pan-y;
}

body {
  user-select: none;
  -webkit-user-select: none;
}
input, textarea, [contenteditable], .selectable, .selectable * {
  user-select: text;
  -webkit-user-select: text;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
svg { display: block; }

::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }

/* ---------- scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--on-surface-4) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--on-surface-4) 55%, transparent);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--on-surface-4) 85%, transparent);
  background-clip: content-box;
}
.scroll-y { overflow-y: auto; overflow-x: hidden; }

/* ---------- focus ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ============================== LAYOUT HELPERS ========================== */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; min-width: 0; min-height: 0; }
.center { display: flex; align-items: center; justify-content: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); } .gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.pad-3 { padding: var(--sp-3); } .pad-4 { padding: var(--sp-4); }
.pad-6 { padding: var(--sp-6); }
.muted { color: var(--on-surface-3); }
.dim { color: var(--on-surface-4); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small { font-size: var(--fs-label); }
.caption { font-size: var(--fs-caption); }
.mono { font-family: var(--font-mono); }
.bold { font-weight: var(--fw-medium); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.full { position: absolute; inset: 0; }
.selectable-text { user-select: text; }

.title-lg { font-size: var(--fs-title-lg); font-weight: var(--fw-regular); letter-spacing: 0; }
.title { font-size: var(--fs-title); font-weight: var(--fw-medium); }
.label { font-size: var(--fs-label); font-weight: var(--fw-medium); letter-spacing: .3px; }

.divider { height: 1px; background: var(--divider); border: 0; margin: var(--sp-2) 0; flex: none; }
.vdivider { width: 1px; background: var(--divider); align-self: stretch; margin: 0 var(--sp-2); flex: none; }

/* ============================== ICONS =================================== */
.icon { width: 20px; height: 20px; flex: none; fill: currentColor; }
.icon-16 { width: 16px; height: 16px; }
.icon-18 { width: 18px; height: 18px; }
.icon-24 { width: 24px; height: 24px; }
.icon-32 { width: 32px; height: 32px; }
.icon-40 { width: 40px; height: 40px; }
.icon-48 { width: 48px; height: 48px; }
.icon-btn .icon { width: 20px; height: 20px; }

/* ============================== BUTTONS ================================= */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 32px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--primary);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: background var(--dur-s) var(--ease-standard), box-shadow var(--dur-s) var(--ease-standard),
              opacity var(--dur-s) var(--ease-standard);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--primary-hover); }
.btn:active { background: var(--primary-press); }
.btn:disabled { opacity: .38; pointer-events: none; }
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.filled:hover { box-shadow: var(--elevation-1); filter: brightness(1.06); }
.btn.tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn.tonal:hover { filter: brightness(.97); }
.btn.outlined { border: 1px solid var(--outline); color: var(--primary); }
.btn.outlined:hover { background: var(--primary-hover); }
.btn.neutral { color: var(--on-surface); }
.btn.neutral:hover { background: var(--shelf-icon-bg); }
.btn.danger { color: var(--error); }
.btn.danger:hover { background: color-mix(in srgb, var(--error) 10%, transparent); }
.btn.sm { height: 26px; padding: 0 12px; font-size: var(--fs-label); }
.btn.lg { height: 40px; padding: 0 22px; font-size: 14px; }
.btn.block { width: 100%; }

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--on-surface-2);
  cursor: pointer;
  overflow: hidden;
  flex: none;
  transition: background var(--dur-s) var(--ease-standard), color var(--dur-s) var(--ease-standard);
}
.icon-btn:hover { background: var(--shelf-icon-bg); }
.icon-btn:active { background: var(--shelf-icon-hover); }
.icon-btn.on { color: var(--primary); background: var(--primary-container); }
.icon-btn[disabled], .icon-btn.disabled { opacity: .38; pointer-events: none; }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm .icon { width: 16px; height: 16px; }
.icon-btn.lg { width: 40px; height: 40px; }
.icon-btn.lg .icon { width: 24px; height: 24px; }

.fab {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 44px; padding: 0 20px; border: 0; border-radius: var(--r-l);
  background: var(--primary-container); color: var(--on-primary-container);
  font-weight: var(--fw-medium); cursor: pointer; box-shadow: var(--elevation-2);
  transition: box-shadow var(--dur-m) var(--ease-standard), transform var(--dur-m) var(--ease-standard);
}
.fab:hover { box-shadow: var(--elevation-3); }
.fab:active { transform: scale(.97); }

/* ---------- ripple ---------- */
.ripple-host { position: relative; overflow: hidden; }
.ripple-ink {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: .16;
  transform: scale(0);
  animation: ripple-in 520ms var(--ease-decelerate) forwards;
  pointer-events: none;
}
@keyframes ripple-in {
  to { transform: scale(1); opacity: 0; }
}

/* ============================== CHIPS / BADGES ========================== */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px; border-radius: var(--r-s);
  background: var(--surface-2); border: 1px solid transparent;
  color: var(--on-surface-2); font-size: var(--fs-label); font-weight: var(--fw-medium);
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-s) var(--ease-standard);
}
.chip:hover { background: var(--surface-3); }
.chip.selected { background: var(--primary-container); color: var(--on-primary-container); }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px; padding: 0 5px; border-radius: var(--r-full);
  background: var(--error); color: #fff; font-size: 10px; font-weight: var(--fw-medium);
}
.dot-badge {
  width: 8px; height: 8px; border-radius: 50%; background: var(--primary);
}
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: var(--fs-body); font-weight: var(--fw-medium);
  flex: none; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.avatar.xl { width: 88px; height: 88px; font-size: 34px; }

/* ============================== SWITCH ================================== */
.sw {
  position: relative; display: inline-block; width: 36px; height: 20px;
  flex: none; cursor: pointer;
}
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sw .track {
  position: absolute; inset: 0; border-radius: var(--r-full);
  background: var(--surface-4); border: 2px solid var(--surface-4);
  transition: background var(--dur-m) var(--ease-standard), border-color var(--dur-m) var(--ease-standard);
  pointer-events: none;
}
.sw .thumb {
  position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: transform var(--dur-m) var(--ease-spring), width var(--dur-m) var(--ease-standard),
              height var(--dur-m) var(--ease-standard), background var(--dur-m);
  pointer-events: none;
}
.sw input:checked ~ .track { background: var(--primary); border-color: var(--primary); }
.sw input:checked ~ .thumb { transform: translateX(16px); background: #fff; }
.sw input:active ~ .thumb { width: 18px; height: 18px; top: 1px; left: 1px; }
.sw input:focus-visible ~ .track { outline: 2px solid var(--primary); outline-offset: 2px; }

.switch-row {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-m); cursor: pointer;
}
.switch-row:hover { background: var(--surface-2); }
.switch-row .sr-text { flex: 1 1 auto; min-width: 0; }
.switch-row .sr-title { font-size: var(--fs-body); color: var(--on-surface); }
.switch-row .sr-sub { font-size: var(--fs-caption); color: var(--on-surface-3); margin-top: 2px; }

/* ============================== SLIDER ================================== */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 20px; background: transparent; cursor: pointer; margin: 0;
}
.slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--primary) var(--pct, 50%), var(--surface-4) var(--pct, 50%));
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: var(--primary); border: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform var(--dur-s) var(--ease-standard);
}
.slider:hover::-webkit-slider-thumb { transform: scale(1.15); }
.slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--surface-4); }
.slider::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--primary); }
.slider::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--primary); }
.slider.vertical {
  writing-mode: vertical-lr; direction: rtl;
  width: 20px; height: 120px;
}

/* ============================== FIELDS ================================== */
.field {
  display: flex; align-items: center; gap: var(--sp-3);
  height: 38px; padding: 0 12px;
  border-radius: var(--r-s);
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: background var(--dur-s), border-color var(--dur-s), box-shadow var(--dur-s);
}
.field:hover { background: var(--surface-3); }
.field:focus-within {
  background: var(--surface); border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.field input, .field textarea, .field select {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: var(--fs-body); color: var(--on-surface);
}
.field input::placeholder { color: var(--on-surface-4); }
.field .icon { color: var(--on-surface-3); }
.field.flat { background: transparent; border-color: var(--outline); }
.field.round { border-radius: var(--r-full); }
textarea.area {
  width: 100%; border: 1px solid var(--outline); border-radius: var(--r-s);
  background: var(--surface); color: var(--on-surface);
  padding: 10px 12px; outline: none; resize: none; font-size: var(--fs-body);
  font-family: inherit;
}
textarea.area:focus { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.select-native {
  height: 34px; border-radius: var(--r-s); border: 1px solid var(--outline);
  background: var(--surface); color: var(--on-surface); padding: 0 8px; outline: none; cursor: pointer;
}

/* ============================== CARDS / LISTS =========================== */
.card {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-l);
  overflow: hidden;
}
.card-pad { padding: var(--sp-4); }
.card-hover { transition: box-shadow var(--dur-m) var(--ease-standard), transform var(--dur-m) var(--ease-standard); }
.card-hover:hover { box-shadow: var(--elevation-2); }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 10px 16px; min-height: 48px; cursor: pointer;
  border-radius: 0; position: relative;
  transition: background var(--dur-xs) var(--ease-standard);
}
.list-item:hover { background: var(--surface-2); }
.list-item.selected { background: var(--primary-container); color: var(--on-primary-container); }
.list-item .li-icon { color: var(--on-surface-3); flex: none; }
.list-item .li-text { flex: 1 1 auto; min-width: 0; }
.list-item .li-title { font-size: var(--fs-body); }
.list-item .li-sub { font-size: var(--fs-caption); color: var(--on-surface-3); margin-top: 2px; }
.list-item .li-trail { color: var(--on-surface-3); flex: none; }
.list-item.rounded { border-radius: var(--r-m); }
.list-item.section-head {
  min-height: 40px; padding-top: 16px; font-size: var(--fs-caption);
  letter-spacing: .6px; text-transform: uppercase; color: var(--on-surface-3);
  cursor: default; pointer-events: none;
}
.list-item.section-head:hover { background: transparent; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-3); padding: var(--sp-10) var(--sp-6); text-align: center;
  color: var(--on-surface-3); flex: 1 1 auto;
}
.empty-state .icon { width: 48px; height: 48px; opacity: .5; }
.empty-state .es-title { font-size: var(--fs-title); color: var(--on-surface-2); }

/* ============================== TABS ==================================== */
.tabs {
  display: flex; align-items: center; gap: var(--sp-1);
  border-bottom: 1px solid var(--divider); flex: none;
}
.tab {
  position: relative; height: 40px; padding: 0 16px; border: 0; background: transparent;
  color: var(--on-surface-3); font-size: var(--fs-body); font-weight: var(--fw-medium);
  cursor: pointer; white-space: nowrap; border-radius: var(--r-s) var(--r-s) 0 0;
}
.tab:hover { background: var(--surface-2); color: var(--on-surface); }
.tab.active { color: var(--primary); }
.tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px;
  background: var(--primary); border-radius: 3px 3px 0 0;
}
.segmented {
  display: inline-flex; padding: 2px; border-radius: var(--r-full);
  background: var(--surface-2); gap: 2px;
}
.segmented button {
  border: 0; background: transparent; height: 26px; padding: 0 12px; border-radius: var(--r-full);
  font-size: var(--fs-label); color: var(--on-surface-3); cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--on-surface); box-shadow: var(--elevation-1); }

/* ============================== MENU (context / dropdown) =============== */
.menu {
  min-width: 180px; max-width: 340px; padding: 6px 0;
  background: var(--menu-bg); border: 1px solid var(--popover-border);
  border-radius: var(--r-s); box-shadow: var(--elevation-3);
  animation: menu-in var(--dur-s) var(--ease-decelerate);
}
@keyframes menu-in { from { opacity: 0; transform: scale(.96); } }
.menu-item {
  display: flex; align-items: center; gap: var(--sp-3);
  height: 34px; padding: 0 14px; font-size: var(--fs-body); color: var(--on-surface);
  cursor: pointer; white-space: nowrap;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.disabled { opacity: .4; pointer-events: none; }
.menu-item .shortcut { margin-left: auto; color: var(--on-surface-4); font-size: var(--fs-caption); }
.menu-item .icon { color: var(--on-surface-3); }
.menu-item.danger { color: var(--error); }
.menu-item.danger .icon { color: var(--error); }
.menu-sep { height: 1px; background: var(--divider); margin: 6px 0; }
.menu-label {
  padding: 8px 14px 4px; font-size: var(--fs-caption); text-transform: uppercase;
  letter-spacing: .6px; color: var(--on-surface-3);
}

/* ============================== TOOLTIP ================================= */
.tooltip {
  position: fixed; z-index: var(--z-tooltip, 1500);
  padding: 5px 9px; border-radius: var(--r-xs);
  background: var(--surface-inverse); color: var(--surface);
  font-size: var(--fs-caption); pointer-events: none;
  box-shadow: var(--elevation-2);
  animation: fade-in var(--dur-s) var(--ease-standard);
}
@keyframes fade-in { from { opacity: 0; } }

/* ============================== PROGRESS ================================ */
.progress {
  height: 4px; border-radius: 2px; background: var(--surface-4); overflow: hidden; flex: none;
}
.progress > span {
  display: block; height: 100%; background: var(--primary); border-radius: 2px;
  transition: width var(--dur-l) var(--ease-standard);
}
.progress.circle {
  width: 36px; height: 36px; border-radius: 50%; background: transparent;
  border: 3px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-top-color: var(--primary); animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--on-surface-3) 30%, transparent);
  border-top-color: var(--on-surface-3);
  animation: spin 800ms linear infinite; flex: none;
}

/* ============================== POPOVER ================================= */
.popover-layer { position: fixed; inset: 0; pointer-events: none; z-index: var(--z-popover); }
.popover {
  position: absolute; pointer-events: auto;
  background: var(--popover-bg);
  border: 1px solid var(--popover-border);
  border-radius: var(--r-l);
  box-shadow: var(--elevation-4);
  overflow: hidden;
  animation: popover-in var(--dur-m) var(--ease-decelerate);
}
@keyframes popover-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.popover.closing { animation: popover-out var(--dur-s) var(--ease-accelerate) forwards; }
@keyframes popover-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }

/* ============================== DIALOG ================================== */
.dialog-layer {
  position: fixed; inset: 0; z-index: var(--z-dialog);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.dialog-layer.active { pointer-events: auto; }
.dlg-scrim {
  position: absolute; inset: 0; background: var(--scrim);
  animation: fade-in var(--dur-m) var(--ease-standard);
}
.dlg {
  position: relative; width: min(440px, calc(100vw - 48px));
  max-height: calc(100vh - 120px);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--on-surface);
  border-radius: var(--r-2xl); box-shadow: var(--elevation-5);
  animation: dlg-in var(--dur-m) var(--ease-decelerate);
  overflow: hidden;
}
.dlg.wide { width: min(720px, calc(100vw - 48px)); }
.dlg.narrow { width: min(360px, calc(100vw - 48px)); }
@keyframes dlg-in { from { opacity: 0; transform: scale(.94); } }
.dlg.closing { animation: dlg-out var(--dur-s) var(--ease-accelerate) forwards; }
@keyframes dlg-out { to { opacity: 0; transform: scale(.96); } }
.dlg-head { padding: 22px 24px 0; }
.dlg-icon { display: flex; justify-content: center; margin-bottom: var(--sp-3); color: var(--primary); }
.dlg-icon .icon { width: 40px; height: 40px; }
.dlg-title { font-size: var(--fs-title-lg); font-weight: var(--fw-regular); text-align: center; }
.dlg-title.left { text-align: left; font-size: var(--fs-title); font-weight: var(--fw-medium); }
.dlg-body {
  padding: 14px 24px 4px; overflow-y: auto; font-size: var(--fs-body);
  color: var(--on-surface-3); line-height: 1.55; flex: 1 1 auto;
}
.dlg-body.left { color: var(--on-surface); }
.dlg-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2);
  padding: 16px 16px 16px; flex: none;
}
.dlg-actions.stack { flex-direction: column; align-items: stretch; }
.dlg-actions.spread { justify-content: space-between; }
.dlg .field { margin-top: var(--sp-3); }

/* ============================== TOAST / NOTIFICATION ==================== */
.toast-layer {
  position: fixed; right: 16px; bottom: calc(var(--shelf-height) + 14px);
  z-index: var(--z-toast); display: flex; flex-direction: column-reverse;
  gap: var(--sp-2); pointer-events: none; width: 344px; max-width: calc(100vw - 32px);
}
body.shelf-left .toast-layer, body.shelf-right .toast-layer { right: auto; }
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 14px;
  background: var(--popover-bg); color: var(--on-surface);
  border: 1px solid var(--popover-border);
  border-radius: var(--r-m); box-shadow: var(--elevation-4);
  animation: toast-in var(--dur-l) var(--ease-decelerate);
  cursor: pointer;
}
.toast.closing { animation: toast-out var(--dur-m) var(--ease-accelerate) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px) scale(.97); } }
.toast .avatar { width: 28px; height: 28px; }
.toast-body { flex: 1 1 auto; min-width: 0; }
.toast-title { font-size: var(--fs-body); font-weight: var(--fw-medium); }
.toast-msg { font-size: var(--fs-label); color: var(--on-surface-3); margin-top: 3px; line-height: 1.45; word-wrap: break-word; }
.toast-actions { display: flex; gap: var(--sp-1); margin-top: 8px; flex-wrap: wrap; }
.toast-close { margin-left: auto; flex: none; }

/* ============================== OSD (volume / brightness) =============== */
.osd-layer {
  position: fixed; left: 50%; bottom: calc(var(--shelf-height) + 24px);
  transform: translateX(-50%); z-index: var(--z-osd);
  display: flex; flex-direction: column; gap: var(--sp-2); align-items: center;
  pointer-events: none;
}
.osd {
  display: flex; align-items: center; gap: var(--sp-4);
  min-width: 220px; padding: 12px 20px;
  background: rgba(32, 33, 36, .88); color: #fff;
  border-radius: var(--r-full); box-shadow: var(--elevation-4);
  animation: osd-in var(--dur-m) var(--ease-decelerate);
  backdrop-filter: blur(12px);
}
.osd.closing { animation: osd-out var(--dur-m) var(--ease-accelerate) forwards; }
@keyframes osd-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes osd-out { to { opacity: 0; transform: translateY(10px); } }
.osd .osd-label { font-size: var(--fs-title); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.osd .osd-track { flex: 1 1 auto; height: 4px; border-radius: 2px; background: rgba(255,255,255,.3); overflow: hidden; }
.osd .osd-fill { height: 100%; background: #fff; border-radius: 2px; }
.osd .osd-icon { color: #fff; }

/* ============================== SCREEN TINTS ============================ */
.screen-tint {
  position: fixed; inset: 0; z-index: var(--z-tint); pointer-events: none;
}
.brightness-tint { background: #000; opacity: 0; transition: opacity var(--dur-s) linear; }
.nightlight-tint { background: #ff9800; opacity: 0; mix-blend-mode: multiply; transition: opacity var(--dur-l) linear; }

/* ============================== LOADING VEIL ============================ */
.loading-veil {
  position: fixed; inset: 0; z-index: calc(var(--z-session) + 5);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-6); background: var(--surface);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-l);
}
.loading-veil.show { opacity: 1; }
.lv-logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #7b1fa2));
}
.lv-bar { width: 180px; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.lv-bar span { display: block; height: 100%; width: 40%; background: var(--primary); border-radius: 2px; animation: lv-slide 1.1s var(--ease-standard) infinite; }
@keyframes lv-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* ============================== UTIL ANIMATIONS ========================= */
.fade-in { animation: fade-in var(--dur-m) var(--ease-standard); }
.pop-in { animation: pop-in var(--dur-m) var(--ease-spring); }
@keyframes pop-in { from { opacity: 0; transform: scale(.9); } }
