:root {
  color-scheme: dark;
  --bg: #05101f;
  --panel: rgba(10, 28, 50, .78);
  --panel2: rgba(14, 38, 67, .74);
  --line: rgba(139, 190, 235, .14);
  --text: #e6f1ff;
  --muted: #839ab5;
  --blue: #1d9bff;
  --blue2: #64baff;
  --good: #64d6ad;
  --warn: #f0bd68;
  --danger: #ff7d8a;
  --radius: 22px;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: radial-gradient(circle at 78% -10%, #123f70 0, transparent 37%), linear-gradient(145deg, #06111f, #07172b 55%, #05101f); }
button, input { font: inherit; }
button { color: inherit; }
.ambient { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 10% 40%, rgba(29,155,255,.10), transparent 26%), radial-gradient(circle at 80% 70%, rgba(84,126,255,.08), transparent 30%); }
.shell { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 28px 0 36px; position: relative; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: linear-gradient(135deg, #147fd0, #25a8ff); font-weight: 900; letter-spacing: -.04em; box-shadow: 0 12px 38px rgba(16,140,240,.25); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; line-height: 1.05; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .13em; }
.status-row { display: flex; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: rgba(8, 25, 45, .66); color: var(--muted); padding: 8px 11px; border-radius: 999px; font-size: 12px; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: #516175; box-shadow: 0 0 0 4px rgba(81,97,117,.08); }
.pill.online { color: #bfead9; border-color: rgba(100,214,173,.2); }
.pill.online i { background: var(--good); box-shadow: 0 0 12px rgba(100,214,173,.55); }
.pill.warn { color: #f3d7a6; }
.pill.warn i { background: var(--warn); }
.connection-banner { display:flex; align-items:center; justify-content:space-between; gap:18px; padding: 16px 18px; margin-bottom: 18px; border: 1px solid rgba(240,189,104,.23); border-radius: 18px; background: rgba(72, 49, 18, .27); }
.connection-banner strong, .connection-banner span { display:block; }
.connection-banner span { color: #c5b394; font-size: 13px; margin-top: 2px; }
.hidden { display: none !important; }
.tabs { display: flex; gap: 6px; padding: 5px; margin-bottom: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(5,16,31,.56); width: max-content; max-width: 100%; overflow-x: auto; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 9px 13px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.tab.active { background: #102a49; color: #eaf5ff; box-shadow: inset 0 0 0 1px rgba(77,166,239,.15); }
.tab span { opacity: .62; margin-left: 4px; }
.page { display: none; }
.page.active { display: block; animation: in .2s ease-out; }
@keyframes in { from { opacity:0; transform:translateY(5px); } }
.hero-card { border: 1px solid var(--line); background: linear-gradient(140deg, rgba(10,30,53,.88), rgba(7,22,40,.82)); border-radius: 28px; padding: 28px; display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 34px; box-shadow: 0 24px 80px rgba(0,0,0,.22); backdrop-filter: blur(20px); }
.artwork { aspect-ratio: 1; border-radius: 24px; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle at 36% 30%, #17497b, #0a1d34 58%, #06111e); box-shadow: 0 24px 70px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.05); }
.artwork img { width:100%; height:100%; object-fit:cover; }
.artwork span { color: rgba(166,211,247,.35); font-size: 92px; font-weight: 700; }
.track-area { align-self: center; min-width: 0; }
.eyebrow { color: var(--blue2); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 8px 0 2px; font-size: clamp(28px, 4vw, 48px); line-height: 1.05; letter-spacing: -.035em; overflow-wrap: anywhere; }
.track-area > p { margin: 0; color: var(--muted); font-size: 16px; }
.progress-wrap { margin-top: 30px; }
input[type="range"] { --pct: 0%; width:100%; height: 4px; appearance:none; border-radius: 999px; outline:none; background: linear-gradient(to right, var(--blue) var(--pct), rgba(148,181,211,.18) var(--pct)); }
input[type="range"]::-webkit-slider-thumb { appearance:none; width:15px; height:15px; border-radius:50%; background:#dff2ff; border:3px solid var(--blue); box-shadow:0 2px 9px rgba(0,0,0,.35); }
.time-row { display:flex; justify-content:space-between; color:#68839d; font-size:11px; margin-top:8px; font-variant-numeric: tabular-nums; }
.transport { display:flex; align-items:center; justify-content:center; gap: 13px; margin-top: 23px; }
.icon-button, .play-button, .soft-button, .primary, .volume-icon { border:0; cursor:pointer; transition: transform .12s ease, background .12s ease, opacity .12s ease; }
.icon-button:hover, .play-button:hover, .soft-button:hover, .primary:hover { transform:translateY(-1px); }
.icon-button { width:42px; height:42px; border-radius:50%; background:transparent; color:#8ba6c1; }
.icon-button.large { color:#d9ecfb; }
.icon-button.active { color: var(--blue2); background: rgba(29,155,255,.1); }
.play-button { width:66px; height:66px; border-radius:50%; background:linear-gradient(145deg,#31aaff,#1685e0); color:#fff; font-size:20px; box-shadow:0 15px 34px rgba(23,144,234,.30); }
.secondary-controls { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top: 25px; padding-top:18px; border-top:1px solid var(--line); }
.rating-controls { display:flex; gap:7px; }
.soft-button { background:rgba(120,168,209,.08); border:1px solid rgba(137,184,224,.1); border-radius:11px; padding:8px 12px; color:#a9bfd3; }
.primary { background:linear-gradient(145deg,#249ff4,#147fd4); padding:10px 16px; border-radius:11px; color:#fff; font-weight:700; }
.volume-control { display:grid; grid-template-columns:32px minmax(90px,160px) 28px; align-items:center; gap:8px; color:#708ba5; }
.volume-icon { background:transparent; padding:0; }
.volume-control input { height:3px; }
#volumeText { font-size:11px; font-variant-numeric:tabular-nums; }
.mini-grid, .server-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; margin-top:14px; }
.mini-card, .info-card { border:1px solid var(--line); background:var(--panel); border-radius:18px; padding:17px 19px; min-width:0; }
.mini-card span, .info-card span { display:block; color:#637f9a; font-size:10px; text-transform:uppercase; letter-spacing:.12em; }
.mini-card strong, .info-card strong { display:block; margin-top:6px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mini-card small, .info-card small { display:block; color:var(--muted); margin-top:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.section-heading { display:flex; align-items:end; justify-content:space-between; gap:16px; margin:22px 3px 13px; }
h2 { margin:4px 0 0; font-size:28px; letter-spacing:-.03em; }
.search-box { display:grid; grid-template-columns:1fr auto; gap:9px; padding:9px; border:1px solid var(--line); border-radius:17px; background:var(--panel); }
.search-box input { min-width:0; border:0; outline:0; color:var(--text); background:transparent; padding:4px 8px; }
.search-box input::placeholder { color:#57728e; }
.media-list { display:grid; gap:8px; margin-top:13px; }
.media-item { display:grid; grid-template-columns:52px minmax(0,1fr) auto; align-items:center; gap:12px; padding:9px; border:1px solid transparent; border-radius:15px; background:rgba(12,31,54,.55); cursor:pointer; }
.media-item:hover { border-color:var(--line); background:rgba(16,40,69,.72); }
.media-item.active { border-color:rgba(29,155,255,.28); background:rgba(16,51,84,.7); }
.media-thumb { width:52px; height:52px; border-radius:10px; background:#0d223b; overflow:hidden; display:grid; place-items:center; color:#42627f; }
.media-thumb img { width:100%; height:100%; object-fit:cover; }
.media-copy { min-width:0; }
.media-copy strong, .media-copy span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.media-copy strong { font-size:14px; }
.media-copy span { color:var(--muted); font-size:12px; margin-top:3px; }
.media-meta { color:#657f98; font-size:11px; padding-right:8px; }
.empty-message { padding:30px 18px; text-align:center; color:#66809a; border:1px dashed var(--line); border-radius:16px; margin-top:13px; }
.server-grid { grid-template-columns:repeat(2,1fr); }
.instructions { margin-top:14px; padding:20px; border:1px solid var(--line); border-radius:18px; background:var(--panel); }
.instructions h3 { margin:0 0 7px; }
.instructions p { margin:0; color:var(--muted); line-height:1.55; }
.instructions code { display:block; margin-top:14px; padding:12px 14px; border-radius:11px; background:#04101d; color:#8acbff; overflow-x:auto; }
footer { display:flex; justify-content:space-between; gap:20px; color:#49647d; font-size:11px; margin-top:22px; padding:0 4px; }
.toast { position:fixed; left:50%; bottom:24px; transform:translate(-50%,20px); opacity:0; pointer-events:none; padding:10px 14px; border-radius:12px; background:#12314f; border:1px solid rgba(92,176,244,.2); color:#e5f4ff; box-shadow:0 18px 50px rgba(0,0,0,.35); transition:.2s; z-index:20; }
.toast.show { opacity:1; transform:translate(-50%,0); }
button:disabled, input:disabled { opacity:.4; cursor:not-allowed; }
@media (max-width: 760px) {
  .shell { width:min(100% - 18px, 720px); padding-top:16px; padding-bottom:24px; }
  .topbar { margin-bottom:14px; }
  .brand small { display:none; }
  .pill { padding:7px 9px; }
  .hero-card { grid-template-columns:1fr; gap:20px; padding:14px; border-radius:22px; }
  .artwork { width:min(100%, 430px); justify-self:center; border-radius:19px; }
  .track-area { padding:0 6px 8px; }
  h1 { font-size:32px; }
  .secondary-controls { align-items:flex-end; }
  .volume-control { grid-template-columns:28px minmax(70px,1fr) 26px; width:55%; }
  .mini-grid, .server-grid { grid-template-columns:1fr; }
  .connection-banner { align-items:flex-start; flex-direction:column; }
  .tabs { width:100%; }
  .tab { flex:1; }
}
@media (max-width: 430px) {
  .status-row .pill { font-size:0; width:32px; justify-content:center; }
  .status-row .pill i { margin:0; }
  .transport { gap:6px; }
  .play-button { width:62px; height:62px; }
  .secondary-controls { flex-direction:column; align-items:stretch; }
  .volume-control { width:100%; }
  .rating-controls { justify-content:center; }
}
.pill.error { color:#ffc3ca; border-color:rgba(255,125,138,.22); }
.pill.error i { background:var(--danger); box-shadow:0 0 12px rgba(255,125,138,.4); }
.auth-actions { display:flex; gap:9px; flex-wrap:wrap; margin-top:14px; }
.device-code { margin-top:14px; padding:14px 16px; border:1px solid rgba(29,155,255,.18); border-radius:13px; background:rgba(12,41,69,.55); color:var(--muted); }
.device-code span { display:block; margin:3px 0; }
.device-code code { display:inline-block; margin:0 3px; padding:4px 7px; font-size:16px; font-weight:800; letter-spacing:.08em; }
.section-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.playlist-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); gap:13px; margin-top:13px; }
.playlist-card { border:1px solid transparent; border-radius:18px; padding:11px; background:rgba(12,31,54,.55); cursor:pointer; transition:transform .12s ease,border-color .12s ease,background .12s ease; min-width:0; }
.playlist-card:hover { transform:translateY(-2px); border-color:var(--line); background:rgba(16,40,69,.72); }
.playlist-art { width:100%; aspect-ratio:1; border-radius:13px; overflow:hidden; display:grid; place-items:center; background:#0d223b; color:#42627f; font-size:42px; }
.playlist-art img { width:100%; height:100%; object-fit:cover; }
.playlist-card strong, .playlist-card span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.playlist-card strong { margin-top:10px; font-size:14px; }
.playlist-card span { margin-top:4px; color:var(--muted); font-size:11px; }
@media (max-width: 760px) {
  .section-heading { align-items:flex-start; }
  .section-actions { justify-content:flex-start; }
  .playlist-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* TG Music v4 — stable, branded scrolling */
html { scrollbar-gutter: stable; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #06111f; }
::-webkit-scrollbar-thumb { background: #244b70; border: 2px solid #06111f; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #2e82c5; }
* { scrollbar-width: thin; scrollbar-color: #244b70 #06111f; }

.hidden { display: none !important; }
.topbar-right { display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.profile-pill b { font-weight:700; }
.compact { padding:7px 10px !important; font-size:12px; }
.danger-text { color:#ffadb6; }

.auth-gate { position:relative; min-height:100vh; display:grid; place-items:center; padding:24px; z-index:2; }
.auth-card { width:min(520px,100%); padding:28px; border:1px solid var(--line); border-radius:26px; background:rgba(7,24,43,.94); box-shadow:0 30px 90px rgba(0,0,0,.42); backdrop-filter:blur(18px); }
.auth-brand { display:flex; align-items:center; gap:12px; margin-bottom:22px; }
.auth-brand strong,.auth-brand small { display:block; }
.auth-brand small { color:var(--muted); text-transform:uppercase; letter-spacing:.12em; font-size:10px; margin-top:2px; }
.auth-message { color:#9db6ce; margin:0 0 18px; padding:11px 13px; background:rgba(35,99,151,.12); border:1px solid rgba(75,155,219,.12); border-radius:12px; }
.auth-form { display:grid; gap:14px; }
.auth-form h2 { margin:0; }
.auth-form p { margin:0; color:var(--muted); line-height:1.55; }
.auth-form label { display:grid; gap:6px; color:#aec0d1; font-size:12px; font-weight:650; }
.auth-form input,.account-controls input,.account-controls select { width:100%; border:1px solid var(--line); outline:0; border-radius:11px; padding:11px 12px; color:var(--text); background:#081a2d; }
.auth-form input:focus,.account-controls input:focus,.account-controls select:focus { border-color:rgba(29,155,255,.55); box-shadow:0 0 0 3px rgba(29,155,255,.08); }
.auth-form code { color:#8acbff; }

.compact-instructions { padding-bottom:14px; }
.admin-list { display:grid; gap:10px; margin-top:14px; }
.admin-card { display:grid; grid-template-columns:minmax(150px,1fr) auto; gap:12px; align-items:center; padding:13px; border:1px solid rgba(139,190,235,.1); border-radius:14px; background:rgba(8,26,47,.64); }
.admin-copy { min-width:0; }
.admin-copy strong,.admin-copy span,.admin-copy small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.admin-copy span { color:var(--muted); font-size:12px; margin-top:4px; }
.admin-copy small { color:#607b94; font-size:10px; margin-top:4px; }
.admin-actions { display:flex; align-items:center; justify-content:flex-end; gap:7px; flex-wrap:wrap; }
.approval-code { min-width:88px; padding:7px 9px; text-align:center; border-radius:9px; background:#04101d; color:#85ccff; font-weight:800; letter-spacing:.09em; }
.account-admin-card { grid-template-columns:1fr; }
.account-controls { display:grid; grid-template-columns:minmax(130px,1fr) 110px auto auto; gap:8px; align-items:center; }
.toggle-label { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:12px; white-space:nowrap; }
.toggle-label input { width:auto; }
.device-list { display:grid; gap:6px; padding-top:4px; }
.device-row { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 10px; border-radius:10px; background:rgba(91,142,184,.06); color:#8fa8c0; font-size:12px; }

@media (max-width:760px) {
  .topbar { align-items:flex-start; }
  .topbar-right { gap:7px; }
  .status-row { flex-wrap:wrap; justify-content:flex-end; }
  .auth-gate { padding:14px; align-items:start; padding-top:max(28px,env(safe-area-inset-top)); }
  .auth-card { padding:20px; border-radius:22px; }
  .admin-card { grid-template-columns:1fr; }
  .admin-actions { justify-content:flex-start; }
  .account-controls { grid-template-columns:1fr 110px; }
  .account-controls .primary { width:100%; }
}
