/* Radio A Link — stile condiviso, mobile-first. Palette e font dal sito radioa.it */
/* font del sito Radio A, ospitati qui (niente richieste a Google: meglio per il GDPR) */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-display: swap; font-weight: 200 800; src: url(../fonts/bricolage-grotesque-latin-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-display: swap; font-weight: 200 800; src: url(../fonts/bricolage-grotesque-latin-ext-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-display: swap; font-weight: 400 700; src: url(../fonts/instrument-sans-latin-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Sans"; font-style: normal; font-display: swap; font-weight: 400 700; src: url(../fonts/instrument-sans-latin-ext-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
  /* brand Radio A */
  --verde: #016349; --verde-deep: #014a37; --verde-ink: #002b20; --verde-night: #001d15;
  --golfo: #0b5d74; --golfo-deep: #073f4f;
  --ginestra: #f2c230; --ginestra-soft: #fbe9a6;
  --ardesia: #18222c; --calce: #f6f7f4; --pietra: #e3e8e4;
  --live: #ff5a3c;

  --bg: var(--verde-ink);
  --card: rgba(0, 20, 14, .42); --card-solid: #01382a;
  --field: rgba(0, 0, 0, .28);
  --line: rgba(246, 247, 244, .09); --line2: rgba(246, 247, 244, .18);
  --fg: var(--calce); --mute: rgba(246, 247, 244, .66); --dim: rgba(246, 247, 244, .45);
  --ok: #5fd39a; --warn: var(--ginestra); --err: var(--live);
  --meter-bg: rgba(0, 0, 0, .45); --meter-lo: #5fd39a; --meter-mid: #f2c230; --meter-hi: #ff5a3c; --meter-peak: #f6f7f4; --meter-tick: rgba(255,255,255,.07);
  --radius: 18px; --tap: 44px;
  --font-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", sans-serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
@property --wave { syntax: "<length>"; inherits: false; initial-value: 0px; }
@keyframes radioa-waves { from { --wave: 0px; } to { --wave: 45px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--verde-night); }
body {
  margin: 0; min-height: 100dvh; color: var(--fg); font: 15px/1.5 var(--font-body);
  background: radial-gradient(120% 70rem at 80% -10%, var(--verde) 0%, var(--verde-deep) 38%, var(--verde-ink) 75%, var(--verde-night) 100%) no-repeat var(--verde-night);
  -webkit-font-smoothing: antialiased; isolation: isolate;
}
/* i cerchi: onde concentriche come sul sito, animate quando si è in onda */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: repeating-radial-gradient(circle at center, transparent 0 var(--wave), rgba(255,255,255,.07) var(--wave) calc(var(--wave) + 1px), transparent calc(var(--wave) + 1px) 46px);
  mask-image: radial-gradient(circle, #000 30%, transparent 70%); -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 70%);
}
body::before { width: max(80vw, 640px); right: -22vw; top: -30vw; }
body::after { width: max(52vw, 420px); left: -26vw; top: 45%; opacity: .8; }
body.is-live::before { animation: radioa-waves 5s linear infinite; background: repeating-radial-gradient(circle at center, transparent 0 var(--wave), rgba(255,255,255,.12) var(--wave) calc(var(--wave) + 1.5px), transparent calc(var(--wave) + 1.5px) 46px); }
body.is-live::after { animation: radioa-waves 5s linear -2.5s infinite; }

[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
h1, h2, h3, .display { font-family: var(--font-display); }
h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); line-height: 1.1; margin: .3em 0 .7em; font-weight: 800; letter-spacing: -.015em; }
h2 { font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ginestra); margin: 0 0 .8em; font-weight: 700; font-family: var(--font-body); }
h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
small { color: var(--mute); font-weight: 400; }
code { font-family: var(--mono); background: var(--field); padding: 2px 8px; border-radius: 99px; }
a { color: var(--ginestra); }

/* ---------- logo ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.logo { flex: none; width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.logo img { width: 74%; height: 74%; object-fit: contain; transform: translateY(-1px); }
.brand-txt { display: grid; line-height: 1.05; }
.brand-txt b { font: 800 1rem var(--font-display); letter-spacing: .02em; }
.brand-txt span { font-size: .72rem; color: var(--mute); }
.brand-txt em { font-style: normal; color: var(--ginestra); }
.logo.xl { width: 96px; height: 96px; margin: 0 auto 8px; box-shadow: 0 0 0 10px rgba(255,255,255,.06), 0 0 0 22px rgba(255,255,255,.035), 0 8px 30px rgba(0,0,0,.3); }

/* ---------- form ---------- */
label { display: block; font-size: .85rem; color: var(--mute); margin: 0 0 .85rem; }
label small { display: block; font-size: .78rem; color: var(--dim); }
input, select, button, textarea { font: inherit; color: inherit; }
input[type=text], input:not([type]), input[type=password], select, textarea {
  display: block; width: 100%; margin-top: 5px; min-height: var(--tap);
  background: var(--field); border: 1px solid var(--line2); border-radius: 12px; padding: 9px 14px;
  font-size: 16px; /* niente zoom automatico su iOS */
}
select option { background: var(--card-solid); }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--ginestra); outline-offset: 2px; }
button {
  white-space: nowrap; min-height: var(--tap); padding: 0 18px; border-radius: 999px; border: 1px solid var(--line2);
  background: rgba(255,255,255,.08); cursor: pointer; font-weight: 600; touch-action: manipulation; transition: background .15s, transform .1s;
}
button:hover { background: rgba(255,255,255,.14); }
button:active { transform: scale(.98); }
button:disabled { opacity: .5; cursor: default; }
button.primary { width: 100%; background: var(--ginestra); color: var(--ardesia); border-color: transparent; font-size: 1.05rem; font-weight: 700; min-height: 54px; }
button.primary:hover { background: #ffd34d; }
button.ghost { background: transparent; }
button.icon { min-height: 36px; min-width: 36px; padding: 0; font-size: 1.3rem; line-height: 1; background: transparent; border-color: transparent; color: var(--mute); }
button.toggle[aria-pressed=true] { background: rgba(95, 211, 154, .16); border-color: rgba(95, 211, 154, .5); color: #c9f5de; }
button.mute[aria-pressed=true], #muteBtn[aria-pressed=true] { background: rgba(255, 90, 60, .2); border-color: rgba(255, 90, 60, .6); color: #ffd2c9; }
.check, .checks label { display: inline-flex; align-items: center; gap: 8px; color: var(--fg); min-height: 36px; margin: 0 14px 0 0; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--ginestra); margin: 0; }
.err { color: #ffb4a6; min-height: 1.2em; margin: .6em 0 0; }
.hint { color: var(--dim); font-size: .8rem; margin: .6em 0 0; }

.row { display: grid; grid-template-columns: 4.8em 1fr 3.4em; align-items: center; gap: 10px; margin: 0 0 .5rem; color: var(--fg); }
.row output { text-align: right; color: var(--mute); font-size: .85rem; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; margin: 0; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; background: rgba(255,255,255,.16); border-radius: 3px; }
input[type=range]::-moz-range-track { height: 6px; background: rgba(255,255,255,.16); border-radius: 3px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: var(--ginestra); border: 3px solid var(--verde-ink); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--ginestra); border: 3px solid var(--verde-ink); }

/* ---------- pill / stato ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: var(--field); color: var(--mute); border: 1px solid var(--line); white-space: nowrap; }
.pill:empty { display: none; }
.pill.ok { color: var(--ok); border-color: rgba(95,211,154,.4); }
.pill.warn { color: var(--ginestra); border-color: rgba(242,194,48,.4); }
.pill.err { color: var(--live); border-color: rgba(255,90,60,.45); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.warn { background: var(--ginestra); animation: blink 1.2s infinite; }
.dot.err { background: var(--live); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(255,90,60,.6); animation: livepulse 1.6s infinite; }
@keyframes blink { 50% { opacity: .35; } }
@keyframes livepulse { 70% { box-shadow: 0 0 0 8px rgba(255,90,60,0); } 100% { box-shadow: 0 0 0 0 rgba(255,90,60,0); } }

/* ---------- meter ---------- */
.meter { display: block; width: 100%; height: 12px; border-radius: 99px; background: var(--meter-bg); }
.mrow { display: grid; grid-template-columns: 2.6em 1fr; align-items: center; gap: 8px; margin: 7px 0; }
.ml { font: 700 .68rem var(--mono); color: var(--mute); letter-spacing: .04em; }
.panel > .meter { margin: 4px 0 10px; }

/* ---------- ritardo ---------- */
.lat { margin: 10px 0 6px; }
.lat .big { font: 800 2.3rem/1 var(--font-display); letter-spacing: -.02em; color: var(--ok); }
.lat .big small { font: 600 .9rem var(--font-body); margin-left: 4px; color: var(--mute); }
.lat.warn .big { color: var(--ginestra); } .lat.err .big { color: var(--live); }
.latsub { font-size: .78rem; color: var(--mute); margin-top: 4px; }
.latsub b { color: var(--fg); font-weight: 600; }

/* ---------- card / login ---------- */
.card { width: 100%; max-width: 480px; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 22px 18px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px; }
.login .card { text-align: left; }
.login .hero { text-align: center; margin-bottom: 14px; }
.login .hero h1 { margin-bottom: .2em; }
.login .hero p { margin: 0; color: var(--mute); }
.choice { border: 0; padding: 0; margin: 0 0 1rem; }
.choice legend { font-size: .85rem; color: var(--mute); margin-bottom: 6px; }
.choice label { display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin: 0 0 8px; border: 1px solid var(--line2); border-radius: 14px; color: var(--fg); cursor: pointer; background: var(--field); }
.choice label:has(input:checked) { border-color: var(--ginestra); background: rgba(242,194,48,.1); }
.choice span { display: grid; }
.choice small { font-size: .78rem; }

/* ---------- ospite ---------- */
.guest .live { display: grid; gap: 14px; justify-items: center; padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)); }
.guest .live .card { display: grid; gap: 6px; }
.g-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.status { display: flex; align-items: center; gap: 10px; font-weight: 600; padding: 12px 14px; border-radius: 14px; background: var(--field); margin: 10px 0 4px; }
.status.ok { background: rgba(95,211,154,.13); color: #d4f7e4; } .status.ok .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status.warn .dot { background: var(--ginestra); animation: blink 1.2s infinite; }
.status.err { background: rgba(255,90,60,.15); color: #ffd2c9; } .status.err .dot { background: var(--live); }
.big-lat { text-align: center; padding: 6px 0; } .big-lat .big { font-size: 3.2rem; }
.btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.btns.three { grid-template-columns: repeat(3, 1fr); }
.big-btn { min-height: 56px; font-size: .95rem; padding: 0 10px; border-radius: 16px; display: grid; place-items: center; gap: 2px; white-space: normal; line-height: 1.15; }
.big-btn svg { width: 22px; height: 22px; }
.guest .meter { height: 16px; }
#leaveBtn { margin-top: 10px; color: var(--mute); }
.chat-jump { position: relative; min-height: 38px; padding: 0 14px; font-size: .85rem; }

/* ---------- video ---------- */
.vid { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 16 / 9; margin: 8px 0; }
.vid video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.vid.mirror video { transform: scaleX(-1); }
.vid .vbadge { position: absolute; left: 8px; bottom: 8px; font-size: .72rem; }
.vid .vbtn { position: absolute; right: 8px; bottom: 8px; min-height: 36px; padding: 0 12px; background: rgba(0,0,0,.55); border-color: transparent; font-size: .8rem; }
.vid.paused video { filter: grayscale(1) brightness(.45); }
.vid .vmsg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; font-size: .85rem; color: #fff; text-shadow: 0 1px 4px #000; pointer-events: none; }
.vid:fullscreen { border-radius: 0; } .vid:fullscreen video { object-fit: contain; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-log { list-style: none; margin: 0; padding: 4px 2px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; min-height: 120px; max-height: 340px; scroll-behavior: smooth; }
.chat-log li { max-width: 88%; align-self: flex-start; background: rgba(255,255,255,.08); border-radius: 16px 16px 16px 4px; padding: 7px 12px 8px; overflow-wrap: anywhere; }
.chat-log li.me { align-self: flex-end; background: rgba(242,194,48,.18); border-radius: 16px 16px 4px 16px; }
.chat-log li.regia:not(.me) { background: rgba(11,93,116,.55); }
.chat-log .who { display: flex; gap: 8px; align-items: baseline; font-size: .72rem; color: var(--mute); margin-bottom: 1px; }
.chat-log .who b { color: var(--fg); font-weight: 700; }
.chat-log li.regia .who b { color: var(--ginestra); }
.chat-log .sys { align-self: center; background: none; color: var(--dim); font-size: .75rem; padding: 0; }
.chat-empty { color: var(--dim); font-size: .85rem; text-align: center; margin: auto; }
.chat-form { display: flex; gap: 8px; margin-top: 10px; }
.chat-form input { margin: 0; border-radius: 999px; }
.chat-form button { flex: none; background: var(--ginestra); color: var(--ardesia); border-color: transparent; padding: 0 16px; }
.badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--live); color: #fff; font: 700 .7rem/20px var(--font-body); text-align: center; }
.badge:empty { display: none; }

/* ---------- dettagli ---------- */
details.adv { border-top: 1px solid var(--line); padding: 4px 0; }
details.adv summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; color: var(--mute); font-size: .85rem; font-weight: 600; list-style: none; }
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: "▸"; margin-right: 8px; transition: transform .15s; color: var(--ginestra); }
details.adv[open] summary::before { transform: rotate(90deg); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.checks { display: flex; flex-wrap: wrap; margin-bottom: 8px; }
.dspread { font-size: .8rem; color: var(--mute); margin: 6px 0; } .dspread b { color: var(--fg); font-weight: 600; }
.eqbars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.eqbars div { display: grid; gap: 4px; justify-items: center; font-size: .68rem; color: var(--mute); }
.eqbars i { position: relative; display: block; width: 100%; height: 40px; background: var(--meter-bg); border-radius: 8px; overflow: hidden; }
.eqbars i::after { content: ""; position: absolute; left: 25%; right: 25%; top: var(--top, 50%); height: var(--h, 0%); background: var(--ginestra); border-radius: 2px; }
.eqbars i::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line2); }
.stats { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .72rem; color: var(--dim); }

/* ---------- regia ---------- */
.studio main { min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(0, 32, 24, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar .room { font-size: .85rem; color: var(--mute); }
.topbar .link { display: flex; gap: 6px; flex: 1 1 100%; order: 3; min-width: 0; }
.topbar .link input { margin: 0; min-width: 0; font-family: var(--mono); font-size: 14px; border-radius: 999px; }
.topbar .link button { background: var(--ginestra); color: var(--ardesia); border-color: transparent; }
.topbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.layout { display: flex; flex-direction: column; gap: 14px; padding: 14px; }
.guests { order: -1; display: grid; gap: 14px; align-content: start; }
.side { display: grid; gap: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.panel label:last-child { margin-bottom: 0; }
.empty { border: 1px dashed var(--line2); border-radius: var(--radius); padding: 34px 18px; text-align: center; color: var(--mute); background: rgba(0,0,0,.12); }
.empty p { margin: .3em 0; }
.empty .logo { margin: 0 auto 12px; }
.strip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.strip.talking { border-color: rgba(242,194,48,.55); box-shadow: 0 0 0 1px rgba(242,194,48,.25) inset; }
.strip header { display: flex; align-items: center; gap: 8px; }
.strip .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip .ctl { margin-top: 8px; }
.rec-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.rec-btn { min-width: 112px; font-family: var(--mono); background: rgba(255,90,60,.15); border-color: rgba(255,90,60,.5); color: #ffc4b8; }
.rec-btn.on { background: var(--live); color: #fff; border-color: transparent; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255,90,60,.2); } }
#recTime { font: 700 1.35rem var(--mono); }
.files { list-style: none; padding: 0; margin: 10px 0 0; font: .75rem var(--mono); color: var(--mute); display: grid; gap: 4px; word-break: break-all; }
.files li.live::before { content: "● "; color: var(--live); }
.files a { color: var(--fg); }
.chat-fab { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 6; width: 56px; height: 56px; padding: 0; border-radius: 50%; background: var(--ginestra); color: var(--ardesia); border: 0; box-shadow: 0 8px 24px rgba(0,0,0,.35); display: grid; place-items: center; }
.chat-fab svg { width: 26px; height: 26px; }

/* tablet e desktop */
@media (min-width: 720px) {
  .topbar .link { flex: 1 1 360px; order: 0; max-width: 620px; }
  .guests { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
  .card { padding: 28px; }
}
@media (min-width: 1000px) {
  .layout { display: grid; grid-template-columns: 320px 1fr; align-items: start; padding: 18px; gap: 18px; }
  .guests { order: 0; }
  .side { position: sticky; top: 78px; max-height: calc(100dvh - 96px); overflow: auto; scrollbar-width: thin; }
  .chat-fab { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, body::before, body::after { animation: none !important; transition: none !important; } }
