:root {
    --bg: #f1f2f8; --surface: #fff; --raised: #e6e8f2; --text: #191c33; --muted: #52587a;
    --line: #d5d8e8; --accent: #ffb547; --accent-text: #895100; --on-accent: #1d1503; --danger: #a8243c;
    --tick: #a9adc6;
    --nav: 232px; --top: 68px; --bar: 92px; --tabs: 0px; --qw: 320px; --stage-h: 200px;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #14172b; --surface: #1d213c; --raised: #282d4f; --text: #eef0fa; --muted: #a3a9ca;
    --line: #30365c; --accent-text: #ffbe5c; --danger: #ff8fa0; --tick: #50577f;
    color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Odaklanan öğe sabit çubukların ve videonun altında kalmasın. */
html { background: var(--bg); scroll-padding-top: calc(var(--top) + 8px); scroll-padding-bottom: calc(var(--tabs) + 8px); }
html:has(body.has-bar) { scroll-padding-bottom: calc(var(--tabs) + var(--bar) + 8px); }
html:has(body.playing) { scroll-padding-bottom: calc(var(--tabs) + var(--bar) + var(--stage-h) + 24px); }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent-text); text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; margin: 0; overflow-wrap: anywhere; }
h2 { font-size: 19px; margin: 32px 0 12px; letter-spacing: -.01em; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg .solid { fill: currentColor; stroke: none; }
.skip { position: fixed; left: 8px; top: -60px; z-index: 60; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 6px; }
.skip:focus { top: 8px; }

/* Menü ve üst alan */
.brand { font-size: 23px; font-weight: 800; letter-spacing: -.03em; color: var(--text); text-decoration: none; }
#nav { position: fixed; inset: 0 auto 0 0; width: var(--nav); padding: 20px 12px; background: var(--surface); overflow-y: auto; display: flex; flex-direction: column; gap: 24px; }
#nav .brand { padding: 0 12px; }
.main-links, .nav-lists { display: flex; flex-direction: column; gap: 2px; }
#nav a:not(.brand) { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
#nav a:not(.brand):hover, #nav a[aria-current] { background: var(--raised); color: var(--text); }
#nav .main-links a { font-weight: 500; }
.nav-lists { border-top: 1px solid var(--line); padding-top: 16px; }
#nav .nav-lists a { display: block; flex: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; }
#page { margin-left: var(--nav); }
#top { position: sticky; top: 0; z-index: 5; height: var(--top); display: flex; align-items: center; gap: 10px; padding: 0 28px; background: var(--bg); }
#top .brand { display: none; }
.searchbar { flex: 1; min-width: 0; max-width: 560px; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; margin-right: auto; }
.searchbar:focus-within { border-color: var(--accent-text); }
.searchbar input[type="search"] { flex: 1; min-width: 0; width: 100%; background: none; border: 0; outline: 0; padding: 10px 6px 10px 18px; }
#view { padding: 12px 28px 24px; max-width: 1040px; }
#view:focus { outline: none; }
footer { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 48px; font-size: 13px; color: var(--muted); }
#tabs { display: none; }

/* Düğmeler ve formlar */
.ib { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); text-decoration: none; }
.ib:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.ib.on, .ib[aria-pressed="true"] { color: var(--accent-text); }
.ib.on svg { fill: currentColor; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 500; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 5px 14px; white-space: nowrap; }
.btn svg { width: 18px; height: 18px; }
input:not([type="range"]):not([type="checkbox"]):not([type="search"]) { width: 100%; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.inline-form { display: flex; gap: 10px; margin: 20px 0; max-width: 520px; }
.inline-form .btn { white-space: nowrap; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.chips { display: flex; gap: 8px; }
.chips a { padding: 6px 14px; border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px; }
.chips a[aria-current] { background: var(--text); color: var(--bg); }
.sub { color: var(--muted); margin: 4px 0 0; }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--raised); margin: 16px 0; }
.empty { padding: 28px 0; color: var(--muted); max-width: 46ch; }

/* Parça listesi */
.tracks { list-style: none; margin: 12px 0; padding: 0; }
.track { display: flex; align-items: center; gap: 4px; border-radius: 10px; min-width: 0; }
.track:hover, .track:focus-within { background: var(--surface); }
.rank { width: 38px; flex: none; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 700; }
.play-row { flex: 1; min-width: 0; display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 7px; border: 0; background: none; text-align: left; border-radius: 10px; }
.art { display: block; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden; background: var(--raised); }
.art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.meta, .meta > span { display: block; min-width: 0; }
.title, .channel { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.title { font-weight: 500; }
.channel { color: var(--muted); font-size: 13px; }
.time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-right: 6px; }
.actions { display: flex; flex: none; }
.actions form { display: contents; }
.track.current { background: var(--raised); }
.track.current .title { color: var(--accent-text); font-weight: 700; }
.track.off .title { color: var(--muted); }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 184px; gap: 14px; overflow-x: auto; padding: 3px 3px 10px; scroll-snap-type: x proximity; }
.shelf .track { display: block; scroll-snap-align: start; background: none; }
.shelf .play-row { display: block; width: 100%; padding: 0; }
.shelf .art { border-radius: 8px; margin-bottom: 8px; }
.shelf .title, .shelf .channel { display: block; }
.lists { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.lists a { display: flex; flex-direction: column; justify-content: flex-end; height: 112px; padding: 16px; border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; }
.lists a:hover { background: var(--raised); }
.lists strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 17px; }
.lists span { color: var(--muted); font-size: 13px; }
.settings { margin-top: 32px; max-width: 520px; }
.settings summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.settings form, .auth form { display: flex; flex-direction: column; gap: 16px; margin: 16px 0; }
.auth { max-width: 380px; }
.prose { max-width: 68ch; }

/* Oynatıcı */
#stage { position: fixed; z-index: 20; background: #000; right: 16px; bottom: calc(var(--bar) + 16px); width: 356px; height: var(--stage-h); }
#stage iframe, #player { display: block; width: 100%; height: 100%; border: 0; }
#bar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: var(--bar); display: grid; grid-template: "seek seek seek" 32px "controls now extra" 1fr / minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr); align-items: center; column-gap: 16px; padding: 0 16px; background: var(--surface); border-top: 1px solid var(--line); }
.seek { grid-area: seek; display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* İlerleme çubuğu: radyo kadranı gibi çentikli, ibreli. */
#seek { --p: 0%; appearance: none; flex: 1; min-width: 0; height: 28px; margin: 0; cursor: pointer; background:
    linear-gradient(var(--accent), var(--accent)) left bottom 6px / var(--p) 2px no-repeat,
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 40px) left bottom 8px / 100% 11px no-repeat,
    repeating-linear-gradient(90deg, var(--tick) 0 1px, transparent 1px 8px) left bottom 8px / 100% 5px no-repeat,
    linear-gradient(var(--line), var(--line)) left bottom 6px / 100% 2px no-repeat; }
#seek::-webkit-slider-thumb { appearance: none; width: 4px; height: 26px; border-radius: 2px; background: var(--accent); }
#seek::-moz-range-thumb { width: 4px; height: 26px; border: 0; border-radius: 2px; background: var(--accent); }
.controls { grid-area: controls; display: flex; align-items: center; gap: 4px; }
.controls .ib { color: var(--text); }
.ib.big { width: 48px; height: 48px; background: var(--accent); color: var(--on-accent) !important; }
.ib.big:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.i-pause, .is-on .i-play { display: none; }
.i-play, .is-on .i-pause { display: grid; }
.now { grid-area: now; display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
.now img { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; }
.now div { min-width: 0; }
.now strong, .now span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.now span { color: var(--muted); font-size: 13px; }
.extra { grid-area: extra; display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.volume { flex-direction: row; align-items: center; gap: 8px; color: var(--muted); margin-right: 8px; }
.volume input { width: 96px; accent-color: var(--accent); }
body.expanded [data-act="expand"] svg { transform: rotate(180deg); }
#queue { display: none; position: fixed; z-index: 15; right: 0; top: 0; bottom: var(--bar); width: var(--qw); flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); }
.queue-head { display: flex; align-items: center; gap: 2px; padding: 8px 10px 8px 16px; }
.queue-head h2 { margin: 0 auto 0 0; font-size: 17px; }
#repeat-one { position: absolute; font-size: 9px; }
#queue-list { flex: 1; overflow-y: auto; margin: 0; padding: 0 8px 8px; list-style: none; }
#queue-list .play-row { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 6px; }
#queue-list .track:hover { background: var(--raised); }

body.has-bar #nav { bottom: var(--bar); }
body.has-bar #page { padding-bottom: calc(var(--bar) + 12px); }
body.playing #page { padding-bottom: calc(var(--bar) + var(--stage-h) + 32px); }
body.expanded #page { visibility: hidden; }
body.expanded #stage { left: var(--nav); right: var(--qw); top: 0; bottom: var(--bar); width: auto; height: auto; }
body.expanded #queue { display: flex; }

/* Parça seçenekleri paneli: oynatıcının üstünü hiçbir zaman kapatmaz. */
#sheet { position: fixed; z-index: 25; inset: 0; display: grid; place-items: center; padding: 16px; background: rgb(8 9 20 / .66); }
body.has-bar #sheet { bottom: var(--bar); }
body.playing #sheet { bottom: calc(var(--bar) + var(--stage-h) + 16px); }
body.expanded #sheet { left: auto; width: var(--qw); bottom: var(--bar); }
.sheet-box { position: relative; width: min(440px, 100%); max-height: 100%; overflow-y: auto; padding: 20px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.sheet-close { position: absolute; top: 8px; right: 8px; }
.sheet-title { font-size: 18px; padding-right: 40px; }
.pick button { display: flex; justify-content: space-between; gap: 12px; width: 100%; padding: 11px 12px; border: 0; border-radius: 8px; background: none; text-align: left; overflow-wrap: anywhere; }
.pick button:hover { background: var(--raised); }
.pick small { color: var(--muted); white-space: nowrap; }
/* Bildirim de oynatıcının üstüne gelmeyecek yerde durur. */
#toast { position: fixed; z-index: 50; left: 10px; bottom: calc(var(--bar) + 12px); width: calc(var(--nav) - 20px); padding: 11px 14px; font-size: 14px; border-radius: 10px; background: var(--text); color: var(--bg); pointer-events: none; }
#toast:empty { display: none; }

@media (min-width: 1280px) {
    :root { --qw: 384px; --stage-h: 216px; }
    body.playing #page { margin-right: var(--qw); padding-bottom: calc(var(--bar) + 12px); }
    html:has(body.playing) { scroll-padding-bottom: calc(var(--bar) + 8px); }
    body.playing #stage { right: 0; top: 0; bottom: auto; width: var(--qw); }
    body.playing #queue { display: flex; top: var(--stage-h); }
    body.playing #sheet { right: var(--qw); bottom: var(--bar); }
    body.expanded #stage { right: var(--qw); bottom: var(--bar); width: auto; height: auto; }
    body.expanded #queue { top: 0; }
    body.expanded #sheet { right: 0; }
}
@media (max-width: 999px) {
    :root { --nav: 188px; --qw: 280px; }
}
@media (max-width: 759px) {
    :root { --nav: 0px; --top: 60px; --bar: 84px; --tabs: calc(58px + env(safe-area-inset-bottom)); --stage-h: max(200px, 56.25vw); }
    #nav { display: none; }
    #top { padding: 0 12px; gap: 6px; }
    #top .brand { display: block; font-size: 19px; }
    #view { padding: 8px 12px 20px; }
    #tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: var(--tabs); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
    #tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--muted); text-decoration: none; }
    #tabs a[aria-current] { color: var(--accent-text); }
    #page { padding-bottom: calc(var(--tabs) + 8px); }
    body.has-bar #page { padding-bottom: calc(var(--tabs) + var(--bar) + 8px); }
    body.playing #page { padding-bottom: calc(var(--tabs) + var(--bar) + var(--stage-h) + 8px); }
    #bar { bottom: var(--tabs); grid-template: "seek seek seek" 24px "now controls extra" 1fr / minmax(0, 1fr) auto auto; column-gap: 2px; padding: 0 6px 0 12px; }
    .seek span, .volume, .now img { display: none; }
    .now { justify-content: flex-start; font-size: 13px; }
    .controls { gap: 0; }
    .controls .ib, .extra .ib { width: 38px; }
    .ib.big { width: 44px !important; height: 44px; }
    body.playing #stage { left: 0; right: 0; bottom: calc(var(--tabs) + var(--bar)); width: 100%; }
    #queue { left: 0; width: auto; border-left: 0; bottom: calc(var(--tabs) + var(--bar)); }
    body.expanded #stage { top: 0; bottom: auto; height: var(--stage-h); width: 100%; }
    body.expanded #queue { top: var(--stage-h); }
    body.has-bar #sheet { bottom: calc(var(--tabs) + var(--bar)); }
    body.playing #sheet { bottom: calc(var(--tabs) + var(--bar) + var(--stage-h)); }
    body.expanded #sheet { left: 0; width: auto; top: var(--stage-h); bottom: calc(var(--tabs) + var(--bar)); }
    #toast { top: 8px; bottom: auto; left: 8px; right: 8px; width: auto; }
    body.expanded #toast { top: calc(var(--stage-h) + 8px); }
    #sheet { place-items: end center; padding: 8px; bottom: var(--tabs); }
    .play-row { grid-template-columns: 68px minmax(0, 1fr); gap: 10px; padding: 7px 4px; }
    .time { display: none; }
    .rank { width: 24px; font-size: 13px; }
    .actions .ib { width: 36px; }
    .editable .track { flex-wrap: wrap; }
    .editable .play-row { flex-basis: 100%; }
    .editable .actions { margin-left: auto; }
    .inline-form { flex-direction: column; }
}
@media (max-width: 420px) {
    #top .brand { display: none; }
}
/* Yatay tutulan küçük telefon */
@media (max-width: 759px) and (max-height: 520px) {
    :root { --stage-h: 200px; --tabs: 48px; }
    #tabs a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } /* ekran okuyucu için kalır */
    body.expanded #stage { left: 0; right: auto; width: 55%; }
    body.expanded #queue { top: 0; left: 55%; }
    body.playing #toast { right: 364px; }
    body.expanded #toast { top: 8px; left: calc(55% + 8px); right: 8px; }
}
/* Kısa ekranlar (yatay telefon): video içeriğin üstüne binmez, sağda kendi sütununu alır. */
@media (max-width: 1279px) and (max-height: 560px) {
    html:has(body.playing) { scroll-padding-bottom: calc(var(--tabs) + var(--bar) + 8px); }
    body.playing #page { margin-right: 356px; padding-bottom: calc(var(--tabs) + var(--bar) + 8px); }
    body.playing #top .brand { display: none; }
    body.playing:not(.expanded) #stage { left: auto; right: 0; bottom: calc(var(--tabs) + var(--bar)); width: 356px; }
    body.playing:not(.expanded) #sheet { right: 356px; bottom: calc(var(--tabs) + var(--bar)); }
}
@media (prefers-reduced-motion: no-preference) {
    .ib, .btn, .track { transition: background-color .12s; }
}
