:root {
  --bg: #0b0b10;
  --bg-2: #111118;
  --surface: #16161f;
  --surface-2: #1d1d29;
  --surface-3: #262636;
  --line: #2a2a3a;
  --line-2: #37374a;
  --text: #f2f2f7;
  --muted: #9a9ab0;
  --accent: #ff991c;
  --accent-2: #ffb352;
  --accent-ink: #ffffff;
  --lime: #d4ff3a;
  --ok: #2fd27a;
  --warn: #ffb020;
  --danger: #ff4d6a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Devanagari', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.gap { gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grow { flex: 1; }
.ic { flex: none; display: block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13px;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); border-color: #4a4a62; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #f08a0a; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger); border-color: rgba(255, 77, 106, .4); }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 7px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.xs { width: 24px; height: 24px; border-radius: 6px; }
.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-2); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 153, 28, .2); }
.input.sm { height: 32px; font-size: 13px; padding: 0 9px; border-radius: 8px; }
select.input { cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.field > span { font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin: 8px 0; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=color] { width: 38px; height: 30px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); padding: 2px; cursor: pointer; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.lg { width: 40px; height: 40px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .1); overflow: hidden; margin: 6px 0; }
.bar.big { height: 10px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffd166, var(--accent)); transition: width .3s; }
.center-msg { min-height: 100vh; display: grid; place-items: center; text-align: center; gap: 16px; }

.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 18px; font-weight: 500; letter-spacing: -.02em; }
.logo b { font-weight: 800; }
/* Artist logo: the supplied black-on-white artwork, cropped to the wordmark and flipped for the dark theme
   (invert + hue-rotate keeps the purple play triangle purple; screen blending drops the white background). */
.brand { display: inline-block; position: relative; height: 26px; aspect-ratio: 971 / 244; overflow: hidden; flex: none; }
.brand img { position: absolute; width: 205.97%; left: -53.04%; top: -88.52%; filter: invert(1) hue-rotate(310deg) saturate(1.8); mix-blend-mode: screen; /* 310° = 180° (undo invert) + 130° (purple → orange) */ pointer-events: none; }
.logo.big .brand { height: 38px; }

#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 999; pointer-events: none; }
.toast { background: var(--surface-3); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; font-size: 13px; animation: tin .2s ease; transition: opacity .3s, transform .3s; max-width: 90vw; }
.toast.ok { border-color: rgba(47, 210, 122, .5); }
.toast.error { border-color: rgba(255, 77, 106, .6); background: #2a1520; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

.modal-back { position: fixed; inset: 0; background: rgba(4, 4, 8, .7); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 500; padding: 16px; animation: tin .15s; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px 22px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 8px 22px 22px; }
.modal-body p { margin: 0 0 12px; }

/* ---- dropdown / popover open animation ---- */
@keyframes ddIn { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes itemIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.dd-menu:not([hidden]), .lp-pop:not([hidden]), .pop, .modal { transform-origin: top center; animation: ddIn .18s cubic-bezier(.2, .8, .2, 1) both; }
.dd-menu:not([hidden]) > *, .pop.wmenu > .mi, .font-pop .fp-item { animation: itemIn .22s ease both; }
.dd-menu:not([hidden]) > *:nth-child(2), .pop.wmenu > .mi:nth-child(2) { animation-delay: .02s; }
.dd-menu:not([hidden]) > *:nth-child(3), .pop.wmenu > .mi:nth-child(3) { animation-delay: .04s; }
.dd-menu:not([hidden]) > *:nth-child(4), .pop.wmenu > .mi:nth-child(4) { animation-delay: .06s; }
.dd-menu:not([hidden]) > *:nth-child(n+5), .pop.wmenu > .mi:nth-child(n+5) { animation-delay: .08s; }
select { transition: border-color .15s, box-shadow .15s; }
select:hover { border-color: #4a4a62; }
@media (prefers-reduced-motion: reduce) { .dd-menu, .lp-pop, .pop, .modal, .dd-menu > *, .pop > * { animation: none !important; } }
