/* Builder chrome for /onair only.
   Every rule is scoped to body.onair-builder so that share.html — which loads
   the same onair.css for the neon sign itself — is completely unaffected.
   The sign classes (.on-air-sign, .radio-name, .second-line, #customsign) are
   deliberately left alone: that artwork is the product. */

/* onair.css predates any reset, so width:100% + padding overflowed every field.
   Applied to the chrome only - a blanket reset would also re-measure the sign
   itself (width:300px + padding + border), making this preview disagree with the
   real share page. */
body.onair-builder .oa-wrap,
body.onair-builder .oa-card,
body.onair-builder .oa-stage,
body.onair-builder .input-container input,
body.onair-builder #embedCode,
body.onair-builder #copyButton,
body.onair-builder #shareButton {
  box-sizing: border-box;
}

body.onair-builder {
  --oa-ink: #06070d;
  --oa-text: #f5f6fa;
  --oa-muted: #99a1b3;
  --oa-line: rgba(255, 255, 255, 0.10);
  --oa-surface: rgba(255, 255, 255, 0.045);
  --oa-red: #ff2d55;
  --oa-orange: #ff7a3d;
  --oa-violet: #a78bfa;

  display: block;
  padding: 0;
  margin: 0;
  background: var(--oa-ink);
  color: var(--oa-text);
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Two soft light sources — the vibrancy comes from these, not from the cards. */
body.onair-builder::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 460px at 12% -8%, rgba(255, 45, 85, 0.22), transparent 62%),
    radial-gradient(680px 420px at 92% 6%, rgba(167, 139, 250, 0.18), transparent 60%),
    radial-gradient(900px 600px at 50% 108%, rgba(255, 122, 61, 0.10), transparent 70%);
}

body.onair-builder > * {
  position: relative;
  z-index: 1;
}

.oa-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------------------------------------------------------- hero ---- */

.oa-hero {
  text-align: center;
  padding: 72px 0 8px;
}

.oa-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border: 1px solid rgba(255, 45, 85, 0.35);
  border-radius: 999px;
  background: rgba(255, 45, 85, 0.10);
  color: #ffb3c2;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.oa-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--oa-red);
  box-shadow: 0 0 8px var(--oa-red), 0 0 16px var(--oa-red);
  animation: oaPulse 1.6s ease-in-out infinite;
}

@keyframes oaPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

body.onair-builder h1.oa-title {
  margin: 22px 0 0;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: #fff;
}

.oa-title em {
  font-style: normal;
  background: linear-gradient(100deg, var(--oa-red), var(--oa-orange) 55%, #ffd166);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 44px rgba(255, 45, 85, 0.35);
}

.oa-sub {
  margin: 16px auto 0;
  max-width: 620px;
  color: var(--oa-muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

/* --------------------------------------------------------------- cards ---- */

.oa-card {
  background: var(--oa-surface);
  border: 1px solid var(--oa-line);
  border-radius: 20px;
  padding: 28px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.oa-step {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 20px;
  color: var(--oa-text);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.oa-step span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--oa-red), var(--oa-orange));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(255, 45, 85, 0.35);
}

/* --------------------------------------------------------------- inputs --- */

.oa-form { margin-top: 40px; padding-bottom: 22px; }

body.onair-builder .input-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  width: 100%;
  max-width: none;
  margin: 0;
}

.oa-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.oa-field label {
  color: var(--oa-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.onair-builder .input-container input {
  width: 100%;
  max-width: none;
  flex: none;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

body.onair-builder .input-container input::placeholder {
  color: #6b7280;
}

body.onair-builder .input-container input:focus {
  border-color: rgba(255, 45, 85, 0.65);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 45, 85, 0.14);
}

body.onair-builder .warning-message {
  padding: 0;
  margin: 12px 0 0;
  color: #ff8fa3;
  font-size: 0.85rem;
  min-height: 1.1em;
}

/* --------------------------------------------------------------- layout --- */

.oa-columns {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 26px;
  align-items: stretch;
  margin-top: 26px;
}

/* The preview panel: a dark stage so the neon reads as light, not as decoration. */
.oa-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  min-height: 430px;
  padding: 44px 28px;
  border: 1px solid var(--oa-line);
  border-radius: 20px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 45, 85, 0.10), transparent 65%),
    linear-gradient(180deg, #0b0d15, #050609);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 24px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

body.onair-builder #customsign {
  background: transparent;
}

.oa-hint {
  margin: 0;
  color: var(--oa-muted);
  font-size: 0.82rem;
  text-align: center;
}

.oa-share {
  display: flex;
  flex-direction: column;
}

body.onair-builder .embed-container {
  display: block;
  width: 100%;
  margin: 0;
}

body.onair-builder #embedCode {
  display: block;
  width: 100%;
  height: 116px;
  padding: 14px 16px;
  margin: 0 0 14px;
  border: 1px solid var(--oa-line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.42);
  color: #cbd5e1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

body.onair-builder #embedCode:focus {
  border-color: rgba(167, 139, 250, 0.55);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.14);
}

.oa-divider {
  height: 1px;
  margin: 24px 0;
  background: linear-gradient(90deg, transparent, var(--oa-line), transparent);
}

body.onair-builder .embedinstructions,
body.onair-builder .introinstructions {
  margin: 0 0 8px;
  color: var(--oa-muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* -------------------------------------------------------------- buttons --- */

body.onair-builder #copyButton,
body.onair-builder #shareButton {
  display: block;
  width: 100%;
  margin: 0;
  padding: 15px 22px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

body.onair-builder #copyButton {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--oa-line);
  color: var(--oa-text);
}

body.onair-builder #copyButton:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

body.onair-builder #shareButton {
  background: linear-gradient(135deg, var(--oa-red), var(--oa-orange));
  color: #fff;
  box-shadow: 0 12px 30px rgba(255, 45, 85, 0.32);
}

body.onair-builder #shareButton:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(255, 45, 85, 0.42);
  filter: saturate(1.08);
}

body.onair-builder #copyButton:active,
body.onair-builder #shareButton:active {
  transform: translateY(0);
}

body.onair-builder #copyButton:disabled,
body.onair-builder #shareButton:disabled {
  cursor: default;
  transform: none;
}

/* --------------------------------------------------------------- footer --- */

/* The old page centred the footer as a flex item, so it sat in a narrow column
   with black either side. Full width, and given room to breathe. */
body.onair-builder .jmf-footer {
  width: 100%;
  margin-top: 120px;
}

/* ----------------------------------------------------------- responsive --- */

@media (max-width: 900px) {
  .oa-columns { grid-template-columns: 1fr; }
  .oa-hero { padding-top: 52px; }
  body.onair-builder .input-container { grid-template-columns: 1fr; }
  .oa-stage { min-height: 0; padding: 36px 20px; }
  body.onair-builder .jmf-footer { margin-top: 80px; }
}

@media (max-width: 560px) {
  .oa-wrap { padding: 0 16px; }
  .oa-card { padding: 20px; border-radius: 16px; }
  .oa-stage { padding: 30px 14px; }

  /* Scale the artwork down rather than let a fixed 350px sign overflow the
     viewport. Builder-scoped: the standalone share page keeps full size. */
  body.onair-builder #customsign .on-air-sign {
    width: 224px;
    padding: 16px;
    font-size: 34px;
  }
  body.onair-builder #customsign .radio-name { font-size: 23px; margin-bottom: 20px; }
  body.onair-builder #customsign .second-line { font-size: 16px; }
}

/* The shared sign carries generous margins for the standalone share page; inside
   the preview stage they leave the artwork floating. Scoped, so share.html keeps
   the original spacing. */
body.onair-builder #customsign .radio-name { margin-bottom: 26px; }
body.onair-builder #customsign .on-air-sign { margin-bottom: 28px; }
body.onair-builder #customsign .second-line { margin-top: 4px; }

/* ----------------------------------------------- stream field + tester --- */

/* The test button sits on its own line under the input rather than clipped to
   its right edge: at three-across the field is too narrow to share, and the
   button is a real action (it starts audio), not an input adornment. */
.oa-stream-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 12px;
}

body.onair-builder #testStreamButton {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(167, 139, 250, 0.42);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.20), rgba(167, 139, 250, 0.07));
  color: #ddd2ff;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.18s, background 0.2s;
}

body.onair-builder #testStreamButton:hover {
  border-color: rgba(167, 139, 250, 0.85);
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.32), rgba(167, 139, 250, 0.12));
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(167, 139, 250, 0.22);
}

body.onair-builder #testStreamButton:active { transform: translateY(0); }

body.onair-builder #testStreamButton:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.25);
}

.oa-ico {
  width: 13px;
  height: 13px;
  flex: none;
  fill: currentColor;
}

/* One icon at a time: play by default, square while a stream is running,
   spinner while we are still waiting for the first audio. */
.oa-ico-stop,
.oa-ico-wait { display: none; }

#testStreamButton.is-playing .oa-ico-play,
#testStreamButton.is-busy .oa-ico-play { display: none; }
#testStreamButton.is-playing .oa-ico-stop { display: block; }
#testStreamButton.is-busy .oa-ico-wait {
  display: block;
  animation: oaSpin 0.9s linear infinite;
}

@keyframes oaSpin { to { transform: rotate(360deg); } }

body.onair-builder #testStreamButton.is-busy { cursor: progress; }

body.onair-builder #testStreamButton.is-playing {
  border-color: rgba(74, 222, 128, 0.55);
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.22), rgba(74, 222, 128, 0.07));
  color: #bbf7d0;
}

/* Sits beside the button while it fits, wraps under it when it does not. */
.oa-test-result {
  margin: 0;
  flex: 1 1 190px;
  min-width: 0;
  font-size: 0.72rem;
  line-height: 1.45;
}

.oa-test-result:empty { display: none; }
.oa-test-result.is-busy { color: #fcd34d; }
.oa-test-result.is-warn { color: #fbbf24; }
.oa-test-result.is-ok   { color: #4ade80; }
.oa-test-result.is-bad  { color: #ff8fa3; }

.oa-field-note {
  margin: 12px 0 0;
  color: var(--oa-muted);
  font-size: 0.7rem;
  line-height: 1.6;
}

.oa-field-note strong { color: #cbd5e1; font-weight: 600; }

.oa-field-note code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
}

/* The https requirement gets its own amber line: it is the one rule a user
   cannot work around by editing the URL, only by asking their host. */
.oa-note-https {
  position: relative;
  margin: 8px 0 0;
  padding: 8px 11px 8px 30px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 9px;
  background: rgba(251, 191, 36, 0.07);
  color: #d9be8a;
  font-size: 0.68rem;
  line-height: 1.55;
}

.oa-note-https::before {
  content: '\26A0';
  position: absolute;
  left: 10px;
  top: 8px;
  color: #fbbf24;
  font-size: 0.8rem;
  line-height: 1.4;
}

.oa-note-https strong { color: #fcd34d; font-weight: 600; }

.oa-note-https code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  color: #fde68a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.64rem;
}

/* Still clickable — the click is what opens the explanation modal. */
body.onair-builder #copyButton.oa-locked,
body.onair-builder #shareButton.oa-locked {
  opacity: 0.55;
  filter: saturate(0.5);
  box-shadow: none;
}

body.onair-builder #copyButton.oa-locked:hover,
body.onair-builder #shareButton.oa-locked:hover {
  transform: none;
  box-shadow: none;
}

/* Superseded by #streamTestResult, which sits next to the field the message is
   about; onair.obs.js still writes to this node, so hide it rather than let the
   same warning appear twice, orphaned at the bottom of the card. */
body.onair-builder #urlWarning { display: none; }
