/* Shared player container: resize the layout without moving or restarting media. */
:root { --safe-bottom: env(safe-area-inset-bottom, 0px); }
.mini-audio { display: none; }
body.mini-audio-open .mini-audio { display: block; order: 8; flex-shrink: 0; margin-top: 12px; padding: 10px 6px 6px; border-top: 1px solid #ffffff20; background: #141b16; border-radius: 10px; }
.bottom-nav .mini-audio button { transform: none !important; box-shadow: none; border: 0; background: none; color: #fff; padding: 0; margin: 0; }
.bottom-nav .mini-audio-track { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; width: 100%; height: auto; min-height: 40px; gap: 8px; text-align: left; }
.mini-audio-track img { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; }
.mini-audio-track > span { min-width: 0; flex: 1; }
.mini-audio-track strong, .mini-audio-track small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-audio-track strong { font-size: 10px; margin: 3px 0; }
.mini-audio-track small { font-size: 8px; color: #98a69c; }
.mini-audio-track small:first-child { color: var(--green); font-weight: 700; letter-spacing: .08em; }
.mini-audio-controls { display: flex; justify-content: center; gap: 4px; margin-top: 6px; }
.bottom-nav .mini-audio-controls button { display: grid; place-items: center; width: 34px; min-height: 34px; height: 34px; font-size: 16px; }
.bottom-nav .mini-audio-controls #miniAudioPlay { border-radius: 50%; background: var(--green); color: #071b0d; }
/* The audio iframe remains mounted; no video overlay is shown while browsing. */
.youtube-stage.minimized { position: fixed !important; inset: auto 0 0 auto !important; display: block !important; width: 1px !important; height: 1px !important; min-height: 0 !important; max-width: 1px !important; opacity: 0 !important; overflow: hidden !important; pointer-events: none !important; box-shadow: none !important; }
@media (max-width: 699px) {
  body.mini-audio-open { padding-bottom: calc(148px + var(--safe-bottom)); }
  body.mini-audio-open .bottom-nav { height: calc(140px + var(--safe-bottom)); grid-template-rows: 64px 68px; }
  body.mini-audio-open .mini-audio { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin: 0 8px; padding: 7px 10px; min-width: 0; }
  .bottom-nav .mini-audio-track { flex: 1; min-width: 0; }
  .mini-audio-controls { flex-shrink: 0; margin: 0; }
}
html { -webkit-text-size-adjust: 100%; }
body { min-width: 280px; }
button, input, select { touch-action: manipulation; }
.detail-layout > *, .detail-player-space > *, .record-copy, .mobile-mp3 { min-width: 0; }
.detail-open .top { left: 0; }
body.detail-open .bottom-nav, body.detail-open.record-open .bottom-nav { display: none !important; }
.tablet-detail { overscroll-behavior: contain; }
.detail-close { min-width: 36px; min-height: 36px; }
.detail-player-slot > .youtube-stage:not(.force-fullscreen) {
  position: relative !important; inset: auto !important; width: 100% !important;
  max-width: none !important; margin: 0 !important;
}
.detail-player-space > .mode-overlay { position: static; width: max-content; max-width: 100%; }
.video-row .video-spacer { min-width: 0; }
.video-row { row-gap: 4px; }
.record-mode .record-copy h2 { overflow-wrap: anywhere; }
.record-mode .record-disc { flex-shrink: 0; }
.record-mode .mobile-mp3 { flex-shrink: 0; }
.record-mode .mp3-queue-list { min-height: 0; }
.detail-song, .mp3-queue-song { min-height: 52px; }
.detail-song, .mp3-queue-song { position: relative; padding-right: 34px !important; }
.detail-song.is-current, .mp3-queue-song.is-current { background: #1ed76012; }
.is-current > span > strong { color: var(--green); }
.playing-waves { display: none; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); height: 20px; align-items: center; gap: 2px; }
.is-current > .playing-waves { display: flex; }
.playing-waves i { width: 3px; height: 17px; border-radius: 2px; background: var(--green); transform: scaleY(.25); animation: playingWave .85s ease-in-out infinite alternate; animation-play-state: paused; }
.playing-waves i:nth-child(2) { animation-delay: -.4s; }
.playing-waves i:nth-child(3) { animation-delay: -.65s; }
.playing-waves i:nth-child(4) { animation-delay: -.2s; }
.is-playing > .playing-waves i { animation-play-state: running; }
@keyframes playingWave { 0% { transform: scaleY(.2); } 45% { transform: scaleY(.6); } 100% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .playing-waves i { animation: none; } .playing-waves i:nth-child(even) { transform: scaleY(.7); } }

@media (max-width: 699px) {
  body { padding-bottom: calc(80px + var(--safe-bottom)); }
  .top { height: 56px; padding: 0 16px; }
  .top .brand, .top .avatar { transform: none; }
  .hero { padding: 28px 16px; }
  .hero h1 { font-size: clamp(36px, 12vw, 58px); }
  .section { padding: 24px 14px; }
  .section-head { gap: 12px; align-items: center; }
  .section-head h2 { font-size: 22px; }
  .section-head > span { flex-shrink: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .card { padding: 9px; }
  .card strong { font-size: 12px; }
  .card small { font-size: 10px; }
  .bottom-nav { bottom: 0; height: calc(72px + var(--safe-bottom)); padding-bottom: var(--safe-bottom); }
  .bottom-nav button { min-height: 48px; font-size: 8px; }
  body.record-open .bottom-nav { bottom: 0 !important; }
  .youtube-stage.minimized { bottom: calc(84px + var(--safe-bottom)) !important; }
  .detail-search { display: flex; gap: 8px; padding: 6px 8px 6px 14px; background: #0b0d0d; border: 1px solid #ffffff20; border-radius: 24px; }
  .detail-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: #fff; font-size: 12px; }
  .detail-search button { border: 0; border-radius: 20px; background: var(--green); color: #061108; padding: 10px 14px; }
  .detail-song { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 8px; padding: 8px; background: none; text-align: left; }
  .detail-song img { width: 44px; height: 44px; object-fit: cover; border-radius: 5px; }
  .detail-song strong, .detail-song small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .detail-song strong { font-size: 12px; }
  .detail-song small { color: #999; font-size: 10px; margin-top: 4px; }
}

@media (orientation: portrait) {
  body.detail-open .top { height: 56px; padding: 0 16px; }
  .tablet-detail { position: fixed; z-index: 38; inset: 56px 0 0; overflow-y: auto; padding: 48px 14px calc(20px + var(--safe-bottom)); background: #101714; }
  .detail-close { position: absolute; top: 8px; right: 14px; width: 36px; height: 36px; border: 1px solid #ffffff24; border-radius: 50%; background: #121714; color: #fff; }
  .detail-layout { display: flex; flex-direction: column; gap: 16px; padding: 0; height: auto; min-height: 0; max-width: 900px; margin: auto; }
  .detail-info { display: none; }
  .detail-player-space { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
  .detail-player-slot { width: 100%; max-width: none; height: auto; }
  .detail-player-slot > .youtube-stage:not(.record-mode):not(.force-fullscreen) { height: auto !important; aspect-ratio: 16 / 9 !important; min-height: 185px; }
  .detail-player-slot > .youtube-stage.record-mode:not(.force-fullscreen) { height: clamp(410px, calc(100dvh - 190px), 640px) !important; aspect-ratio: auto !important; }
  .detail-player-space > .mode-overlay { margin: 0 !important; align-self: center; padding: 4px !important; }
  .detail-search { margin: 0; }
  .detail-note { display: none; }
  .detail-queue { display: flex; flex-direction: column; background: #0b100e; border: 1px solid #ffffff12; border-radius: 12px; padding: 12px; height: auto; max-height: min(50dvh, 500px); }
  .detail-queue h3 { flex-shrink: 0; margin: 0 0 10px; font-size: 16px; }
  .detail-queue > div { display: block; min-height: 0; overflow-y: auto; }
  body.record-open .record-view { display: flex; flex-direction: column; justify-content: center; padding: 48px 16px 16px !important; gap: 8px; overflow-y: auto; }
  body.record-open .record-disc { width: clamp(90px, 23dvh, 200px) !important; margin: 0 !important; }
  .record-mode .record-disc:before { display: none; }
  .record-mode .record-copy { margin: 0; }
  .record-mode .record-copy h2 { font-size: clamp(15px, 3vw, 22px); margin-bottom: 4px; }
  .record-mode .mobile-mp3 { display: flex; flex-direction: column; flex: 0 0 auto; width: min(100%, 440px); margin: 0; }
  .record-mode .mp3-lyric, .record-mode .mp3-sub { display: none; }
  .record-mode .mp3-wave { margin: 8px 0; }
  .record-mode .mp3-main-controls { margin: 4px 0; }
  .record-mode .mp3-main-controls .mp3-play { width: 48px; height: 48px; }
  .record-mode .mp3-actions { padding: 6px 0 0; margin: 0; }
  .record-mode .mp3-queue { display: none; }
  .record-mode .mp3-queue.open { display: flex; top: 48px; bottom: 0; width: 100%; }
  .record-mode #mp3QueueClose { display: block; }
  .record-mode .lyrics-panel { top: 48px; bottom: 12px; }
}

/* Compact landscape uses the same left player / right playlist arrangement. */
@media (orientation: landscape) and (max-width: 699px) {
  .tablet-detail { position: fixed; z-index: 38; inset: 44px 0 0; padding: 36px 10px 8px; background: #101714; overflow: hidden; }
  body.detail-open .top { height: 44px; padding: 0 12px; }
  .detail-close { position: absolute; right: 10px; top: 2px; width: 32px; height: 32px; border: 1px solid #ffffff24; border-radius: 50%; background: #121714; }
  .detail-info { display: none; }
  .detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(135px, 30%); gap: 10px; height: 100%; min-height: 0; }
  .detail-player-space { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 6px; min-height: 0; }
  .detail-player-slot { grid-column: 1 / -1; height: 100%; min-height: 0; }
  .detail-player-slot > .youtube-stage:not(.force-fullscreen) { height: 100% !important; aspect-ratio: auto !important; }
  .detail-player-space > .mode-overlay { margin: 0 !important; padding: 3px !important; align-self: center; }
  .mode-overlay button { height: 30px !important; padding: 0 10px !important; font-size: 9px !important; }
  .detail-search { padding: 2px 6px; margin: 0; }
  .detail-search input { width: 30px; font-size: 10px; }
  .detail-search button { padding: 7px; font-size: 10px; }
  .detail-note { display: none; }
  .detail-queue { display: flex; flex-direction: column; min-height: 0; padding: 8px; background: #0b100e; border-radius: 8px; }
  .detail-queue h3 { margin: 0 0 6px; font-size: 13px; flex-shrink: 0; }
  .detail-queue > div { overflow-y: auto; min-height: 0; }
  .detail-song { grid-template-columns: 30px minmax(0, 1fr); gap: 6px; padding: 6px 0; }
  .detail-song img { width: 30px; height: 30px; }
  .detail-song strong { font-size: 10px; }
  .detail-song small { font-size: 8px; }
}

@media (orientation: landscape) and (max-height: 400px), (orientation: landscape) and (max-width: 800px) {
  body.record-open .record-view { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; align-content: center; justify-items: center; gap: 4px; padding: 30px 12px 8px !important; overflow-y: auto; }
  body.record-open .record-disc { display: none; }
  .record-mode .record-copy { margin: 0; }
  .record-mode .record-copy h2 { font-size: 14px; margin: 0; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .record-mode .record-copy p { margin-top: 3px; font-size: 10px; }
  .record-mode .mobile-mp3 { display: flex; flex-direction: column; width: min(100%, 440px); margin: 0; flex: 0 0 auto; }
  .record-mode .mp3-lyric, .record-mode .mp3-sub { display: none; }
  .record-mode .lyrics-toggle { margin: 0 auto; padding: 3px 10px; font-size: 9px; }
  .record-mode .mp3-wave { margin: 4px 0; }
  .record-mode .mp3-main-controls { margin: 0; gap: 24px; }
  .record-mode .mp3-main-controls .mp3-play { width: 40px; height: 40px; }
  .record-mode .mp3-actions { margin: 0; padding: 2px 0 0; justify-content: center; gap: 12px; }
  .record-mode .mp3-actions button { width: 28px; height: 28px; font-size: 16px; }
  .record-mode .record-close { top: 6px; left: 8px; width: 28px; height: 28px; }
  .record-mode .mp3-queue { display: none; }
  .record-mode .mp3-queue.open { display: flex; inset: 0; width: 100%; }
}

@media (max-height: 360px) and (orientation: landscape) {
  .record-mode .record-copy p, .record-mode .lyrics-toggle { display: none; }
  .record-mode .mp3-bars { height: 22px; overflow: hidden; }
  .record-mode .mp3-actions { padding: 0; }
  .video-row { gap: 3px; }
  .video-row .video-volume { display: none; }
  .video-transport button { width: 30px; min-width: 30px; height: 30px; }
  .video-select { height: 28px; padding: 0 4px; }
  .video-row .video-time { font-size: 9px; }
  .youtube-stage:not(.record-mode) .video-controls { padding: 12px 8px 4px; }
}

@media (orientation: portrait) and (min-width: 700px) {
  body { padding-top: 64px; }
  .hero { margin: 0; padding-top: 30px; }
  .record-mode .lyrics-toggle { align-self: center; border: 1px solid #ff1f6d77; border-radius: 18px; background: #ff1f6d18; color: #ff5c94; padding: 6px 14px; }
  .record-mode .lyrics-panel { display: none; position: absolute; z-index: 10; inset: 48px 16px 16px; overflow-y: auto; background: #10121bf2; padding: 18px; }
  .record-mode .lyrics-panel.open { display: block; }
}

/* PushPlay branding */
.top .brand { gap: 9px; }
.top .logo { width: 42px; height: 42px; background: transparent; flex-shrink: 0; }
.top .logo img, .avatar img { width: 100%; height: 100%; object-fit: contain; display: block; }
.top .avatar { background: transparent; width: 38px; height: 38px; }
@media (min-width: 700px) {
  .bottom-nav::before { content: 'PushPlay'; background: url('pushplay-logo.png') left center / 38px 38px no-repeat; padding-left: 44px; min-height: 38px; line-height: 38px; }
}
