/* The shared player (markup: src/lib/sound-player.js). Every rule is scoped to .sound-player and states the
   properties that host pages set on bare elements (library form fields, svg sizes, paragraph rhythm). */
.sound-player { color:#ecf0e8; }
.sound-player [hidden] { display:none !important; }
.sound-player :is(button,a,input,select,label) { -webkit-tap-highlight-color:transparent; }
.sound-player button { cursor:pointer; font:inherit; color:inherit; }
.sound-player :is(button,a,input,select):focus-visible { outline:2px solid #c8d9aa; outline-offset:3px; }
.sound-player svg { display:block; width:100%; height:100%; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.sound-player svg .icon-fill { fill:currentColor; stroke:none; }
.sound-player :is(p,h1,h2) { margin:0; letter-spacing:0; }

/* Listening bar: the catalog's mini player. */
.sound-player .listening-bar { position:fixed; z-index:60; inset:auto 0 0; padding:12px max(20px,calc((100vw - 1080px)/2)) max(10px,env(safe-area-inset-bottom)); background:#18221dfa; border-top:1px solid #ffffff20; box-shadow:0 -8px 30px #0004; backdrop-filter:blur(20px); }
.sound-player .bar-heading { display:flex; align-items:center; gap:16px; }
.sound-player .track-open { display:flex; align-items:center; gap:12px; min-width:0; flex:1; text-align:start; border:0; background:none; padding:0; }
/* The bar shows the title only; the cover is in the expanded scene. */
.sound-player .track-open img { display:none; }
.sound-player .track-open > span { min-width:0; }
.sound-player .track-open strong { display:block; font-size:14px; font-weight:500; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.sound-player .track-open small { display:block; color:#a4b0a4; font-size:11px; margin-top:3px; }
.sound-player .expand-mark { color:#c8d9aa; font-size:22px; }
.sound-player .player-app { flex-shrink:0; padding:10px 12px; border-radius:9px; background:#c8d9aa; color:#18221d; font-size:12px; line-height:1.4; text-decoration:none; }
.sound-player .player-app:hover { background:#d6e8bc; color:#18221d; }
.sound-player .app-short { display:none; }
.sound-player .transport-row { display:flex; align-items:center; gap:10px; margin-top:6px; }
.sound-player .transport-row .loop-button { flex-shrink:0; min-width:44px; }
.sound-player .transport-row .control-label { display:none; }
/* Podcast episodes do not loop, so they have no loop control. */
.sound-player[data-loopable=false] .loop-button.control { display:none; }

/* Play / pause */
.sound-player .play-toggle { display:grid; place-items:center; flex-shrink:0; width:44px; height:44px; margin:0; padding:0; border:0; border-radius:50%; color:#18221d; background:#c8d9aa; transition:background .15s, transform .15s; }
.sound-player .play-toggle:hover { background:#d6e8bc; }
.sound-player .play-toggle:active { transform:scale(.96); }
.sound-player .play-toggle > span { display:block; width:20px; height:20px; }
.sound-player .play-toggle > .icon-pause, .sound-player[data-playing=true] .play-toggle > .icon-play { display:none; }
.sound-player[data-playing=true] .play-toggle > .icon-pause { display:block; }

/* Timeline */
.sound-player .time { flex-shrink:0; font:11px/1 ui-monospace,SFMono-Regular,Menlo,monospace; color:#b0bbae; font-variant-numeric:tabular-nums; }
.sound-player .seek { display:block; flex:1; width:auto; min-width:0; height:36px; margin:0; padding:0; border:0; border-radius:0; cursor:pointer; appearance:none; -webkit-appearance:none; background:transparent; --seek-progress:0%; }
.sound-player .seek:disabled { cursor:default; }
.sound-player .seek::-webkit-slider-runnable-track { height:4px; border-radius:4px; background:linear-gradient(to right,#c8d9aa var(--seek-progress),#ffffff2e var(--seek-progress)); }
[dir=rtl] .sound-player .seek::-webkit-slider-runnable-track { background:linear-gradient(to left,#c8d9aa var(--seek-progress),#ffffff2e var(--seek-progress)); }
.sound-player .seek::-moz-range-track { height:4px; border-radius:4px; background:#ffffff2e; }
.sound-player .seek::-moz-range-progress { height:4px; border-radius:4px; background:#c8d9aa; }
.sound-player .seek::-webkit-slider-thumb { -webkit-appearance:none; appearance:none; width:14px; height:14px; margin-top:-5px; border-radius:50%; background:#eef4e4; box-shadow:0 1px 4px #0006; transition:transform .15s; }
.sound-player .seek::-moz-range-thumb { width:14px; height:14px; border:0; border-radius:50%; background:#eef4e4; box-shadow:0 1px 4px #0006; }
.sound-player .seek:is(:hover,:active)::-webkit-slider-thumb { transform:scale(1.2); }

/* Scene */
body.has-sound-player { padding-bottom:140px; }
body.sound-scene-open { overflow:hidden; }
.sound-player .sound-scene { position:fixed; inset:0; margin:0; padding:0; width:100%; height:100dvh; max-width:none; max-height:none; border:0; color:#fff; background:#101916; overscroll-behavior:contain; }
.sound-player .sound-scene::backdrop { background:#101916dd; }
.sound-player .scene-sheet { position:relative; min-height:100%; display:flex; flex-direction:column; justify-content:space-between; overflow:hidden; user-select:none; -webkit-user-select:none; touch-action:pan-x; background:radial-gradient(ellipse at 50% 30%,#4a6148,#101916 80%); transition:transform .2s ease; }
.sound-player :is(.scene-image,.scene-video,.scene-shade) { position:absolute; inset:0; width:100%; height:100%; max-width:none; margin:0; }
.sound-player :is(.scene-image,.scene-video) { object-fit:cover; pointer-events:none; }
.sound-player .scene-shade { background:linear-gradient(180deg,#06130c66,transparent 30%,#06130c80 55%,#06130cf5); pointer-events:none; }
.sound-player .scene-header { position:relative; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:max(20px,env(safe-area-inset-top)) 24px 16px; }
.sound-player .scene-header [data-collapse-scene] { display:flex; align-items:center; gap:8px; min-height:44px; padding:0 16px; border:1px solid #ffffff25; border-radius:24px; background:#10201644; font-size:13px; backdrop-filter:blur(12px); }
.sound-player .scene-header [data-collapse-scene] > span:first-child { font-size:26px; }
.sound-player .scene-content { position:relative; z-index:1; width:min(100%,600px); align-self:center; padding:40px 28px max(28px,env(safe-area-inset-bottom)); text-align:center; }
.sound-player .scene-creator { margin-bottom:8px; font-size:12px; line-height:1.5; color:#c4d2bf; }
.sound-player .scene-title { margin-bottom:6px; font:400 clamp(28px,5vw,40px)/1.25 Georgia,"Songti SC","Noto Serif CJK SC",serif; color:#fff; text-wrap:balance; }
.sound-player .scene-status { min-height:18px; margin-bottom:12px; font-size:12px; line-height:1.5; color:#b8c9b3; }
.sound-player .scene-timeline { display:flex; align-items:center; gap:12px; }
.sound-player .scene-hint { margin-top:24px; font-size:11px; line-height:1.5; color:#a6b7a1; }

/* Controls: save and loop | play | timer and the App's sleep-triggered stop, one row around the play button. */
.sound-player .scene-controls { display:grid; grid-template-columns:1fr auto 1fr; align-items:start; gap:14px; margin-top:12px; }
.sound-player .control-side { display:flex; align-items:flex-start; gap:6px; }
.sound-player .control-side:first-child { justify-content:flex-end; }
.sound-player .scene-play { width:68px; height:68px; margin-top:-4px; box-shadow:0 6px 24px #0005; }
.sound-player .scene-play > span { width:28px; height:28px; }
.sound-player :is(.control, .scene-controls .sound-favorite) { position:relative; z-index:auto; display:flex; flex-direction:column; align-items:center; gap:3px; min-width:58px; min-height:0; margin:0; padding:0; border:0; border-radius:0; background:none; color:#e8efe2cc; font-size:11px; line-height:1.4; text-decoration:none; cursor:pointer; }
.sound-player :is(.control-icon, .scene-controls [data-favorite-icon]) { position:relative; display:grid; place-items:center; width:42px; height:42px; border-radius:50%; transition:background .15s, color .15s; }
.sound-player .control-icon > svg { width:22px; height:22px; }
.sound-player .scene-controls [data-favorite-icon] { font-size:23px; line-height:1; }
/* Captions wrap to two lines in languages with long words instead of widening the row. */
.sound-player :is(.control-label, .scene-controls .favorite-label) { max-width:76px; color:#b9c6b5; text-align:center; line-height:1.25; overflow-wrap:break-word; font-variant-numeric:tabular-nums; }
.sound-player :is(.control, .scene-controls .sound-favorite):hover :is(.control-icon, [data-favorite-icon]) { background:#ffffff17; }
.sound-player .scene-controls .sound-favorite:hover { background:none; }
.sound-player :is(.loop-button[aria-pressed=true], .sleep-timer[data-active], .sound-favorite[aria-pressed=true]) { color:#d7e4c0; }
.sound-player :is(.loop-button[aria-pressed=true], .sleep-timer[data-active]) :is(.control-icon, .control-label) { color:#d7e4c0; }
.sound-player :is(.loop-button[aria-pressed=true], .sleep-timer[data-active]) .control-icon { background:#c8d9aa24; }
.sound-player .sleep-timer select { position:absolute; inset:0; display:block; width:100%; height:100%; margin:0; padding:0; border:0; opacity:0; font-size:16px; cursor:pointer; appearance:none; }
.sound-player .sleep-timer:has(select:focus-visible) .control-icon { outline:2px solid #c8d9aa; outline-offset:2px; }
.sound-player .auto-stop, .sound-player .auto-stop .control-label { color:#d7e4c0; }
.sound-player .auto-stop .control-icon { background:#c8d9aa1c; box-shadow:inset 0 0 0 1px #c8d9aa4d; }
.sound-player .auto-stop:hover .control-icon { background:#c8d9aa33; }
.sound-player .app-mark { position:absolute; top:-3px; right:-5px; display:grid; place-items:center; width:16px; height:16px; border-radius:50%; background:#c8d9aa; color:#18221d; font-size:10px; font-weight:700; line-height:1; }

/* Inline: the scene is the page's own player card. */
.sound-player.inline-player .sound-scene { position:relative; inset:auto; height:auto; border-radius:24px; overflow:hidden; }
.sound-player.inline-player .scene-sheet { min-height:540px; touch-action:auto; }
.sound-player .scene-header .scene-share { display:inline-flex; align-items:center; gap:6px; min-height:38px; padding:0 13px; border:1px solid #ffffff2e; border-radius:9px; background:#0e1a1459; color:#eef3ea; font-size:12px; line-height:1.4; backdrop-filter:blur(12px); }
.sound-player .scene-header .scene-share:hover { background:#0e1a148c; }
.sound-player .scene-header .scene-share[hidden] { display:none; }
.sound-player .share-icon { display:block; width:16px; height:16px; }

@media (min-width:768px) {
  .sound-player .listening-bar { display:flex; align-items:center; gap:28px; }
  .sound-player .bar-heading { flex:1; min-width:0; }
  .sound-player .transport-row { width:46%; margin:0; }
}
/* Phones: the title gets the width, the App link shrinks. */
@media (max-width:767px) {
  .sound-player .listening-bar { padding-top:14px; }
  .sound-player .bar-heading { gap:12px; }
  .sound-player .app-long { display:none; }
  .sound-player .app-short { display:inline; }
  .sound-player .player-app { padding:8px 11px; }
  .sound-player .transport-row { margin-top:10px; }
  .sound-player .play-toggle:not(.scene-play) { width:40px; height:40px; }
  .sound-player.inline-player .sound-scene { border-radius:18px; }
  .sound-player.inline-player .scene-sheet { min-height:500px; }
}
@media (max-width:400px) {
  .sound-player .transport-row { gap:8px; }
  .sound-player .scene-header { padding-inline:18px; }
  .sound-player .scene-content { padding-inline:16px; }
  .sound-player .scene-controls { gap:8px; }
  .sound-player .control-side { gap:0; }
  .sound-player :is(.control, .scene-controls .sound-favorite) { min-width:52px; }
  .sound-player .scene-play { width:62px; height:62px; }
}
@media (prefers-reduced-motion:reduce) { .sound-player .scene-sheet { transition:none; } }
