:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --panel: rgba(27, 27, 31, 0.94);
  --panel-soft: rgba(21, 21, 24, 0.78);
  --line: rgba(255, 255, 255, 0.08);
  --text: #f6f6f7;
  --muted: #8f9098;
  --accent: #ff7417;
  --accent-soft: rgba(255, 116, 23, 0.16);
  --success: #36d56b;
  --danger: #ff5b62;
  --radius: 19px;
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% -10%, #262126 0, #0a0a0c 38%, #060607 100%); color: var(--text); }
body { min-height: 100vh; min-height: 100dvh; }
button, input { font: inherit; }
button { color: inherit; -webkit-tap-highlight-color: transparent; }
button:not(:disabled) { cursor: pointer; }

.app-shell { width: min(100%, 520px); min-height: 100vh; min-height: 100dvh; margin: 0 auto; padding: 14px 18px calc(96px + var(--safe-bottom)); position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px 14px; position: sticky; top: 0; z-index: 10; background: linear-gradient(to bottom, rgba(10,10,12,.98) 70%, rgba(10,10,12,0)); backdrop-filter: blur(14px); }
.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-logo { width: 37px; height: 37px; }
.brand-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand-subtitle { font-size: 11px; color: var(--muted); margin-top: 1px; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; min-width: 88px; justify-content: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); font-size: 12px; transition: .2s ease; }
.status-badge span { width: 8px; height: 8px; border-radius: 50%; background: #d99b34; box-shadow: 0 0 14px currentColor; }
.status-online span { background: var(--success); }
.status-offline span { background: var(--danger); }

.view { display: none; animation: view-in .22s ease both; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.glass-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(31,31,36,.95), rgba(18,18,21,.92)); border-radius: var(--radius); box-shadow: 0 14px 40px rgba(0,0,0,.24); }
.auth-notice { display: grid; gap: 7px; padding: 16px; margin-bottom: 13px; border-color: rgba(255,91,98,.28); }
.auth-notice strong { font-size: 15px; }
.auth-notice span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.auth-notice[hidden] { display: none; }
.secondary-button { justify-self: start; margin-top: 5px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.05); }

.device-card { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 15px 16px; }
.device-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.05); color: #ddd; }
.device-copy { min-width: 0; }
.device-title { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-subtitle { color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.device-label { color: var(--accent); font-size: 12px; }

.artwork-wrap { padding: 22px 44px 10px; position: relative; }
.artwork { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 19px; box-shadow: 0 24px 50px rgba(0,0,0,.44), 0 0 0 1px rgba(255,255,255,.08); background: #1d1d21; }
.busy-pill { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 110px); padding: 9px 13px; border-radius: 999px; background: rgba(9,9,11,.88); border: 1px solid rgba(255,116,23,.36); color: var(--accent); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(12px); }
.busy-pill[hidden] { display: none; }

.track-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 0 4px; }
.track-heading > div { min-width: 0; }
.track-heading h1 { margin: 0; font-size: 27px; letter-spacing: -.03em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.track-heading p { margin: 4px 0 0; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mode-pill { flex: 0 0 auto; max-width: 118px; padding: 7px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.seek-section { margin-top: 18px; }
.range { width: 100%; accent-color: var(--accent); touch-action: pan-y; }
.range:not(:disabled) { cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: -2px; }
.transport { display: flex; align-items: center; justify-content: center; gap: 42px; padding: 12px 0 11px; }
.transport-button { width: 48px; height: 48px; border: 0; background: transparent; font-size: 22px; opacity: .84; border-radius: 50%; transition: transform .12s ease, opacity .12s ease, background .12s ease; }
.transport-button:not(:disabled):active { transform: scale(.92); background: rgba(255,255,255,.05); }
.transport-main { width: 66px; height: 66px; border-radius: 50%; color: white; background: linear-gradient(145deg, #ff8c34, #ff5d0a); box-shadow: 0 10px 25px rgba(255,106,17,.35), inset 0 1px rgba(255,255,255,.35); font-size: 25px; opacity: 1; }
.volume-row { display: grid; grid-template-columns: 22px 1fr 43px; gap: 10px; align-items: center; color: var(--muted); padding: 0 8px 18px; }
.volume-row > :last-child { text-align: right; }
.volume-range { accent-color: var(--accent); }

.queue-card { padding: 14px 15px; }
.section-heading { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.section-heading strong { color: #dedee1; }
.queue-placeholder { min-height: 62px; display: grid; place-items: center; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 12px; text-align: center; }
.primary-outline { width: 100%; margin-top: 14px; padding: 15px; border-radius: 17px; border: 1px solid rgba(255,116,23,.34); background: rgba(255,116,23,.04); color: var(--accent); font-weight: 750; transition: .15s ease; }
.primary-outline:not(:disabled):active { transform: scale(.985); background: rgba(255,116,23,.1); }
.security-note { text-align: center; color: #74767d; font-size: 11px; padding: 14px 0 0; }

.search-box { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.05); }
.search-box input { border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; }
.disabled-section { opacity: .55; }
.feature-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; padding: 18px; margin-top: 14px; }
.feature-card strong, .feature-card span { display: block; }
.feature-card span { color: var(--muted); font-size: 12px; line-height: 1.55; margin-top: 5px; }
.feature-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 23px; }
.mini-player { display: grid; grid-template-columns: 47px minmax(0,1fr) auto auto; gap: 10px; align-items: center; padding: 10px; margin-top: 13px; }
.mini-player img { width: 47px; height: 47px; border-radius: 11px; object-fit: cover; background: #1d1d21; }
.mini-player strong, .mini-player span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mini-player span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.mini-player button { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.04); border: 0; font-size: 19px; }
.desktop-mark { color: var(--accent); }

.settings-title { font-size: 29px; margin: 12px 0 18px; }
.settings-card { padding: 4px 16px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row span { color: var(--muted); }
.settings-row strong { text-align: right; overflow-wrap: anywhere; }
.settings-help { color: var(--muted); line-height: 1.55; font-size: 13px; padding: 3px; }

.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 520px); display: grid; grid-template-columns: repeat(3, 1fr); padding: 11px 20px var(--safe-bottom); border-top: 1px solid var(--line); background: rgba(10,10,12,.94); backdrop-filter: blur(20px); }
.nav-item { border: 0; background: transparent; display: grid; justify-items: center; gap: 4px; color: #777981; font-size: 11px; }
.nav-item span { font-size: 23px; }
.nav-item.active { color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(94px + var(--safe-bottom)); transform: translate(-50%, 16px); width: min(calc(100% - 36px), 480px); padding: 13px 15px; border-radius: 14px; background: #27272c; border: 1px solid var(--line); box-shadow: 0 18px 45px rgba(0,0,0,.42); opacity: 0; pointer-events: none; transition: .2s ease; z-index: 40; font-size: 13px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
button:disabled, input:disabled { cursor: not-allowed; opacity: .42; }
.command-busy .transport-button:not(.transport-main), .command-busy .primary-outline { opacity: .38; }

@media (max-width: 380px) {
  .app-shell { padding-left: 13px; padding-right: 13px; }
  .artwork-wrap { padding-left: 32px; padding-right: 32px; }
  .transport { gap: 28px; }
  .device-label { display: none; }
  .device-card { grid-template-columns: auto 1fr; }
}
@media (min-width: 700px) {
  .app-shell { margin-top: 24px; margin-bottom: 24px; min-height: calc(100vh - 48px); border-radius: 30px; border: 1px solid var(--line); background: rgba(9,9,11,.8); box-shadow: 0 30px 100px rgba(0,0,0,.5); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
