/* base.css — STRUCTURA paginii (layout, pozitionare, dimensiuni, comportament).
   Fara fonturi, culori, spatieri sau efecte: acelea sunt in skin (css/skins/<nume>.css).
   Generat din style.css; o proprietate sta fie aici, fie in skin, niciodata in ambele. */

*, *::before, *::after { box-sizing: border-box; }

/* loc rezervat mereu pentru bara de derulare: cand pagina e aproape cat ecranul, bara apare si
   dispare la incarcare, latimea se schimba cu ~15 px si cardurile se redimensioneaza de cateva ori */
html { scrollbar-gutter: stable; }

body {
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.build-badge {
  position: absolute;
  left: 24px;
  bottom: 3px;
  pointer-events: none;
  user-select: none;
}

.header-status {
  display: flex;
  align-items: center;
}

/* ===== LAYOUT ===== */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 280px 560px 280px;
  width: fit-content;
  max-width: 100%;
  align-items: stretch;
}

.layout.fm-mode {
  grid-template-columns: 280px 1fr 230px;
}
/*
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr 1fr; }
  .col-left { grid-column: 1; }
  .col-center { grid-column: 1 / -1; }
  .col-right { grid-column: 2; grid-row: 2; }
}

@media (max-width: 600px) {
  .layout { grid-template-columns: 1fr; }
  .col-right { grid-column: 1; grid-row: auto; }
}
*/

@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr 1fr; }
  .col-left { grid-column: 1; }
  .col-center { grid-column: 1 / -1; }
  .col-right { grid-column: 2; grid-row: 2; }
}

@media (max-width: 600px) {
  .layout { grid-template-columns: 1fr; }
  .layout.fm-mode {grid-template-columns: max-content;}
  .col-right { grid-column: 1; grid-row: auto; }
}

.col-left { display: flex; flex-direction: column; height: 100%; }

.col-center.dab-only { display: flex; flex-direction: column; height: 100%; }
.col-center.dab-only .player-panel { flex: 1; }

/* ===== PANEL ===== */
.panel {
  position: relative;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
}

/* ===== SIGNAL GRAPH ===== */
.signal-graph-wrap {
  grid-column: 1 / -1;
  position: relative;
}

.signal-graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#signalCanvas {
  width: 100%;
  height: 70px;
  display: block;
}

/* ===== TUNE DISPLAY ===== */

.tune-controls {
  display: flex;
}

.tune-controls select {
  flex: 1;
  cursor: pointer;
}

.btn {
  cursor: pointer;
}

.btn:disabled,
.btn[disabled],
select:disabled,
select[disabled],
input:disabled,
input[disabled] {
  cursor: not-allowed;
  pointer-events: none;
}

/* ===== ENSEMBLE ===== */

/* ===== SERVICE SELECT ===== */
.svc-select-wrap {
  display: flex;
}

.svc-select-wrap select {
  flex: 1;
  cursor: pointer;
}

/* ===== PLAYER ===== */
.player-panel {
  position: relative;
  overflow: hidden;
}

.player-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
}

.player-main {
  display: flex;
  align-items: stretch;
}

.player-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.player-heading {
  display: flex;
  align-items: center;
  min-width: 0;
}

.player-top {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
}

.station-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 238px;
}

.rt-box {
  height: 70px;
  overflow: hidden;
}

.dlp-row {
  display: flex;
  align-items: baseline;
}
.dlp-key {
  flex-shrink: 0;
  min-width: 90px;
}
.dlp-val {
  word-break: break-word;
}

.rt-text {
  overflow: hidden;
}

.rt-line {
  white-space: nowrap;
  overflow: hidden;
  display: block;
}

.rt-line.scrolling {
  display: inline-block;
  min-width: 100%;
}

/* controls */
.player-controls {
  display: flex;
  align-items: center;
}

.play-btn {
  width: 48px; height: 48px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.play-btn:active { transform: scale(0.95); }

.pc-icon-play  { display: block; }
.pc-icon-pause { display: none; }
.pc-playing-state .pc-icon-play  { display: none; }
.pc-playing-state .pc-icon-pause { display: block; }

.tune-arrow {
  width: 44px;
  min-width: 44px;
  height: 28px;
  min-height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tune-controls #fmFreqInput {
  height: 28px;
  box-sizing: border-box;
}

.tune-seek {
  width: 36px;
  min-width: 36px;
  height: 28px;
  min-height: 28px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tune-arrow::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
}

.tune-seek::before,
.tune-seek::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
}

.status-chip {
  /*font-family: 'Share Tech Mono', monospace;*/
  display: inline-block;
}

.status-dot {
  width: 8px; height: 8px;
  flex-shrink: 0;
  align-self: flex-start;
}

/* volume */
.vol-row {
  display: flex;
  align-items: center;
}

.vol-icon {
  cursor: pointer;
  flex-shrink: 0;
}

.vol-slider {
  flex: 1;
  min-width: 0;          /* altfel ramane la latimea implicita (~129 px) si impinge REC / ▾ afara */
  height: 3px;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  width: 13px; height: 13px;
  cursor: pointer;
}

.vol-value {
  width: 28px;
}

/* inregistrare (record.js) */
.rec-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 10px; padding: 3px 9px; flex-shrink: 0;
  background: transparent; color: var(--muted, #8a97a8);
  border: 1px solid var(--border, #2a3a4c); border-radius: 12px;
  font: 600 10px/1.4 inherit; letter-spacing: .5px; cursor: pointer; white-space: nowrap;
}
.rec-btn:hover { color: var(--text, #e6edf3); border-color: #d64545; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: #d64545; }
.rec-btn.recording { color: #fff; background: #d64545; border-color: #d64545; }
.rec-btn.recording .rec-dot { background: #fff; animation: recBlink 1s steps(2, start) infinite; }
.rec-pick {
  margin-left: 2px; padding: 3px 6px; flex-shrink: 0; cursor: pointer;
  background: transparent; color: var(--muted, #8a97a8);
  border: 1px solid var(--border, #2a3a4c); border-radius: 12px; font-size: 10px; line-height: 1.4;
}
.rec-pick:hover { color: var(--text, #e6edf3); }
.vol-row { position: relative; }
.rec-menu {
  position: absolute; right: 0; bottom: calc(100% + 4px); z-index: 50;
  background: var(--card, #121a24); border: 1px solid var(--border, #2a3a4c); border-radius: 8px;
  padding: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.4); min-width: 110px;
}
.rec-menu-item { padding: 6px 10px; border-radius: 5px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.rec-menu-item:hover { background: rgba(255,255,255,.06); }
.rec-menu-item.sel { color: #d64545; font-weight: 600; }
@keyframes recBlink { to { visibility: hidden; } }

/* SLS salvat (nu live) */
.sls-cached-badge {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 10px;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 10px; line-height: 1.4; letter-spacing: .3px;
  pointer-events: auto; cursor: help; white-space: nowrap;
}

/* loudness meter (loudness-ui.js) */
.loud-row {
  display: flex; align-items: center; gap: 16px; height: 22px; margin-top: 8px;
  font-size: 13px; color: var(--text-dim, #8a97a8); white-space: nowrap; overflow: hidden;
}
.loud-row b { color: var(--text, #e6edf3); font-weight: 700; font-variant-numeric: tabular-nums; }
.loud-row b.loud-max.hot { color: var(--red, #ff5c5c); }
.loud-bar {
  position: relative; width: 120px; height: 8px; border-radius: 4px; flex-shrink: 0;
  background: rgba(255,255,255,0.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.loud-fill {
  position: absolute; inset: 0; border-radius: 4px;
  clip-path: inset(0 100% 0 0); transition: clip-path .18s linear;
  background: linear-gradient(90deg, #22c55e 0%, #84cc16 40%, #facc15 65%, #fb923c 82%, #ef4444 100%);
  filter: drop-shadow(0 0 4px rgba(250, 204, 21, 0.45));
}
/* semnul pentru I (integrat) pe bara */
.loud-mark {
  position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px;
  background: #fff; box-shadow: 0 0 3px rgba(0,0,0,0.6); display: none;
}

/* service info */
.svc-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));   /* textele lungi nu mai lungesc coloana */
  height: 100px;
}

.svc-info-row {
  display: flex;
  flex-direction: column;
}

.svc-info-value {
  min-width: 0;
}
/* insignele din grila: un rand, taiat cu "..." daca nu incape */
.svc-info-value .badge {
  display: inline-block; max-width: 100%; box-sizing: border-box;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===== SIGNAL BARS ===== */

.sig-row {
  display: flex;
  align-items: center;
}

.sig-label {
  width: 80px;
  flex-shrink: 0;
}

.sig-bar-wrap {
  flex: 1;
  height: 6px;
  overflow: hidden;
}

.sig-bar-fill {
  height: 100%;
  width: 0%;
}

.sig-value {
  width: 35px;
  flex-shrink: 0;
}

/* lock */
.lock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lock-indicator {
  display: flex;
  align-items: center;
}

.lock-dot {
  width: 10px; height: 10px;
  flex-shrink: 0;
}

/* ===== SLIDESHOW ===== */
.slideshow-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slideshow-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ===== BADGES ===== */

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
}

/* ===== SCANNER ===== */
.scan-chart-wrap {
  width: 100%;
  overflow: hidden;
}

#scanCanvas,
#fmSpectrum {
  width: 100%;
  height: 80px;
  display: block;
  cursor: pointer;
}

.scan-channels {
  display: flex;
  flex-wrap: wrap;
}

.scan-ch {
  cursor: pointer;
}

.scan-overlay {
  display: none;
}

@media (max-width: 600px) {
  .scan-panel { display: none; }

  .scan-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
  }
  
  .scan-overlay.active {
    display: flex;
  }
}

/* ===== SERVICES SCAN LIST ===== */
.svc-scan-channel {
  overflow: hidden;
}

.svc-scan-channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.svc-scan-channel-toggle.open {
  transform: rotate(90deg);
}

.svc-scan-services {
  display: none;
}

.svc-scan-services.open {
  display: block;
}

.svc-scan-item {
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}
.svc-scan-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.svc-fav-star {
  flex-shrink: 0;
}
.svc-fav-star:hover { transform: scale(1.25); }

/* Coloana dreapta FM (AF List + Favorites): fiecare lista face scroll in panoul ei */
.fm-side-panel { display: flex; flex-direction: column; min-height: 0; }
.fm-side-list { overflow-y: auto; min-height: 0; max-height: 270px; }
@media (min-width: 1001px) {
  /* coloana nu mai dicteaza inaltimea randului: ia inaltimea coloanelor stanga/centru */
  .layout.fm-mode #fmSideCol { height: 0; min-height: 100%; }
  #fmAfPanel  { flex: 0 1 auto; max-height: 40%; }
  #fmFavPanel { flex: 1 1 0; }
  #fmSideCol .fm-side-list { flex: 1 1 auto; max-height: none; }
}

/* Alerta de urgenta HD Radio */
.hd-alert {
  display: flex; align-items: flex-start;
}
.hd-alert-icon { flex-shrink: 0; }
.hd-alert-body { flex: 1; min-width: 0; }
.hd-alert-text { word-break: break-word;
  display: -webkit-box; overflow: hidden;
}
.hd-alert-close { cursor: pointer; flex-shrink: 0; }

/* Favorite FM */
.fm-fav-star { cursor: pointer; }
.fm-fav-item { display: flex; align-items: center; cursor: pointer; }
.fm-fav-logo { flex-shrink: 0; width: 36px; height: 24px; display: flex; align-items: center; justify-content: center; }
.fm-fav-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.fm-fav-freq { flex-shrink: 0; min-width: 44px; }
.fm-fav-del { flex-shrink: 0; }

.svc-search-bar {
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
}
.svc-search-input {
  flex: 1;
}
.svc-fav-toggle {
  flex-shrink: 0;
  cursor: pointer;
}

#servicesScanList {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 320px;
}

.col-services {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.col-services .panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.col-services .panel .panel-title {
  flex-shrink: 0;
}
/* scrollbar */
::-webkit-scrollbar { width: 4px; }

#slideshow { cursor: pointer; }

.col-center.fm-only {
  display: flex;
  flex-direction: column;
}

.col-center.fm-only .player-panel {
  flex: 1;
}

/* textul lung nu are voie sa latesca coloana (layout-ul e fit-content):
   contribuie cu 0 la latime, apoi se intinde la 100% si face wrap (max 3 randuri) */
#fmRT, #hdSubchannelName {
  width: 0;
  min-width: 100%;
}

#fmRT {
  display: block;
  white-space: nowrap;
  overflow: hidden;
}

/* RT prea lung pentru un rand: scroll in bucla (setFmRtText / _fmRtFit in hd.js) */
#fmRT .rt-marquee {
  display: inline-block;
  overflow: visible;
}
#fmRT .rt-marquee::after {
  content: attr(data-text);
}

#fmStereoBadge, #fmMonoText, #fmPTYBadge, #fmMSVal {
  width: 100%;          /* afisarea (flex, centrat) vine din regula grilei de la final */
}

@media (max-width: 760px) {

  body {
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .header {
    display: block;
    width: 100vw;
    max-width: 100vw;
    overflow: visible;
  }

  .header-logo {
    min-width: 0;
  }

  .header-logo span {
    display: none;
  }

  .build-badge {
    left: 10px;
    bottom: 2px;
  }

  .header-controls {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    left: min(250px, calc(100vw - 130px));
    right: auto;
    z-index: 140;
    justify-content: flex-end;
    min-width: 0;
    max-width: 100%;
  }

  #modeWrap {
    min-width: 0;
  }

  #modeWrap > span {
    display: none;
  }

  .header .btn {
    min-height: 34px;
  }

  .header-status {
    min-width: 0 !important;
    justify-content: space-between !important;
    overflow: hidden;
  }

  .header-status span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .layout,
  .layout.fm-mode {
    width: 100%;
    max-width: 100vw;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
  }

  .layout > * {
    grid-column: 1 / -1 !important;
    min-width: 0;
    max-width: 100%;
  }

  .layout *,
  .player-panel *,
  .panel *,
  .signal-graph-wrap * {
    min-width: 0;
  }

  .col-center {
    order: 1;
  }

  .signal-graph-wrap {
    order: 2;
  }

  .col-left {
    order: 3;
  }

  .col-services {
    order: 4;
  }

  .scan-panel {
    order: 5;
  }

  .player-main {
    flex-direction: column;
  }

  .player-heading {
    align-items: center;
  }

  .play-btn {
    width: 58px;
    height: 58px;
  }

  .station-name {
    width: auto;
    max-width: 100%;
  }

  .station-ensemble,
  .now-playing-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-icons {
    flex-wrap: wrap;
  }

  #slideshow {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
    max-height: 42vh;
  }

  .album-art-frame {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
  }

  .album-art-frame > div {
    width: 100% !important;
    height: 100% !important;
  }

  .vol-slider {
    height: 6px;
  }

  .vol-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  .rt-box {
    height: auto;
    min-height: 76px;
  }

  .svc-info-grid {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .svc-info-value {
    overflow-wrap: anywhere;
  }

  .signal-graph-header {
    align-items: flex-end;
    min-width: 0;
  }

  .signal-graph-value {
    flex: 0 1 auto;
    max-width: 44%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .signal-graph-title {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #signalCanvas {
    height: 86px;
  }

  .tune-controls .tune-arrow {
    width: 76px;
    min-width: 76px;
    height: 44px;
    min-height: 44px;
  }

  .fm-tune-controls .tune-arrow {
    width: 58px;
    min-width: 58px;
  }

  .fm-tune-controls .tune-seek {
    width: 42px;
    min-width: 42px;
    height: 44px;
    min-height: 44px;
  }

  .tune-controls select,
  .svc-select-wrap select,
  #fmFreqInput,
  #deemphSelect {
    min-height: 44px;
  }

  .btn {
    min-height: 44px;
  }

  .sig-label {
    width: 92px;
  }

  .sig-bar-wrap {
    height: 8px;
  }

  .sig-value {
    width: 42px;
  }

  .col-services[style] {
    position: static !important;
  }

  img,
  canvas,
  select,
  input {
    max-width: 100%;
  }

  #servicesScanList,
  #fmAFList {
    max-height: none !important;
  }

  .svc-scan-channel-header,
  .svc-scan-item {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .scan-panel {
    display: none !important;
  }

  .layout.fm-mode .col-center.fm-only {
    display: flex !important;
  }

  .layout.fm-mode .col-center.fm-only .player-heading {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .layout.fm-mode .col-center.fm-only .play-btn {
    width: 64px;
    height: 64px;
  }

  .layout.fm-mode .col-center.fm-only .station-name {
    width: 100%;
  }

  .layout.fm-mode .col-center.fm-only .vol-value {
    width: 36px;
  }

  .layout.fm-mode .album-art-frame {
    width: min(68vw, 268px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    align-self: center;
  }

  .layout.fm-mode .album-art-frame > div {
    width: 100% !important;
    height: 100% !important;
  }

  .layout.fm-mode #hdArtImg {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .layout.fm-mode .rt-box {
    min-height: 62px;
  }

  .layout.fm-mode .svc-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout.fm-mode .svc-info-row {
    min-height: 56px;
    justify-content: center;
  }

  .layout.fm-mode #fmStereoBadge,
  .layout.fm-mode #fmMonoText,
  .layout.fm-mode #fmPTYBadge,
  .layout.fm-mode #fmMSVal {
    width: auto;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 380px) {

  .play-btn {
    width: 52px;
    height: 52px;
  }

  .svc-info-grid {
    grid-template-columns: 1fr;
  }

  .layout.fm-mode .album-art-frame {
    width: min(74vw, 276px) !important;
  }

  .tune-controls .tune-arrow {
    width: 68px;
    min-width: 68px;
  }

  .layout.fm-mode .svc-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Buton setari in header */
#setupGearBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}
#setupGearBtn:hover {
  transform: rotate(90deg);
}

/* Panou setari (themes.js toggleSettingsPanel) */
#settingsBackdrop {
  position: fixed; inset: 0; z-index: 9998; background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#settingsBackdrop.open { opacity: 1; pointer-events: auto; }
#settingsPanel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 9999; width: 300px; max-width: 88vw;
  box-sizing: border-box; padding: 28px 22px 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg2, #1b2129); border-left: 1px solid var(--border, #2a3a4c);
  box-shadow: -10px 0 30px rgba(0,0,0,0.45);
  transform: translateX(100%); transition: transform .22s ease;
}
#settingsPanel.open { transform: translateX(0); }
#settingsPanel h2 { margin: 0 0 6px; font-size: 22px; font-weight: 600; color: var(--accent); text-align: center; }
#settingsPanel .sp-close {
  position: absolute; top: 10px; right: 12px; width: 30px; height: 30px; border: none; background: transparent;
  color: var(--muted, #8a97a8); font-size: 24px; line-height: 1; cursor: pointer;
}
#settingsPanel .sp-close:hover { color: var(--text, #e6edf3); }
#settingsPanel .sp-field { display: flex; flex-direction: column; gap: 6px; }
#settingsPanel .sp-field span {
  font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); font-weight: 600;
}
#settingsPanel select {
  width: 100%; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px;
  background: var(--bg3, #222a33); color: var(--text, #e6edf3); border: 1px solid var(--border, #2a3a4c);
}
#settingsPanel select:focus { outline: none; border-color: var(--accent); }
#settingsPanel .sp-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border, #2a3a4c); text-align: center; }
#settingsPanel .sp-setup {
  display: block; padding: 9px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 13px;
  color: var(--accent); border: 1px solid var(--accent);
}
#settingsPanel .sp-setup:hover { background: rgba(var(--accent-rgb, 0,210,255), 0.12); }
#settingsPanel .sp-ver { margin-top: 10px; font-size: 11px; color: var(--muted, #8a97a8); }

/* RBDS (America de Nord): TP / TA nu se folosesc */
html.rbds .rds-eu-only { display: none; }

/* HD LEVEL: bara 0-100 in degrade (rosu -> galben -> verde), partea neatinsa acoperita */
.hd-level-bar {
  position: relative; height: 22px; overflow: hidden;
}
.hd-level-mask {
  position: absolute; top: 0; right: 0; bottom: 0; width: 100%;
}
.hd-level-tick {              /* pragul 20: AN649 "peste 20 = HD foarte probabil prezent" */
  position: absolute; top: 0; bottom: 0; left: 20%; width: 1px;
}
.hd-level-val {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
}

/* Indicator MAP (harti HD Radio) langa butoanele de program HD */
.hd-map-ind { cursor: pointer; user-select: none;
}

/* ===== Grila de informatii (RDS / HD / DAB): toate valorile in acelasi chenar =====
   Text simplu, insigne (Stereo/Mono, gen...) si bare (HD level, calitate audio) au
   aceeasi inaltime, acelasi font si acelasi chenar. */
.svc-info-grid { height: auto; min-height: 100px; }
.svc-info-grid .svc-info-value {
  height: 26px; box-sizing: border-box;
  display: block;     /* block (nu flex) ca textele lungi sa se taie cu "..." */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  overflow-wrap: normal;
}
/* insigna sau bara umple chenarul (culoarea insignei ramane: Stereo verde, Mono portocaliu...) */
.svc-info-grid .svc-info-value > .badge {
  display: flex; align-items: center; width: 100%; height: 100%; box-sizing: border-box;
}
.svc-info-grid .svc-info-value > .hd-level-bar { width: 100%; height: 100%; box-sizing: border-box; }

@media (max-width: 760px) {
  .svc-info-grid .svc-info-value { height: 32px; }
  .svc-info-grid .svc-info-value > .badge,
  .layout.fm-mode .svc-info-grid #fmStereoBadge,
  .layout.fm-mode .svc-info-grid #fmMonoText,
  .layout.fm-mode .svc-info-grid #fmPTYBadge,
  .layout.fm-mode .svc-info-grid #fmMSVal {
    width: 100%; height: 100%;
  }
}

/* Boot overlay + banner reconectare */
#bootOverlay {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#bootOverlay.hide { pointer-events: none; }
#bootOverlay img { width: 72px; height: 72px; }
#wsBanner {
  position: fixed; top: 0; left: 50%; transform: translate(-50%, -110%); z-index: 99999; pointer-events: none;
}
#wsBanner.show { transform: translate(-50%, 0); }

/* Pop-up harta emitatoare (hover pe PI) */
#fmtxPop {
  display: none; position: fixed; z-index: 9000; width: 320px; overflow: hidden;
}
#fmtxMap { width: 100%; height: 200px; }
#fmPIGrid { cursor: help; }
#fmtxPop .fmtx-other svg { width: 20px; height: 20px; }
#fmtxMap { height: 240px; }
#fmtxPop { width: 360px; }
#fmtxInfo .fmtx-tbl-wrap { max-height: 150px; overflow-y: auto; }
#fmtxInfo .fmtx-tbl { width: 100%; }
#fmtxInfo .fmtx-tbl th { position: sticky; top: 0; }
#fmtxInfo .fmtx-tbl td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
/* pop-up emitatoare: font simplu, lizibil (fara Orbitron / mono) */

/* Progres descarcare slideshow: linie subtire sub chip-ul SLS */
#chipSls, #chipSpi { position: relative; overflow: hidden; }
#chipSls::after, #chipSpi::after {
  content: ''; position: absolute; left: 0; bottom: 0; height: 2px;
  width: var(--sls-pct, 0%);
}

/* logo SPI in lista de servicii DAB (32x32, afisat mai mic) */
.svc-logo { width: 22px; height: 22px; flex-shrink: 0; object-fit: contain; display: block; }
.svc-logo.empty { visibility: hidden; }
/* pictograma cu initiale pentru posturile fara logo (aceeasi marime ca logo-ul) */
.svc-mono { width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden; white-space: nowrap; }

/* randul DAB+ | SLS DLS DL+ SPI: chip-urile stau in containerul lor, langa DAB+;
   daca nu incap, trec pe randul urmator aliniate sub SLS (nu intra peste slideshow) */
.player-heading > div { min-width: 0; }
.status-icons { align-items: baseline; }
.status-icons > .audio-type-badge { flex-shrink: 0; }
.status-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.status-chips > * { flex-shrink: 0; }

/* Journaline: fereastra de stiri (structura; aspectul in skin) */
.jml-item { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.jml-item.jml-missing { cursor: default; }
.jml-arrow { flex-shrink: 0; }
.jml-text { overflow-wrap: anywhere; }
.jml-row { display: flex; }
.jml-row > span { flex: 1; min-width: 0; }
.jml-links { display: flex; flex-wrap: wrap; }
#jmlBackBtn, #jmlCloseBtn { cursor: pointer; flex-shrink: 0; }

/* BWS: chip-ul WEB are bara de progres ca SLS/SPI; fereastra cu site-ul (aspectul in skin) */
#chipBws { position: relative; overflow: hidden; }
#chipBws::after { content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: var(--sls-pct, 0%); }
#bwsNewTab, #bwsCloseBtn { cursor: pointer; flex-shrink: 0; text-decoration: none; }

/* componenta secundara (SCIdS>0) in lista: sub serviciul parinte, indentata */
.svc-scan-item.svc-secondary { padding-left: 38px; }

/* ===== FIC ERRORS: erori FIB pe secunda + istoric 30 s (din FIBERR cumulativ) ===== */
.sig-bar-wrap.fib-spark { display: flex; align-items: flex-end; gap: 1px; height: 14px; padding: 1px 2px; box-sizing: border-box; overflow: hidden; }
.fib-spark i { flex: 1; min-height: 1px; border-radius: 1px; background: var(--border-strong, rgba(255,255,255,0.12)); }
.fib-spark i.e1 { background: var(--sig-mid, #f1c40f); }
.fib-spark i.e2 { background: var(--sig-weak, #e74c3c); }
#fibErrVal.ok   { color: var(--sig-strong, #2ecc71); }
#fibErrVal.warn { color: var(--sig-mid, #f1c40f); }
#fibErrVal.bad  { color: var(--sig-weak, #e74c3c); }
.layout.fm-mode #fibErrRow { display: none; }

/* ===== Scanare continua DAB: perdea peste pagina ===== */
.dw-overlay { position:fixed; inset:0; z-index:99000; display:flex; align-items:center; justify-content:center; padding:16px;
  background:rgba(4,8,12,.72); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); }
.dw-overlay[hidden] { display:none; }
body.dw-active { overflow:hidden; }
.dw-card { width:min(440px,100%); background:var(--bg2,#0d151d); border:1px solid var(--border-strong,var(--border,#22303f));
  border-radius:14px; padding:24px 22px 20px; text-align:center; box-shadow:0 20px 60px rgba(0,0,0,.5); }
.dw-anim { position:relative; height:86px; margin:0 0 18px; border-radius:8px; overflow:hidden;
  background:linear-gradient(180deg, rgba(var(--accent-rgb,245,197,24),.06), transparent); border-bottom:1px solid var(--border,#22303f); }
.dw-bars { position:absolute; inset:10px 10px 0; display:flex; align-items:flex-end; gap:3px; }
.dw-bars i { flex:1; height:12%; border-radius:2px 2px 0 0; background:rgba(var(--accent-rgb,245,197,24),.35);
  animation:dw-level 2.4s ease-in-out infinite; animation-delay:calc(var(--d) * 2.4s / 28); }
.dw-bars i:nth-child(7n+3) { --h:78%; } .dw-bars i:nth-child(11n+5) { --h:55%; } .dw-bars i:nth-child(5n+1) { --h:34%; }
@keyframes dw-level { 0%, 70%, 100% { height:12%; opacity:.5; } 8% { height:var(--h,22%); opacity:1; background:var(--accent,#f5c518); } }
.dw-beam { position:absolute; top:0; bottom:0; width:18%; left:-18%;
  background:linear-gradient(90deg, transparent, rgba(var(--accent-rgb,245,197,24),.28), transparent);
  border-right:2px solid var(--accent,#f5c518); animation:dw-beam 2.4s linear infinite; }
@keyframes dw-beam { from { left:-18%; } to { left:100%; } }
.dw-title { font-family:var(--font-display,inherit); font-size:20px; color:var(--text-bright,#fff); letter-spacing:.02em; }
.dw-sub { margin-top:6px; color:var(--accent,#f5c518); font-variant-numeric:tabular-nums; min-height:1.4em; }
.dw-note { margin-top:12px; font-size:13px; color:var(--text-dim,#8296aa); line-height:1.45; }
.dw-link { display:inline-block; margin-top:16px; padding:8px 18px; border-radius:8px; text-decoration:none; font-weight:600;
  color:var(--accent,#f5c518); border:1px solid rgba(var(--accent-rgb,245,197,24),.5); background:rgba(var(--accent-rgb,245,197,24),.08); }
.dw-link:hover { background:rgba(var(--accent-rgb,245,197,24),.18); }
@media (prefers-reduced-motion: reduce) { .dw-bars i, .dw-beam { animation:none; } }

/* ===== Ensemble: linia EId / ECC / CU + serviciile de date ale muxului (SPI, WEB) ===== */
.ensemble-meta { display: block; }
.mux-data { display: flex; flex-direction: column; }
.mux-row { display: flex; align-items: center; min-width: 0; }
.mux-row > .status-chip { flex-shrink: 0; }
.mux-info { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* DAB: antetul graficului = titlu, valoarea (dBuV) langa el, lock-ul in dreapta
   ("SIGNAL STRENGTH LOCKED" alaturate se citeau ca o singura eticheta) */
.signal-graph-header .lock-indicator { margin-left: 14px; }
.layout > .signal-graph-wrap .signal-graph-value { order: 1; margin-left: 14px; margin-right: auto; }
/* FM: HD presence (bara) in dreapta antetului, unde e LOCKED pe DAB */
.signal-graph-header .sig-hd { order: 2; display: flex; align-items: center; gap: 8px; }
.layout:not(.fm-mode) .signal-graph-header .sig-hd { display: none !important; }
.signal-graph-header .sig-hd .hd-level-bar { width: 140px; height: 18px; box-sizing: border-box; }
.layout:not(.fm-mode) > .signal-graph-wrap .lock-indicator { order: 2; }
/* EPG acum / urmeaza sub numele postului (epgnow.js) */
.epg-now { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* Ensemble: bara de capacitate (miniatura hartii) */
.cap-mini { cursor: pointer; }
.cap-mini-bar { position: relative; overflow: hidden; }
.cap-mini-bar > span { position: absolute; top: 0; bottom: 0; box-sizing: border-box; }
.cap-mini-foot { display: flex; justify-content: space-between; align-items: baseline; }
/* volum mai scurt; masuratoarea de loudness pe acelasi rand, in dreapta (dupa REC).
   Daca nu incape (coloana ingusta), trece pe randul urmator, nu se taie. */
.vol-row { flex-wrap: wrap; row-gap: 8px; }
.vol-row .vol-slider { flex: 0 1 100px; }
.vol-row .loud-row { margin: 0 0 0 auto; padding-left: 12px; gap: 8px; height: auto; flex: 0 0 auto; font-size: 12px; }
.vol-row .loud-bar { width: 80px; }
@media (max-width: 760px) {
  .vol-row .vol-slider { flex: 1 1 80px; }
  .vol-row .loud-row { flex-basis: 100%; margin-left: 0; padding-left: 0; }
}
/* telefon in Modern (mobile.js): "Service info" pliabil, filele de jos, mini-player.
   Ascunse peste tot; modern.css le arata doar cu body.m-b (telefon + Modern + DAB) */
.m-toggle, #mTabBar, #mMini { display: none; }
