@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;600;700&family=Share+Tech+Mono&family=Orbitron:wght@400;700;900&display=swap');

:root {
  --bg:        #080e14;
  --bg2:       #0d1620;
  --bg3:       #111d28;
  --accent:    #00d2ff;
  --accent-rgb: 0,210,255;   /* componenta RGB a accentului, pt. rgba() */
  --accent2:   #00ff88;
  --accent3:   #ff6b35;
  --border:    rgba(var(--accent-rgb),0.12);
  --text:      #c9d1d9;
  --text-dim:  #FFFFFF;
  --text-bright: #e6edf3;
  --green:     #00e676;
  --red:       #e53935;
  --warn:      #ffab40;
  /* Culori semnal (spectru, badge-uri) — galben=mediu, verde=puternic */
  --sig-weak:   #e74c3c;
  --sig-mid:    #f1c40f;
  --sig-strong: #2ecc71;
}

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

html {
  background: var(--bg);
}

body {
  font-family: 'Share Tech Mono', monospace;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(var(--accent-rgb),0.04) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 80% 80%, rgba(0,255,136,0.03) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(8,14,20,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.header-logo {
  font-family: 'Orbitron', monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.header-logo span {
  color: var(--text-dim);
  font-weight: 400;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ===== LAYOUT ===== */
.layout {
  position: relative;
  z-index: 1;
  padding: 20px;
  display: grid;
  grid-template-columns: 280px 560px 280px;
  gap: 16px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  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 {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  position: relative;
}

.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

.panel-title {
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 14px;
  opacity: 0.7;
}

/* ===== SIGNAL GRAPH ===== */
.signal-graph-wrap {
  grid-column: 1 / -1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 16px 8px;
  position: relative;
}

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

.signal-graph-title {
  font-family: 'Orbitron', monospace;
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 3px;
  opacity: 0.7;
}

.signal-graph-value {
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 2px;
}

.signal-graph-value span {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 4px;
}

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

/* ===== TUNE DISPLAY ===== */
.tune-big {
  text-align: center;
  padding: 8px 0;
  color: var(--text-bright);
}

.tune-channel {
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 4px;
  margin-bottom: 4px;
}

.tune-freq {
  font-family: 'Orbitron', monospace;
  font-size: 28px;
  font-weight: 900;
  color: var(--text-bright);
  letter-spacing: 2px;
  line-height: 1;
}

.tune-freq span {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 400;
}

.tune-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.tune-controls select {
  flex: 1;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 7px 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 7px 14px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.btn:hover {
  background: var(--accent);
  color: var(--bg);
}

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

@media (hover: none) {
  .btn:hover {
    background: transparent;
    color: var(--accent);
  }
}

.btn.active {
  background: var(--accent);
  color: var(--bg);
}

/* ===== ENSEMBLE ===== */
.ensemble-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.ensemble-id {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 2px;
}

/* ===== SERVICE SELECT ===== */
.svc-select-wrap {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.svc-select-wrap select {
  flex: 1;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 7px 10px;
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

/* ===== PLAYER ===== */
.player-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 20px;
  position: relative;
  overflow: hidden;
}

.player-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

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

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

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

.player-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
  margin-bottom: 16px;
}

.now-playing-label {
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 3px;
  opacity: 0.7;
  margin-bottom: 4px;
}

.station-name {
  font-family: 'Rajdhani', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 1px;
  line-height: 1;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 238px;
}

.station-ensemble {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 2px;
  margin-bottom: 0;
}

.rt-box {
  background: rgba(var(--accent-rgb),0.04);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 10px 14px;
  height: 70px;
  overflow: hidden;
}

.rt-label {
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 2px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.rt-text {
  font-size: 16px;
  color: var(--text-dim);
  overflow: hidden;
}

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

.rt-line.scrolling {
  animation: scrollRT 10s linear infinite;
  display: inline-block;
  min-width: 100%;
}

@keyframes scrollRT {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(0); }
  80%  { transform: translateX(calc(-50% - 20px)); }
  100% { transform: translateX(calc(-50% - 20px)); }
}

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

.play-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.play-btn:hover {
  background: var(--accent);
  box-shadow: 0 0 20px rgba(var(--accent-rgb),0.4);
}

.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;
  padding: 0 !important;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0;
}

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

.tune-seek {
  width: 36px;
  min-width: 36px;
  height: 28px;
  min-height: 28px;
  padding: 0 !important;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0;
}

.tune-seek.scanning {
  background: var(--accent);
  color: #061018;
  box-shadow: 0 0 16px rgba(var(--accent-rgb), 0.28);
}

.tune-arrow::before {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.tune-prev::before {
  border-right: 8px solid currentColor;
}

.tune-next::before {
  border-left: 8px solid currentColor;
}

.tune-seek::before,
.tune-seek::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.tune-seek-prev::before,
.tune-seek-prev::after {
  border-right: 8px solid currentColor;
}

.tune-seek-next::before,
.tune-seek-next::after {
  border-left: 8px solid currentColor;
}

.status-chip {
  /*font-family: 'Share Tech Mono', monospace;*/
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--bg3);
  display: inline-block;
  opacity: 0.45;
  transition: all 0.2s ease;
}

.status-chip.active {
  color: var(--accent);
  border-color: var(--accent);
  opacity: 1;
}

.audio-type-badge {
  font-family: 'Orbitron', monospace;
  font-size: 18px;
  font-weight: 900;
  color: var(--text-bright);
  letter-spacing: 3px;
  /*margin-top: 10px;*/
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  margin-left: auto;
  flex-shrink: 0;
  align-self: flex-start;
  transition: all 0.3s;
}

.pc-playing-state .status-dot {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 4px var(--accent); }
  50%       { box-shadow: 0 0 14px var(--accent); }
}

/* volume */
.vol-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.vol-icon {
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.2s;
}

.vol-icon:hover { color: var(--accent); }

.vol-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--vol, 80%), #21262d var(--vol, 80%));
  outline: none;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(var(--accent-rgb),0.5);
  cursor: pointer;
}

.vol-value {
  font-size: 11px;
  color: var(--text-dim);
  width: 28px;
  text-align: right;
}

/* service info */
.svc-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 20px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  height: 100px;
}

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

.svc-info-label {
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.svc-info-value {
  font-size: 13px;
  color: var(--text-bright);
  font-weight: 600;
}

/* ===== SIGNAL BARS ===== */
.signal-section { margin-bottom: 11px; }

.sig-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
}

.sig-label {
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 2px;
  width: 80px;
  flex-shrink: 0;
  font-family: 'Orbitron', monospace;
}

.sig-bar-wrap {
  flex: 1;
  height: 6px;
  background: rgba(0,0,0,0.4);
  border-radius: 3px;
  overflow: hidden;
}

.sig-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(.4,2,.6,1);
  background: linear-gradient(90deg, var(--accent2), var(--accent));
}

.sig-value {
  font-size: 10px;
  color: var(--text-dim);
  width: 30px;
  text-align: right;
  flex-shrink: 0;
  font-family: 'Orbitron', monospace;
}

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

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

.lock-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
  transition: all 0.3s;
  flex-shrink: 0;
}

.lock-dot.locked {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.lock-label {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

/* ===== SLIDESHOW ===== */
.slideshow-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

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

/* ===== BADGES ===== */
.badge {
  padding: 3px 9px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: 'Orbitron', monospace;
}

.badge-stereo { background: rgba(0,230,118,0.15); color: var(--green); border: 1px solid rgba(0,230,118,0.3); }
.badge-mono   { background: rgba(255,152,0,0.15); color: var(--warn); border: 1px solid rgba(255,152,0,0.3); }
.badge-alarm  { background: rgba(229,57,53,0.15); color: var(--red); border: 1px solid rgba(229,57,53,0.3); }
.badge-music  { background: rgba(63,81,181,0.15); color: #7986cb; border: 1px solid rgba(63,81,181,0.3); }
.badge-talk   { background: rgba(0,150,136,0.15); color: #4db6ac; border: 1px solid rgba(0,150,136,0.3); }

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ===== SCANNER ===== */
.scan-chart-wrap {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

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

.scan-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.scan-ch {
  font-size: 9px;
  padding: 2px;
  border-radius: 2px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Orbitron', monospace;
  letter-spacing: 1px;
}

.scan-ch:hover          { border-color: var(--accent); color: var(--accent); }
.scan-ch.has-signal     { border-color: var(--accent2); color: var(--accent2); }
.scan-ch.strong-signal  { border-color: var(--sig-mid); color: var(--sig-mid); }

.scan-status {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  font-family: 'Share Tech Mono', monospace;
}

.scan-status.scanning {
  color: var(--accent);
  animation: blink 1s infinite;
}

.scan-overlay {
  display: none;
}

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

  .scan-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(8,14,20,0.95);
    z-index: 999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
  }
  
  .scan-overlay.active {
    display: flex;
  }
  
  .scan-overlay-text {
    font-family: 'Orbitron', monospace;
    font-size: 14px;
    color: var(--accent);
    letter-spacing: 3px;
    animation: blink 1s infinite;
  }
  
  .scan-overlay-sub {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 2px;
  }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ===== SERVICES SCAN LIST ===== */
.svc-scan-channel {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.svc-scan-channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg3);
  cursor: pointer;
  user-select: none;
}

.svc-scan-channel-header:hover {
  background: rgba(var(--accent-rgb),0.08);
}

.svc-scan-channel-name {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 2px;
}

.svc-scan-channel-freq {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
}

.svc-scan-channel-toggle {
  font-size: 12px;
  color: var(--text-dim);
  transition: transform 0.2s;
}

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

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

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

.svc-scan-item {
  padding: 6px 10px 6px 16px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  border-top: 1px solid var(--border);
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.svc-scan-item:hover {
  background: rgba(var(--accent-rgb),0.08);
  color: var(--accent);
}

.svc-scan-item.active {
  color: var(--accent2);
  border-left: 2px solid var(--accent2);
}

#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; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }


#slideshow { cursor: pointer; }


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

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

#fmRT {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#fmStereoBadge, #fmMonoText, #fmPTYBadge, #fmMSVal {
  display: block;
  width: 100%;
}

@media (max-width: 760px) {
  :root {
    --bg: #060b10;
    --bg2: #0b141d;
    --bg3: #111b27;
    --border: rgba(67, 202, 255, 0.16);
    --text-dim: #7f93a8;
  }

  body {
    min-height: 100dvh;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  body::before {
    background:
      linear-gradient(180deg, rgba(var(--accent-rgb),0.06), transparent 240px),
      linear-gradient(135deg, rgba(0,255,136,0.04), transparent 45%);
  }

  .header {
    display: block;
    padding: max(12px, env(safe-area-inset-top)) 10px 10px;
    width: 100vw;
    max-width: 100vw;
    overflow: visible;
  }

  .header-logo {
    font-size: 13px;
    letter-spacing: 2px;
    min-width: 0;
    padding-right: 132px;
  }

  .header-logo span {
    display: none;
  }

  .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;
    gap: 8px !important;
    min-width: 0;
    max-width: 100%;
  }

  #modeWrap {
    gap: 5px !important;
    min-width: 0;
  }

  #modeWrap > span {
    display: none;
  }

  .header .btn {
    min-height: 34px;
    padding: 8px 9px;
    letter-spacing: 1px;
  }

  .header-status {
    min-width: 0 !important;
    justify-content: space-between !important;
    gap: 8px;
    overflow: hidden;
    padding-top: 20px;
    font-size: 10px;
  }

  .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);
    gap: 10px;
    padding: 10px;
    margin: 0;
    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;
  }

  .panel,
  .player-panel,
  .signal-graph-wrap {
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  }

  .panel-title,
  .signal-graph-title,
  .now-playing-label,
  .rt-label {
    letter-spacing: 2px;
  }

  .player-main {
    flex-direction: column;
    gap: 12px;
  }

  .player-heading {
    gap: 12px;
    align-items: center;
  }

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

  .station-name {
    width: auto;
    max-width: 100%;
    font-size: 30px;
    line-height: 1.02;
  }

  .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;
    background: #070f17;
    border: 1px solid var(--border);
  }

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

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

  .vol-row {
    margin-top: 10px;
    padding-top: 12px;
  }

  .vol-slider {
    height: 6px;
  }

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

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

  .rt-text {
    font-size: 17px;
    line-height: 1.25;
  }

  .svc-info-grid {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
  }

  .svc-info-value {
    font-size: 15px;
    overflow-wrap: anywhere;
  }

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

  .signal-graph-value {
    flex: 0 1 auto;
    max-width: 44%;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 22px;
    letter-spacing: 1px;
  }

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

  #signalCanvas {
    height: 86px;
  }

  .tune-big {
    padding: 4px 0 8px;
  }

  .tune-freq {
    font-size: 34px;
  }

  .tune-controls {
    gap: 8px;
  }

  .tune-controls .tune-arrow {
    width: 76px;
    min-width: 76px;
    height: 44px;
    min-height: 44px;
    padding: 0 !important;
  }

  .tune-controls .tune-arrow::before {
    border-top-width: 6px;
    border-bottom-width: 6px;
  }

  .tune-controls .tune-prev::before {
    border-right-width: 10px;
  }

  .tune-controls .tune-next::before {
    border-left-width: 10px;
  }

  .fm-tune-controls {
    gap: 6px !important;
  }

  .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;
    font-size: 12px;
  }

  .tune-controls select,
  .svc-select-wrap select,
  #fmFreqInput,
  #deemphSelect {
    min-height: 44px;
    font-size: 16px !important;
    border-radius: 7px !important;
  }

  .btn {
    min-height: 44px;
    border-radius: 7px;
    padding: 10px 14px;
  }

  .ensemble-name {
    font-size: 24px;
    line-height: 1.05;
  }

  .lock-row {
    gap: 12px;
  }

  .sig-row {
    gap: 8px;
    margin-bottom: 9px;
  }

  .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;
  }

  .svc-scan-item {
    font-size: 17px;
  }

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

  #motDebugPanel {
    margin: 10px !important;
  }

  .layout.fm-mode {
    gap: 12px;
    padding: 10px 10px 18px;
  }

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

  .layout.fm-mode .col-center.fm-only .player-panel {
    padding: 16px;
    border-radius: 16px;
    background:
      linear-gradient(180deg, rgba(var(--accent-rgb),0.055), transparent 120px),
      var(--bg2);
    border-color: rgba(67, 202, 255, 0.22);
  }

  .layout.fm-mode .col-center.fm-only .player-main {
    gap: 14px;
  }

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

  .layout.fm-mode .col-center.fm-only .play-btn {
    width: 64px;
    height: 64px;
    box-shadow: 0 16px 36px rgba(var(--accent-rgb), 0.22);
  }

  .layout.fm-mode .col-center.fm-only .now-playing-label {
    font-size: 10px;
    letter-spacing: 3px;
    margin-bottom: 6px;
  }

  .layout.fm-mode .col-center.fm-only .station-name {
    font-size: clamp(38px, 11vw, 54px);
    line-height: .92;
    letter-spacing: .5px;
    width: 100%;
  }

  .layout.fm-mode .col-center.fm-only .audio-type-badge {
    font-size: 24px;
    letter-spacing: 4px;
  }

  .layout.fm-mode .col-center.fm-only .vol-row {
    margin-top: 12px !important;
    padding-top: 14px;
    gap: 12px;
  }

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

  .layout.fm-mode .album-art-frame {
    width: min(68vw, 268px) !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    margin: 0 auto;
    align-self: center;
    border-radius: 18px;
    filter: drop-shadow(0 18px 42px rgba(0, 0, 0, 0.34));
  }

  .layout.fm-mode .album-art-frame > div {
    width: 100% !important;
    height: 100% !important;
    padding: clamp(12px, 4vw, 22px);
    border-radius: 18px !important;
    background:
      radial-gradient(circle at 50% 45%, rgba(var(--accent-rgb), 0.08), transparent 58%),
      #08111a !important;
    border-color: rgba(67, 202, 255, 0.24) !important;
  }

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

  .layout.fm-mode #hdArtPlaceholder {
    font-size: 11px !important;
    color: rgba(127, 147, 168, 0.44) !important;
  }

  .layout.fm-mode .rt-box {
    min-height: 62px;
    border-radius: 12px;
    margin-top: 14px !important;
    background: rgba(var(--accent-rgb), 0.055);
  }

  .layout.fm-mode #fmRT {
    -webkit-line-clamp: 2;
    font-size: 20px;
    color: #aebdcb;
  }

  .layout.fm-mode .svc-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border-top-color: rgba(67, 202, 255, 0.18);
  }

  .layout.fm-mode .svc-info-row {
    min-height: 56px;
    padding: 10px;
    border: 1px solid rgba(67, 202, 255, 0.15);
    border-radius: 10px;
    background: rgba(17, 27, 39, 0.7);
    justify-content: center;
  }

  .layout.fm-mode .svc-info-label {
    font-size: 10px;
    letter-spacing: 2px;
  }

  .layout.fm-mode .svc-info-value {
    font-size: 20px;
    line-height: 1.05;
  }

  .layout.fm-mode #fmTAVal {
    color: var(--warn, #ffab40);
  }

  .layout.fm-mode #fmStereoBadge,
  .layout.fm-mode #fmMonoText,
  .layout.fm-mode #fmPTYBadge,
  .layout.fm-mode #fmMSVal {
    width: auto;
    max-width: 100%;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .layout.fm-mode .signal-graph-wrap {
    margin-top: 0;
  }

  .layout.fm-mode .col-left.fm-only,
  .layout.fm-mode .col-services.fm-only {
    gap: 12px !important;
  }
}

@media (max-width: 380px) {
  .layout,
  .layout.fm-mode {
    padding: 8px;
  }

  .panel,
  .player-panel,
  .signal-graph-wrap {
    padding: 12px;
  }

  .station-name {
    font-size: 26px;
  }

  .tune-freq {
    font-size: 30px;
  }

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

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

  .layout.fm-mode .col-center.fm-only .station-name {
    font-size: 36px;
  }

  .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;
  margin-left: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s, transform 0.4s ease;
}
#setupGearBtn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: rotate(90deg);
}
