/* Static King shell — full-screen dark pro radio app (phone-first) */
:root {
  color-scheme: dark;
  --ad-bg: #050505;
  --ad-fg: #f5f5f5;
  --ad-muted: #a3a3a3;
  --sk-lime: #b8ff00;
  --sk-lime-hot: #d4ff4a;
  --sk-lime-dim: rgba(184, 255, 0, 0.35);
  --sk-safe-top: env(safe-area-inset-top, 0px);
  --sk-safe-right: env(safe-area-inset-right, 0px);
  --sk-safe-bottom: env(safe-area-inset-bottom, 0px);
  --sk-safe-left: env(safe-area-inset-left, 0px);
  --sk-header-h: 3.75rem;
}

* {
  box-sizing: border-box;
}

html {
  margin: 0;
  height: 100%;
  height: 100dvh;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
}

body.ad-body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%, rgba(184, 255, 0, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(184, 255, 0, 0.05), transparent 50%),
    var(--ad-bg);
  color: var(--ad-fg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}

/* Full-viewport stage for standalone / installed PWA */
.ad-stage {
  max-width: 52rem;
  margin: 0 auto;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(0.85rem + var(--sk-safe-top))
    calc(1rem + var(--sk-safe-right))
    calc(1.5rem + var(--sk-safe-bottom))
    calc(1rem + var(--sk-safe-left));
}

.ad-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--sk-header-h);
  padding: 0.35rem 0 0.85rem;
  border-bottom: 1px solid var(--sk-lime-dim);
  margin-bottom: 1.25rem;
  flex-shrink: 0;
  /* Not sticky — sticky header was covering radio panel top controls (PWR/Vault/Close) */
  position: relative;
  z-index: 10;
  background: linear-gradient(180deg, rgba(5, 5, 5, 0.96) 60%, rgba(5, 5, 5, 0.75));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    opacity 0.22s ease,
    transform 0.28s cubic-bezier(0.2, 0.9, 0.2, 1),
    max-height 0.28s ease,
    margin 0.22s ease,
    padding 0.22s ease,
    border-color 0.22s ease;
}

.ad-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.ad-brand-text {
  min-width: 0;
}

.ad-brand-mark {
  width: 3.25rem !important;
  height: 3.25rem !important;
  border-radius: 999px !important;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow:
    0 0 0 2px rgba(184, 255, 0, 0.55),
    0 0 28px rgba(184, 255, 0, 0.35),
    0 10px 24px -10px rgba(0, 0, 0, 0.9) !important;
  background: #000;
}

.ad-brand-name {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #ffffff 0%, #e8e8e8 40%, #b8ff00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(184, 255, 0, 0.3));
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-brand-tag {
  font-size: 0.68rem;
  color: #a3e635;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 0.15rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Titlebar slot — radio button homes here (standalone.js + radio.js) */
.af-titlebar-center,
#ad-titlebar-center {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-height: 2.5rem;
  min-width: 3.5rem;
}

.ad-main {
  max-width: 36rem;
  flex: 1 1 auto;
}

.ad-hero {
  font-size: 1.02rem;
  line-height: 1.55;
  color: #e5e5e5;
  margin: 0 0 1rem;
}

.ad-hero strong {
  color: var(--sk-lime);
}

.ad-legal {
  font-size: 0.78rem;
  line-height: 1.5;
  color: #737373;
  margin: 0;
  max-width: 32rem;
}

/* When radio panel is open — phone app mode: radio owns the screen */
body.ad-radio-open {
  overflow: hidden;
  height: 100%;
  height: 100dvh;
}

body.ad-radio-open .ad-main {
  /* Soft hide hero under open cabinet; panel is the product */
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

/*
 * Pro shell: collapse page header while radio is open so it NEVER
 * covers Power / Vault / Close / mode tabs / CH±.
 * Close lives on the radio cabinet; reopening uses the RADIO control
 * after close restores this bar.
 */
body.ad-radio-open .ad-top,
html.af-radio-phone-open .ad-top,
html.af-radio-open .ad-top {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  max-height: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-color: transparent;
  overflow: hidden;
  transform: translateY(-110%);
  z-index: 1;
}

/* iOS standalone polish */
html.ios-client body.ad-body {
  /* Black translucent status bar over lime glow */
  background-attachment: fixed;
}

@media (max-width: 640px) {
  .ad-stage {
    padding:
      calc(0.55rem + var(--sk-safe-top))
      calc(0.7rem + var(--sk-safe-right))
      calc(1rem + var(--sk-safe-bottom))
      calc(0.7rem + var(--sk-safe-left));
  }

  .ad-top {
    padding-bottom: 0.65rem;
    margin-bottom: 0.9rem;
  }

  .ad-brand-name {
    font-size: 1.02rem;
  }

  .ad-brand-tag {
    font-size: 0.55rem;
  }

  .ad-brand-mark {
    width: 2.65rem !important;
    height: 2.65rem !important;
  }

  .ad-hero {
    font-size: 0.92rem;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .ad-brand-tag {
    display: none;
  }

  .ad-brand-name {
    font-size: 0.95rem;
    letter-spacing: 0.05em;
  }
}

/* Landscape phone: tighter header */
@media (max-height: 480px) and (orientation: landscape) {
  .ad-stage {
    padding-top: calc(0.35rem + var(--sk-safe-top));
    padding-bottom: calc(0.5rem + var(--sk-safe-bottom));
  }

  .ad-top {
    min-height: 2.75rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
  }

  .ad-main {
    display: none;
  }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  body.ad-radio-open .ad-main {
    transition: none;
  }
}

/* ══════════════════════════════════════
   Full-app mode — radio is the only page
   (no empty shell after ×, no farm widget chrome)
   ══════════════════════════════════════ */
html.sk-app-only,
html.sk-app-only body.ad-body {
  background: #050505 !important;
  overflow: hidden !important;
  height: 100% !important;
  height: 100dvh !important;
  margin: 0 !important;
}

html.sk-app-only .ad-stage,
html.sk-app-only .ad-top,
html.sk-app-only .ad-main,
html.sk-app-only .ad-hero,
html.sk-app-only .ad-legal {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  height: 0 !important;
  max-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* Close (×) never shown in full-app product */
html.sk-app-only .af-radio-close,
body.sk-app-only .af-radio-close,
html.sk-app-only #af-radio-close {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
}

/* Farm-style “Radio” titlebar open button hidden — panel is always open */
html.sk-app-only #af-radio-btn,
html.sk-app-only .af-radio-btn {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html.sk-app-only .af-radio-root {
  z-index: 50 !important;
}

html.sk-app-only .af-radio-panel.is-open,
html.sk-app-only .af-radio-panel {
  /* Full viewport radio product */
  left: 0 !important;
  top: env(safe-area-inset-top, 0px) !important;
  width: 100% !important;
  max-width: 100vw !important;
  max-height: calc(
    100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)
  ) !important;
  z-index: 60 !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: none !important;
}

html.sk-app-only .af-radio-panel .af-radio-cabinet {
  min-height: calc(
    100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 2px
  );
  border-radius: 0 !important;
  max-height: inherit !important;
}
