/* radio.sala.company — the radio screen (modern.js) and its dialogs. */
/* Country flags: Windows has no flag emojis, so load a flags-only font (used only for flag characters) */
@font-face{font-family:'Twemoji Country Flags';src:url('https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1.8/dist/TwemojiCountryFlags.woff2') format('woff2');unicode-range:U+1F1E6-1F1FF,U+1F3F4,U+E0062-E007F;font-display:swap}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:#0e1927;color:#f3f7fc;font:14px/1.45 'Twemoji Country Flags',system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
.hidden{display:none!important}
.muted{color:#bdcbd9}
.small{font-size:12px}
.spacer{flex:1}
/* Dialogs: settings, add a list, songs heard, the song card */
dialog{background:linear-gradient(145deg,#203549,#17293b);color:#f3f7fc;border:1px solid #6d8ca6;border-radius:18px;padding:20px;width:min(520px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:auto;box-shadow:0 18px 60px #030b14c0}
dialog::backdrop{background:#030b14b8}
dialog.wide{width:min(680px,calc(100vw - 32px))}
dialog h3{margin:6px 0 10px;font-size:18px;font-weight:750;color:#fff}
dialog h4{margin:14px 0 4px;font-size:12px;letter-spacing:.12em;text-transform:uppercase;color:#afc5da}
dialog label{display:block;margin:12px 0 4px;color:#bdcbd9}
dialog label.check{display:flex;gap:9px;align-items:flex-start;color:#f3f7fc}
dialog a{color:#8dd0f3}
dialog button,dialog select,dialog input,dialog textarea,.filebtn{font:inherit;color:#f3f7fc;background:#172638;border:1px solid #5c7892;border-radius:10px;padding:8px 12px}
dialog input[type=checkbox]{padding:0;margin-top:3px;accent-color:#8dd0f3}
dialog input[type=text],dialog input[type=url],dialog input[type=search],dialog input[type=number],dialog textarea,dialog select{width:100%}
dialog select option{background:#172638;color:#f3f7fc}
dialog textarea{min-height:80px;font:12px/1.4 ui-monospace,Consolas,monospace}
dialog button,.filebtn{cursor:pointer}
dialog button:hover,.filebtn:hover{background:#2a4257;border-color:#a0c4dd}
dialog button:disabled{opacity:.45;cursor:default}
dialog button.primary{background:#8dd0f3;border-color:#8dd0f3;color:#0b1a28;font-weight:700}
dialog button.danger{color:#ff8f8f}
dialog :focus-visible{outline:3px solid #93d8ff;outline-offset:2px}
dialog .adv{margin:14px 0 4px;border-top:1px solid #41556b;padding-top:6px}
dialog .adv summary{cursor:pointer;color:#bdcbd9;font-weight:600;padding:4px 0}
dialog .rbx{margin-top:6px}
.filebtn{display:inline-block;margin:0!important}
.btns{display:flex;gap:8px;flex-wrap:wrap}
.dlg-acts{display:flex;justify-content:flex-end;gap:8px;margin-top:18px}
.err{color:#ff8f8f;min-height:1em;margin-top:8px}
.sc-now{display:flex;flex-direction:column;gap:4px;padding:4px 0 12px}
.sc-title{font-size:22px;line-height:1.2;overflow-wrap:anywhere}
.sc-artist{font-size:16px}
.sc-links{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;align-items:center}
.sc-links a{display:inline-block;padding:6px 12px;border:1px solid #8dd0f3;border-radius:20px;font-weight:700;text-decoration:none}
.sc-links a:hover{background:#8dd0f3;color:#0b1a28}
.songs{max-height:min(60vh,520px);overflow-y:auto;margin-top:10px;border-top:1px solid #41556b}
.song-day{position:sticky;top:0;background:#1b2e41;padding:8px 0 4px;font:700 11px/1 system-ui,sans-serif;letter-spacing:.12em;text-transform:uppercase;color:#afc5da}
.song{display:grid;grid-template-columns:64px minmax(0,1fr) auto;gap:10px;align-items:center;padding:7px 0;border-bottom:1px solid #2c4256}
.song-time{font-size:13px;color:#bdcbd9}
.song-text{min-width:0;overflow-wrap:anywhere}
.song-text small{display:block;color:#bdcbd9;font-size:12px;margin-top:2px}
.song-links{display:flex;gap:8px;font-size:12px;white-space:nowrap}
.songs .empty{padding:12px 0;color:#bdcbd9}
@media (max-width:600px){.song{grid-template-columns:52px minmax(0,1fr)}.song-links{grid-column:2}}
.toast{position:fixed;left:50%;transform:translateX(-50%);max-width:calc(100vw - 32px)}
body.modern-ui{--m-bg:#0e1927;--m-panel:#172638;--m-panel2:#203449;--m-border:#415a72;--m-ink:#f3f7fc;--m-muted:#bdcbd9;--m-silver:#cbd3dc;--m-blue:#8dd0f3;background:var(--m-bg)!important;color:var(--m-ink)!important;font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
body.modern-ui #modernApp{display:block;height:100dvh;min-height:420px;overflow:hidden;color:var(--m-ink);background:radial-gradient(circle at 35% 20%,#23364c 0,#101d2c 56%,#0a1420 100%)}
#modernApp *{box-sizing:border-box}
#modernApp button,#modernApp select,#modernApp input{font:inherit}
#modernApp button{cursor:pointer;color:inherit;background:none;border:0}
#modernApp button:focus-visible,#modernApp input:focus-visible,#modernApp select:focus-visible{outline:3px solid #93d8ff;outline-offset:2px}
#modernApp button:disabled{opacity:.45;cursor:not-allowed}
#modernApp h1,#modernApp h2,#modernApp h3,#modernApp p{margin:0}
#modernApp .m-shell{display:grid;grid-template-columns:184px minmax(310px,1fr) minmax(355px,560px);height:100%;gap:0}
#modernApp .m-nav{display:flex;flex-direction:column;min-width:0;background:#122132;border-right:1px solid var(--m-border);padding:24px 12px 18px;overflow:auto}
#modernApp .m-brand{display:flex;align-items:center;gap:8px;font-size:18px;letter-spacing:.08em;margin:3px 8px 34px;white-space:nowrap}
#modernApp .m-brand b{color:var(--m-blue)}
#modernApp .m-navitem{display:flex;align-items:center;gap:12px;text-align:left;padding:13px 10px;margin:2px 0;border-radius:12px!important;font-size:14px!important;color:var(--m-muted)!important}
#modernApp .m-navitem:hover,#modernApp .m-navitem:focus-visible{background:#2a4257!important;color:#fff!important}
#modernApp .m-navitem svg{flex-shrink:0}
#modernApp .m-navspacer{flex:1}
#modernApp .m-central{display:flex;flex-direction:column;min-width:0;min-height:0}
#modernApp .m-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:15px 22px;min-height:72px;border-bottom:1px solid #41556b}
#modernApp .m-header>div,#modernApp .m-head-actions{display:flex;align-items:center;gap:10px}
#modernApp .m-brandtext{font-size:17px;font-weight:750;letter-spacing:.01em}
#modernApp #mNavToggle{display:none}
#modernApp .m-station-launch{display:flex;align-items:center;gap:9px!important;border-radius:13px!important;background:#304d64!important;border:1px solid #64849e!important;padding:10px 14px!important;font-weight:700!important;white-space:nowrap}
#modernApp #mSettings{font-size:22px;padding:7px!important}
#modernApp .m-center-scroll{padding:clamp(12px,2vw,28px);overflow:auto;min-height:0;display:flex;flex-direction:column;gap:18px;scrollbar-color:#59738c transparent}
#modernApp .m-player,#modernApp .m-section{background:linear-gradient(145deg,#203549,#17293b);border:1px solid var(--m-border);border-radius:22px;padding:clamp(15px,2vw,24px);box-shadow:0 6px 30px #030b1480}
#modernApp .m-eyebrow{font-size:11px;letter-spacing:.16em;font-weight:800;color:#afc5da;display:flex;justify-content:space-between;align-items:center;gap:9px}
#modernApp .m-now{display:flex;align-items:center;gap:16px;padding:22px 0 18px}
#modernApp .m-now-logo{width:84px;height:84px;flex:none;background:#2c4660;border:1px solid #648199;border-radius:18px;display:grid;place-items:center;font-size:34px;overflow:hidden}
#modernApp .m-now-logo img{width:100%;height:100%;object-fit:contain}
#modernApp .m-now-labels{min-width:0;flex:1}
#modernApp .m-now h1{font-size:clamp(21px,2.1vw,30px);line-height:1.15;letter-spacing:-.025em;overflow-wrap:anywhere;margin-bottom:8px}
#modernApp .m-now p{font-size:13px;color:var(--m-muted);line-height:1.4}
#modernApp .m-play{font-size:29px!important;flex:none;display:grid!important;place-items:center;width:66px;height:66px;border-radius:50%!important;color:#0a2537!important;background:#b1dcf4!important;box-shadow:0 0 0 4px #39627c}
#modernApp .m-connection{display:flex;align-items:center;gap:12px;border:1px solid #577c91;border-radius:14px;padding:11px 14px;background:#203d4b;min-height:64px}
#modernApp .m-connection-dot{width:15px;height:15px;flex:none;border-radius:50%;background:#d0dbe7;box-shadow:0 0 0 3px #73859740}
#modernApp .m-connection strong,#modernApp .m-connection small{display:block}
#modernApp .m-connection strong{font-size:14px}
#modernApp .m-connection small{color:#c7d7e4;font-size:12px;margin-top:3px}
#modernApp .m-connection[data-state="live"] .m-connection-dot{background:#a2e6cd}
#modernApp .m-connection[data-state="buffering"] .m-connection-dot,#modernApp .m-connection[data-state="tuning"] .m-connection-dot{background:#ffda8b;animation:mPulse 1.25s infinite}
#modernApp .m-connection[data-state="nosignal"]{border-color:#e8af87;background:#503b36}
#modernApp .m-connection[data-state="nosignal"] .m-connection-dot{background:#ffb48c}
#modernApp #mRetry{margin-left:auto;border:1px solid #dec4a9!important;padding:8px 12px!important;border-radius:9px!important}
@keyframes mPulse{50%{opacity:.3;transform:scale(.75)}}
#modernApp .m-player-tools{display:flex;align-items:center;gap:18px;justify-content:space-between;margin-top:18px;flex-wrap:wrap}
#modernApp .m-timer{display:flex;gap:10px;align-items:center;font-size:12px;color:var(--m-muted)}
#modernApp .m-ring{--progress:0%;height:45px;width:45px;display:grid;place-items:center;border-radius:50%;background:conic-gradient(#9dd6f7 var(--progress),#455f74 var(--progress));position:relative}
#modernApp .m-ring:before{content:"";position:absolute;inset:5px;border-radius:50%;background:#1b2f42}
#modernApp .m-ring>span{z-index:1;display:flex;align-items:center}
#modernApp #mSleep,#modernApp #mVolume{background:#293e51;border:1px solid #688095;border-radius:9px;color:#f7fbff;padding:8px 5px;max-width:110px}
#modernApp #mSleepTime{font-size:12px;min-width:38px;color:#e7f1fa;font-variant-numeric:tabular-nums}
#modernApp .m-volume{display:flex;gap:10px;align-items:center;font-size:12px;color:var(--m-muted)}
#modernApp #mVolume{width:90px}
#modernApp .m-section-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:15px}
#modernApp .m-section h2{font-size:18px;line-height:1.3}
#modernApp .m-section-head>span{font-size:11px;color:var(--m-muted);text-align:right}
#modernApp .m-section-head button{font-size:12px!important;color:#a6dfff!important}
#modernApp .m-presets{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;touch-action:pan-y}
#modernApp .m-preset{min-width:0;min-height:89px;border:1px solid #547087!important;background:#263c50!important;border-radius:12px!important;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:4px;position:relative;padding:10px 5px 6px!important;user-select:none;-webkit-user-select:none;touch-action:pan-y}
#modernApp .m-preset.active{background:#415f77!important;border-color:#d4dce4!important;box-shadow:inset 0 0 0 1px #cbd5df}
#modernApp .m-preset-number{position:absolute;left:7px;top:5px;font-size:10px;color:#d0deeb}
#modernApp .m-preset img{width:38px;height:33px;object-fit:contain;border-radius:5px}
#modernApp .m-preset svg{width:30px;height:30px}
#modernApp .m-preset-add{font-size:26px;color:#a5bcd0}
#modernApp .m-preset-label{font-size:10px;line-height:1.15;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#edf4fb}
#modernApp .m-recent{display:grid;grid-template-rows:repeat(2,minmax(39px,auto));grid-auto-flow:column;grid-auto-columns:minmax(105px,1fr);gap:8px;overflow-x:auto;padding-bottom:4px}
#modernApp .m-recent button{display:flex;gap:7px;align-items:center;min-width:0;border:1px solid #516a80!important;background:#283e52!important;padding:7px!important;border-radius:10px!important;text-align:left}
#modernApp .m-recent img{width:25px;height:25px;object-fit:contain;flex:none}
#modernApp .m-recent button>span:not(.m-fallback){font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#modernApp .m-empty{font-size:13px;color:#bdcbd8;line-height:1.5;padding:12px}
#modernApp .m-browser{min-width:0;display:flex;flex-direction:column;background:#142335;border-left:1px solid var(--m-border);min-height:0;transition:transform .23s ease}
#modernApp .m-browser-head{display:flex;align-items:center;justify-content:space-between;padding:22px 18px 12px}
#modernApp .m-browser-head h2{font-size:19px}
#modernApp .m-browser-head p{font-size:12px;color:var(--m-muted);margin-top:4px}
#modernApp #mBrowserClose{font-size:20px;padding:7px!important}
#modernApp .m-browser-search{display:flex;gap:6px;padding:10px 13px}
#modernApp .m-browser-search input{flex:1;min-width:0;background:#263b50;border:1px solid #668098;color:#fff;border-radius:10px;padding:10px 12px;font-size:13px}
#modernApp #mSearchWorld{background:#36536b!important;border-radius:10px!important;padding:8px!important;font-size:11px!important}
#modernApp .m-columns{display:flex;overflow:auto;flex:1;min-height:0;scrollbar-color:#6b849b transparent;border-block:1px solid #496077}
#modernApp .m-column{min-width:155px;width:155px;flex:none;overflow:auto;border-right:1px solid #40566b}
#modernApp .m-column-source{min-width:164px;width:164px}
#modernApp .m-column-stations{min-width:244px;width:244px}
#modernApp .m-column h3{position:sticky;top:0;z-index:2;background:#213449;padding:13px 10px;font-size:13px;border-bottom:1px solid #4e667e}
#modernApp .m-column h3 small{font-size:11px;color:var(--m-muted)}
#modernApp .m-column>button{display:flex;align-items:center;gap:3px;width:100%;text-align:left;min-height:40px;padding:8px 10px!important;border-bottom:1px solid #354a5d!important;color:#d8e6f3!important;font-size:12px!important;overflow-wrap:anywhere}
#modernApp .m-column>button span{margin-left:auto}
#modernApp .m-column>button small{color:#b7cadd;margin-left:auto}
#modernApp .m-column>button.selected{background:#355574!important;color:#fff!important}
#modernApp .m-st-row{display:flex;align-items:stretch;border-bottom:1px solid #40556b;border-left:3px solid transparent}
#modernApp .m-st-row.m-verified{border-left-color:#dce4eb;background:linear-gradient(90deg,#a5b8c91b,transparent)}
#modernApp .m-st-select{display:flex;align-items:center;gap:9px;text-align:left;padding:9px 6px!important;flex:1;min-width:0}
#modernApp .m-st-select img{width:32px;height:32px;object-fit:contain;border-radius:5px;flex:none}
#modernApp .m-fallback{color:#b8e1fa;display:grid;place-items:center;min-width:27px}
#modernApp .m-fallback svg{width:24px;height:24px}
#modernApp .m-st-text{min-width:0}
#modernApp .m-st-text strong{display:block;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#modernApp .m-status{display:inline-flex;align-items:center;gap:4px;font-size:10px;letter-spacing:0;color:#bdcbd9}
#modernApp .m-status-good{color:#142333;background:linear-gradient(110deg,#a5b5c3,#eef3f7 50%,#a1b2c1);border:1px solid #d2dce5;padding:2px 5px;border-radius:6px;text-shadow:none}
#modernApp .m-status-bad,#modernApp .m-status-blocked{color:#ffc29b}
#modernApp .m-status-warn{color:#ffe1a1}
#modernApp .m-status-untested{color:#b9c5d1}
#modernApp .m-browser-footer{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:13px;font-size:11px;color:#cedbea}
#modernApp .m-silver-key{border:1px solid #e0e8f0;background:#c3d0da;color:#142333;padding:4px 6px;border-radius:6px}
#modernApp .m-failed-key{color:#ffd0a4}
#modernApp #mTest{margin-left:auto;background:#304c64!important;border:1px solid #6d899e!important;border-radius:8px!important;padding:7px!important;font-size:11px!important}
#modernApp .m-more{font-size:12px;color:var(--m-muted);padding:15px}
#modernApp .m-backdrop{display:none}
@media(max-width:1330px){
  #modernApp .m-shell{grid-template-columns:67px minmax(300px,1fr) minmax(305px,480px)}
  #modernApp .m-nav{padding-inline:7px;align-items:center}
  #modernApp .m-brand span,#modernApp .m-navitem span{display:none}
  #modernApp .m-navitem{justify-content:center;width:50px;font-size:24px!important}
}
@media(max-width:1049px){
  #modernApp .m-shell{display:block;position:relative}
  #modernApp .m-central{height:100%}
  #modernApp .m-nav{position:absolute;inset:0 auto 0 0;width:min(270px,75vw);z-index:31;transform:translateX(-101%);transition:transform .25s ease;align-items:stretch;padding:25px 16px}
  #modernApp .m-nav .m-brand span,#modernApp .m-nav .m-navitem span{display:inline}
  #modernApp .m-nav .m-navitem{width:auto;justify-content:flex-start;font-size:15px!important}
  #modernApp.m-nav-open .m-nav{transform:translateX(0)}
  #modernApp #mNavToggle{display:inline-block;font-size:23px;padding:5px 11px!important}
  #modernApp .m-browser{position:absolute;right:0;top:0;bottom:0;z-index:25;width:min(680px,90vw);box-shadow:-8px 0 35px #020b16a0;transform:translateX(105%)}
  #modernApp.m-browser-open .m-browser{transform:translateX(0)}
  #modernApp .m-backdrop{display:none;position:absolute;inset:0;background:#040b15ad;z-index:20}
  #modernApp.m-browser-open .m-backdrop,#modernApp.m-nav-open .m-backdrop{display:block}
}
@media(max-width:620px){
  #modernApp .m-header{padding:10px 13px;min-height:62px}
  #modernApp .m-brandtext{font-size:13px}
  #modernApp .m-station-launch{padding:8px!important;gap:4px!important}
  #modernApp .m-station-launch span{font-size:11px}
  #modernApp .m-center-scroll{padding:11px;gap:11px}
  #modernApp .m-player,#modernApp .m-section{padding:13px;border-radius:16px}
  #modernApp .m-now{gap:10px;padding:16px 0 13px}
  #modernApp .m-now-logo{width:55px;height:55px;border-radius:12px}
  #modernApp .m-now h1{font-size:20px;margin-bottom:5px}
  #modernApp .m-play{width:54px;height:54px;font-size:25px!important}
  #modernApp .m-connection{min-height:53px;padding:9px 11px}
  #modernApp .m-player-tools{gap:8px;margin-top:11px}
  #modernApp .m-timer label{display:none}
  #modernApp .m-volume{display:none}
  #modernApp .m-presets{gap:5px}
  #modernApp .m-preset{min-height:68px;padding:9px 2px 4px!important;border-radius:8px!important}
  #modernApp .m-preset img{width:26px;height:26px}
  #modernApp .m-preset svg{width:23px;height:23px}
  #modernApp .m-preset-number{font-size:9px;top:3px;left:4px}
  #modernApp .m-preset-label{font-size:9px}
  #modernApp .m-section-head>span{max-width:140px}
  #modernApp .m-section h2{font-size:15px}
  #modernApp .m-recent{grid-auto-columns:minmax(110px,145px)}
  #modernApp .m-browser{width:100vw}
  #modernApp .m-column{min-width:145px;width:145px}
  #modernApp .m-column-stations{min-width:228px;width:228px}
}
@media(prefers-reduced-motion:reduce){#modernApp *,#modernApp *:before{animation:none!important;transition:none!important}}


/* Compact the station picker on folded-cover/mobile layouts.
   Make room for approximately 7-8 visible station choices on common phone heights
   without removing search, discovery chips, verification or status legend. */
@media(max-width:1049px){
  #modernApp .m-browser-head{padding:10px 12px 4px;min-height:43px}
  #modernApp .m-browser-head h2{font-size:16px;line-height:1.2}
  #modernApp .m-browser-head p{display:none}
  #modernApp #mBrowserClose{padding:3px 7px!important;font-size:18px}
  #modernApp .m-browser-search{padding:5px 10px;gap:5px}
  #modernApp .m-browser-search input{padding:7px 9px;font-size:12px;min-height:35px}
  #modernApp #mSearchWorld{padding:5px 8px!important;font-size:10px!important}
  #modernApp .m-column h3{padding:8px 9px;font-size:12px}
  #modernApp .m-column>button{min-height:34px;padding:5px 8px!important;font-size:11px!important}
  #modernApp .m-st-select{padding:5px 6px!important;min-height:43px;gap:7px}
  #modernApp .m-st-select img{width:27px;height:27px}
  #modernApp .m-st-text strong{font-size:11px}
  #modernApp .m-status{font-size:9px}
  #modernApp .m-status-good{padding:1px 4px}
  #modernApp .m-browser-footer{padding:6px 10px;gap:6px;font-size:10px}
  #modernApp #mTest{padding:5px 7px!important;font-size:10px!important}
}

/* Single-line station titles with a compact adjacent stream-health symbol.
   Full status text remains available via aria-label/title and browser legend. */
#modernApp .m-st-text{display:flex;align-items:center;gap:6px;min-width:0;flex:1;white-space:nowrap}
#modernApp .m-st-text strong{flex:1 1 auto;min-width:0;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#modernApp .m-st-text .m-status{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;line-height:1;min-width:18px;font-weight:750}
#modernApp .m-st-text .m-status-good{color:#122331;background:linear-gradient(135deg,#a9b8c7 0%,#f4f8fb 49%,#a7b6c6 100%);border:1px solid #e2ebf3;box-shadow:inset 0 1px 0 #fff8,0 0 0 1px #a8b9c33b;border-radius:5px;padding:4px 5px;text-shadow:none}
#modernApp .m-st-row.m-verified{border-left-color:#e7edf4;background:linear-gradient(90deg,#d8e0e831,#c7d4e00b)}
#modernApp .m-st-row.m-verified .m-st-text strong{color:#f5f8fc}
#modernApp .m-st-text .m-status-checking{color:#adddfd}
@media(max-width:1049px){
  #modernApp .m-st-text{gap:5px}
  #modernApp .m-st-text .m-status-good{padding:3px 4px}
}

/* Station-picker return navigation, with enough touch area on a folded screen. */
#modernApp .m-browser-head{gap:12px}
#modernApp .m-back-radio{display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:none;min-height:44px;padding:10px 13px!important;border:1px solid #a2bdd4!important;border-radius:12px!important;background:#33546d!important;color:#f5faff!important;font-size:14px!important;font-weight:700!important;white-space:nowrap}
#modernApp .m-back-radio:hover{background:#466b87!important}
@media(min-width:1050px){
  #modernApp:not(.m-browser-open) .m-shell{grid-template-columns:184px minmax(310px,1fr) 0}
  #modernApp:not(.m-browser-open) .m-browser{visibility:hidden;overflow:hidden;border:0;pointer-events:none}
  #modernApp:not(.m-browser-open) .m-central{width:100%}
}
@media(min-width:1050px) and (max-width:1330px){
  #modernApp:not(.m-browser-open) .m-shell{grid-template-columns:67px minmax(300px,1fr) 0}
}
@media(max-width:1049px){
  #modernApp .m-browser-head{padding:8px 10px 4px}
  #modernApp .m-back-radio{min-height:44px;padding:8px 12px!important;font-size:13px!important}
}

/* One self-explanatory sleep control: duration selector and live countdown.
   No decorative crescent, progress circle, or duplicate Off indicator. */
#modernApp .m-timer{display:flex;align-items:center;flex:0 0 auto;gap:0}
#modernApp .m-timer #mSleep{min-width:132px;max-width:180px;min-height:43px;padding:9px 28px 9px 12px;background:#304d64;border:1px solid #a0c4dd;border-radius:12px;color:#f5faff;font-size:13px;font-weight:700;font-variant-numeric:tabular-nums;cursor:pointer}
@media(max-width:620px){
  #modernApp .m-timer #mSleep{min-width:120px;max-width:155px;min-height:43px;font-size:12px;padding:8px 23px 8px 9px}
}

/* Toasts come from the shared engine; in the modern interface they use its palette and type,
   and sit above the picker and menu overlays instead of under them. */
body.modern-ui .toast{z-index:60;bottom:calc(20px + env(safe-area-inset-bottom));background:#203549;border:1px solid #a0c4dd;border-radius:12px;padding:10px 16px;color:#f3f7fc;font:600 14px/1.35 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;letter-spacing:0;box-shadow:0 8px 28px #030b14b0;text-align:center}
/* Long-pressing a preset on iOS shouldn't pop the system callout. */
#modernApp .m-preset{-webkit-touch-callout:none}
#modernApp .m-column>button.m-merged .m-merge-names{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:inherit}
/* The song on now, under the station: tap for the song card */
#modernApp .m-now-song{display:block;max-width:100%;margin-top:6px;padding:0!important;text-align:left;color:#8dd0f3!important;font-size:14px!important;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#modernApp .m-now-song[hidden]{display:none}
#modernApp .m-now-song:hover{text-decoration:underline}
#modernApp .m-column>button.m-add-list{color:#8dd0f3!important;font-weight:700}
/* Stations button: a red Knight Rider scanner light sweeping back and forth along its border */
#modernApp .m-station-launch{position:relative;isolation:isolate;border-color:#5b2a2a!important}
#modernApp .m-station-launch::before,#modernApp .m-station-launch::after{content:"";position:absolute;inset:-2px;border-radius:15px;pointer-events:none;
  background:linear-gradient(90deg,transparent 0 43%,#ff3b2f 47%,#ffd9d2 50%,#ff3b2f 53%,transparent 57% 100%) 0 0/250% 100% no-repeat;
  animation:m-kitt 1.6s ease-in-out infinite alternate}
#modernApp .m-station-launch::before{padding:2px;-webkit-mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);-webkit-mask-composite:xor;mask:linear-gradient(#000 0 0) content-box exclude,linear-gradient(#000 0 0);z-index:1}
#modernApp .m-station-launch::after{filter:blur(9px);opacity:.75;z-index:-1}
@keyframes m-kitt{from{background-position:80% 0}to{background-position:20% 0}}
@media (prefers-reduced-motion:reduce){#modernApp .m-station-launch::before,#modernApp .m-station-launch::after{animation:none;background:#ff3b2f}#modernApp .m-station-launch::after{opacity:.35}}

/* =====================================================================================
   Devices: notches and Dynamic Islands (any side), folds and hinges, landscape rail,
   on-screen keyboard, touch sizes. Layout changes are CSS only, so the audio never stops.
   ===================================================================================== */
:root{--sa-t:env(safe-area-inset-top,0px);--sa-r:env(safe-area-inset-right,0px);--sa-b:env(safe-area-inset-bottom,0px);--sa-l:env(safe-area-inset-left,0px);--kb:0px}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body.modern-ui{overscroll-behavior:none}
#modernApp button,#modernApp a,#modernApp select,dialog button,dialog select{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
#modernApp .m-center-scroll,#modernApp .m-columns,#modernApp .m-nav,dialog{overscroll-behavior:contain}
/* Columns only contain up/down scrolling: a sideways swipe on a column must pass on to the row of columns,
   or on phones and folds the stations column (names, the ✓ marks) can't be reached. */
#modernApp .m-column{overscroll-behavior:auto contain}
/* Everything sits inside the safe area on every side (camera cutouts, a side-mounted island or system bar,
   the home indicator); the background still fills the whole screen. */
body.modern-ui #modernApp{height:100vh;height:100dvh;min-height:0;padding:var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l);box-sizing:border-box}
#modernApp .m-shell{position:relative}
/* Dialogs: centred inside the safe area and above the keyboard, scrolling inside if they're tall */
dialog{position:fixed;inset:calc(12px + var(--sa-t)) calc(12px + var(--sa-r)) calc(12px + var(--sa-b) + var(--kb)) calc(12px + var(--sa-l));margin:auto;
  width:min(520px,calc(100vw - 24px - var(--sa-l) - var(--sa-r)));max-height:calc(100dvh - 24px - var(--sa-t) - var(--sa-b) - var(--kb));height:fit-content}
dialog.wide{width:min(680px,calc(100vw - 24px - var(--sa-l) - var(--sa-r)))}
dialog .dlg-acts{position:sticky;bottom:-20px;background:linear-gradient(transparent,#17293b 30%);padding:12px 0 4px;margin-bottom:-4px}
body.modern-ui .toast{bottom:calc(20px + var(--sa-b) + var(--kb));max-width:calc(100vw - 32px - var(--sa-l) - var(--sa-r))}

/* Touch screens: every control at least 44 px, as Apple and Android recommend */
@media (pointer:coarse){
  #modernApp .m-column>button{min-height:44px}
  #modernApp .m-st-select{min-height:46px}
  #modernApp .m-browser-search input{min-height:44px;font-size:16px} /* 16 px stops iOS zooming in on focus */
  #modernApp #mSearchWorld,#modernApp #mTest,#modernApp #mRetry,#modernApp .m-recent button,#modernApp .m-section-head button{min-height:44px}
  #modernApp .m-timer #mSleep,#modernApp .m-station-launch{min-height:44px}
  #modernApp #mNavToggle,#modernApp #mSettings{min-width:44px;min-height:44px}
  #modernApp .m-now-song{min-height:44px;display:flex;align-items:center}
  #modernApp .m-now-song[hidden]{display:none}
  #modernApp .m-volume{display:none} /* touch devices: the device's own volume buttons */
  dialog input,dialog select,dialog textarea{font-size:16px}
  dialog button,.filebtn{min-height:44px}
}

/* ---------- Side rail: phones in landscape and short wide displays ----------
   The menu becomes a vertical toolbar (with Stations and Settings); now playing and the presets sit side by side. */
#modernApp.m-rail .m-shell{display:grid!important;grid-template-columns:76px minmax(0,1fr);grid-template-rows:100%}
#modernApp.m-rail .m-nav{position:static!important;transform:none!important;width:auto!important;padding:10px 6px!important;align-items:center;gap:4px;box-shadow:none}
#modernApp.m-rail .m-nav .m-brand{margin:2px 0 10px}
#modernApp.m-rail .m-nav .m-brand span,#modernApp.m-rail .m-nav .m-navitem>span{display:none!important}
#modernApp.m-rail .m-nav .m-navitem{width:58px;min-height:48px;justify-content:center;padding:8px!important;font-size:22px!important}
#modernApp.m-rail .m-nav .m-navitem[data-action="stations"]{color:#fff!important;background:#304d64!important;border:1px solid #c9554b!important;box-shadow:0 0 12px #ff3b2f66}
#modernApp.m-rail .m-header{display:none}
#modernApp.m-rail .m-central{height:100%;grid-column:2}
#modernApp.m-rail .m-center-scroll{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start;padding:10px 12px;gap:12px}
#modernApp.m-rail .m-center-scroll>.m-section:last-child{grid-column:1 / -1}
#modernApp.m-rail .m-player,#modernApp.m-rail .m-section{padding:12px;border-radius:16px}
#modernApp.m-rail .m-now{padding:10px 0 10px}
#modernApp.m-rail .m-now-logo{width:52px;height:52px;border-radius:12px}
#modernApp.m-rail .m-now h1{font-size:19px}
#modernApp.m-rail .m-play{width:54px;height:54px}
#modernApp.m-rail .m-presets{gap:5px}
#modernApp.m-rail .m-preset{min-height:64px;padding:8px 2px 4px!important}
#modernApp.m-rail .m-preset img{width:26px;height:26px}
#modernApp.m-rail .m-browser{position:absolute;right:0;top:0;bottom:0;z-index:25;width:min(680px,calc(100% - 76px));transform:translateX(105%);visibility:visible;pointer-events:auto}
#modernApp.m-rail.m-browser-open .m-browser{transform:none}
#modernApp.m-rail .m-backdrop{position:absolute;inset:0 0 0 76px;z-index:20;background:#040b15ad;display:none}
#modernApp.m-rail.m-browser-open .m-backdrop{display:block}

/* ---------- Folding screens: two panes either side of the hinge, nothing under it ----------
   Side by side: the radio on the first screen, the station picker always open on the second.
   Top and bottom: the radio on the top screen, picker on the bottom. The menu opens as a drawer on the first screen. */
#modernApp.m-dual-h .m-shell{display:grid!important;grid-template-columns:var(--seg-first) var(--seg-hinge) minmax(0,1fr);grid-template-rows:100%}
#modernApp.m-dual-v .m-shell{display:grid!important;grid-template-rows:var(--seg-first) var(--seg-hinge) minmax(0,1fr);grid-template-columns:100%}
#modernApp.m-dual-h .m-central{grid-column:1;grid-row:1;height:100%;min-width:0}
#modernApp.m-dual-v .m-central{grid-row:1;grid-column:1;height:100%;min-height:0}
#modernApp.m-dual-h .m-browser,#modernApp.m-dual-v .m-browser{position:static!important;transform:none!important;width:auto!important;visibility:visible!important;pointer-events:auto!important;overflow:visible!important;box-shadow:none;min-height:0;min-width:0}
#modernApp.m-dual-h .m-browser{grid-column:3;grid-row:1;border-left:0}
#modernApp.m-dual-v .m-browser{grid-row:3;grid-column:1;border-left:0;border-top:1px solid var(--m-border)}
#modernApp.m-dual-h #mBrowserClose,#modernApp.m-dual-v #mBrowserClose,#modernApp.m-dual-h #mStationToggle,#modernApp.m-dual-v #mStationToggle{display:none}
#modernApp.m-dual-h .m-nav,#modernApp.m-dual-v .m-nav{position:absolute!important;inset:0 auto 0 0;width:min(270px,75%);z-index:31;transform:translateX(-101%);display:flex;align-items:stretch;padding:25px 16px}
#modernApp.m-dual-h .m-nav .m-brand span,#modernApp.m-dual-v .m-nav .m-brand span,#modernApp.m-dual-h .m-nav .m-navitem span,#modernApp.m-dual-v .m-nav .m-navitem span{display:inline}
#modernApp.m-dual-h .m-nav .m-navitem,#modernApp.m-dual-v .m-nav .m-navitem{width:auto;justify-content:flex-start;font-size:15px!important}
#modernApp.m-dual-h.m-nav-open .m-nav,#modernApp.m-dual-v.m-nav-open .m-nav{transform:translateX(0)}
#modernApp.m-dual-h #mNavToggle,#modernApp.m-dual-v #mNavToggle{display:inline-block}
#modernApp.m-dual-h .m-backdrop,#modernApp.m-dual-v .m-backdrop{position:absolute;inset:0;z-index:20;background:#040b15ad;display:none}
#modernApp.m-dual-h.m-nav-open .m-backdrop,#modernApp.m-dual-v.m-nav-open .m-backdrop{display:block}
@media(prefers-reduced-motion:reduce){#modernApp.m-rail .m-browser,#modernApp.m-dual-h .m-nav,#modernApp.m-dual-v .m-nav{transition:none}}

/* Narrow screens: the picker can't show all four columns, so the stations column fills what the genres column
   leaves (choosing a country slides to genres + stations), and station names show in full. */
@media(max-width:1049px){
  #modernApp .m-columns{container-type:inline-size}
  #modernApp .m-column-stations{width:clamp(244px,calc(100cqw - 155px),380px);min-width:0}
}
@media(max-width:620px){
  #modernApp .m-column-stations{width:clamp(228px,calc(100cqw - 145px),380px)}
}

/* Save to presets, under the station name: a clear tap target instead of a hidden long-press. */
#modernApp .m-save-preset{display:inline-flex;align-items:center;gap:4px;margin-top:8px;padding:5px 11px!important;border:1px solid #6f8ca4!important;border-radius:999px!important;background:#263c50!important;color:#e9f3fb!important;font-size:12px!important;font-weight:650}
#modernApp .m-save-preset:hover{background:#33506a!important}
#modernApp .m-save-preset.saved{border-color:#d4dce4!important;color:#fff!important}
#modernApp .m-save-preset[hidden]{display:none}
@media (pointer:coarse){#modernApp .m-save-preset{min-height:44px}}
#modernApp .m-preset.m-flash{animation:mFlash 1.1s ease}
@keyframes mFlash{0%,60%{box-shadow:0 0 0 3px #a6dfff;border-color:#a6dfff!important}}

/* Station rows: the logo slot is always the same size (logo, loading, or fallback icon), so names never shift. */
#modernApp .m-st-select>img,#modernApp .m-st-select>.m-fallback{flex:none;width:32px;height:32px;min-width:32px}
@media(max-width:1049px){#modernApp .m-st-select>img,#modernApp .m-st-select>.m-fallback{width:27px;height:27px;min-width:27px}}
