/* Responsive presentation layer. Player source, export, auth and history are unchanged. */
:root{--responsive-layout-revision:688;--responsive-gutter:max(16px,env(safe-area-inset-left),env(safe-area-inset-right))}
.app{max-width:none}
.view,.welcome-slot{width:calc(100% - var(--responsive-gutter) - var(--responsive-gutter));max-width:none}
.welcome-slot{padding-inline:0}
.bottom-nav .desktop-nav-only{display:none}
.responsive-nav-brand img{width:70px;height:70px;object-fit:contain}
.responsive-nav-brand strong{font-size:20px}
.responsive-nav-brand small{color:var(--muted);font-size:12px}
.bottom-nav button:focus-visible{outline:2px solid var(--brand2);outline-offset:2px}
.modal select,.modal input,.birth-grid>*{min-width:0;max-width:100%}

/* Mobile pages already own their padding: avoid subtracting the same gutter twice. */
@media(max-width:599px){
  .view:not(.responsive-home){width:100%}
  .hos-card-actions{margin-inline:4px;gap:0}
  .hos-card-actions button{flex:1;min-width:0;padding-inline:4px}
}

/* Tablets keep the familiar lower navigation, while giving lists more room. */
@media(min-width:600px){
  .app{max-width:none}
  .home-block,.home-content-list{padding-inline:0}
  .bottom-nav{width:min(960px,100%);left:50%;right:auto;transform:translateX(-50%)}
  .hos-mini{width:min(960px,100%);max-width:none;left:50%;right:auto;transform:translateX(-50%);bottom:calc(74px + env(safe-area-inset-bottom))}
  .hos-page .view{padding-inline:0}
  .hos-root-grid,.hos-audio-list{max-width:none}
  .hos-grid:not(.hos-audio-list):not(.hos-root-grid):not(.hos-favorite-list):not(.hos-story-grid){grid-template-columns:repeat(auto-fill,minmax(min(240px,100%),1fr))}
  .hos-favorite-list{grid-template-columns:minmax(0,1fr)!important}
  .hos-card-copy{overflow-wrap:break-word}
  .hos-story-card{flex-basis:45%}
  .hos-story-card .hos-open>img{max-height:520px;object-fit:contain;background:#000}
}

/* Home order and complete image fit are identical on every viewport. */
#view.responsive-home{display:grid;grid-template-columns:minmax(0,1fr);gap:clamp(14px,2vw,20px);align-items:start}
#view.responsive-home>.home-block{min-width:0;margin:0;padding-inline:0;width:100%}
#view.responsive-home>.home-content-list{min-width:0;width:100%;padding-inline:0}
#view.responsive-home .hero-viewport,#view.responsive-home .fixed-banner{height:auto;aspect-ratio:auto}
#view.responsive-home .hero-visual,#view.responsive-home .hero-slide-button{height:auto}
#view.responsive-home .hero-slide-button>img,#view.responsive-home .fixed-banner>img{display:block;width:100%;height:auto;aspect-ratio:auto 16/9;object-fit:contain}
/* The built-in slide is HTML artwork: its logo and copy scale with the same full-width frame. */
#view.responsive-home .heritage-banner{height:auto;min-height:180px;aspect-ratio:16/9;box-sizing:border-box;position:relative;display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.5fr);align-items:center;gap:clamp(14px,3vw,64px);padding:clamp(20px,6%,160px);background:radial-gradient(ellipse at 78% 50%,#319a6377 0,transparent 58%),linear-gradient(105deg,#03100b,#075132 58%,#12945c);isolation:isolate}
#view.responsive-home .heritage-banner::before{content:"";position:absolute;inset:5%;border:1px solid #dfd09a66;border-radius:18px;pointer-events:none}
#view.responsive-home .heritage-banner::after{content:"";position:absolute;inset:9% 7%;border-block:1px solid #dfd09a22;border-radius:45%;pointer-events:none}
#view.responsive-home .heritage-banner>img{position:relative;z-index:1;width:100%!important;height:auto!important;max-height:none;object-fit:contain!important;flex:none;justify-self:center;filter:drop-shadow(0 10px 24px #0005)}
#view.responsive-home .heritage-banner>div{position:relative;z-index:1;min-width:0;display:grid;gap:clamp(6px,1.1vw,20px);text-align:right}
#view.responsive-home .heritage-banner strong{font-size:clamp(24px,4vw,96px);line-height:1.35;color:#fff5d6}
#view.responsive-home .heritage-banner span{font-size:clamp(13px,1.8vw,42px);line-height:1.7;color:#e0f2e6}
#view.responsive-home .heritage-banner small{font-size:clamp(12px,1.5vw,32px);line-height:1.6;color:#c4e4ce}
#view.responsive-home .home-content-list{display:grid;grid-template-columns:minmax(0,1fr);gap:clamp(14px,2vw,20px);align-items:stretch}
#view.responsive-home .home-content-list>.home-content-banner,#view.responsive-home .home-content-list>.hos-home-banner{height:auto;aspect-ratio:16/9;min-height:188px;min-width:0;grid-column:auto}
#view.responsive-home .home-content-list>.hos-home-banner>img:not(.hos-banner-logo){position:absolute;inset:0;width:100%;height:100%;min-height:0;max-height:none;object-fit:cover;object-position:center}
/* Explicit card ranges keep copy legible from a small phone to a large monitor. */
@media(min-width:540px){
  #view.responsive-home .home-content-list{grid-template-columns:repeat(2,minmax(0,1fr))}
  #view.responsive-home .home-content-list>.home-content-banner,#view.responsive-home .home-content-list>.hos-home-banner{min-height:160px}
}
@media(min-width:1400px){#view.responsive-home .home-content-list{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(min-width:2200px){#view.responsive-home .home-content-list{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(min-width:3000px){#view.responsive-home .home-content-list{grid-template-columns:repeat(5,minmax(0,1fr))}}
@media(min-width:3800px){#view.responsive-home .home-content-list{grid-template-columns:repeat(6,minmax(0,1fr))}}

/* Audio controls and artwork share a horizontal layout on sufficiently wide screens. */
@media(min-width:800px) and (min-height:500px){
  .modal:has(.hos-player){width:min(1040px,calc(100% - 48px));height:auto;max-height:calc(100dvh - 48px);top:50%;bottom:auto;transform:translate(-50%,-50%);border-radius:24px}
  .modal:has(.hos-player) #modalBody{padding:4px 12px 12px}
  .hos-player{max-width:none;display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,.8fr);gap:8px 28px;align-items:center}
  .hos-player>*{grid-column:1;min-width:0}
  .hos-player .hos-art{grid-column:2;grid-row:1/span 7;width:100%;height:auto;aspect-ratio:1;max-height:min(46dvh,360px);object-fit:contain;align-self:center}
  .hos-player h2{font-size:clamp(20px,1.8vw,28px);margin:4px 0;line-height:1.5}
  .hos-player .hos-performer{margin:0}
  .hos-player .hos-wave{margin:4px 0;height:32px}
  .hos-player #hosTime{margin:2px 0}
  .hos-player .hos-transport{margin:4px 0}
  .hos-player .hos-transport #hosPlay{width:60px;height:60px}
  .hos-player #hosExports{margin:0;flex-wrap:wrap}
  .hos-player .hos-player-controls{margin:0;gap:12px}
  .hos-player .hos-player-controls label{text-align:start;min-width:110px}
  .hos-player .hos-text,.hos-player #hosLinks{grid-column:1/-1}
  .hos-player #hosLinks:empty{display:none}
  .hos-player #hosLyrics{justify-self:start}
}

/* A rail replaces the lower tabs only when content has enough width beside it. */
@media(min-width:1100px){
  :root{--responsive-rail:clamp(212px,16vw,260px);--responsive-gutter:max(32px,env(safe-area-inset-left),env(safe-area-inset-right))}
  .app{width:calc(100% - var(--responsive-rail));max-width:none;margin:0 var(--responsive-rail) 0 0;padding-bottom:32px}
  .view{padding-top:20px}
  .welcome-slot{height:var(--responsive-welcome-size,112px)!important;padding:12px 0;position:sticky;top:0}
  .welcome,.welcome.collapsed{display:flex!important;align-items:center!important;min-height:88px!important;border-radius:20px!important}
  .welcome .welcome-header{flex:1;min-width:0;min-height:88px;padding:12px 20px}
  .welcome .welcome-wave{width:48px;height:48px;flex-basis:48px;border-radius:18px}
  .welcome-copy strong{font-size:20px}
  .welcome-copy .welcome-main{font-size:14px!important}
  .welcome .welcome-support{height:auto!important;flex:0 0 auto}
  .welcome .welcome-support-inner{min-height:0;padding:12px 20px;align-items:center;gap:6px}
  .welcome .welcome-sub{display:none}
  .welcome.collapsed .welcome-support{visibility:hidden;pointer-events:none;display:none!important}
  .primary-tabs{top:var(--responsive-welcome-size,112px)!important}
  .bottom-nav{top:0;bottom:0;left:auto;right:0;width:var(--responsive-rail);height:100dvh;max-height:100dvh;transform:none;border-radius:0;border-top:0;border-left:1px solid var(--line);box-shadow:-6px 0 24px #00000005;padding:24px 16px;display:flex;flex-direction:column;gap:8px;overflow-y:auto;overscroll-behavior:contain}
  .bottom-nav .desktop-nav-only{display:flex}
  .responsive-nav-brand{order:0;flex:none;flex-direction:column;align-items:center;gap:10px;padding:0 0 20px;margin-bottom:12px;border-bottom:1px solid var(--line)}
  .bottom-nav button{display:flex;align-items:center;justify-content:flex-start;text-align:start;gap:14px;padding:12px 16px;min-height:52px;flex:none;border-radius:14px;width:100%;color:var(--text)}
  .bottom-nav button.active{background:var(--brand);color:#fff}
  .bottom-nav button small{font-size:15px}
  .bottom-nav button span{flex:none;width:30px!important;height:30px!important;border-radius:0!important;background:transparent!important}
  .bottom-nav button[data-tab=home]{order:1}
  #responsiveHosNav{order:2}
  .bottom-nav button[data-tab=albums]{order:3}
  .bottom-nav button[data-tab=notices]{order:4}
  .bottom-nav button[data-tab=favorites]{order:5}
  #navProfile{order:8;margin-top:auto;border-top:1px solid var(--line);border-radius:0;padding-top:16px}
  #navProfile .nav-avatar{width:30px!important;height:30px!important;border-radius:50%!important;overflow:hidden}
  #responsiveSettings{order:9}
  .hos-root-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;align-items:stretch}
  .hos-root-card .hos-open{flex-direction:column;align-items:stretch;padding:0;gap:0}
  .hos-root-card .hos-open>img{width:100%;aspect-ratio:16/9;border-radius:0;object-fit:cover}
  .hos-root-card .hos-card-copy{padding:16px}
  .hos-root-card strong{font-size:22px}
  .hos-root-card .hos-card-play{align-self:flex-start;padding:0 16px 12px}
  .hos-audio-list{grid-template-columns:repeat(2,minmax(0,1fr))!important;align-items:start}
  .hos-grid .hos-group-title,.hos-grid .hos-search-status,.hos-grid .hos-path{grid-column:1/-1}
  .hos-intro-banner{height:clamp(220px,26dvh,320px);background:#122e22}
  .hos-intro-banner img{width:100%;height:100%;max-height:none;object-fit:contain}
  .hos-story-card{flex-basis:28%}
  .albums-shell .album-grid{grid-template-columns:repeat(12,minmax(0,1fr))}
  .albums-shell .album-grid .folder-card{grid-column:span 4}
  .albums-shell .album-grid .media-card{grid-column:span 3}
  .albums-shell .album-grid.layout-compact{grid-template-columns:repeat(20,minmax(0,1fr))}
  .albums-shell .layout-compact .folder-card{grid-column:span 5}
  .albums-shell .layout-compact .media-card{grid-column:span 4}
  .albums-shell .album-grid.layout-large{grid-template-columns:repeat(6,minmax(0,1fr))}
  .albums-shell .layout-large .folder-card{grid-column:span 3}
  .albums-shell .layout-large .media-card{grid-column:span 2}
  .hos-mini{width:min(calc(100vw - var(--responsive-rail) - 48px),1680px);max-width:none;left:calc((100% - var(--responsive-rail))/2);right:auto;transform:translateX(-50%);bottom:0;border:1px solid var(--line);border-bottom:0;border-radius:18px 18px 0 0;padding:12px 18px 14px;min-height:82px}
  .media64-mini-open strong{font-size:16px}
  .media64-mini-open small{font-size:13px}
  .hos-mini .media64-mini-transport button{width:44px;min-width:44px}
  .hos-playing .view{padding-bottom:120px}
  .radio-fab{left:24px;bottom:24px}
  .hos-playing .radio-fab{bottom:110px}
  .radio-now{left:88px;right:auto;bottom:24px}
  .hos-playing .radio-now{bottom:110px}
  .modal:not(.media64-modal):not(.viewer-expanded):not(:has(.hos-player)){width:min(900px,calc(100% - 64px));max-height:calc(100dvh - 64px);top:50%;bottom:auto;transform:translate(-50%,-50%);border-radius:24px}
  .viewer-actions{flex-wrap:wrap}
  .settings-list{gap:12px}
}
@media(min-width:1600px){
  .albums-shell .album-grid{grid-template-columns:repeat(20,minmax(0,1fr))}
  .albums-shell .album-grid .folder-card{grid-column:span 5}
  .albums-shell .album-grid .media-card{grid-column:span 4}
  .albums-shell .album-grid.layout-large{grid-template-columns:repeat(6,minmax(0,1fr))}
  .albums-shell .layout-large .folder-card{grid-column:span 3}
  .albums-shell .layout-large .media-card{grid-column:span 2}
}
/* Short landscape windows and large browser zoom never trap controls below a fixed panel. */
@media(max-height:540px) and (min-width:600px){
  .modal:has(.hos-player){width:min(1000px,calc(100% - 24px));height:auto;max-height:calc(100dvh - 24px);top:50%;bottom:auto;transform:translate(-50%,-50%);border-radius:18px}
  .hos-player .hos-art{display:none}
  .hos-player h2{font-size:19px;margin:4px 0}
  .hos-player .hos-performer,.hos-player .hos-wave{margin:4px 0}
  .hos-player .hos-wave{height:20px}
  .hos-player .hos-transport,.hos-player .hos-player-controls,.hos-player #hosExports{margin:4px 0}
  .hos-player .hos-transport #hosPlay{width:48px;height:48px}
  .responsive-nav-brand{padding-bottom:8px;margin-bottom:4px}
  .responsive-nav-brand img{width:36px;height:36px}
  .responsive-nav-brand small{display:none}
  .bottom-nav{gap:2px;padding-block:12px}
  .bottom-nav button{min-height:44px;padding-block:8px}
}
