/* Radio by HappyBein — light design, same look as Arcade (where it started, Arcade v1.4). */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e6e8f0;
  --text: #1a1d29;
  --text-soft: #5a6072;
  --text-faint: #9aa0b4;
  --accent: #ea580c;
  --accent-soft: #fff7ed;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 49, 0.05), 0 1px 3px rgba(20, 24, 49, 0.06);
  --shadow: 0 4px 14px rgba(20, 24, 49, 0.06), 0 2px 6px rgba(20, 24, 49, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}
* { box-sizing: border-box; }
/* v1.03: the hidden attribute must always win. Without this, .rd-sheet's display:flex
   kept both pop-ups (countries, share) on screen from the moment the app opened. */
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h2 { margin: 0; }
p { margin: 0; }
a { color: var(--accent); }

/* ---- top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: rgba(246, 247, 251, 0.85);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__home {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  font: inherit;
  font-weight: 650;
  font-size: 1.05rem;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.topbar__logo {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #c2410c, #fb923c);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.topbar__home:active .topbar__logo { transform: scale(0.92); }
.is-refreshing .topbar__logo svg { animation: rd-spin 0.8s linear infinite; }
@keyframes rd-spin { to { transform: rotate(360deg); } }
.ver { font-size: .62rem; font-weight: 600; opacity: .6; margin-left: 4px; letter-spacing: 0; vertical-align: middle; }
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.94rem;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn--ghost { color: var(--accent); background: transparent; border: 1px solid var(--border); }
.btn--solid { color: #fff; background: var(--accent); border: 1px solid var(--accent); }
.btn--icon { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; }
.topbar__actions { display: flex; align-items: center; gap: 8px; }

/* ---- share sheet (v1.01): fallback when the phone has no share menu ---- */
.rd-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(20, 24, 49, 0.4);
}
.rd-sheet__box {
  width: 100%;
  max-width: 480px;
  max-height: 100%;
  overflow-y: auto;
  padding: 18px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.rd-sheet__title { font-size: 1.1rem; }
.rd-sheet__text { margin-top: 4px; color: var(--text-soft); }
.rd-sheet__btns { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- radio ---- */
.radio {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 16px calc(90px + env(safe-area-inset-bottom, 0px));
}

/* ---- now playing ---- */
.rd-now {
  position: sticky;
  top: calc(64px + env(safe-area-inset-top, 0px));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.rd-play {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #c2410c, #fb923c);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(194, 65, 12, 0.3);
}
.rd-play:active { transform: scale(0.94); }
.rd-play:disabled { opacity: 0.4; cursor: default; }
.rd-play .rd-ic-stop { display: none; }
.rd-now--playing .rd-play .rd-ic-play { display: none; }
.rd-now--playing .rd-play .rd-ic-stop { display: block; }
.rd-now__text { flex: 1; min-width: 0; }
.rd-now__name {
  font-weight: 700;
  font-size: 1.08rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-now__status { font-size: 0.86rem; color: var(--text-soft); }
.rd-now__status--err { color: var(--danger); }

/* ---- search + chips ---- */
.rd-search {
  display: block;
  width: 100%;
  margin: 14px 0 10px;
  padding: 11px 14px;
  font: inherit;
  font-size: 1rem; /* 16px: no zoom on iOS */
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
}
.rd-search:focus { outline: none; border-color: var(--accent); }
.rd-chips {
  display: flex;
  flex-wrap: wrap; /* six chips: wrap to a second line on a phone rather than hide one */
  gap: 5px;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.rd-chips::-webkit-scrollbar { display: none; }
.rd-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
}
.rd-chip--on { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ---- list ---- */
.rd-list { list-style: none; margin: 10px 0 0; padding: 0; }
.rd-row {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.rd-row--on { border-color: #fb923c; background: #fff7ed; }
.rd-row__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  font: inherit;
  color: var(--text);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}
.rd-row__flag { font-size: 1.15rem; line-height: 1; }
.rd-row__name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-star {
  flex: 0 0 auto;
  width: 46px;
  align-self: stretch;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-faint);
  background: none;
  border: 0;
  cursor: pointer;
}
.rd-star--on { color: #f59e0b; }
.rd-star--big { width: 40px; height: 40px; align-self: center; font-size: 1.5rem; }
.rd-empty { margin: 18px 4px; color: var(--text-soft); text-align: center; }
.rd-note { margin: 20px 4px 0; font-size: 0.8rem; color: var(--text-faint); text-align: center; }

/* little "playing" bars */
.rd-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.rd-eq i { width: 3px; background: #ea580c; border-radius: 1px; animation: rd-eq 0.9s ease-in-out infinite; }
.rd-eq i:nth-child(2) { animation-delay: -0.3s; }
.rd-eq i:nth-child(3) { animation-delay: -0.6s; }
@keyframes rd-eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
@media (prefers-reduced-motion: reduce) { .rd-eq i { animation: none; height: 10px; } }

/* ---- directory results (v1.00) ---- */
.rd-section { margin: 18px 4px 4px; font-size: 0.82rem; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.rd-row__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rd-row__sub { font-size: 0.78rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- your countries (v1.02) ---- */
.rd-chip--add { color: var(--accent); border-style: dashed; }
.rd-sheet__box--tall { display: flex; flex-direction: column; height: min(640px, 100%); }
.rd-clist { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rd-crow {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; font: inherit; color: var(--text); text-align: left;
  background: none; border: 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.rd-crow__name { flex: 1; min-width: 0; font-weight: 600; }
.rd-crow__count { font-size: 0.78rem; color: var(--text-faint); }
.rd-crow__tick { width: 22px; text-align: center; font-weight: 700; color: var(--accent); }
.rd-crow--on { background: var(--accent-soft); }
