:root {
  --bg: #0a0a0a;
  --bg2: #121212;
  --card: #161616;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3efe6;
  --muted: #9a958a;
  --gold: #cdb15d;
  --gold-soft: rgba(205, 177, 93, 0.14);
  --danger: #d8665a;
  --ok: #7fb68a;
  --radius: 14px;
  --font: Heebo, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* shell */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 12px 18px; padding-top: calc(12px + env(safe-area-inset-top)); background: rgba(10, 10, 10, 0.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 300; font-size: 22px; letter-spacing: 0.02em; color: var(--gold); }
.nav { display: flex; gap: 4px; margin-inline-start: 12px; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--gold-soft); }
.spacer { flex: 1; }
.main { max-width: 920px; margin: 0 auto; padding: 22px 18px 90px; }
.offline { background: var(--gold-soft); color: var(--gold); text-align: center; padding: 6px; font-size: 14px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 11px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; transition: border-color .15s, background .15s; }
.btn:hover { border-color: rgba(205, 177, 93, 0.5); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1a1608; font-weight: 500; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { color: var(--muted); font-size: 14px; }
.input, textarea.input, select.input { width: 100%; padding: 11px 13px; background: var(--bg2); border: 1px solid var(--line); border-radius: 11px; outline: none; }
.input:focus { border-color: rgba(205, 177, 93, 0.6); }
textarea.input { min-height: 320px; line-height: 1.8; resize: vertical; font-size: 18px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > .field { flex: 1 1 140px; }
h1 { font-weight: 300; font-size: 28px; margin: 0 0 4px; }
h2 { font-weight: 400; font-size: 18px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }

/* lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; }
.item:hover { border-color: rgba(205, 177, 93, 0.45); }
.item .t { font-size: 18px; }
.item .m { color: var(--muted); font-size: 14px; }
.item .grow { flex: 1; min-width: 0; }
.item .grow > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--gold); font-size: 14px; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.badge.warn { color: var(--gold); border-color: rgba(205, 177, 93, 0.4); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.chip { padding: 5px 13px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 14px; }
.chip.on { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }
.empty { text-align: center; color: var(--muted); padding: 50px 10px; }
.msg { margin: 10px 0; color: var(--muted); font-size: 14px; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }
.iconbtn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: transparent; }
.iconbtn:hover { border-color: rgba(205, 177, 93, 0.5); color: var(--gold); }

/* login */
.auth { max-width: 400px; margin: 9vh auto 0; padding: 0 18px; }
.auth .brand { justify-content: center; font-size: 34px; margin-bottom: 6px; }
.auth .tabs { display: flex; margin: 22px 0 16px; border-bottom: 1px solid var(--line); }
.auth .tabs button { flex: 1; background: none; border: 0; padding: 10px; color: var(--muted); border-bottom: 2px solid transparent; }
.auth .tabs button.on { color: var(--gold); border-color: var(--gold); }

/* stage */
.stage { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: var(--sbg, #000); color: var(--sfg, #fff); }
.stage.t-white { --sbg: #fff; --sfg: #000; --smuted: rgba(0, 0, 0, 0.45); --sacc: #7a5c00; }
.stage.t-black { --sbg: #000; --sfg: #fff; --smuted: rgba(255, 255, 255, 0.45); --sacc: #cdb15d; }
.stage.t-yellow { --sbg: #000; --sfg: #ffe14d; --smuted: rgba(255, 225, 77, 0.5); --sacc: #fff; }
.stage-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(70px + env(safe-area-inset-top)) 6vw calc(60vh) 6vw; scrollbar-width: none; text-align: center; }
.stage-scroll::-webkit-scrollbar { display: none; }
.stage-title { font-size: 0.55em; font-weight: 300; color: var(--smuted); margin-bottom: 1.2em; }
.line { font-weight: 500; margin: 0 0 0.35em; overflow-wrap: anywhere; }
.line.gap { height: 0.9em; }
.line.sec { color: var(--sacc); font-size: 0.6em; font-weight: 400; letter-spacing: 0.08em; margin-top: 0.9em; }
.stage-bar { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: rgba(0, 0, 0, 0.78); backdrop-filter: blur(8px); color: #fff; transition: opacity .2s, transform .2s; z-index: 5; }
.stage-bar.topbar { top: 0; padding-top: calc(10px + env(safe-area-inset-top)); }
.stage-bar.botbar { bottom: 0; flex-wrap: wrap; padding-bottom: calc(10px + env(safe-area-inset-bottom)); justify-content: center; }
.stage.hide .stage-bar { opacity: 0; pointer-events: none; }
.stage-bar .iconbtn { color: #fff; border-color: rgba(255, 255, 255, 0.2); }
.stage-bar .ttl { flex: 1; text-align: center; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-bar input[type=range] { width: 110px; accent-color: var(--gold); }
.stage-bar .grp { display: flex; align-items: center; gap: 6px; }
.stage-bar .iconbtn.on { color: #1a1608; background: var(--gold); border-color: var(--gold); }
.stage .swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); padding: 0; }
.swatch.s-white { background: #fff; } .swatch.s-black { background: #000; } .swatch.s-yellow { background: #ffe14d; }

@media (max-width: 640px) {
  .nav a span { display: none; }
  .nav a { padding: 8px 11px; }
  .main { padding-top: 16px; }
  textarea.input { min-height: 260px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.mt1 { margin-top: 10px; } .mt2 { margin-top: 22px; } .mt3 { margin-top: 26px; }
.item a.grow, a.item { color: inherit; text-decoration: none; }
button.item.pick { width: 100%; text-align: start; font: inherit; color: inherit; }
.auth .sub { text-align: center; }

/* artists grouping */
.grp { margin-bottom: 22px; }
.grp-h { display: flex; align-items: center; gap: 10px; color: var(--gold); font-weight: 400; font-size: 17px; margin: 18px 0 10px; }
.grp-h a { color: inherit; text-decoration: none; }
.grp-h .count { color: var(--muted); font-size: 13px; border: 1px solid var(--line); border-radius: 99px; padding: 0 9px; }

/* editor */
.keyrow { display: flex; gap: 8px; align-items: center; }
.keyrow .input { flex: 1; min-width: 0; }
.sec-row { margin-bottom: 8px; flex-wrap: nowrap; }
.sec-name { width: 90px; flex: none; color: var(--text); }
.sec-row .input { flex: 1; }
.printonly { display: none; }

/* stage additions */
.stage-bar.topbar { flex-direction: column; align-items: stretch; gap: 6px; }
.toprow { display: flex; align-items: center; gap: 8px; }
.stage-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.stage-chips:empty { display: none; }
.stage-chips .chip { color: #fff; border-color: rgba(255, 255, 255, 0.25); white-space: nowrap; flex: none; }
.stage-scroll { padding-top: calc(120px + env(safe-area-inset-top)); }
.stage-meta { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 0.4em; color: var(--smuted); margin-bottom: 1em; }
.keyb { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 10px; padding: 2px 12px; border-radius: 99px; border: 1px solid currentColor; background: transparent; color: var(--sacc); font-size: 0.8em; font-family: inherit; }
.stage-meta .keyb { margin: 0; font-size: 1em; }
.line.sec .keyb .icon { width: 0.9em; height: 0.9em; }
.stage-scroll.ar .line { letter-spacing: 0.03em; line-height: 1.45; }
.stage-bar.botbar { flex-direction: column; align-items: stretch; gap: 8px; }
.botrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.pbar { height: 3px; background: rgba(255, 255, 255, 0.18); border-radius: 3px; overflow: hidden; }
.pfill { height: 100%; width: 0; background: var(--gold); }
.clock { font-variant-numeric: tabular-nums; font-size: 14px; min-width: 84px; text-align: center; direction: ltr; }
.iconbtn.txt { width: auto; min-width: 38px; padding: 0 10px; font-size: 14px; }
[hidden] { display: none !important; }

@media print {
  body { background: #fff; color: #000; }
  .top, .noprint, .offline { display: none !important; }
  .printonly { display: block; }
  .item { border: 0; border-bottom: 1px solid #ccc; border-radius: 0; background: #fff; color: #000; }
  .item .m, .item .num { color: #444; }
  .main { max-width: none; padding: 0; }
}
.iconbtn.txt { direction: ltr; unicode-bidi: isolate; }

/* add-to-playlist sheet */
.overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, 0.72); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 18px; } }
.typesel { width: auto; min-width: 150px; }
@media (max-width: 640px) { .top { gap: 8px; padding-inline: 12px; } .top .m { display: none; } .nav { margin-inline-start: 0; } .brand { font-size: 20px; } }

/* filters, favourites, maqam label, browse tiles, player */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
select.sel { padding: 9px 11px; font-size: 15px; }
.maq { color: var(--gold); font-size: 12px; letter-spacing: 0.04em; margin-bottom: 1px; }
.item.song .m { white-space: normal; }
.iconbtn.heart.on { color: var(--gold); border-color: rgba(205, 177, 93, 0.6); }
.iconbtn.heart.on .icon { fill: currentColor; }
.heart-link { text-decoration: none; color: inherit; }
.chip .icon { width: 14px; height: 14px; margin-inline-end: 4px; vertical-align: -2px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 10px; margin-top: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--text); text-align: center; }
.ring { width: 78px; height: 78px; border-radius: 50%; border: 1.5px solid var(--gold); display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, rgba(205, 177, 93, 0.22), rgba(205, 177, 93, 0.04)); color: var(--gold); font-size: 24px; font-weight: 300; transition: transform .15s; }
.tile:hover .ring { transform: scale(1.05); }
.tile.zero .ring { border-color: var(--line); background: transparent; color: var(--muted); }
.tile.zero .tname { color: var(--muted); }
.tname { font-size: 14px; line-height: 1.25; }
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; margin-top: 12px; border-radius: 12px; overflow: hidden; background: #000; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.stage-player { position: absolute; z-index: 8; left: 4vw; right: 4vw; top: calc(96px + env(safe-area-inset-top)); display: flex; gap: 8px; align-items: flex-start; }
.stage-player .player { margin: 0; flex: 1; }
.stage-player .iconbtn { background: rgba(0, 0, 0, 0.7); color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* phones: tabs move to a bottom bar */
@media (max-width: 640px) {
  .nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; margin: 0; gap: 0; justify-content: space-around; background: rgba(10, 10, 10, 0.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .nav a { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; justify-content: center; }
  .nav a span { display: inline; }
  .main { padding-bottom: 96px; }
  .top .heart-link { margin-inline-start: auto; }
}
@media print { .nav { display: none !important; } }
@media (max-width: 640px) { .top { backdrop-filter: none; background: #0a0a0a; } }
