:root {
  --bg: #23202C;
  --card: #292532;
  --accent: #8B4361;
  --soft: #E2B9C8;
  --text: #F2ECE7;
  --max-width: 980px;
}
body {
  font-family: "Kay Pho Du", serif, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--soft);
  min-height: 100vh;
}
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; max-width: var(--max-width); margin: 0 auto;
}
.logo {
  font-size: 36px; font-weight: 800; width: 44px; height: 44px;
  background: var(--accent); color: #fff; border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 14px #210a1b6c;
}
.title {
  font-size: 30px; font-weight: bold; letter-spacing: 4px;
  color: var(--soft); text-shadow: 0 1px 6px #14101440;
}
.app, .card {
  max-width: var(--max-width); margin: 30px auto 0 auto;
  background: var(--card);
  border-radius: 15px;
  box-shadow: 0 3px 24px #18151c4c;
  border: 1.5px solid #2d263570;
  padding: 22px;
  color: var(--text);
}
.btn, .primary, #vizStylePanel .btn, .vizStyleSelect.btn {
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  border: none;
  font-family: inherit;
  font-weight: 700; padding: 9px 15px; font-size: 16px;
  box-shadow: 0 1px 9px #23152340;
  transition: box-shadow 0.14s, background 0.11s, color 0.08s, transform .09s;
  cursor: pointer;
}
.btn:hover, .primary:hover, #vizStylePanel .btn:hover, .vizStyleSelect.btn:hover {
  background: #a55a7b;
  color: #fff;
  transform: scale(1.03);
  box-shadow: 0 3px 10px #7b3b6060;
}
.bibki-badge {
  background: #4e2e41;
  border: none;
  color: var(--soft);
  font-weight:700; min-width:72px; text-align:center;
  box-shadow: 0 1px 6px #210a1b25;
}
.radio-slider, #volumeSlider, .volume-slider { 
  accent-color: var(--accent);
  background: #18151c;
  border-radius: 7px;
  margin-bottom:7px;
}
#miniViz { background: #18151c; border-radius: 7px; z-index:2100!important; transition:width .35s, height .35s;}
#favList {
  background: #201c24;
  border: 1px solid #2d263570;
  border-radius: 8px; padding: 8px; color: var(--soft); font-size:15px;
  box-shadow: 0 1px 13px #140f1482;
}
#vizStylePopup{
  z-index:2201!important;
  position: fixed;
  bottom: 62px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1.5px solid #2d263570;
  box-shadow: 0 3px 12px #18151c4c;
  border-radius: 14px;
  color: var(--soft);
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: 0 3px 16px #000;
  min-width: 220px;
  align-items: center;
  padding: 14px 25px;
}
#vizStyleBtn { 
  z-index:2202!important; 
  position:fixed;bottom:18px;left:50%;transform:translateX(-50%);
  padding:9px 18px;font-size:17px;
  background: var(--accent);
  color: #fff;
}
input, select {
  background: #201c24; color: var(--soft);
  border: 1px solid #4e2e41; padding: 8px 10px; border-radius:8px;
  font-size:15px; margin-top:6px; margin-bottom:4px;
}
input:focus { border-color: var(--accent); outline: none; }
.card { background: var(--card); border: 1.5px solid #2d263570; box-shadow: 0 3px 18px #18151c4c; padding: 20px;}
.popup, .modal {
  position:fixed; inset:0; display:flex; align-items:center; justify-content:center; z-index:600;
  background:rgba(20,18,28,0.85); opacity:0; pointer-events:none; transition: opacity .19s ease;
}
.popup.visible, .modal.visible { opacity:1; pointer-events:all; }
button:focus, input:focus { outline: 2px dashed #8B4361; outline-offset:3px; }
@media (max-width:900px) {
  .app, .card { padding:12px;}
  .title { font-size:20px;}
}
.hidden { display: none !important; }

#miniViz {
  z-index: 2100 !important;
  transition: width .35s, height .35s;
}

#vizStylePopup {
  z-index: 2201 !important;
}


.header-content {
  display: flex;
  gap: 12px;
  align-items: center;
}

.username-area {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-container {
  max-width: 980px;
  margin: 24px auto;
}

.card-centered {
  text-align: center;
}

.favorite-button-container {
  margin-top: 8px;
}

.favorite-button-wrapper {
  display: flex;
  justify-content: flex-end;
  width: 90%;
  margin: 0 auto 6px auto;
}

.radio-controls-container {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.scan-info {
  margin-left: 12px;
  font-size: 14px;
  color: rgba(242,236,231,0.8);
}

.stop-scan-button {
  display: none;
}

.speed-info {
  margin-left: 10px;
  opacity: 0.8;
}

.viz-container {
  margin-top: 18px;
}

.viz-canvas {
  width: 90%;
  height: 50px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
}

.volume-controls {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.volume-label {
  font-size: 14px;
  color: rgba(242,236,231,0.8);
}

.volume-slider {
  width: 200px;
}

.volume-value {
  font-size: 14px;
  color: rgba(242,236,231,0.8);
  min-width: 40px;
}

.favorites-sidebar {
  position: fixed;
  right: 14px;
  top: 110px;
  width: 180px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hidden-audio {
  display: none;
}

.viz-style-title {
  font-size: 16px;
  font-weight: bold;
  color: #F9D85E;
  margin-bottom: 4px;
}

.viz-close-btn {
  margin-top: 7px;
}

#vizStyleBtn {
  z-index: 2202 !important;
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 13px 22px;
  font-size: 17px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-family: inherit;
  transition:
    box-shadow 0.18s,
    background 0.13s,
    color 0.13s,
    /* НА ВАЖНО: transform только для высоты, не трогаем X! */
    transform 0.15s cubic-bezier(.61,.14,.44,1.12);
  /* убрано scale(1.03) по умолчанию, чтобы анимация работала от единичного состояния */
}

#vizStyleBtn:hover, #vizStyleBtn:focus {
  animation: heartbeat 0.92s cubic-bezier(.31, .64, .55, 1.59) infinite;
  background: #a55a7b;
  color: #fff;
  box-shadow: 0 7px 28px #8b436154, 0 1px 16px #e2b9c867;
  /* transform не меняем, чтобы не смещалась */
}

@keyframes heartbeat {
  0%   { transform: translateX(-50%) scale(1);}
  16%  { transform: translateX(-50%) scale(1.10);}
  28%  { transform: translateX(-50%) scale(0.96);}
  40%  { transform: translateX(-50%) scale(1.11);}
  52%  { transform: translateX(-50%) scale(1);}
  100% { transform: translateX(-50%) scale(1);}
}
.stream-info-panel {
  position: absolute;
  left: 18px;   /* можешь подвинуть! */
  top: 115px;   /* чуть ниже header */
  width: 245px;
  background: #23202C;
  border-radius: 18px;
  box-shadow: 0 3px 22px #18151c2c, 0 1px 10px #29152655;
  padding: 18px 10px 16px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stream-img-preview {
  width: 225px;
  height: 225px;
  object-fit:cover;
  border-radius: 14px;
  background: #191425;
  box-shadow:0 2px 6px #29152625;
}

.stream-name-display {
  margin-top: 13px;
  font-size: 21px;
  font-weight: 700;
  color: #e2b9c8;
  text-align: center;
  width: 100%;
}

.stream-time-display {
  margin-top: 6px;
  font-size: 15px;
  color: #ccc0ab;
  font-family: 'Consolas', 'Monaco', 'Menlo', 'monospace';
  text-align: center;
  width: 100%;
}
.popup {
  position: fixed;
  z-index: 9999;
  left: 0; top: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  transition: opacity 0.2s;
}
.popup-box {
  background: #25292e;
  padding: 32px 28px 20px 28px;
  border-radius: 20px;
  min-width: 320px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 6px 24px #000a;
}
.popup.hidden {
  display: none;
}
.popup {
  position: fixed;
  z-index: 9999;
  left: 0; top: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
}
.popup.hidden {
  display: none;
}
.popup-box {
  background: #25292e;
  padding: 32px 28px 20px 28px;
  border-radius: 20px;
  min-width: 320px;
  text-align: center;
  box-shadow: 0 6px 24px #000a;
}
.popup-close {
  position: absolute;
  right: 18px;
  top: 14px;
  font-size: 28px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}
.radio-slider-wrap {
  position: relative;
  width: 320px;
  height: 22px;      /* трек слегка выше, чтобы острие было по краям */
}

/* Блики стекла */
.radio-slider-wrap::before {
  content: "";
  position: absolute;
  top: 3px; left: 26%;
  width: 50px; height: 6px;
  background: linear-gradient(92deg, transparent 0%, #fff 60%, transparent 100%);
  opacity: 0.13;
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}
.radio-slider-wrap::after {
  content: "";
  position: absolute;
  top: 13px; left: 75%;
  width: 18px; height: 3px;
  background: linear-gradient(82deg, transparent 0%, #fff 90%, transparent 100%);
  opacity: 0.10;
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
}

/* Тёмный трек */
.radio-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 17px;
  background: #18151c;
  border-radius: 11px;
  box-shadow:
    inset 0 1.5px 8px #000a,
    inset 0 -1.5px 6px #29262a88;
  outline: none;
  cursor: pointer;
  position: relative;
}

/* Острая длинная ручка (Chrome, Edge, Opera) */
.radio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 2px;               /* тонкая полоска */
  height: 30px;             /* игла по всей высоте */
  background: #ed293c;
  border-radius: 0px;
  border: none;
  box-shadow: 0 0 8px #ed293c19;
  position: relative;
  /* "заострить" низ и верх (игла через ::before и ::after к thumb) */
}
.radio-slider::-webkit-slider-thumb::before,
.radio-slider::-webkit-slider-thumb::after {
  content: "";
  display: block;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #ed293c;
}

/* заострение вверх */
.radio-slider::-webkit-slider-thumb::before {
  top: -7px;
  width: 0;
  height: 0;
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  border-bottom: 7px solid #ed293c;
  border-radius: 1px;
}

/* заострение вниз */
.radio-slider::-webkit-slider-thumb::after {
  bottom: -7px;
  width: 0;
  height: 0;
  border-left: 2px solid transparent;
  border-right: 2px solid transparent;
  border-top: 7px solid #ed293c;
  border-radius: 1px;
}

/* Firefox */
.radio-slider::-moz-range-thumb {
  width: 4px;
  height: 22px;
  background: #ed293c;
  border-radius: 2.5px;
  border: none;
  box-shadow: 0 0 8px #ed293c19;
}
.radio-slider::-moz-range-track {
  background: #18151c;
  height: 22px;
  border-radius: 11px;
  box-shadow:
    inset 0 1.5px 8px #000a,
    inset 0 -1.5px 6px #29262a88;
}

/* IE & Edge */
.radio-slider::-ms-thumb {
  width: 4px;
  height: 22px;
  background: #ed293c;
  border-radius: 2.5px;
  border: none;
  box-shadow: 0 0 8px #ed293c19;
}

.radio-slider::-ms-fill-lower,
.radio-slider::-ms-fill-upper {
  background: #18151c;
  border-radius: 11px;
  box-shadow:
    inset 0 1.5px 8px #000a,
    inset 0 -1.5px 6px #29262a88;
}

.radio-slider:focus {
  outline: none;
}
.radio-slider::-ms-tooltip {
  display: none;
}
.ruler-tick {
  position: absolute;
  top: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
}

.tick-micro { height: 3px; background: rgba(255,255,255,0.2); }
.tick-minor { height: 6px; background: rgba(255,255,255,0.4); }
.tick-mid { height: 10px; background: rgba(255,255,255,0.6); }
.tick-major { height: 16px; background: rgba(255,255,255,0.9); }

.tick-label {
  position: absolute;
  top: 18px;
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  transform: translateX(-50%);
}
/* ======== Ruler ======== */
#rulerTicks {
  position: relative;
  width: 100%;
  height: 40px;
  margin-top: 8px;
  user-select: none;
}

.r-tick {
  position: absolute;
  top: 0;
  width: 2px;
  background: rgba(255,255,255,0.55);
  transform: translateX(-50%);
}

.r-major {
  height: 20px;
  background: rgba(255,255,255,0.8);
}

.r-mid {
  height: 14px;
  background: rgba(255,255,255,0.7);
}

.r-minor {
  height: 6px;
  background: rgba(255,255,255,0.25);
  width: 2px;
}


.r-label {
  position: absolute;
  top: 22px;
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  transform: translateX(-50%);
  pointer-events: none;
  font-family: monospace;
  text-align: center;
}

/* при активной подсветке */
.r-tick.active {
  background: #4bf1a6;
}

.r-label.active {
  color: #4bf1a6;
}
