@font-face { font-family: "Open Sans"; src: url("fonts/OpenSans-Regular.ttf") format("truetype"); font-weight: 400; }
@font-face { font-family: "Open Sans"; src: url("fonts/OpenSans-Semibold.ttf") format("truetype"); font-weight: 600; }

:root {
    --bg: #121212;
    --surface: #1c1c1e;
    --surface-2: #26262a;
    --surface-3: #303036;
    --text: #f2f2f2;
    --text-2: #a7a7ad;
    --accent: #ff9800;
    --accent-2: #e27435;
    --gold: #f5c542;
    --danger: #ff6b6b;
    --radius: 14px;
    --player-h: 88px;
    --side-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Open Sans", system-ui, sans-serif; font-size: 15px; }
/* Dark scrollbars everywhere (the browser's default ones are light grey on the dark theme). */
html { color-scheme: dark; }
* { scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #45454c; }
::-webkit-scrollbar-corner { background: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1 { font-size: 30px; margin: 0 0 16px; font-weight: 600; }
h1:focus { outline: none; }
h2 { font-size: 20px; margin: 28px 0 12px; font-weight: 600; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* Shell: sidebar, content, player bar */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; grid-template-rows: 1fr var(--player-h); height: 100vh; }
.sidebar { grid-row: 1; background: #0b0b0c; padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 600; padding: 0 10px 22px; }
.brand img { width: 34px; height: 34px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: var(--text-2); font-weight: 600; }
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--accent); background: var(--surface); }
.nav-link svg { width: 22px; height: 22px; flex: none; }
.nav-link .narrow { display: none; }
.sidebar .spacer { flex: 1; }
.account-chip { display: block; padding: 12px; border-radius: 12px; background: var(--surface); font-size: 13px; color: var(--text-2); }
.account-chip b { color: var(--text); display: block; font-size: 14px; }
.gold-badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: linear-gradient(90deg, #ffd27a, #f08a2c); color: #1a1205; font-size: 11px; font-weight: 600; margin-left: 6px; vertical-align: middle; }

.content { grid-row: 1; overflow-y: auto; padding: 28px 34px 40px; }
.content-inner { max-width: 1280px; margin: 0 auto; }

/* Player bar */
.player { grid-column: 1 / span 2; grid-row: 2; background: #0b0b0c; border-top: 1px solid #222; display: grid; grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr) minmax(160px, 1fr); align-items: center; gap: 18px; padding: 0 18px; }
.now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.now img { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; }
.now .meta { min-width: 0; }
.now .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .artist { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .note { color: var(--accent); font-size: 12px; }
.controls { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.buttons { display: flex; align-items: center; gap: 18px; }
.icon-btn { background: none; border: none; padding: 6px; border-radius: 999px; color: var(--text); display: grid; place-items: center; }
.icon-btn:hover { color: var(--accent); }
.icon-btn svg { width: 24px; height: 24px; }
.play-btn { width: 46px; height: 46px; border-radius: 999px; border: none; background: var(--accent); color: #111; display: grid; place-items: center; }
.play-btn:hover { filter: brightness(1.1); }
.play-btn svg { width: 26px; height: 26px; }
.seek { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 12px; color: var(--text-2); }
.seek input { flex: 1; }
input[type=range] { accent-color: var(--accent); }
.extra { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.extra input { width: 110px; }
.extra > svg { width: 22px; height: 22px; color: var(--text-2); flex: none; }
.player { overflow: hidden; }
.spinner { width: 22px; height: 22px; border: 3px solid #555; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Queue drawer */
.queue { position: fixed; right: 16px; bottom: calc(var(--player-h) + 12px); width: 380px; max-height: 60vh; overflow-y: auto; background: var(--surface); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0,0,0,.6); padding: 14px; z-index: 20; }
.queue h3 { margin: 4px 6px 10px; font-size: 16px; }
.icon-btn.on { color: var(--accent); }
.lyrics { position: fixed; right: 16px; bottom: calc(var(--player-h) + 12px); width: 460px; height: min(72vh, 680px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0,0,0,.6); z-index: 20; overflow: hidden; }
.lyrics-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 14px 10px 20px; border-bottom: 1px solid var(--surface-3); }
.lyrics-head h3 { margin: 0 0 2px; font-size: 16px; }
.lyrics-head .s { color: var(--text-2); font-size: 13px; }
.lyrics-body { flex: 1; overflow-y: auto; padding: 24px 22px 45%; text-align: center; scroll-behavior: auto; }
.lyrics-body .line { margin: 0 0 14px; font-size: 17px; line-height: 1.4; color: var(--text); white-space: pre-wrap; }
.lyrics-body.synced .line { font-size: 22px; font-weight: 600; color: var(--text-2); opacity: .55; cursor: pointer; transition: color .25s, opacity .25s, transform .25s; transform-origin: center; }
.lyrics-body.synced .line.past { opacity: .35; }
.lyrics-body.synced .line.current { color: var(--accent); opacity: 1; transform: scale(1.06); }
.lyrics-body.synced .line:hover { opacity: .9; }
.lyrics-body .empty { color: var(--text-2); padding-top: 30%; }
.lyrics-body .spinner { margin: 30% auto 0; }

/* Cards and rows */
.row { display: grid; grid-auto-flow: column; grid-auto-columns: 180px; gap: 16px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 12px; transition: background .15s; display: block; }
.card:hover { background: var(--surface-2); }
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--surface-3); display: block; }
.card .t { font-weight: 600; margin-top: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .s { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.round img { border-radius: 50%; }
.mood { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 10; background: var(--surface-2); display: block; }
.mood img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.mood:hover img { transform: scale(1.05); }
.mood span { position: absolute; left: 14px; bottom: 12px; font-weight: 600; font-size: 18px; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
.moods { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

.songs { display: flex; flex-direction: column; gap: 2px; }
.song { display: grid; grid-template-columns: 34px 48px 1fr auto auto; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.song:hover, .song:focus-visible { background: var(--surface); }
.song.current { background: var(--surface-2); }
.song.current .st { color: var(--accent); }
.song .n { color: var(--text-2); text-align: right; font-size: 13px; }
.song img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-3); }
.song .info { min-width: 0; }
.song .st { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .sa { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song .d { color: var(--text-2); font-size: 13px; }
.song .actions { display: flex; gap: 2px; opacity: 0; }
.song:hover .actions, .song:focus-within .actions { opacity: 1; }
.song .actions .icon-btn svg { width: 20px; height: 20px; }

/* Detail header */
.hero { display: flex; gap: 26px; align-items: flex-end; margin-bottom: 22px; }
.hero img { width: 210px; height: 210px; object-fit: cover; border-radius: 18px; background: var(--surface-2); box-shadow: 0 16px 40px rgba(0,0,0,.5); flex: none; }
.hero.round img { border-radius: 50%; }
.hero .kind { color: var(--text-2); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.hero h1 { font-size: 42px; margin: 6px 0 10px; }
.hero .sub { color: var(--text-2); }
.btn { border: none; border-radius: 999px; padding: 11px 22px; font-weight: 600; background: var(--surface-2); }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--accent); color: #111; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* Genres (Search with nothing typed, and each genre's page). The pictures carry the genre's name, as in the app. */
.genres { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.genre { position: relative; display: block; aspect-ratio: 503 / 485; border-radius: var(--radius); overflow: hidden; background: var(--surface-2);
    box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: transform .2s ease, box-shadow .2s ease; }
.genre img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.genre:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,.5); }
.genre:hover img { transform: scale(1.05); }
.genre:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.genre-hero img { border-radius: 18px; }
.genre-hero h1::first-letter { text-transform: uppercase; }
button.card { width: 100%; border: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.genre-artist.opening { opacity: .7; }
.spinner.small { width: 14px; height: 14px; border-width: 2px; display: inline-block; vertical-align: middle; }

/* Radio mode */
.radio-btn { display: inline-flex; align-items: center; gap: 8px; }
.radio-btn svg { width: 18px; height: 18px; }
.radio-btn.busy { background: var(--surface-3); color: var(--accent); }
.radio-btn.busy svg { animation: radio-pulse 1s ease-in-out infinite alternate; }
@keyframes radio-pulse { from { opacity: .4; } to { opacity: 1; } }
.radio-note { align-self: center; color: var(--text-2); font-size: 13px; }

/* Forms */
.search-box { position: sticky; top: -28px; padding: 10px 0 18px; background: var(--bg); z-index: 5; }
.input { width: 100%; padding: 14px 18px; border-radius: 999px; border: 1px solid #333; background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
.input:focus { outline: none; border-color: var(--accent); }
.panel { background: var(--surface); border-radius: var(--radius); padding: 22px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.panel h2 { margin-top: 0; }
.panel label { display: block; color: var(--text-2); font-size: 13px; margin: 12px 0 6px; }
.panel .input { border-radius: 12px; }
.hint { color: var(--text-2); font-size: 13px; line-height: 1.5; }
.ok { color: #6fd38a; }
.error { color: var(--danger); }
.muted { color: var(--text-2); }
.empty { color: var(--text-2); padding: 40px 0; text-align: center; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.btn svg { width: 18px; height: 18px; vertical-align: -4px; margin-inline-end: 6px; fill: currentColor; }
button.card { width: 100%; border: none; color: inherit; text-align: start; font: inherit; cursor: pointer; }
.card.selected { outline: 2px solid var(--accent); }
.import-bar { position: sticky; top: 0; z-index: 2; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.import-bar .btn-row { margin-top: 0; }
.loading { display: flex; justify-content: center; padding: 50px 0; }

/* Phones: tab bar at the bottom, compact player */
@media (max-width: 820px) {
    .genres { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    :root { --player-h: 70px; }
    .shell { grid-template-columns: 1fr; grid-template-rows: 1fr var(--player-h) 60px; }
    .sidebar { grid-row: 3; flex-direction: row; justify-content: space-around; padding: 4px; border-top: 1px solid #222; }
    .brand, .sidebar .spacer, .account-chip { display: none; }
    .nav-link { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; white-space: nowrap; min-width: 0; }
    .nav-link .wide { display: none; }
    .nav-link .narrow { display: inline; }
    .content { grid-row: 1; padding: 16px 16px 24px; }
    .player { grid-column: 1; grid-row: 2; grid-template-columns: 1fr auto; padding: 0 10px; }
    .player .seek, .player .extra, .buttons .icon-btn.optional { display: none; }
    .now img { width: 46px; height: 46px; }
    .hero { flex-direction: column; align-items: flex-start; }
    .hero img { width: 150px; height: 150px; }
    .hero h1 { font-size: 28px; }
    .song { grid-template-columns: 48px 1fr auto; }
    .song .n, .song .d { display: none; }
    .song .actions { opacity: 1; }
    .queue { left: 10px; right: 10px; width: auto; }
    .lyrics { left: 10px; right: 10px; width: auto; height: calc(100vh - var(--player-h) - 80px); }
    .row { grid-auto-columns: 140px; gap: 12px; }
    .card { padding: 10px; }
}

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 12px 18px; background: #5c1d1d; z-index: 1000; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }

/* Login wall: everything is behind a Gold login */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.gate-inner { width: 100%; max-width: 980px; }
.gate-inner.narrow { max-width: 520px; }
.gate-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 30px; font-weight: 600; margin-bottom: 24px; }
.gate-brand img { width: 44px; height: 44px; }
.gate-inner > .hint { text-align: center; margin: 0 0 24px; font-size: 15px; }

/* Language picker */
.language { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.language svg { width: 20px; height: 20px; flex: none; }
.language select, .setting-select { background: var(--surface); color: var(--text); border: 1px solid #333; border-radius: 10px; padding: 8px 10px; font: inherit; }
.setting-select { flex: none; }
.gate-language { display: flex; justify-content: center; margin-top: 18px; }
/* Right-to-left (Arabic): the player's controls and progress keep the usual left-to-right direction */
[dir=rtl] .player .controls, [dir=rtl] .player .extra { direction: ltr; }

/* Tooltips (site.js) */
.tooltip { position: fixed; z-index: 1000; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: #f2f2f2; color: #111;
    font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.45); opacity: 0; transition: opacity .12s; }
.tooltip.on { opacity: 1; }
@media (hover: none) { .tooltip { display: none; } }

/* Queue header: title and "save as playlist" */
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: -14px; z-index: 1; margin: -14px -14px 0; padding: 10px 14px 4px; background: var(--surface); }
.queue-head .icon-btn svg { width: 22px; height: 22px; }
.head-actions { margin-top: 0; }

/* Add to playlist dialog */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.dialog { width: 100%; max-width: 440px; max-height: min(80vh, 640px); display: flex; flex-direction: column; gap: 14px; background: var(--surface); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0,0,0,.6); padding: 18px 18px 14px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head h3 { margin: 4px 0 2px; font-size: 18px; }
.dialog-head .s { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.new-playlist label { display: block; color: var(--text-2); font-size: 13px; margin-bottom: 6px; }
.new-playlist-row { display: flex; gap: 8px; }
.new-playlist-row .input { flex: 1; min-width: 0; border-radius: 12px; padding: 10px 14px; font-size: 15px; }
.new-playlist-row .btn { flex: none; }
.dialog-list { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--surface-3); padding-top: 10px; min-height: 0; }
.dialog-item { display: flex; align-items: center; gap: 12px; padding: 8px; border: none; border-radius: 10px; background: none; text-align: start; }
.dialog-item:hover:not(:disabled) { background: var(--surface-2); }
.dialog-item:disabled { opacity: .6; cursor: default; }
.dialog-item img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--surface-3); flex: none; }
.dialog-item span { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog-busy { display: flex; justify-content: center; }
.toast { position: fixed; left: 50%; bottom: calc(var(--player-h) + 16px); transform: translateX(-50%); z-index: 60; background: var(--surface-3); color: var(--text);
    padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.5); font-weight: 600; font-size: 14px; max-width: calc(100vw - 32px); }
@media (max-width: 820px) { .toast { bottom: calc(var(--player-h) + 76px); } }

/* Favorite (heart) next to the page's buttons */
.fav-btn { padding: 9px 12px; display: inline-grid; place-items: center; }
.fav-btn svg { width: 22px; height: 22px; margin: 0; vertical-align: 0; }
.fav-btn.on { color: var(--accent); }

/* Visualizer (player.js): a spectrum behind the player bar and a glow behind the page, only with .viz-on */
.player { position: relative; }
.player > :not(.viz) { position: relative; z-index: 1; }
.player .viz { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; display: none; }
.ambient { position: fixed; top: -25vh; left: calc(var(--side-w) - 10vw); right: -10vw; height: 70vh; pointer-events: none; z-index: 0; display: none;
    background: radial-gradient(40% 50% at 30% 45%, rgba(255,152,0,.28), transparent 70%), radial-gradient(35% 45% at 75% 35%, rgba(226,116,53,.2), transparent 70%);
    opacity: .25; transform-origin: 50% 30%; will-change: transform, opacity; }
.viz-on .player .viz, .viz-on .ambient { display: block; }
.content, .sidebar { position: relative; z-index: 1; }
.viz-on .content { background: transparent; }
@media (max-width: 820px) { .ambient { left: -10vw; } }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #ddd; transition: transform .2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); background: #111; }
.switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Sign-in screen: why the session ended (another browser signed in, or it expired) */
.session-ended { text-align: center; background: rgba(255,152,0,.12); border: 1px solid rgba(255,152,0,.4); color: var(--text); border-radius: 12px; padding: 12px 16px; }

/* A song loading: a card over the page (it lets clicks through), shown only when it takes a moment. */
.loading-overlay { position: fixed; inset: 0 0 var(--player-h) 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.45); pointer-events: none; animation: loading-in .2s ease .15s both; }
.loading-card { display: flex; align-items: center; gap: 14px; max-width: min(420px, 100%); background: var(--surface); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0,0,0,.6); padding: 14px 18px 14px 14px; }
.loading-card img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--surface-2); flex: none; }
.loading-card .meta { min-width: 0; }
.loading-card .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loading-card .artist { color: var(--text-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loading-note { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--text); }
@keyframes loading-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 820px) { .loading-overlay { bottom: calc(var(--player-h) + 60px); } }
@media (prefers-reduced-motion: reduce) { .loading-overlay { animation: none; } }

/* The account's open sessions, to close one and sign in here. */
.open-sessions { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.open-session { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.open-session .meta { min-width: 0; }
.open-session .title { font-weight: 600; }
.open-session .s { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.open-session .btn { flex: none; }
@media (max-width: 520px) { .open-session { flex-direction: column; align-items: stretch; } }
