/* World radio tuner (src/globe/radio.js): a glass panel with an analog dial. Desktop: above the destination band;
   phones (body.m): full width above the bottom dock. */
#rdTuner{--rd:#ff6fd8;position:fixed;left:50%;bottom:84px;width:min(500px,calc(100vw - 28px));transform:translate(-50%,18px);padding:9px 12px 8px;z-index:5;
  opacity:0;pointer-events:none;transition:opacity .2s,transform .25s cubic-bezier(.2,.8,.2,1);user-select:none;-webkit-user-select:none}
#rdTuner.show{opacity:1;transform:translate(-50%,0);pointer-events:auto}
#rdTuner .rd-head{display:flex;align-items:center;gap:10px;margin:0 0 6px}
#rdTuner .rd-head b{font:700 12px/1 var(--display);letter-spacing:.18em;text-transform:uppercase;color:var(--rd)}
#rdTuner .rd-scan{flex:1;min-width:0;font:500 10px/1 var(--mono);letter-spacing:.08em;color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#rdTuner button{border:1px solid transparent;background:none;color:var(--dim);cursor:pointer;border-radius:8px}
#rdTuner button:hover{color:var(--ink);border-color:var(--edge-dim)}
#rdTuner button:focus-visible,#rdTuner .rd-dial:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
#rdTuner .rd-x{font-size:17px;line-height:1;padding:2px 7px;margin:-3px -5px -3px 0}

/* the dial window: station name riding the needle above, a scale of ticks below, station detents in the layer colour */
#rdTuner .rd-dial{position:relative;height:66px;border-radius:9px;border:1px solid var(--edge-dim);cursor:ew-resize;touch-action:none;overflow:hidden;
  background:linear-gradient(180deg,rgba(255,111,216,.05),rgba(0,0,0,.28) 60%),rgba(3,5,8,.55);box-shadow:inset 0 1px 10px rgba(0,0,0,.55)}
#rdTuner .rd-tag{position:absolute;top:6px;max-width:100%;padding:0 14px;white-space:nowrap;pointer-events:none}
#rdTuner .rd-tag b{display:block;font:900 17px/1.05 var(--display);letter-spacing:.05em;text-transform:uppercase;color:var(--ink);overflow:hidden;text-overflow:ellipsis;max-width:min(330px,72vw)}
#rdTuner .rd-tag small{display:block;font:500 10px/1.3 var(--mono);color:var(--dim);overflow:hidden;text-overflow:ellipsis;max-width:min(330px,72vw)}
#rdTuner .rd-scale{position:absolute;left:14px;right:14px;bottom:13px;height:15px;
  background:repeating-linear-gradient(90deg,rgba(139,155,171,.35) 0 1px,transparent 1px 8px) bottom/100% 6px no-repeat}
#rdTuner .rd-ticks{position:absolute;inset:0}
#rdTuner .rd-ticks i{position:absolute;bottom:0;width:2px;height:15px;margin-left:-1px;border-radius:1px;background:var(--rd);opacity:.55}
#rdTuner .rd-w,#rdTuner .rd-e{position:absolute;bottom:-12px;font:500 9px/1 var(--mono);letter-spacing:.06em;color:var(--faint,#738599)}
#rdTuner .rd-w{left:-6px} #rdTuner .rd-e{right:-6px}
#rdTuner .rd-needle{position:absolute;top:3px;bottom:3px;width:2px;margin-left:-1px;border-radius:1px;background:var(--accent);
  box-shadow:0 0 8px rgba(125,255,166,.75),0 0 2px rgba(125,255,166,.9);transition:left .18s cubic-bezier(.2,.8,.2,1);pointer-events:none}
#rdTuner .rd-needle::before{content:'';position:absolute;left:50%;bottom:-3px;width:10px;height:6px;margin-left:-5px;background:var(--accent);clip-path:polygon(50% 0,100% 100%,0 100%)}
#rdTuner .rd-dial.drag .rd-needle,#rdTuner .rd-dial.drag .rd-tag{transition:none}
#rdTuner .rd-tag{transition:left .18s cubic-bezier(.2,.8,.2,1),transform .18s cubic-bezier(.2,.8,.2,1)}

/* controls: previous, status lamp and line, play/stop, next */
#rdTuner .rd-ctl{display:flex;align-items:center;gap:6px;margin-top:6px}
#rdTuner .rd-step{min-width:32px;height:28px;font:500 18px/1 var(--body)}
#rdTuner .rd-play{min-width:38px;height:28px;font:600 13px/1 var(--mono);color:var(--rd);border-color:rgba(255,111,216,.3)!important}
#rdTuner .rd-led{flex:none;width:7px;height:7px;border-radius:50%;background:#3a4452;margin-left:2px}
#rdTuner[data-state="playing"] .rd-led{background:var(--rd);box-shadow:0 0 8px var(--rd)}
#rdTuner[data-state="loading"] .rd-led,#rdTuner[data-state="buffering"] .rd-led{background:#ffd45c;animation:rdBlink .7s steps(2) infinite}
#rdTuner[data-state="error"] .rd-led{background:#ff4d5e}
@keyframes rdBlink{50%{opacity:.25}}
#rdTuner .rd-status{flex:1;min-width:0;font:500 10.5px/1.2 var(--mono);color:var(--dim);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#rdTuner[data-state="playing"] .rd-status{color:var(--ink)}

/* make room: other panels in the same place */
body:has(#wx.show) #rdTuner{display:none}
body.lookup #rdTuner,body.embed #rdTuner{display:none!important}

/* phones: full width above the bottom dock; the card and toasts move up while the tuner is open */
body.m #rdTuner{left:10px;right:10px;width:auto;bottom:calc(76px + env(safe-area-inset-bottom,0px));transform:translateY(18px);padding:8px 10px 7px}
body.m #rdTuner.show{transform:none}
body.m #rdTuner .rd-step{min-width:42px;height:36px} body.m #rdTuner .rd-play{min-width:48px;height:36px}
body.m #rdTuner .rd-dial{height:70px}
body.m #dock.open ~ #rdTuner,body.m:has(#dock.open) #rdTuner,body.m:has(.m-sheet.show) #rdTuner{opacity:0;pointer-events:none}
body.m.rd-open #card{bottom:calc(244px + env(safe-area-inset-bottom,0px));max-height:calc(100dvh - 330px)}
body.m.rd-open #toast{bottom:calc(248px + env(safe-area-inset-bottom,0px))}
@media (prefers-reduced-motion:reduce){#rdTuner,#rdTuner .rd-needle,#rdTuner .rd-tag{transition:none}}
