:root {
  --body: #171522;
  --header: #211c2d;
  --panel: #211d2d;
  --panel-soft: #292337;
  --border: #40364f;
  --border-light: #4a3c5c;
  --accent: #70558f;
  --accent-hover: #8062a1;
  --text: #ffffff;
  --muted: #c0b6d2;
  --muted-2: #a79bbd;
  --shadow: 0 10px 28px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--body);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

a { color: inherit; }

.site-header {
  min-height: 179px;
  padding: 21px 16px 22px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.brand-title {
  font-size: 38px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: .5px;
  margin-top: 2px;
}

.brand-title span {
  font-size: 34px;
  vertical-align: 2px;
}

.brand-subtitle {
  margin-top: 8px;
  color: #c5bad8;
  font-size: 15.5px;
}

.main-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 21px;
}

.nav-button {
  height: 43px;
  min-width: 150px;
  padding: 0 17px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #211c2d;
  color: #f7f4fa;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  transition: background .15s ease, border-color .15s ease;
}

.nav-button:hover { background: #332942; border-color: #58456d; }

.nav-button.active {
  background: var(--accent);
  border-color: #8064a1;
}

.page-wrap {
  width: calc(100% - 32px);
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 0 50px;
}

.welcome-box,
.page-intro,
.guide-box,
.guide-note,
.radio-detail {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.welcome-box {
  min-height: 132px;
  margin-top: 1px;
  padding: 29px 28px;
  text-align: center;
}

.welcome-box h1 {
  margin: 0 0 10px;
  font-size: 24px;
}

.welcome-box p {
  margin: 0;
  color: #c5bad8;
  font-size: 16px;
}

.page-intro {
  padding: 30px 20px 29px;
  text-align: center;
}

.page-intro h1 {
  margin: 0 0 7px;
  font-size: 24px;
}

.page-intro p {
  margin: 0;
  color: #c4b9d7;
  font-size: 16px;
}

.genre-search {
  height: 46px;
  margin: 24px 0 25px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: #b9aeca;
}

.genre-search input,
.inline-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
  font: inherit;
}

.genre-search input::placeholder,
.inline-search input::placeholder {
  color: #9589aa;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.category-card {
  min-height: 98px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.category-card:hover {
  transform: translateY(-1px);
  border-color: #604b76;
  background: #262033;
}

.category-icon {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-light);
  border-radius: 9px;
  background: #171522;
  font-size: 30px;
}

.category-copy { min-width: 0; }

.category-copy h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.category-copy p {
  margin: 0;
  color: #aaa0c0;
  font-size: 13.5px;
  line-height: 1.3;
}

.category-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 24px 0 15px;
}

.back-link {
  color: #c6bad8;
  text-decoration: none;
  font-weight: 700;
}

.back-link:hover { color: white; }

.inline-search {
  min-width: 280px;
  height: 43px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.subcategory-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.subcategory {
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: #bdb2cf;
  cursor: pointer;
  font-weight: 700;
}

.subcategory:hover,
.subcategory.active {
  color: white;
  background: var(--accent);
  border-color: #8064a1;
}

.radio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.radio-card {
  min-width: 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.radio-card-top {
  display: flex;
  gap: 13px;
  align-items: center;
}

.radio-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 8px;
  background: #171522;
  border: 1px solid var(--border);
}

.radio-fallback {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #171522;
  font-size: 28px;
}

.radio-card h2 {
  margin: 0;
  font-size: 17px;
}

.radio-meta {
  margin-top: 4px;
  color: #aaa0c0;
  font-size: 13px;
}

.inline-player {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1a1724;
}

.inline-player audio {
  display: block;
  width: 100%;
  height: 38px;
}

.stream-copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 10px;
}

.stream-input {
  min-width: 0;
  width: 100%;
  height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  outline: 0;
  background: #171522;
  color: #c9bfd7;
  font: 12px Consolas, monospace;
}

.radio-card .button-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.small-button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #2a2335;
  color: white;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.small-button.primary { background: var(--accent); border-color: #8064a1; }
.small-button:hover { background: var(--accent-hover); }

.loading, .empty, .error {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: #bcb1ce;
}

.radio-detail {
  padding: 28px;
  max-width: 850px;
  margin: 0 auto;
}

.radio-detail-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.radio-detail-head img,
.radio-detail-head .radio-fallback {
  width: 90px;
  height: 90px;
  flex-basis: 90px;
}

.radio-detail h1 {
  margin: 0 0 6px;
  font-size: 27px;
}

.player-box {
  margin: 25px 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #292337;
}

.player-box h2 { margin: 0 0 12px; font-size: 18px; }

.player-box audio { width: 100%; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1c1926;
}

.detail-item small { display: block; color: #9f94b2; }
.stream-url {
  margin: 16px 0;
  padding: 13px;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #171522;
  color: #c9bfd7;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.guide-page { max-width: 900px; }

.guide-box { padding: 28px; }

.guide-box > h1 {
  margin: 5px 0 28px;
  font-size: 24px;
}

.guide-step {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.guide-step:last-child { border-bottom: 0; }

.step-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  font-weight: 700;
}

.guide-step h2 {
  margin: 0 0 7px;
  font-size: 18px;
}

.guide-step p {
  margin: 0;
  color: #c4b9d7;
}

.guide-note {
  margin-top: 18px;
  padding: 20px 24px;
}

.guide-note h2 { margin: 0 0 7px; font-size: 18px; }
.guide-note p { margin: 0; color: #bdb2cf; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 850px) {
  .category-grid, .radio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .site-header { min-height: 0; padding-top: 18px; }
  .brand-title { font-size: 30px; }
  .brand-title span { font-size: 27px; }
  .main-nav { flex-wrap: wrap; }
  .nav-button { min-width: 125px; }
  .category-grid, .radio-grid { grid-template-columns: 1fr; }
  .category-controls { align-items: stretch; flex-direction: column; }
  .inline-search { min-width: 0; }
  .welcome-box { padding: 25px 16px; }
}
/* =========================================================
   LOGO PRINCIPALE RADIO STAR
   ========================================================= */

.main-logo {
    display: block;
    width: 220px;
    height: auto;
    margin: 0 auto 12px auto;
    object-fit: contain;
}
/* =========================
   FOOTER
========================= */

.footer {
    padding: 35px 20px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,.08);
    background: none;
    color: #cfd6dc;
    font-size: 14px;
    line-height: 1.8;
}

    .footer p {
        margin: 8px 0;
    }

        .footer p:first-child {
            color: #ffffff;
            font-size: 15px;
            font-weight: 700;
            letter-spacing: .8px;
        }

    .footer strong {
        color: #68e83f;
        font-weight: 800;
    }

/* =========================================================
   RADIO STAR - COMPATIBILITÀ CATALOGO DINAMICO
   ========================================================= */

.site-header.compact {
  min-height: 0;
  padding-top: 18px;
}

.site-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

.site-logo a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-logo img {
  display: block;
  width: 180px;
  max-width: 80vw;
  height: auto;
  object-fit: contain;
}

.site-header h1 {
  margin: 6px 0 7px;
  font-size: 30px;
  line-height: 1.15;
}

.subtitle {
  margin: 0;
  color: #c5bad8;
  font-size: 15px;
}

.nav-link {
  height: 43px;
  min-width: 150px;
  padding: 0 17px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #211c2d;
  color: #f7f4fa;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.nav-link:hover {
  background: #332942;
  border-color: #58456d;
  transform: translateY(-1px);
}

.nav-link.active {
  background: var(--accent);
  border-color: #8064a1;
}

.container {
  width: calc(100% - 32px);
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px 0 50px;
}

.section-heading {
  margin-bottom: 18px;
  padding: 26px 28px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.section-heading h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.button {
  min-height: 43px;
  padding: 9px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #2a2335;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.button:hover { background: var(--accent-hover); }
.button.primary { background: var(--accent); border-color: #8064a1; }
.button.secondary { background: #2a2335; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.search-box {
  min-width: 300px;
  flex: 1;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 43px;
  padding: 0 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #bdb2cf;
  font-size: 13px;
}

.search-box span { white-space: nowrap; }

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: inherit;
}

.search-box input::placeholder { color: #9589aa; }

.catalog-note {
  margin-top: 22px;
  padding: 17px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: #bdb2cf;
  font-size: 13px;
}

.catalog-note strong { color: #fff; }

.site-footer {
  padding: 28px 20px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,.08);
  background: var(--header);
  color: #cfd6dc;
  font-size: 14px;
  line-height: 1.7;
}

.site-footer p { margin: 5px 0; }

.loading,
.empty,
.error {
  grid-column: 1 / -1;
  padding: 42px 20px;
  text-align: center;
  color: #bcb1ce;
}

.error {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.back-link { color: #d5cae2; font-weight: 700; }

/* =========================================================
   PLAYER DELLE SCHEDE RADIO
   ========================================================= */

.inline-player {
  margin-top: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #1a1724;
}

.inline-player audio {
  display: block;
  width: 100%;
  height: 38px;
}

.radio-card .button-row,
.radio-detail .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* =========================================================
   HOME - PLAYER RADIO STAR PERSONALE
   Compatibile con il player già presente in index.html.
   ========================================================= */

.radio-player-box {
  margin-top: 24px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.radio-player-box h2 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 22px;
}

.radio-player-box > p {
  margin: 0 0 18px;
  text-align: center;
  color: var(--muted);
}

.stream-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-bottom: 14px;
}

.stream-input-row input,
.stream-url-input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: #171522;
  color: #d8cee5;
  font: 13px Consolas, monospace;
}

.stream-input-row button,
.load-stream-btn {
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid #8064a1;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.stream-input-row button:hover,
.load-stream-btn:hover { background: var(--accent-hover); }

.radio-player-box audio {
  width: 100%;
  margin-top: 4px;
}

.radio-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.radio-control-btn {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #2a2335;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.radio-control-btn:hover { background: var(--accent-hover); }

.radio-volume {
  width: 170px;
  accent-color: var(--accent);
}

.radio-status {
  margin: 12px 0 0;
  text-align: center;
  color: var(--muted-2);
  font-size: 13px;
}

.now-playing {
  margin-top: 17px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #1a1724;
  text-align: center;
}

.now-playing-title {
  color: #bdb2cf;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .9px;
  margin-bottom: 6px;
}

.now-playing-song {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

@media (max-width: 850px) {
  .category-grid,
  .radio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-box { max-width: none; min-width: 0; }
  .toolbar > .button { width: 100%; }
  .stream-input-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-header { min-height: 0; padding-top: 18px; }
  .site-header h1 { font-size: 26px; }
  .site-logo img { width: 155px; }
  .main-nav { flex-wrap: wrap; }
  .nav-link { min-width: 125px; }
  .category-grid,
  .radio-grid { grid-template-columns: 1fr; }
  .container { width: calc(100% - 22px); padding-top: 22px; }
  .radio-player-box { padding: 17px 13px; }
  .radio-volume { width: 145px; }
}

/* Stato compatibilità IMVU nelle schede radio */
.compat-ok,
.compat-no {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 800;
}

.compat-ok { background: rgba(80, 150, 100, .16); }
.compat-no { background: rgba(190, 150, 70, .14); }

/* =========================================================
   NOW PLAYING - non modifica il player audio esistente
   ========================================================= */
.now-playing-mini,
.now-playing-box {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
}

.now-playing-mini span,
.now-playing-box span {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent-hover);
  letter-spacing: .06em;
  margin-bottom: 4px;
}

.now-playing-mini strong,
.now-playing-box strong {
  display: block;
  color: var(--text);
  font-size: .95rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.now-playing-box {
  margin-top: 14px;
  padding: 14px 16px;
}

.now-playing-box small {
  display: block;
  margin-top: 7px;
  color: var(--muted-2);
  font-size: .78rem;
}
/* Stili per il funzionamento del menu a tendina dei siti affiliati */
.dropdown-affiliati {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 9999;
    border-radius: 4px;
    margin-top: 5px; /* Distanza leggera sotto il bottone */
}

    .dropdown-content a {
        color: #333333;
        padding: 12px 16px;
        text-decoration: none;
        display: block;
        text-align: left;
        font-size: 14px;
    }

        .dropdown-content a:hover {
            background-color: #f1f1f1;
        }

    /* Questa classe viene attivata dal codice JavaScript al click */
    .dropdown-content.mostra {
        display: block;
    }