@font-face {
  font-family: RadioNarrow;
  src: local('Bahnschrift Condensed'), local('Arial Narrow');
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #191919;
  --fg: #e5e3dc;
  --muted: #9c9c94;
  --line: #3b3b37;
  --edge: clamp(24px, 3.5vw, 70px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; min-height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: Arial, sans-serif; font-size: 14px; overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { color: inherit; cursor: pointer; border: 0; border-radius: 0; background: none; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 1px solid var(--fg); outline-offset: 5px; }
::selection { background: var(--fg); color: var(--bg); }
.micro { font: 400 10px/1.6 'Courier New', monospace; letter-spacing: .06em; }
.muted { color: var(--muted); }
.text-button { padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 40; top: 10px; left: var(--edge); transform: translateY(-160%); padding: 12px; background: var(--fg); color: var(--bg); }
.skip-link:focus { transform: none; }

.page-grain {
  position: fixed; inset: 0; z-index: 12; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23n)' opacity='.5' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}
.masthead { position: fixed; top: 32px; left: var(--edge); z-index: 5; }
.wordmark { display: grid; gap: 3px; width: 102px; font-family: RadioNarrow, 'Arial Narrow', monospace; font-size: 13px; }
.wordmark > span { display: flex; justify-content: space-between; letter-spacing: .16em; line-height: 1.05; }
.wordmark > span:last-child { font-size: 10px; }
.letter-turn { display: inline-block; animation: letter-turn 12s var(--ease) infinite; }
.letter-turn.reverse { animation-delay: -5s; }

.radio-stage, .art-stage { position: fixed; inset: 0; }
.art-stage { isolation: isolate; --pointer-x: 0px; --pointer-y: 0px; overflow: hidden; }
.sphere-wrap {
  position: absolute; left: 50%; top: 51%;
  width: min(138svh, 122vw); height: min(138svh, 122vw);
  transform: translate(calc(-50% + var(--pointer-x)), calc(-50% + var(--pointer-y)));
  transition: transform 1.8s var(--ease); will-change: transform;
}
.sphere-field, #particle-field { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#particle-field { opacity: .32; }
.corner { position: absolute; z-index: 2; width: 24px; height: 24px; opacity: .6; pointer-events: none; }
.top-left { left: calc(var(--edge) + 14px); top: 106px; border-top: 1px solid var(--muted); border-left: 1px solid var(--muted); }
.bottom-right { right: var(--edge); bottom: 80px; border-bottom: 1px solid var(--muted); border-right: 1px solid var(--muted); }
.art-coordinate { position: absolute; z-index: 2; right: var(--edge); top: 103px; display: flex; flex-direction: column; gap: 2px; color: var(--muted); pointer-events: none; }
.art-caption { position: absolute; right: var(--edge); bottom: 30px; color: var(--muted); pointer-events: none; }
.art-caption-right { font-size: 9px; }
.orbit-point { position: absolute; left: 50%; top: 51%; width: 2px; height: 2px; background: var(--fg); opacity: .25; animation: orbit 40s linear infinite; pointer-events: none; }

.side-rail {
  position: fixed; z-index: 4; right: calc(var(--edge) + 28px); top: 50%;
  width: clamp(86px, 7.4vw, 136px); transform: translateY(-50%);
  --reveal-opacity: .38; opacity: .38; transition: opacity .5s var(--ease);
}
.side-rail:hover, .side-rail:focus-within { opacity: .95; }
.station-status { display: flex; align-items: center; gap: 7px; margin-bottom: 20px; color: var(--muted); font-size: 9px; }
.status-dot { display: inline-block; width: 4px; height: 4px; border: 1px solid var(--muted); border-radius: 50%; }
.is-playing .status-dot { background: var(--fg); border-color: var(--fg); animation: status-breathe 2.2s ease infinite; }
.form-list { display: grid; }
.form-option { position: relative; display: grid; grid-template-columns: 19px 1fr; align-items: center; min-height: 76px; padding: 8px 0; border-bottom: 1px solid #ffffff0c; text-align: left; }
.form-option > .micro { align-self: start; padding-top: 6px; font-size: 9px; color: var(--muted); }
.form-thumbnail { display: block; width: 100%; height: 62px; opacity: .48; transition: opacity .4s, transform .7s var(--ease); }
.form-option.selected > .form-thumbnail, .form-option:hover > .form-thumbnail { opacity: .9; }
.form-option:hover > .form-thumbnail { transform: scale(1.08); }
.form-option.selected > .micro { color: var(--fg); }
.form-arrow { position: absolute; right: 0; top: 10px; font-size: 11px; opacity: 0; transition: opacity .3s; }
.form-option.selected > .form-arrow, .form-option:hover > .form-arrow { opacity: .8; }
.form-navigation { display: grid; grid-template-columns: 24px 1fr 24px; align-items: center; margin-top: 6px; }
.form-navigation button { min-height: 28px; padding: 0; color: var(--muted); font-size: 18px; }
.form-navigation button:hover { color: var(--fg); }
.form-navigation #forms-open { font-size: 9px; white-space: nowrap; }
.rail-actions { display: flex; justify-content: space-between; margin-top: 8px; }
.rail-actions button { display: grid; place-items: center; width: 32px; height: 40px; color: var(--muted); }
.rail-actions button:hover, .rail-actions button[aria-pressed=true] { color: var(--fg); }
.auto-button { font-size: 20px; }
.auto-button[aria-pressed=true] > span:first-child { animation: rotate 9s linear infinite; }
.motion-symbol { display: block; font-size: 20px; animation: rotate 18s linear infinite; }
.playlist-icon { width: 13px; height: 9px; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; position: relative; }
.playlist-icon:after { content: ''; position: absolute; top: 3px; left: 0; width: 9px; border-top: 1px solid currentColor; }

.player-bar { position: fixed; z-index: 5; left: var(--edge); bottom: 59px; display: flex; align-items: center; gap: 18px; height: 44px; }
.listen-button { display: flex; align-items: center; justify-content: flex-start; width: 44px; height: 44px; padding: 0; }
.play-icon { display: inline-block; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 10px solid var(--fg); transition: transform .3s var(--ease); }
.listen-button:hover .play-icon { transform: scale(1.2); }
.is-playing .play-icon { height: 13px; width: 10px; border: 0; border-left: 3px solid var(--fg); border-right: 3px solid var(--fg); }
.volume-control { width: 68px; opacity: 0; pointer-events: none; transition: opacity .35s; }
.player-bar:hover .volume-control, .player-bar:focus-within .volume-control { opacity: .7; pointer-events: auto; }
input[type=range] { appearance: none; width: 100%; height: 1px; margin: 10px 0; background: linear-gradient(to right,var(--fg) 70%,var(--line) 70%); cursor: pointer; }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 4px; height: 8px; background: var(--fg); border: 0; border-radius: 0; }
input[type=range]::-moz-range-thumb { width: 4px; height: 8px; background: var(--fg); border: 0; border-radius: 0; }
.now-playing { display: none; min-width: 0; max-width: min(35vw, 380px); }
.has-tracks .now-playing { display: block; }
.now-playing p { margin: 0; font: 10px/1.6 'Courier New', monospace; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signal-strip { position: fixed; z-index: 2; bottom: 0; left: var(--edge); right: var(--edge); height: 42px; display: grid; grid-template-columns: 120px 1fr 16%; align-items: center; pointer-events: none; }
.signal-label { font-size: 8px; }
.signal-label > span { font-size: 7px; color: var(--muted); }
#signal-canvas { display: block; width: 100%; height: 36px; opacity: .15; }
.signal-index { display: none; }

dialog { color: var(--fg); background: var(--bg); border: 1px solid var(--line); padding: 30px; overflow-y: auto; }
dialog::backdrop { background: #080808b8; }
dialog[open] { animation: dialog-in .5s var(--ease); }
.side-dialog { position: fixed; left: auto; right: 24px; top: 24px; bottom: 24px; margin: 0; width: min(510px, calc(100% - 48px)); max-height: none; display: none; }
.side-dialog[open] { display: flex; flex-direction: column; }
.dialog-top { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 9px; }
.close-dialog { font-size: 10px; }
.side-dialog h2 { font-family: RadioNarrow, 'Arial Narrow', Arial, sans-serif; font-size: 48px; font-weight: 400; letter-spacing: -.04em; line-height: 1.05; margin: 50px 0 24px; }
.dialog-copy { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 0 0 30px; }
.file-picker { display: flex; justify-content: space-between; font: 11px/1.6 'Courier New',monospace; cursor: pointer; border: 1px solid var(--line); padding: 20px; transition: background .3s,color .3s; }
.file-picker:hover { background: var(--fg); color: var(--bg); }
.source-note { font-size: 9px; margin: 14px 0 35px; }
.queue { list-style: none; padding: 0; margin: 0 0 35px; overflow: auto; flex: 1; }
.queue li { border-top: 1px solid var(--line); }
.queue .empty-queue { font-size: 12px; color: var(--muted); padding-top: 24px; }
.queue button { width: 100%; padding: 17px 0; text-align: left; display: grid; grid-template-columns: 35px minmax(0,1fr) 20px; gap: 5px; color: var(--muted); font-size: 12px; }
.queue button span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue button.is-current, .queue button:hover { color: var(--fg); }
.dialog-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 20px; display: flex; justify-content: space-between; font-size: 8px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%,20px); padding: 15px 24px; background: var(--fg); color: var(--bg); opacity: 0; pointer-events: none; z-index: 25; transition: opacity .3s,transform .3s; max-width: 90vw; }
.toast.visible { opacity: 1; transform: translate(-50%,0); }

.forms-dialog { width: min(880px, calc(100% - 48px)); max-height: calc(100svh - 48px); padding: 28px; }
.forms-dialog h2 { font: inherit; margin: 0; color: var(--fg); }
.form-gallery { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.gallery-form { min-width: 0; padding: 4px 6px 10px; border: 1px solid transparent; transition: border-color .3s, background .3s; }
.gallery-form:hover { background: #ffffff04; }
.gallery-form[aria-pressed=true] { border-color: #e5e3dc55; }
.gallery-form canvas { display: block; width: 100%; height: 110px; }
.gallery-caption { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 8px; color: var(--muted); text-align: right; }
.gallery-caption > span:first-child { color: var(--fg); }
.gallery-form[aria-pressed=true] .gallery-caption { color: var(--fg); }

.reveal { animation: reveal .9s var(--ease) backwards; }
.art-stage { animation-delay: .1s; }
.side-rail, .player-bar, .signal-strip { animation-delay: .3s; }
/* Keep the field's own scale and the rail's centering out of entrance motion. */
@keyframes reveal { from { opacity: 0; } to { opacity: var(--reveal-opacity, 1); } }
@keyframes letter-turn { 0%,70%,100% { transform: rotateY(0) rotate(0); } 77%,88% { transform: rotateY(180deg) rotate(180deg); } }
@keyframes rotate { to { transform: rotate(360deg); } }
@keyframes orbit { from { transform: rotate(0) translateX(min(42svh,35vw)); } to { transform: rotate(360deg) translateX(min(42svh,35vw)); } }
@keyframes status-breathe { 50% { opacity: .3; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(25px); } to { opacity: 1; transform: translateY(0); } }
body.motion-off *, body.motion-off *:before, body.motion-off *:after { animation: none !important; transition: none !important; }
body.motion-off .sphere-wrap { transform: translate(-50%,-50%); }
body.motion-off .orbit-point { display: none; }

@media (min-width:701px) and (max-width:1100px) {
  .sphere-wrap { left: 46%; }
  .side-rail { right: var(--edge); width: 78px; }
  .form-option { grid-template-columns: 14px 1fr; min-height: 64px; }
  .form-thumbnail { height: 52px; }
  .rail-actions button { width: 26px; }
}
@media (max-width:700px) {
  :root { --edge: 24px; }
  .masthead { top: 26px; }
  .wordmark { width: 82px; font-size: 11px; }
  .wordmark > span:last-child { font-size: 9px; }
  .sphere-wrap { width: 145vw; height: 145vw; left: 48%; top: 45%; }
  .top-left { left: var(--edge); top: 100px; width: 16px; height: 16px; }
  .art-coordinate { top: 98px; font-size: 8px; }
  .bottom-right { bottom: 77px; width: 16px; height: 16px; }
  .art-caption { bottom: 26px; }
  .art-caption-right { font-size: 7px; }
  .side-rail { top: auto; bottom: 115px; right: var(--edge); transform: none; width: 126px; opacity: .48; }
  .station-status { font-size: 8px; margin-bottom: 6px; }
  .form-list { grid-template-columns: repeat(3,1fr); }
  .form-option { min-height: 44px; display: block; padding: 0; }
  .form-option > .micro { position: absolute; left: 0; top: 0; font-size: 7px; padding: 0; }
  .form-thumbnail { height: 42px; }
  .form-arrow { display: none; }
  .rail-actions { margin-top: 2px; }
  .rail-actions button { height: 34px; width: 36px; }
  .motion-symbol { font-size: 18px; }
  .player-bar { bottom: 57px; gap: 12px; }
  .now-playing { position: fixed; left: var(--edge); bottom: 104px; max-width: 52vw; }
  .now-playing p { font-size: 9px; }
  .signal-strip { grid-template-columns: 64px 1fr 30%; height: 37px; }
  .signal-label { font-size: 7px; }
  .signal-label > span { font-size: 6px; }
  .side-dialog { right: 10px; top: 10px; bottom: 10px; width: calc(100% - 20px); padding: 24px; }
  .dialog-copy { font-size: 12px; }
  .dialog-foot { font-size: 7px; }
  .forms-dialog { width: calc(100% - 24px); max-height: calc(100svh - 24px); padding: 18px; }
  .form-gallery { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 18px; }
  .gallery-form { padding: 2px 3px 7px; }
  .gallery-form canvas { height: 74px; }
  .gallery-caption { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 7px; text-align: left; }
}
@media (max-height:550px) and (min-width:701px) {
  .masthead { top: 20px; }
  .top-left, .art-coordinate { top: 80px; }
  .station-status { margin-bottom: 6px; }
  .form-option { min-height: 50px; }
  .form-thumbnail { height: 44px; }
}
@media (prefers-reduced-motion:reduce) {
  body:not(.motion-on) *, body:not(.motion-on) *:before, body:not(.motion-on) *:after { animation: none !important; transition: none !important; }
  body:not(.motion-on) .sphere-wrap { transform: translate(-50%,-50%); }
  body:not(.motion-on) .orbit-point { display: none; }
}
