/* Components: buttons, cards, track lists, menus, toasts, settings rows and the rest of the shared pieces. */

button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
.logo { width: 26px; height: 26px; border-radius: var(--radius-s); background: url("../icons/mark.svg") center/cover no-repeat; box-shadow: 0 0 0 1px var(--line); }
/* ---------- controls ---------- */
select, input[type=search], input[type=text] {
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 10px; min-width: 0;
}
select:hover, input[type=search]:hover, input[type=text]:hover { border-color: var(--line-strong); }
input[type=search]:focus, input[type=text]:focus, select:focus { outline: none; border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--line-strong); background: var(--raise-hover); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn svg { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; cursor: default; }
.icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--text-2); }
.icon:hover { color: var(--text); background: var(--raise); }
.icon.sm { width: 32px; height: 32px; }
.icon.sm svg { width: 18px; height: 18px; }
.icon[aria-pressed=true] { color: var(--accent); }
.icon.play { width: 42px; height: 42px; background: var(--text); color: var(--bg); }
.icon.play:hover { background: #fff; transform: scale(1.05); }
.icon:disabled { opacity: .35; cursor: default; }
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; height: 16px; cursor: pointer; --p: 0%;
  touch-action: none; }
/* the slider owns sideways drags; otherwise iPhone Safari treats them as page panning */
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: var(--radius-s); background: linear-gradient(to right, var(--text) var(--p), var(--track) var(--p)); }
input[type=range]:hover::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--accent) var(--p), var(--track) var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; margin-top: -4px; opacity: 0; transition: opacity .15s; }
input[type=range]:hover::-webkit-slider-thumb, input[type=range]:focus-visible::-webkit-slider-thumb, input[type=range]:active::-webkit-slider-thumb { opacity: 1; }
input[type=range]::-moz-range-track { height: 4px; border-radius: var(--radius-s); background: var(--track); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: var(--radius-s); background: var(--text); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }
.empty { color: var(--dim); padding: 40px 0; text-align: center; }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--pop-hover); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 22px 18px; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: clamp(168px, calc((100cqw - 5 * 18px) / 6), 200px); gap: 18px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.shelf > * { scroll-snap-align: start; }
/* a shelf's cards grow with the room they have (about six across, up to 200 px), measured from the shelf's own box */
:has(> .shelf) { container-type: inline-size; }
.shelf::-webkit-scrollbar { height: 6px; }
.shelf::-webkit-scrollbar-thumb { background: transparent; border: 0; }
.shelf:hover::-webkit-scrollbar-thumb { background: var(--pop-hover); }
.card { display: flex; flex-direction: column; gap: 8px; min-width: 0; cursor: pointer; border-radius: var(--radius); position: relative; }
/* the title is the card's link, stretched over the whole card; the buttons on the art sit above it */
.card .t::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card .t:focus-visible { outline: none; }
.card:has(> .t:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
.card .playfab, .card .cmore, .card .mixtag { z-index: 2; }
.card .art { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--raise); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.card.round .art { border-radius: 50%; }
.card .art img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s, opacity .35s; }
img.fade { opacity: 0; }
img.fade.in { opacity: 1; }
.card:hover .art img { transform: scale(1.04); }
.card .art .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 42px; font-weight: 800; color: rgba(255,255,255,.5); }
/* missing artwork: a soft two-tone wash, picked from the title (phTint) */
.ph-0 { background: linear-gradient(135deg, #3a2a1c, #1c1f27); }
.ph-1 { background: linear-gradient(135deg, #1f3340, #1c1f27); }
.ph-2 { background: linear-gradient(135deg, #352040, #1c1f27); }
.ph-3 { background: linear-gradient(135deg, #1f3a2c, #1c1f27); }
.ph-4 { background: linear-gradient(135deg, #40242a, #1c1f27); }
.ph-5 { background: linear-gradient(135deg, #2c2f45, #1c1f27); }
/* loading placeholder rows (search) */
.skel { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.skel > div { height: 48px; border-radius: var(--radius-s); background: linear-gradient(90deg, var(--raise) 0%, var(--raise-hover) 50%, var(--raise) 100%); background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite; }
.skel > div:nth-child(odd) { width: 92%; }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skel > div { animation: none; } }
.card .playfab { position: absolute; right: 10px; bottom: 10px; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; opacity: 0; transform: translateY(6px); transition: .18s; box-shadow: 0 6px 16px rgba(0,0,0,.45); }
.card:hover .playfab, .card:focus-within .playfab { opacity: 1; transform: none; }
.card .playfab svg { width: 20px; height: 20px; margin-left: 2px; }
.card .cmore { display: none; position: absolute; left: 6px; bottom: 6px; width: 44px; height: 44px; border-radius: 50%; place-items: center; color: #fff; background: rgba(10,11,15,.55); backdrop-filter: blur(6px); }
.card .cmore svg { width: 18px; height: 18px; }
.card .t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.card .s { color: var(--text-2); font-size: var(--fs-m); margin-top: -5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.round .t, .card.round .s { text-align: center; }
/* hero (artist/album/playlist) */
.hero { position: relative; padding: 40px 32px 28px; display: flex; gap: 28px; align-items: flex-end; background: linear-gradient(160deg, var(--tint-1), var(--tint-2) 90%); }
.hero::after { content: ""; position: absolute; inset: auto 0 -1px 0; height: 60px; background: linear-gradient(transparent, var(--bg)); pointer-events: none; }
.hero .cover { width: 220px; height: 220px; border-radius: var(--radius); object-fit: cover; box-shadow: 0 18px 50px rgba(0,0,0,.55); flex: none; background: var(--raise); position: relative; z-index: 1; }
.hero.artist .cover { border-radius: 50%; }
.hero .info { min-width: 0; position: relative; z-index: 1; }
.hero .kind { font-size: var(--fs-s); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.hero h1 { font-size: clamp(28px, 4.5vw, 56px); line-height: 1.05; margin: 6px 0 10px; font-weight: 800; letter-spacing: -.03em; word-break: break-word; }
.hero .meta { color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hero .meta a:hover { color: var(--text); text-decoration: underline; }
.hero .meta { gap: 0 6px; }
.hero .meta .dot::before { content: "·"; margin-right: 6px; }
.hero .actions .icon { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--raise); }
.hero .actions .icon:hover { border-color: var(--line-strong); }
.hero .actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.summary { color: var(--text-2); max-width: 820px; margin: 4px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more-btn { margin-top: 4px; padding: 6px 0; min-height: 32px; font-weight: 600; color: var(--text); }
.more-btn:hover { color: var(--accent); }
.more-btn[hidden] { display: none; }
.summary.open { -webkit-line-clamp: unset; }
/* track list */
.tracks { display: flex; flex-direction: column; }
.tracks.chunk { content-visibility: auto; contain-intrinsic-size: auto 10400px; }
/* 200 rows × 52px */
.trow { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(0, .8fr) 56px 36px; align-items: center; gap: 12px; padding: 6px 10px; border-radius: var(--radius-s); cursor: pointer; }
.tracks.no-album .trow { grid-template-columns: 36px minmax(0, 1fr) 56px 36px; }
.trow:hover { background: var(--raise); }
.trow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-s); }
.trow.playing { color: var(--accent); }
.trow .n { color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; position: relative; }
.trow img { width: 40px; height: 40px; border-radius: var(--radius-s); object-fit: cover; background: var(--raise); }
.trow .tt { min-width: 0; display: flex; align-items: center; gap: 10px; }
.trow .tt > div { min-width: 0; }
.trow .ti { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .ta, .trow .al { color: var(--text-2); font-size: var(--fs-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .ta a:hover, .trow .al a:hover { color: var(--text); text-decoration: underline; }
.trow .d { color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; font-size: var(--fs-m); }
.trow .more { opacity: 0; }
.trow:hover .more, .trow .more:focus-visible { opacity: 1; }
.trow.playing .n { color: var(--accent); }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
/* the bars are 14px tall and scaled from the bottom (8, 14 and 10px when still, e.g. under Reduce Motion) */
.eq i { width: 3px; height: 14px; background: var(--accent); border-radius: 1px; transform-origin: 50% 100%; transform: scaleY(.5714); animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { transform: none; }
.eq i:nth-child(3) { transform: scaleY(.7143); }
.eq i:nth-child(2) { animation-delay: -.4s; }
.eq i:nth-child(3) { animation-delay: -.7s; }
.paused .eq i { animation-play-state: paused; }
.disc { color: var(--dim); font-size: var(--fs-s); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 16px 10px 6px; }
.thead { display: grid; grid-template-columns: 36px minmax(0, 1fr) minmax(0, .8fr) 56px 36px; gap: 12px; padding: 0 10px 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--dim); font-size: var(--fs-s); text-transform: uppercase; letter-spacing: .08em; }
/* the playlist page's column titles: buttons that sort it */
.thead .th-sort { font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; padding: 0; text-align: left; cursor: pointer; }
.thead .th-sort.r { text-align: right; }
.thead .th-sort:hover, .thead .th-sort.on { color: var(--text); }
.thead .th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.tracks.no-album .thead { grid-template-columns: 36px minmax(0, 1fr) 56px 36px; }
/* alphabet + filters */
.filterbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.filterbar input[type=search] { width: 280px; max-width: 100%; }
.seg { display: inline-flex; background: var(--raise); border: 1px solid var(--line); border-radius: 999px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { padding: 5px 12px; border-radius: 999px; color: var(--text-2); font-weight: 500; font-size: var(--fs-m); white-space: nowrap; flex: none; }
.seg button.on { background: var(--text); color: var(--bg); }
/* search */
.searchbox { position: relative; max-width: 560px; margin-bottom: 8px; }
.searchbox input { width: 100%; padding: 13px 16px 13px 44px; font-size: 16px; border-radius: 999px; }
.searchbox svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--dim); }
/* menu + toasts */
#menu { position: fixed; z-index: 50; min-width: 200px; background: var(--pop); border: 1px solid var(--pop-line); border-radius: var(--radius); padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.55); }
#menu button { display: flex; width: 100%; text-align: left; padding: 8px 12px; border-radius: var(--radius-s); gap: 10px; align-items: center; }
#menu button:hover, #menu button:focus { background: var(--pop-hover); outline: none; }
#menu button:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
#menu { max-height: calc(100vh - 24px); overflow-y: auto; }
#menu button.rich { min-width: 260px; padding: 8px 12px; gap: 12px; }
#menu button.rich > svg { color: var(--text-2); }
#menu .mi { display: flex; flex-direction: column; min-width: 0; }
#menu .ml { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* a name box in a menu (New playlist, Rename) */
#menu .minput { display: block; width: 100%; min-width: 240px; box-sizing: border-box; margin: 2px 0 4px; padding: 8px 10px; font: inherit; color: var(--text); background: var(--raise); border: 1px solid var(--line-strong); border-radius: var(--radius-s); }
#menu .minput:focus { outline: none; border-color: var(--accent); }
#menu .ms { font-size: var(--fs-s); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
#menu button.active .ml, #menu button.active > svg { color: var(--accent); }
#menu hr { border: 0; border-top: 1px solid var(--pop-line); margin: 4px 2px; }
#menu .mgrid { display: grid; grid-template-columns: repeat(5, 40px); gap: 4px; padding: 4px 8px 6px; }
#menu .mgrid button { width: 40px; height: 32px; padding: 0; justify-content: center; border: 1px solid var(--pop-line); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--dim); }
#menu .mgrid button.filled { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); border-color: transparent; }
#menu .mgrid button.active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
#menu .mgrid button:hover, #menu .mgrid button:focus { background: var(--pop-hover); }
#toasts { position: fixed; z-index: 60; left: 50%; bottom: calc(var(--bar-h) + 16px); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 14px; background: var(--pop); color: var(--text); border: 1px solid var(--pop-line); padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: var(--fs-m); box-shadow: 0 12px 32px rgba(0,0,0,.55); animation: toast .2s ease-out; }
.toast.err { background: #2a1416; border-color: var(--danger); color: #ffd9d9; }
.toast-detail { font-weight: 500; font-size: var(--fs-s); color: var(--text-2); max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast.err .toast-detail { color: #f0b4b4; }
/* an error in a page: the plain sentence, then the technical text small and quiet */
.err-state p { margin: 0 0 6px; }
.err-state .err-detail { max-width: 60ch; margin: 0 auto 14px; overflow-wrap: anywhere; }
.toast-act { pointer-events: auto; color: var(--accent); font-weight: 800; padding: 4px 2px; min-height: 28px; }
#dropHint { position: fixed; inset: 12px; z-index: 70; border: 2px dashed var(--accent); border-radius: var(--radius-l); background: rgba(11,12,16,.85); display: grid; place-items: center; font-size: var(--fs-xl); font-weight: 700; pointer-events: none; }
#dropHint[hidden] { display: none; }
/* sign in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 32px; background: radial-gradient(50% 50% at 50% 35%, #2a2116, transparent 70%), var(--bg); }
.signin .box { max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.signin h1 { font-size: 40px; margin: 0; letter-spacing: -.03em; font-weight: 800; }
.signin p { color: var(--text-2); margin: 0; }
.signin .logo { width: 56px; height: 56px; border-radius: var(--radius-l); }
/* ---------- tier 4: love, radio, queue reorder, sheet, immersive lyrics ---------- */
.icon.loved, .icon[aria-pressed=true].love { color: var(--accent); }
.trow .ti .heart { width: 13px; height: 13px; color: var(--accent); vertical-align: -1px; margin-left: 6px; }
.grip { display: inline-grid; place-items: center; width: 28px; height: 32px; color: var(--dim); cursor: grab; touch-action: none; border-radius: var(--radius-s); }
.grip:hover { color: var(--text); background: var(--raise); }
.grip svg { width: 16px; height: 16px; }
.trow.dragging { opacity: .35; }
.drop-line { height: 2px; background: var(--accent); border-radius: 2px; margin: -1px 10px; pointer-events: none; }
.radio-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-size: var(--fs-s); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.radio-tag svg { width: 14px; height: 14px; }
/* ---------- remote control (play on another device) ---------- */
#menu .mhead { padding: 8px 12px 4px; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--dim); max-width: 320px; }
.btn.sm { padding: 6px 12px; font-size: var(--fs-m); }
/* ---------- Sonic Adventure, Guest DJ ---------- */
.djtag { margin-right: 6px; padding: 1px 5px; border-radius: var(--radius-s); font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .05em; color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); vertical-align: 2px; }
.adv-link { display: flex; gap: 14px; align-items: center; margin: 14px 0 6px; padding: 14px 16px; border-radius: var(--radius-l); background: linear-gradient(120deg, #2a2112, var(--raise) 60%); border: 1px solid #3a3020; }
.adv-link:hover { border-color: var(--accent); }
.adv-link svg { width: 30px; height: 30px; color: var(--accent); flex: none; }
.adv-link .muted { font-size: var(--fs-m); }
/* Home: mixes, time travel, on this day */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--raise); color: var(--text); font: inherit; font-size: var(--fs-base); font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--line-strong); background: var(--raise-hover); }
.chip.on { background: color-mix(in srgb, var(--accent) 18%, var(--raise)); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.card.mix .art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, transparent 45%, rgba(245,165,36,.35)); pointer-events: none; }
.card .mixtag { position: absolute; left: 10px; top: 10px; z-index: 2; padding: 2px 7px; border-radius: var(--radius-s); background: rgba(0,0,0,.6); color: var(--accent); font-size: var(--fs-xs); font-weight: 800; letter-spacing: .08em; backdrop-filter: blur(6px); }
/* Volume bar (the iPhone app hides iOS's own) */
.volhud { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%; transform: translate(-50%, -12px); z-index: 1000;
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 999px; background: rgba(28,31,39,.92);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 8px 28px rgba(0,0,0,.45);
  color: var(--text); font-size: var(--fs-m); font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.volhud.on { opacity: 1; transform: translate(-50%, 0); }
.volhud svg { width: 18px; height: 18px; flex: none; }
.volhud .vh-bar { width: 120px; height: 5px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.volhud .vh-bar span { display: block; height: 100%; background: var(--accent); transition: width .12s; }
.volhud .vh-n { min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
/* Settings: webhooks */
/* settings: grouped sections of rows (label and help on the left, the control on the right) */
.settings { max-width: 720px; }
.set-group { margin-top: 28px; }
.set-group h2 { font-size: var(--fs-s); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; min-height: 56px; border-bottom: 1px solid var(--line); }
.set-group > .set-row:first-of-type, #account > .set-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.set-group > .set-row:last-child, #account > .set-row:last-child { border-radius: 0 0 var(--radius) var(--radius); border-bottom: 0; }
.set-group > .set-row:only-of-type, #account > .set-row:only-child { border-radius: var(--radius); }
.set-row label, .set-row > div > span:first-child, .set-row > span { font-weight: 600; cursor: pointer; }
.set-row .help, .set-group > .help { margin: 2px 0 0; color: var(--dim); font-size: var(--fs-s); line-height: 1.4; }
.set-row select, .set-row input[type=text] { width: 220px; max-width: 45vw; flex: none; }
.set-row .btn { flex: none; }
/* Sound: the engineering behind each key, behind a small "Details" button */
.details-btn { margin-left: 6px; padding: 0 2px; font-size: inherit; font-weight: 600; color: var(--text-2); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-strong); }
.details-btn:hover { color: var(--text); }
.set-row .help.details { margin-top: 6px; }
.set-row:not(:has(> :nth-child(2))) { justify-content: flex-start; }
.switch { appearance: none; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--text); transition: transform .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); background: var(--accent-ink); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.settings .hooks textarea { margin-top: 10px; }
.settings .hooks textarea { width: 100%; box-sizing: border-box; background: var(--raise); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font: var(--fs-m) ui-monospace, monospace; resize: vertical; }
.settings .hooks .row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.settings .hooks code { font-size: var(--fs-s); overflow-wrap: anywhere; }
.r { text-align: right; }
.spinner.flush { margin: 0; }
.spinner.sm-gap { margin: 10px auto; }

@media (max-width: 1100px) {
  #toasts { bottom: auto; top: calc(16px + env(safe-area-inset-top)); }
}

@media (max-width: 760px) {
  /* phones have hardware volume */
  /* touch targets: 44pt minimum (Apple HIG), transport larger than the tools around it */
  .icon, .icon.sm { width: 44px; height: 44px; }
  input[type=range] { height: 24px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 24px 16px; }
  .hero .cover { width: 160px; height: 160px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 16px 12px; }
  .trow, .thead { grid-template-columns: 28px minmax(0, 1fr) 44px 44px; }
  .trow .al, .thead .al { display: none; }
}

@media (hover: none) {
  .trow .more { opacity: 1; }
  /* touch: tap a tile to open it (Play is one tap away there); one quiet menu button, no play button on every tile */
  .card .playfab { display: none; }
  .card .cmore { display: grid; left: auto; right: 4px; bottom: 4px; width: 38px; height: 38px; background: rgba(10,11,15,.45); }
  /* a round photo: the button sits bottom-centre, where the circle has room for it (a corner would clip it) */
  .card.round .cmore { left: 50%; right: auto; bottom: 8px; transform: translateX(-50%); }
  input[type=range]::-webkit-slider-thumb { opacity: 1; }
  .card:hover .art img { transform: none; }
}

/* Mac app: the Sound keys (T-BASS, SUBZ, EQ, PURE, KARAOKE) as one cluster of hardware buttons, like a 90s Aiwa mini
   system's: moulded plastic capsules, each with an LED on the left that lights while it's on. Amber LEDs (the app's
   accent), except T-BASS (red) and SUBZ (blue), whose colours match the Aiwa's; the transport stays centred on its own. */
.sound { display: flex; align-items: center; gap: 5px; margin-right: 6px; }
.sound[hidden] { display: none; }
.hwbtn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; padding: 5px 10px 5px 8px; border-radius: 999px;
  font-size: var(--fs-2xs); font-weight: 800; letter-spacing: .12em; line-height: 1; color: #b9bdc6;
  background: linear-gradient(180deg, #3b3e46 0%, #2a2c32 55%, #1f2125 100%);
  border: 1px solid #0b0c0e;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), inset 0 -1px 0 rgba(0,0,0,.45), 0 1px 0 rgba(255,255,255,.05), 0 2px 3px rgba(0,0,0,.55);
  transition: transform .06s, box-shadow .06s, background .06s; }
.hwbtn:hover { color: #e3e6ec; }
.hwbtn:active { transform: translateY(1px);
  background: linear-gradient(180deg, #24262b 0%, #2b2d33 100%);
  box-shadow: inset 0 2px 3px rgba(0,0,0,.6), 0 0 0 rgba(0,0,0,0); }
/* The LED: dark when off; on, fully lit (the ring round the key shows how hard it's working: --lvl, 0–1, from the
   app 30 times a second). Amber on every key. */
.hwbtn { --led-hot: #fff0c8; --led: #ffaa1f; --led-deep: #c46d00; --led-glow: 255,165,30; --led-off: #4a3310; --led-off2: #221706; }
/* …except T-BASS and SUBZ, which keep their own colours, the same as on the Aiwa (aiwa.css: warm red and blue), so
   the two bass effects read apart at a glance in both windows. */
#btnTBass { --led-hot: #ffd6cc; --led: #ff3c28; --led-deep: #a8180c; --led-glow: 255,60,40; --led-off: #4a1610; --led-off2: #220806; }
#btnSubs { --led-hot: #d6e6ff; --led: #3c8cff; --led-deep: #1450b4; --led-glow: 60,140,255; --led-off: #102a4a; --led-off2: #061222; }
#btnEq { min-width: 5.4em; justify-content: flex-start; }   /* (EQ, ROCK, POP, JAZZ: the key doesn't change size) */
.hwbtn .led { position: relative; width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, var(--led-off), var(--led-off2) 70%);
  box-shadow: inset 0 0 1px rgba(0,0,0,.9), 0 0 0 1px rgba(0,0,0,.5); }
.hwbtn .led::after { content: ""; position: absolute; inset: 0; border-radius: 50%; opacity: 0; transition: opacity 60ms linear;
  background: radial-gradient(circle at 35% 35%, var(--led-hot), var(--led) 45%, var(--led-deep) 100%);
  box-shadow: 0 0 5px 1px rgba(var(--led-glow),.75), 0 0 12px 2px rgba(var(--led-glow),.35); }
/* On is on: the LED is fully lit whenever the effect is on, so on and off read at a glance. How hard it's working
   shows only in the ring of light round the key (below). */
.hwbtn[aria-pressed=true] .led::after { opacity: 1; }
/* And a ring of light round the whole key, in the LED's colour, swelling with how hard the effect is working:
   the effect on the track at a glance, from across the room. */
.hwbtn { position: relative; }
.hwbtn::before { content: ""; position: absolute; inset: -3px; border-radius: inherit; pointer-events: none;
  border: 1.5px solid rgb(var(--led-glow)); opacity: 0; transition: opacity 60ms linear, box-shadow 60ms linear;
  box-shadow: 0 0 calc(2px + 12px * var(--lvl, 0)) calc(var(--lvl, 0) * 2px) rgba(var(--led-glow), .7),
    inset 0 0 calc(6px * var(--lvl, 0)) rgba(var(--led-glow), .45); }
.hwbtn[aria-pressed=true]::before { opacity: calc(.15 + .85 * var(--lvl, 0)); }
.hwbtn[aria-pressed=true] { color: #f1f2f5; }

/* The effect keys' explanation, after resting on one for a moment. */
.hwtip { position: fixed; z-index: 1000; max-width: 320px; padding: 11px 13px; border-radius: var(--radius); pointer-events: none;
  background: rgba(20,22,28,.97); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 10px 30px rgba(0,0,0,.55);
  font-size: var(--fs-s); line-height: 1.45; color: #cfd3da; animation: fadein .18s ease; }
.hwtip b { display: block; margin-bottom: 4px; font-size: var(--fs-m); color: #f1f2f5; }
.hwtip p { margin: 0; }

/* One-click mixes */
.vibes { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.sage .vibes { margin: 4px 0 14px; }
.btn.vibe svg { width: 14px; height: 14px; }
.btn.vibe-chill svg { color: #6fb7ff; } .btn.vibe-hyped svg { color: #ff6a3d; } .btn.vibe-focus svg { color: #b9a6ff; }
.btn.vibe.working { opacity: 1; }
.btn.vibe.working svg { animation: spin 1.2s linear infinite; }

/* PURE: no ring meter (it does nothing to the sound: the ring just stays lit while it's on); the effect keys go dark */
#btnPure { --lvl: 1; }
.hwbtn.off-pure { opacity: .35; cursor: not-allowed; }

/* A scoreboard card as a sheet over the page, where pop-up windows can't open (the iPhone): cardwin.js */
.card-sheet { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.card-sheet-box { position: relative; width: min(560px, 100%); height: min(86vh, 820px); border-radius: var(--radius-l); overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
/* Settings → Radio: the tuner's place (type anything, pick a match, or the device's location) */
.radio-set > .set-row { border-radius: var(--radius); border-bottom: 0; }
.radio-find { display: flex; gap: 8px; align-items: center; flex: none; }
.radio-find input[type=text] { width: 220px; max-width: 40vw; }
.radio-hits { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.radio-hits > .help { padding: 10px 16px; margin: 0; }
.radio-hit { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--text); }
.radio-hit:last-child { border-bottom: 0; }
.radio-hit:hover, .radio-hit:focus-visible { background: var(--raise-hover); }
.radio-hit span { color: var(--text-2); font-size: var(--fs-s); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.radio-hit small { color: var(--dim); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }
@media (max-width: 560px) { .radio-set > .set-row { flex-wrap: wrap; } .radio-find { width: 100%; } .radio-find input[type=text] { flex: 1; width: auto; max-width: none; } }
