/* アニソンBGM：ミュージックアプリの再生画面のような作り。奥にいまの曲の絵を大きくぼかして敷き、文字と操作は白でそろえる
   画面は3つ：v-art（大きなジャケット）／v-ly（歌詞）／v-q（次の曲）。ジャケットは曲の動画を正方形に切り抜いたもの */
:root { --fg: #fff; --sub: rgba(255,255,255,.62); --ter: rgba(255,255,255,.38); --fill: rgba(255,255,255,.14); --fill2: rgba(255,255,255,.24);
  --sheet: rgba(40,34,40,.78); --edge: rgba(255,255,255,.14); --shine: rgba(255,255,255,.2); --a: min(100%, 340px, max(140px, calc(100dvh - 440px))); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; background: #2a2026; color: var(--fg); font-family: -apple-system, "SF Pro Text", "Hiragino Sans", "Noto Sans JP", sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
[hidden] { display: none !important; }
svg { width: 24px; height: 24px; flex: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
input { width: 100%; background: var(--fill); border: 1px solid var(--edge); border-radius: 12px; padding: 11px 14px; font-size: 16px; outline: none; color: var(--fg); }
input::placeholder { color: var(--ter); }

/* 背景：曲の絵を大きくぼかす＋下ほど暗く */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(160deg, #5a3a52, #2a2026 60%); }
.backdrop div { position: absolute; inset: -30%; background: center / cover no-repeat; filter: blur(70px) saturate(1.8) brightness(.9); transform: scale(1.2); transition: opacity .8s; }
.backdrop::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.08), rgba(0,0,0,.22) 50%, rgba(0,0,0,.5)); }

main { max-width: 480px; height: 100dvh; margin: 0 auto; padding: max(6px, env(safe-area-inset-top)) 28px max(8px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 30px; flex: none; }
.back { color: var(--sub); text-decoration: none; font-size: 14px; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--fill2); }

/* ジャケット＋曲名 */
.stage { display: flex; flex-direction: column; align-items: center; gap: 22px; padding-top: 14px; flex: none; }
.art { position: relative; width: var(--a); aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: rgba(0,0,0,.25); box-shadow: 0 18px 40px rgba(0,0,0,.35); transition: width .35s cubic-bezier(.2,.8,.2,1); flex: none; }
.art iframe { position: absolute; top: 0; left: -38.9%; width: 177.8%; height: 100%; border: 0; pointer-events: none; }
.art-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 48px; color: var(--ter); }
body.saving { --a: min(100%, 230px, max(140px, calc(100dvh - 440px))); } /* データ節約：小さいプレーヤーだと低い画質で送られてくる */
/* PiP用：YouTube のボタンを押せるように、切り抜かずに横長で出す */
body.pip.v-art .art { width: 100%; aspect-ratio: 16 / 9; }
body.pip .art iframe { left: 0; width: 100%; pointer-events: auto; }
.pip-hint { text-align: center; color: var(--sub); font-size: 12px; margin-top: 8px; }
.title-row { width: 100%; display: flex; align-items: center; gap: 4px; min-width: 0; }
.meta { flex: 1; min-width: 0; display: grid; gap: 2px; }
.meta b { font-size: 21px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta small { font-size: 18px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta small:has(.w) { display: grid; white-space: normal; font-size: 16px; line-height: 1.3; }
.meta small .w { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.meta small .a { font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.ic svg { width: 27px; height: 27px; }
.ic:active { background: var(--fill); }
#fav.on { color: #ffd76a; }

/* 歌詞・次の曲の画面：ジャケットと曲名は上に小さく */
body.v-ly .stage, body.v-q .stage { flex-direction: row; gap: 14px; padding-top: 12px; }
body.v-ly .art, body.v-q .art { width: 64px; border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.3); }
body.v-ly .meta b, body.v-q .meta b { font-size: 17px; }
body.v-ly .meta small, body.v-q .meta small { font-size: 14px; }
.view { display: none; flex: 1 1 0; min-height: 0; flex-direction: column; margin-top: 10px; }
body.v-ly #lyView, body.v-q #qView { display: flex; }
.spacer { flex: 1 1 0; min-height: 8px; }
body.v-ly .spacer, body.v-q .spacer { display: none; }
.scroll { position: relative; flex: 1; overflow-y: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(transparent, #000 24px, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(transparent, #000 24px, #000 calc(100% - 40px), transparent); }
.scroll::-webkit-scrollbar { display: none; }

/* 歌詞：大きな太字。いまの行だけはっきり、ほかは薄くぼかす */
.ly-lines { display: grid; align-content: start; gap: 22px; padding: 24px 0 55%; }
.ly-lines p { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.22; letter-spacing: -.01em; opacity: .3; filter: blur(1.4px); transition: opacity .35s, filter .35s; }
.ly-lines p.cur { opacity: 1; filter: none; }
.ly-lines:not(.plain) p { cursor: pointer; }
.ly-lines:not(.plain) p:hover { opacity: .7; filter: none; }
.ly-lines:not(.plain) p.cur:hover { opacity: 1; }
.ly-lines.plain p { opacity: .92; filter: none; font-size: 22px; font-weight: 700; }
.ly-note { color: var(--ter); font-size: 12px; text-align: center; min-height: 1em; }

/* 次の曲 */
.qmodes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; flex: none; margin: 6px 0 14px; }
.qmodes button { position: relative; height: 44px; border-radius: 22px; background: var(--fill); display: grid; place-items: center; font-size: 12.5px; font-weight: 600; white-space: nowrap; transition: background .2s, color .2s; }
.qmodes button.on { background: rgba(255,255,255,.78); color: #3a2c34; }
.qmodes em { position: absolute; top: 9px; right: calc(50% - 20px); font-style: normal; font-size: 10px; font-weight: 800; }
.qhead { padding: 8px 0 6px; }
.qhead b { display: block; font-size: 19px; font-weight: 700; }
.qhead small { color: var(--sub); font-size: 14px; }
.q { display: flex; align-items: center; gap: 14px; width: 100%; padding: 7px 0; text-align: left; border-radius: 10px; }
.q:active { background: var(--fill); }
.q img { width: 54px; height: 54px; border-radius: 6px; object-fit: cover; background: var(--fill); flex: none; }
.q .info { flex: 1; min-width: 0; }
.q b { display: block; font-size: 17px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q small { display: block; color: var(--sub); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.q.past { opacity: .45; }
.qend { color: var(--ter); font-size: 13px; padding: 14px 0; text-align: center; }

/* 操作 */
.ctrl { flex: none; display: grid; gap: 4px; padding-top: 14px; }
/* 再生位置：バーのどこを触っても、そこへ動かせる（指で横に動かすあいだは太くなる） */
.seek { height: 28px; display: flex; align-items: center; cursor: pointer; touch-action: none; margin: -10px 0; }
.seek .track { position: relative; width: 100%; height: 7px; border-radius: 99px; background: rgba(255,255,255,.24); overflow: hidden; transition: height .15s; }
.seek .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255,255,255,.82); }
.seek.drag .track { height: 12px; }
.seek.drag .fill { background: #fff; }
.seek.drag + .times { color: var(--fg); }
.times { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--ter); font-variant-numeric: tabular-nums; margin-top: 4px; }
.chorus-btn { padding: 3px 12px; border-radius: 999px; background: var(--fill); color: var(--sub); font-size: 11.5px; font-weight: 700; margin-top: -2px; }
.chorus-btn:active { background: var(--fill2); color: var(--fg); }
.fx-row { display: grid; gap: 8px; }
.fx-head { display: flex; justify-content: space-between; align-items: baseline; }
.fx-head label { font-size: 13px; color: var(--sub); }
.fx-head b { font-size: 20px; font-variant-numeric: tabular-nums; }
.fx-btns { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.5fr) minmax(0, 1.3fr); gap: 5px; }
.fx-btns button { padding: 9px 0; border-radius: 12px; background: var(--fill); font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.fx-btns button:active { background: var(--fill2); }
.inline .main { flex: 1; }
.transport { display: flex; justify-content: space-around; align-items: center; height: 104px; }
.transport button { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; transition: transform .12s, background .2s; }
.transport button:active { transform: scale(.88); background: var(--fill); }
.transport .sk { width: 46px; height: 36px; }
.transport .pp { width: 52px; height: 52px; }
/* 音量：両端のボタンで1段ずつ（10）、バーは触ったところへ */
.vol { display: flex; align-items: center; gap: 4px; color: var(--sub); }
.vol button { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.vol button:active { background: var(--fill); color: var(--fg); }
.vol svg { width: 22px; height: 22px; }
.vol .seek { flex: 1; margin: 0; }
.vol .fill { background: rgba(255,255,255,.7); }
.tabs { display: flex; justify-content: space-between; padding: 14px 16px 4px; }
.tabs button { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: var(--sub); transition: background .2s, color .2s; }
.tabs button svg { width: 27px; height: 27px; }
.tabs button.on { background: rgba(255,255,255,.3); color: var(--fg); }

/* 下から出る窓 */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.3); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet-in { width: 100%; max-width: 480px; max-height: 88dvh; overflow-y: auto; background: var(--sheet); border: 1px solid var(--edge); border-bottom: 0; border-radius: 28px 28px 0 0; box-shadow: inset 0 1px 0 var(--shine), 0 -10px 40px rgba(0,0,0,.3);
  backdrop-filter: blur(40px) saturate(1.6); -webkit-backdrop-filter: blur(40px) saturate(1.6);
  padding: 16px 18px max(18px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; animation: up .25s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head b { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; font-size: 14px; background: var(--fill); border: 1px solid var(--edge); white-space: nowrap; flex: none; }
.menu { width: 100%; text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--fill); font-size: 16px; }
.menu:active { background: var(--fill2); }
.row { display: grid; gap: 7px; }
.row label { font-size: 12.5px; color: var(--sub); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 7px 13px; border-radius: 999px; font-size: 13.5px; background: var(--fill); border: 1px solid var(--edge); }
.chips button.on { background: rgba(255,255,255,.82); border-color: transparent; color: #3a2c34; font-weight: 600; }
.hint { color: var(--sub); font-size: 12px; line-height: 1.5; }
.main { width: 100%; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.88); color: #3a2c34; font-weight: 700; font-size: 16px; }
.main:active { transform: scale(.98); }
.pl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pl-list button { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--fill); }
.pl-list button small { color: var(--sub); }
.pl-list button.on { background: rgba(255,255,255,.82); color: #3a2c34; }
.pl-list button.on small { color: #6a5a62; }
.inline { display: flex; gap: 8px; }
.inline .pill { padding: 10px 16px; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; padding: 10px 18px; border-radius: 999px; font-size: 14px; max-width: calc(100% - 32px);
  background: var(--sheet); border: 1px solid var(--edge); box-shadow: 0 6px 24px rgba(0,0,0,.3); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.pill.wide { width: 100%; padding: 11px; justify-content: center; }
.pl-list a.yt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--fill); color: inherit; text-decoration: none; }
.pl-list a.yt span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-list a.yt small { color: var(--sub); flex: none; }
.pl-list a.yt:active { background: var(--fill2); }

/* ── PC（広い画面＋マウス）：動画をウィンドウいっぱいに敷き、操作はすりガラスで重ねる。
   上＝曲の情報、右＝次の曲、下＝歌詞と操作。ウィンドウの大きさで伸び縮みする（body.pc は bgm.js が付ける） ── */
.meta small .y { display: none; }
body.pc { --gap: clamp(14px, 1.6vw, 28px); --qw: clamp(280px, 24vw, 400px); --ch: 118px; }
body.pc main { max-width: none; padding: 0; }
body.pc .glass { background: rgba(30,24,30,.42); border: 1px solid var(--edge); border-radius: 22px; box-shadow: inset 0 1px 0 var(--shine), 0 10px 40px rgba(0,0,0,.28);
  backdrop-filter: blur(28px) saturate(1.6); -webkit-backdrop-filter: blur(28px) saturate(1.6); }
/* 動画：16:9 をウィンドウいっぱいに（はみ出す分は切る）。上下は文字が読めるように少し暗く */
body.pc .art { position: fixed; inset: 0; width: auto; aspect-ratio: auto; border-radius: 0; box-shadow: none; z-index: 0; background: transparent; }
body.pc .art iframe { top: 50%; left: 50%; width: max(100vw, 177.78vh); height: max(100vh, 56.25vw); transform: translate(-50%, -50%); }
body.pc .art::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(0,0,0,.35), transparent 22%, transparent 55%, rgba(0,0,0,.55)); }
body.pc .art-empty { font-size: 96px; }
body.pc .topbar { position: fixed; top: var(--gap); left: var(--gap); z-index: 2; display: block; height: auto; }
body.pc .back { display: inline-block; padding: 8px 14px; color: var(--fg); }
body.pc .grab, body.pc .spacer, body.pc .pip-hint { display: none; }
/* 上：曲の情報 */
body.pc .stage { padding: 0; }
body.pc .title-row { position: fixed; z-index: 2; top: var(--gap); left: calc(var(--gap) + 110px); right: calc(var(--qw) + var(--gap) * 2); width: auto; max-width: 760px; padding: 12px 12px 12px 20px; }
body.pc .meta b { font-size: clamp(20px, 1.9vw, 30px); }
body.pc .meta small:has(.w) { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: clamp(14px, 1.1vw, 17px); }
body.pc .meta small .w { -webkit-line-clamp: 1; font-weight: 600; color: var(--fg); }
body.pc .meta small .y { display: block; color: var(--sub); font-size: .9em; }
/* 右：次の曲 */
body.pc #qView { display: flex; position: fixed; z-index: 2; top: var(--gap); right: var(--gap); bottom: calc(var(--ch) + var(--gap) * 2); width: var(--qw); margin: 0; padding: 14px 16px 6px; }
body.pc .qmodes { margin: 0 0 8px; gap: 6px; }
body.pc .qmodes button { height: 38px; }
body.pc .q { padding: 6px 8px; }
body.pc .q:hover { background: var(--fill); }
body.pc .q img { width: 48px; height: 48px; }
body.pc .q b { font-size: 15px; }
body.pc .q small { font-size: 13px; }
/* 下：歌詞（いまの行を大きく、字幕のように流れる） */
body.pc #lyView { display: flex; position: fixed; z-index: 1; left: var(--gap); right: calc(var(--qw) + var(--gap) * 2); bottom: calc(var(--ch) + var(--gap) * 2); height: clamp(150px, 30vh, 340px); margin: 0; }
body.pc .ly-lines { gap: clamp(8px, 1.4vh, 18px); padding: 12px 0 60%; text-align: center; }
body.pc .ly-lines p { font-size: clamp(22px, 2.5vw, 44px); text-shadow: 0 2px 12px rgba(0,0,0,.7), 0 0 2px rgba(0,0,0,.6); }
body.pc .ly-lines.plain p { font-size: clamp(18px, 1.7vw, 28px); }
body.pc .ly-note { text-shadow: 0 1px 6px rgba(0,0,0,.8); color: var(--sub); }
body.pc.no-ly #lyView, body.pc.no-q #qView { display: none; }
body.pc.no-q .title-row, body.pc.no-q #lyView, body.pc.no-q .ctrl { right: var(--gap); }
/* 下：操作（左に ⏮▶⏭、まん中に再生位置、右に音量と切り替え） */
body.pc .ctrl { position: fixed; z-index: 2; left: var(--gap); right: calc(var(--qw) + var(--gap) * 2); bottom: var(--gap); height: var(--ch); padding: 10px 18px;
  grid-template-columns: auto minmax(0, 1fr) clamp(140px, 14vw, 220px) auto; grid-template-areas: 'tr seek vol tabs' 'tr times vol tabs'; align-content: center; column-gap: clamp(12px, 1.6vw, 28px); row-gap: 0; }
body.pc #seek { grid-area: seek; align-self: end; }
body.pc .times { grid-area: times; align-self: start; }
body.pc .transport { grid-area: tr; height: auto; gap: 4px; }
body.pc .transport button { width: 60px; height: 60px; }
body.pc .transport button:hover, body.pc .tabs button:hover, body.pc .vol button:hover, body.pc .ic:hover { background: var(--fill); }
body.pc .transport .pp { width: 40px; height: 40px; }
body.pc .transport .sk { width: 36px; height: 28px; }
body.pc .vol { grid-area: vol; }
body.pc .tabs { grid-area: tabs; padding: 0; gap: 6px; }
body.pc .tabs button { width: 46px; height: 46px; }
body.pc .tabs button svg { width: 24px; height: 24px; }
/* 窓は画面のまん中に */
body.pc .sheet { align-items: center; }
body.pc .sheet-in { max-width: 560px; max-height: 86dvh; border-radius: 24px; border-bottom: 1px solid var(--edge); padding-bottom: 18px; }
body.pc .art:has(.art-empty:not([hidden])) iframe { visibility: hidden; } /* 曲を選ぶまでは空のプレーヤーを見せない */
