:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-glass: rgba(10, 10, 15, 0.6);
  --text-primary: #f0eee6;
  --text-secondary: #a09e98;
  --text-muted: #6b6a66;
  --accent: #d4a853;
  --accent-hover: #e4b863;
  --accent-dim: rgba(212, 168, 83, 0.15);
  --border: rgba(240, 238, 230, 0.08);
  --border-hover: rgba(240, 238, 230, 0.15);
  --radius: 12px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

body.menu-open {
  overflow: hidden;
}

::selection { background: var(--accent); color: var(--bg-primary); }

/* === App Container === */
.app-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  gap: 16px;
  padding: 16px 32px;
}

/* === Center Column === */
.center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* === Main Player Screen (16:9) === */
.main-screen {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.main-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.main-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.main-cover.visible { display: block; }

#audioViz {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 1;
  pointer-events: none;
}

#audioViz.active { display: block; }

/* Портретный лист по центру, а не во весь экран. На десктопе .main-screen
   широкий (например 780×437), а рисунок 720×1280. При inset:0 + slice
   composition обрезалась до полосы в треть экрана: терялись и низ, и верх.
   artFitPanel() в app.js задаёт размер этого бокса под фактический viewBox
   сцены, поэтому и портрет 9:16, и старые landscape-сценарии вписываются
   целиком (contain), а не режутся. */
#artCanvas {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  z-index: 1;
  background: transparent;
  pointer-events: none;
}

/* Статическая бумага под рисунком. feTurbulence считается ОДИН раз на весь
   слой и не анимируется — вкладка не замирает, как при покадровой анимации. */
#artPaper {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  /* Мягкая тень отдаёт лист от фона экрана — без неё бумага читается как
     заливка страницы, а не как физический лист. */
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  /* Бумага по канону Belle Époque §2: тёплая слоновая кость #F4EFE3. */
  background-color: #F4EFE3;
  background-image:
    /* волокна: полосы разного направления. Плотность волокна поднята по
       образцам (замер: зерно бумаги 0.021 против 0.057–0.080 в образце). */
    repeating-linear-gradient(94deg, rgba(120, 106, 84, 0.10) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(2deg, rgba(120, 106, 84, 0.075) 0 1px, transparent 1px 11px),
    repeating-linear-gradient(47deg, rgba(120, 106, 84, 0.05) 0 1px, transparent 1px 15px),
    /* неравномерность тонировки листа */
    radial-gradient(120% 80% at 18% 12%, rgba(255, 253, 247, 0.55), transparent 60%),
    radial-gradient(90% 70% at 82% 88%, rgba(206, 194, 170, 0.30), transparent 65%),
    /* фоксинги §2: 3 пятна #B98D5E, alpha 0.06–0.12 */
    radial-gradient(circle at 22% 68%, rgba(185, 141, 94, 0.10) 0 1.4%, transparent 1.7%),
    radial-gradient(circle at 63% 31%, rgba(185, 141, 94, 0.08) 0 1.0%, transparent 1.3%),
    radial-gradient(circle at 81% 76%, rgba(185, 141, 94, 0.07) 0 1.7%, transparent 2.0%),
    /* облачность тонировки (крупная печать) — «живой» лист, а не ровная заливка */
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='420'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.018' numOctaves='2' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='420' height='420' filter='url(%23m)' opacity='0.18'/%3E%3C/svg%3E"),
    /* зерно */
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)' opacity='0.35'/%3E%3C/svg%3E");
  background-size: auto, auto, auto, auto, auto, auto, auto, 420px 420px, 140px 140px;
}

/* Зерно отдельным слоем в режиме soft-light: фактура получается втрое
   плотнее (замер 0.021 против 0.057–0.080 в образцах), а тон бумаги не
   темнеет - soft-light не сдвигает среднее, в отличие от наложения серого. */
#artPaper::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: soft-light;
  opacity: 1;
  background-image:
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.05' numOctaves='3' stitchTiles='stitch'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='1.8' intercept='-0.4'/%3E%3CfeFuncG type='linear' slope='1.8' intercept='-0.4'/%3E%3CfeFuncB type='linear' slope='1.8' intercept='-0.4'/%3E%3C/feComponentTransfer%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.35' numOctaves='2' stitchTiles='stitch' seed='5'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23b)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.06' numOctaves='2' stitchTiles='stitch' seed='9'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23c)'/%3E%3C/svg%3E");
  background-size: 120px 120px, 260px 260px, 400px 400px;
}

/* Виньетка отдельным слоем: край листа темнее центра — глаз считывает это как
   бумагу, а не как белый прямоугольник. Тень края §2: rgba(70,50,25,0.16). */
#artPaper::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 95% at 50% 45%, transparent 52%, rgba(70, 50, 25, 0.16) 100%);
}

/* Live art engine (поток сознания) */
#artCanvas .el-fade {
  opacity: 0;
  animation: artFade var(--draw-duration, 0.8s) ease-out forwards;
}
@keyframes artFade { from { opacity: 0; } to { opacity: 1; } }

#artCanvas .el-scale {
  transform: scale(0);
  transform-origin: 50% 50%;
  animation: artScale var(--draw-duration, 0.8s) ease-out forwards;
}
@keyframes artScale { from { transform: scale(0); } to { transform: scale(1); } }

#artCanvas .el-path path,
#artCanvas .el-path circle,
#artCanvas .el-path line,
#artCanvas .el-path rect,
#artCanvas .el-path polyline,
#artCanvas .el-path polygon,
#artCanvas .el-path ellipse {
  /* v5.11: прорисовка привязана к audio.currentTime через RAF (§47-51);
     CSS transition убран, чтобы покадровое обновление не сглаживалось. */
}

/* Overlay */
.main-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.main-overlay > * { pointer-events: auto; }

.main-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, transparent 100%);
}

.main-logo {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.main-logo span { color: var(--accent); }

.main-center {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  pointer-events: none;
}

.main-play-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.9);
  border: none;
  color: var(--bg-primary);
  font-size: 1.8rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.main-play-btn.visible { display: flex; }

.loading-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0.7;
}
.loading-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: loading-bounce 1.4s ease-in-out infinite both;
}
.loading-indicator span:nth-child(1) { animation-delay: -0.32s; }
.loading-indicator span:nth-child(2) { animation-delay: -0.16s; }
.loading-indicator span:nth-child(3) { animation-delay: 0s; }
@keyframes loading-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.loading-indicator.hidden { display: none; }

/* === Side Screens === */
.side-screen {
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-secondary);
  flex-shrink: 0;
  position: relative;
}

.side-screen:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.side-cover {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg-secondary);
}

.side-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.side-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--accent);
  background: linear-gradient(135deg, var(--bg-secondary), #1a1a28);
}

.side-cover img.side-placeholder-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 25%;
  background: linear-gradient(135deg, var(--bg-secondary), #1a1a28);
  display: block;
}

.menu-list-item-thumb .side-placeholder-img {
  object-fit: contain;
  display: block;
  background: none;
}

.side-title {
  padding: 10px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  color: var(--text-secondary);
  text-align: center;
  background: var(--bg-primary);
}

.side-title-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
}

.side-title-text {
  display: inline-block;
  white-space: nowrap;
  padding: 0 2px;
}

.side-title.scrolling .side-title-track {
  animation: marquee 15s linear infinite;
}

.side-title .side-title-text {
  color: inherit;
  text-shadow: none;
}

/* === Main Bottom (title inside player, like side screens) === */
.main-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 3;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
  padding: 32px 12px 10px;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
}

.main-title-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
}

.main-title-text {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.85rem;
  color: #fff;
  padding: 0 12px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.main-bottom.scrolling .main-title-track {
  animation: marquee 15s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* === Desktop / Tablet landscape: 3 equal screens fill window === */
@media (min-width: 900px) and (orientation: landscape) {
  .app-container {
    padding: 0;
    gap: 0;
  }

  .main-screen,
  .side-screen {
    width: calc(100vw / 3);
    height: 100vh;
    border-radius: 0;
  }

  .main-screen {
    width: 100%;
  }

  .center-column {
    width: calc(100vw / 3);
  }

  .side-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    padding: 32px 12px 10px;
    font-size: 0.75rem;
    text-align: left;
    color: #fff;
    border-radius: 0;
  }
}

/* === Mobile / Tablet portrait === */
@media (max-width: 899px), (orientation: portrait) {
  .app-container {
    padding: 0;
    gap: 0;
  }

  .main-screen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    aspect-ratio: auto;
  }

  .main-screen video {
    object-fit: cover;
  }

  .center-column {
    width: 100vw;
  }

  .side-screen { display: none; }

  .main-bottom {
    padding: 24px 10px 8px;
  }

  .menu-dropdown {
    border-radius: 0;
  }
}

/* Narrow phones: 4 icon buttons (26px each with the touch-target padding) plus
   the 36px hamburger no longer fit at 320px, so tighten the padding and gaps. */
@media (max-width: 400px) {
  .main-top { padding: 12px 12px; }
  .top-right-controls { gap: 2px; }
  .main-logo { font-size: 0.95rem; }
}

/* === Hamburger === */
.flag-btn {
  color: rgba(255,255,255,0.45);
  font-size: 0;
  line-height: 1;
  vertical-align: middle;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.2s ease, transform 0.2s ease;
  opacity: 1;
}

.flag-btn:hover {
  color: rgba(255,255,255,0.85);
  transform: scale(1.15);
}

.flag-btn:active {
  transform: scale(0.92);
}

.hamburger {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.hamburger:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.15);
  transform: scale(1.05);
}

.hamburger:active {
  transform: scale(0.95);
}

.hamburger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: rgba(255,255,255,0.85);
  border-radius: 2px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.hamburger.active span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* === Menu Dropdown — curtain slide-down === */
.menu-dropdown {
  position: absolute;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 16px;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  transition: clip-path 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.menu-dropdown.open {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  pointer-events: auto;
}

.menu-dropdown-inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.menu-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.menu-tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 14px 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.menu-tab.active { color: var(--accent); }

.menu-tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.menu-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.menu-panel {
  display: none;
  padding: 16px 20px;
}

.menu-panel.active { display: block; }

.menu-search {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
  margin-bottom: 16px;
}

.menu-search:focus { border-color: var(--accent); }

.menu-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: stretch;
}
.menu-search-row .menu-search { margin-bottom: 0; flex: 1; }

.lang-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.lang-btn {
  padding: 12px 10px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.lang-btn:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.lang-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.menu-sort-row {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.sort-btn {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.sort-btn:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.sort-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding-bottom: 12px;
}
.cover-cell {
  cursor: pointer;
  overflow: hidden;
  background: var(--bg-secondary);
  position: relative;
  line-height: 0;
}
.cover-cell:hover { opacity: 0.85; }
.cover-cell:active { opacity: 0.6; }
.cover-cell img {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  object-fit: cover;
  display: block;
  background: var(--bg-secondary);
}
.cover-cell-title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 3px 5px;
  font-size: 0.6rem;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.cover-cell:hover .cover-cell-title { opacity: 1; }

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.menu-list-item:hover { background: var(--accent-dim); }

.menu-list-item.active {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
}

.menu-list-item-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: var(--bg-secondary);
  overflow: hidden;
  flex-shrink: 0;
}

.menu-list-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.menu-list-item-thumb .side-placeholder { font-size: 1rem; }

.menu-list-item-info {
  flex: 1;
  min-width: 0;
}

.menu-list-item-title {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.menu-podcast-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.menu-podcast-badge svg {
  display: block;
}

.menu-list-item-num {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
}

/* About */
.about-content {
  text-align: left;
  padding: 32px 16px;
}

.about-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 20px;
  color: var(--accent);
  text-align: center;
}

.about-text {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 0.95rem;
}

.about-body {
  text-align: left;
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-primary);
  line-height: 1.45;
  font-size: 0.9rem;
}

.about-body p {
  margin-bottom: 6px;
}

.about-body p:first-child {
  text-align: center;
  font-size: 0.95rem;
}

.about-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.about-body a {
  color: var(--accent);
  text-decoration: underline;
}

.about-body a:hover {
  opacity: 0.8;
}

.about-note {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
}

.about-offer {
  font-weight: 500;
  color: var(--accent);
  text-align: center;
  margin-top: 16px;
}

/* Lang tab in menu bar */
.lang-tab {
  flex: 0 0 auto;
  padding-left: 16px;
  padding-right: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.lang-tab:hover {
  color: var(--accent);
}

.close-tab {
  flex: 0 0 auto;
  padding-left: 12px;
  padding-right: 12px;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.6;
  transition: var(--transition);
}

.close-tab:hover {
  opacity: 1;
  color: var(--accent);
}

/* Podcast button */
.podcast-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  pointer-events: auto;
  font-size: 1rem;
}

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

/* Links popup */
.links-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.links-popup-overlay.open { display: flex; }

.links-popup {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
}

.links-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--accent);
}

.links-popup-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.links-popup-close:hover { color: var(--text-primary); background: var(--accent-dim); }

.links-popup-body { padding: 12px 0; }

.links-popup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-primary);
}
.links-popup-item:hover { background: var(--accent-dim); }

.links-popup-item-icon { font-size: 1.4rem; flex-shrink: 0; }

.links-popup-item-info { flex: 1; min-width: 0; }

.links-popup-item-title {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.links-popup-item-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.links-popup-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* === Progress Bar === */
.progress-container {
  width: 100%;
  padding: 0 12px 4px;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.progress-times {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.progress-time {
  font-size: 0.65rem;
  font-family: 'SF Mono', 'Menlo', monospace;
  color: rgba(255,255,255,0.45);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.progress-track:hover,
.progress-track.dragging {
  height: 6px;
}

.progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  pointer-events: none;
}

.progress-filled {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
  transition: background 0.2s;
}

.progress-thumb {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.4);
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, width 0.15s ease, height 0.15s ease;
}

.progress-track:hover .progress-thumb,
.progress-track.dragging .progress-thumb {
  opacity: 1;
}

.progress-track.dragging .progress-thumb {
  width: 16px;
  height: 16px;
}

/* === Lyrics View === */
.lyrics-container {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow-y: auto;
  background: linear-gradient(180deg, #1a1410 0%, #0d0a07 50%, #1a1410 100%);
  display: none;
  scrollbar-width: none;
}

.lyrics-container::-webkit-scrollbar { display: none; }
.lyrics-container.active { display: block; }

.lyrics-spacer { height: 33vh; }

.lyrics-line {
  padding: 10px 24px;
  opacity: 0;
  transform: scale(1);
  transition: opacity 0.5s ease, transform 0.3s ease;
  font-family: var(--font-serif);
  white-space: pre-wrap;
  word-break: break-word;
}

.lyrics-line.past { opacity: 0.2; }
.lyrics-line.current {
  opacity: 1;
  transform: scale(1.02);
}

.lyrics-text {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.6;
  color: transparent;
  transition: color 0.15s ease, text-shadow 0.3s ease;
}

.lyrics-line.current .lyrics-text {
  color: var(--accent);
  text-shadow: 0 0 16px rgba(212, 168, 83, 0.4);
}

/* Character reveal */
.lyrics-char {
  display: inline-block;
  transition: color 0.15s ease, text-shadow 0.3s ease;
}

.lyrics-char.revealed {
  color: var(--accent);
}

.lyrics-char.revealing {
  color: var(--accent);
  text-shadow: 0 0 12px rgba(212, 168, 83, 0.6), 0 0 24px rgba(212, 168, 83, 0.3);
}

.lyrics-char.sung {
  color: var(--accent);
  text-shadow: 0 0 8px rgba(212, 168, 83, 0.15);
}

/* Word reveal */
.lyrics-word {
  display: inline-block;
  margin-right: 0.3em;
}

/* Plain text mode (no LRC timing) */
.lyrics-plain {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.6;
  color: transparent;
  transition: color 0.4s ease, text-shadow 0.4s ease;
}

.lyrics-line.current .lyrics-plain {
  color: var(--accent);
  text-shadow: 0 0 16px rgba(212, 168, 83, 0.4);
}

.lyrics-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255,255,255,0.25);
  font-style: italic;
  font-size: 0.85rem;
}

/* === Pen styles — font & animation variations === */
.lyrics-container[data-pen="feather-quill"] .lyrics-line {
  font-family: 'Georgia', 'Palatino Linotype', 'Book Antiqua', serif;
  font-style: italic;
}
.lyrics-container[data-pen="feather-quill"] .lyrics-line.current {
  animation: penStroke 0.6s ease-out;
}

.lyrics-container[data-pen="fountain-pen"] .lyrics-line {
  font-family: 'Georgia', serif;
  letter-spacing: 0.02em;
}

.lyrics-container[data-pen="brush-pen"] .lyrics-line {
  font-family: 'Segoe Script', 'Comic Sans MS', 'Brush Script MT', cursive;
  font-weight: 300;
}

.lyrics-container[data-pen="calligraphy-pen"] .lyrics-line {
  font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}

.lyrics-container[data-pen="pencil"] .lyrics-line {
  font-family: var(--font-sans);
  font-weight: 300;
  opacity: 0.85;
}
.lyrics-container[data-pen="pencil"] .lyrics-line.current {
  font-weight: 400;
  opacity: 1;
}

.lyrics-container[data-pen="digital-pen"] .lyrics-line {
  font-family: var(--font-sans);
}

/* Paper texture backgrounds */
.lyrics-container[data-paper="aged-parchment"] {
  background: radial-gradient(ellipse at center, rgba(62, 50, 30, 0.25) 0%, rgba(13, 10, 7, 1) 70%);
}
.lyrics-container[data-paper="modern-paper"] {
  background: radial-gradient(ellipse at center, rgba(30, 30, 40, 0.3) 0%, rgba(13, 10, 7, 1) 70%);
}
.lyrics-container[data-paper="linen"] {
  background: radial-gradient(ellipse at center, rgba(40, 35, 50, 0.2) 0%, rgba(13, 10, 7, 1) 70%);
}
.lyrics-container[data-paper="kraft"] {
  background: radial-gradient(ellipse at center, rgba(70, 50, 20, 0.3) 0%, rgba(13, 10, 7, 1) 70%);
}
.lyrics-container[data-paper="vellum"] {
  background: radial-gradient(ellipse at center, rgba(50, 50, 45, 0.2) 0%, rgba(13, 10, 7, 1) 70%);
}
.lyrics-container[data-paper="recycled"] {
  background: radial-gradient(ellipse at center, rgba(35, 40, 35, 0.2) 0%, rgba(13, 10, 7, 1) 70%);
}

@keyframes penStroke {
  0% { opacity: 0; transform: translateY(8px) scale(0.95); filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0) scale(1.02); filter: blur(0); }
}

/* Pen overlay mode — lyrics over video with slight tint */
.lyrics-container.pen-mode {
  background:
    url("https://storage.yandexcloud.net/poetry/img/emboss_faded.webp") no-repeat center / contain,
    linear-gradient(135deg, #f5f0e8 0%, #ede6d8 25%, #f2ece3 50%, #e8e0d0 75%, #f0ebe3 100%);
  z-index: 15;
}
.lyrics-container.pen-mode .lyrics-spacer { display: none; }
.lyrics-container.pen-mode #lyricsContent { display: none; }
.lyrics-container.pen-mode .lyrics-line {
  font-family: 'Caveat', cursive;
  font-size: 3.6rem;
  font-weight: 700;
  line-height: 4.4rem;
  color: transparent;
  opacity: 1;
  transform: none;
  padding: 6px 24px;
  text-shadow: none;
}
.lyrics-container.pen-mode .lyrics-text,
.lyrics-container.pen-mode .lyrics-text * {
  color: transparent !important;
}
.lyrics-container.pen-mode .lyrics-line.past .lyrics-text,
.lyrics-container.pen-mode .lyrics-line.past .lyrics-text * {
  color: rgba(80, 55, 25, 0.5) !important;
  text-shadow: none !important;
}
.lyrics-container.pen-mode .lyrics-line.past {
  opacity: 0.6;
}
.lyrics-container.pen-mode .lyrics-line.current {
  opacity: 1;
  transform: none;
}

/* Pen Canvas */
#penCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: none;
}
.lyrics-container.pen-mode #penCanvas {
  display: block;
}

/* Pen Cursor — CSS brush */
.pen-cursor {
  position: absolute;
  width: 3px;
  height: 28px;
  background: linear-gradient(to bottom, #2a1a0a, #4a3020);
  border-radius: 1px 1px 50% 50%;
  transform: rotate(-60deg);
  transform-origin: top center;
  box-shadow: 0 0 3px rgba(42, 26, 10, 0.4), 1px 1px 4px rgba(0, 0, 0, 0.3);
  z-index: 12;
  display: none;
  pointer-events: none;
  transition: left 0.04s linear, top 0.04s linear;
  opacity: 0.9;
}
.lyrics-container.pen-mode .pen-cursor {
  display: none;
}

/* Karaoke mode — song cover as full central background, orange handwriting */
.lyrics-container.karaoke-mode {
  background-color: #0b0b0d;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 15;
}
.lyrics-container.karaoke-mode .lyrics-spacer { display: none; }
.lyrics-container.karaoke-mode #lyricsContent { display: none; }
.lyrics-container.karaoke-mode #penCanvas { display: block; }
.lyrics-container.karaoke-mode ~ .main-overlay { z-index: 20; }
.lyrics-container.karaoke-mode ~ .main-overlay .main-top {
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, transparent 100%);
}
.lyrics-container.karaoke-mode ~ .main-overlay .main-bottom {
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
}
.pen-cursor::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: -1px;
  width: 5px;
  height: 5px;
  background: #1a0f05;
  border-radius: 50%;
  opacity: 0.6;
}

/* Textonly mode — full-screen paper background */
.lyrics-container.textonly-mode {
  background: var(--bg-primary);
  z-index: 15;
}
.lyrics-container.textonly-mode .lyrics-spacer { height: 25vh; }

/* Typewriter mode — Erika-style, one line at a time with paper */
.lyrics-container.typewriter-mode {
  background:
    url("https://storage.yandexcloud.net/poetry/img/emboss_faded.webp") no-repeat center / contain,
    radial-gradient(circle at 50% 50%, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.05) 100%),
    #f4f1ea;
  z-index: 15;
  padding-top: 100px;
  padding-bottom: 120px;
  box-sizing: border-box;
}
.lyrics-container.typewriter-mode .lyrics-spacer { display: none; }
.lyrics-container.typewriter-mode .lyrics-line {
  /* Nimbus Mono — это URW-клон настоящего Courier (шаг ровно 0.6000em, засечки,
     характер «машинки»), и в отличие от Special Elite он содержит кириллицу
     (144 глифа, весь русский алфавит). Special Elite был подменой из исходной
     спецификации режима: у него 0 кириллических глифов и 26 разных ширин
     латиницы, поэтому русские строки целиком уходили в Courier New, а цифры и
     латиница рисовались с шагом 0.6978em — строка рвалась на ~16%. */
  font-family: 'Nimbus Mono', 'Courier New', monospace;
  font-size: 2.4rem;
  /* Вес объявлен явно, а не наследуется от базового .lyrics-line. У Nimbus Mono
     объявлено только начертание 400, и синтезированный жирный на кириллице
     выглядит как жирный удар печатной машинки вместо ровного Courier New.
     Режимы взаимоисключающие по классу, так что 700 из .pen-mode сюда не
     попадает — но полагаться на это нельзя: правило общего предка с
     font-weight снова всё сломает молча. */
  font-weight: 400;
  line-height: 1.5em;
  color: #1a1a1a;
  text-shadow: 0.5px 0.5px 0px rgba(0,0,0,0.3);
  letter-spacing: 1px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  padding: 2px 0;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  max-width: 90%;
  margin: 0 auto;
}
.lyrics-container.typewriter-mode .lyrics-line.current {
  opacity: 1;
  transform: translateY(0);
}
.lyrics-container.typewriter-mode .lyrics-line.past {
  opacity: 0.6;
}

/* Carriage return animation */
.lyrics-container.typewriter-mode .lyrics-line.carriage-return {
  animation: carriage-return 0.25s ease-out;
}

/* Keep player controls visible above the paper in pen/typewriter modes */
.lyrics-container.pen-mode ~ .main-overlay,
.lyrics-container.typewriter-mode ~ .main-overlay {
  z-index: 20;
}
.lyrics-container.pen-mode ~ .main-overlay .main-top,
.lyrics-container.pen-mode ~ .main-overlay .main-bottom,
.lyrics-container.typewriter-mode ~ .main-overlay .main-top,
.lyrics-container.typewriter-mode ~ .main-overlay .main-bottom {
  background: linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, transparent 100%);
}
.lyrics-container.pen-mode ~ .main-overlay .main-bottom,
.lyrics-container.typewriter-mode ~ .main-overlay .main-bottom {
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 100%);
}

@keyframes carriage-return {
  0% { transform: translateX(8px); opacity: 0.6; }
  50% { transform: translateX(-2px); }
  100% { transform: translateX(0); opacity: 1; }
}

/* === Top Right Controls === */
.top-right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Touch-target padding: the icons are 16px, below the 24px minimum. A
   transparent ::before expands the hit area without moving a single pixel of
   the visible icon. */
.share-btn::before,
.mode-toggle::before,
.podcast-toggle-btn::before,
.flag-btn::before {
  content: '';
  position: absolute;
  inset: -6px;
}

.share-btn,
.podcast-toggle-btn,
.flag-btn {
  position: relative;
}

/* === Mode Toggle === */
.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  font-size: 0;
  line-height: 1;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.2s ease, transform 0.2s ease;
  opacity: 1;
}

.share-btn:hover {
  color: rgba(255,255,255,0.85);
  transform: scale(1.15);
}

.share-btn:active {
  transform: scale(0.92);
}

.mode-toggle {
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  color: rgba(255,255,255,0.45);
  transition: color 0.2s ease;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  display: none;
  position: relative;
}

.mode-toggle.visible { display: inline; }

.mode-toggle:hover {
  color: rgba(255,255,255,0.8);
}

.mode-toggle.lyrics-mode {
  color: var(--accent);
}

/* === Podcast toggle button === */
.podcast-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.podcast-toggle-btn:hover {
  color: rgba(255,255,255,0.85);
  transform: scale(1.15);
}

.podcast-toggle-btn.active:hover {
  color: #222;
}

.podcast-toggle-btn:active {
  transform: scale(0.92);
}

.podcast-toggle-btn.active {
  color: #000;
}

/* === Podcast overlay === */
.podcast-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0d center/cover no-repeat;
  background-image: linear-gradient(135deg, rgba(10,10,13,0.82), rgba(10,10,13,0.92));
  z-index: 15;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  overflow: hidden;
  padding: 28px 0 20px;
  container-type: inline-size;
  container-name: podcast;
}

.podcast-overlay.visible { display: flex; }

/* Режим подкаста помечаем классом на .main-screen (showPodcastOverlay).
   Прежний селектор «.podcast-overlay.visible ~ .main-overlay» был мёртвым:
   .main-overlay в DOM идёт ПЕРЕД .podcast-overlay, а «~» требует обратного
   порядка. Из-за этого .main-overlay оставался с z-index 2, оверлей подкаста
   (z-index 15) перекрывал верхнюю панель — гамбургер не нажимался и меню
   было недоступно в режиме Подкаста. */
.main-screen.podcast-mode .main-overlay {
  z-index: 20;
  background: none;
}
.main-screen.podcast-mode #mainPlayBtn,
.main-screen.podcast-mode .main-bottom,
.main-screen.podcast-mode .loading-indicator {
  display: none !important;
}

.podcast-top {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.podcast-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.podcast-title-text {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60cqw;
}

.podcast-waveform {
  position: relative;
  width: min(70cqw, 520px);
  height: 100px;
  z-index: 1;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.podcast-lrc-scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  width: min(84cqw, 720px);
  box-sizing: border-box;
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.podcast-lrc-scroll.no-lrc { display: none; }

.podcast-lrc-scroll::-webkit-scrollbar { display: none; }

.podcast-lrc-line {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 24px;
  opacity: 0.25;
  transform: scale(1);
  transition: opacity 0.4s ease, transform 0.3s ease, color 0.3s ease, text-shadow 0.3s ease;
  font-family: var(--font-serif);
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
  font-size: clamp(1.45rem, 4.5cqw, 2.05rem);
  line-height: 1.6;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 2px 14px rgba(0,0,0,0.8);
}

.podcast-lrc-line.past { opacity: 0.25; }

.podcast-lrc-line.current {
  opacity: 1;
  transform: scale(1.02);
  color: var(--accent);
  text-shadow: 0 0 16px rgba(212, 168, 83, 0.4), 0 2px 14px rgba(0,0,0,0.8);
}

.podcast-progress-container {
  position: relative;
  z-index: 1;
  width: min(80cqw, 640px);
  padding: 0 12px 4px;
  flex-shrink: 0;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Utility */
.hidden { display: none !important; }

/* Song rating stars (list + playback widget) */
.menu-list-item-stars {
  display: flex;
  gap: 1px;
  font-size: 0.8rem;
  line-height: 1;
  flex-shrink: 0;
  align-items: center;
  margin-left: 4px;
}
.menu-list-item-stars .menu-star { color: rgba(255,255,255,0.22); }
.menu-list-item-stars .menu-star.on { color: #ffcf4d; }

.rating-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
  position: relative;
  pointer-events: auto;
}
.rating-stars {
  display: flex;
  gap: 4px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.rating-stars .rstar {
  color: rgba(255,255,255,0.28);
  transition: color .12s, transform .12s;
}
.rating-stars .rstar.on { color: #ffcf4d; }
.rating-stars .rstar:hover { transform: scale(1.15); }
.rating-tip {
  position: fixed;
  z-index: 9999;
  background: #1a1a2e;
  color: #e0e0e0;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.rating-tip.show { opacity: 1; }

/* EXPERIMENT V1: multi-param widget (Текст / Музыка / Эмоция) */
.rating-head {
  font-size: 0.82rem;
  color: #ffcf4d;
  letter-spacing: .02em;
}
.rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
.rating-row-label {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.65);
  min-width: 56px;
}
.rating-row .rating-stars { font-size: 1.05rem; }
.rating-row-val {
  font-size: 0.7rem;
  color: #ffcf4d;
  opacity: .9;
  margin-left: auto;
  white-space: nowrap;
}
.menu-list-item-stars .menu-star-val {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.6);
  margin-left: 3px;
}

/* === Account (MVP 0.2): tab, modal, paywall, works === */
.acct-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.acct-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--accent);
  margin-bottom: 4px;
}
.acct-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.acct-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.acct-row:last-child { border-bottom: none; }
.acct-row-label { color: var(--text-muted); }
.acct-row-value { color: var(--text-primary); text-align: right; }

.acct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  line-height: 1.2;
  white-space: normal;
}
.acct-btn:hover { border-color: var(--accent); color: var(--accent); }
.acct-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
}
.acct-btn.primary:hover { background: var(--accent-hover); color: var(--bg-primary); }
.acct-btn.ghost { background: transparent; }
.acct-btn.block { width: 100%; }
.acct-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.acct-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.acct-form { display: flex; flex-direction: column; gap: 10px; }
.acct-form label { font-size: 0.75rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.acct-input {
  padding: 11px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
  width: 100%;
}
.acct-input:focus { border-color: var(--accent); }
textarea.acct-input { min-height: 90px; resize: vertical; font-family: var(--font-sans); }

.acct-error {
  color: #ff8f7a;
  font-size: 0.78rem;
  padding: 6px 0;
}
.acct-ok { color: #8fd08f; font-size: 0.78rem; padding: 6px 0; }

.acct-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.acct-tab {
  flex: 1;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}
.acct-tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.acct-status-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  text-transform: lowercase;
}
.acct-status-badge.active { color: var(--accent); border-color: var(--accent); }

/* Plan cards */
.plan-grid { display: grid; gap: 8px; }
.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}
.plan-card.current { border-color: var(--accent); background: var(--accent-dim); }
.plan-card-info { min-width: 0; }
.plan-card-name { font-size: 0.92rem; color: var(--text-primary); }
.plan-card-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.plan-card-price { font-size: 0.85rem; color: var(--accent); white-space: nowrap; }

/* Paywall modal */
.acct-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.acct-modal-overlay.open { display: flex; }
.acct-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  max-height: 84vh;
  overflow-y: auto;
}
.acct-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--accent);
}
.acct-modal-header small { display: block; font-family: var(--font-sans); font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.acct-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.acct-modal-close:hover { color: var(--text-primary); background: var(--accent-dim); }
.acct-modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }

/* Lock badge on song rows */
.menu-lock {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 6px;
  font-size: 0.72rem;
  color: var(--accent);
  border: 1px solid rgba(212,168,83,0.4);
  border-radius: 10px;
  padding: 2px 6px;
  line-height: 1;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Works list */
.work-list { display: flex; flex-direction: column; gap: 8px; }
.work-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.work-item-left { min-width: 0; flex: 1; }
.work-item-title {
  font-size: 0.9rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.work-item-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; }
.work-status {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  margin-right: 6px;
}
.work-status.published { color: #8fd08f; border-color: rgba(143,208,143,0.4); }
.work-status.pending_moderation { color: var(--accent); border-color: rgba(212,168,83,0.4); }
.work-status.rejected { color: #ff8f7a; border-color: rgba(255,143,122,0.4); }

/* ================================================================
   MENU POLISH — полировка навигации плеера (2026-09-25)
   Только меню: гамбургер, шторка #menuDropdown, табы, пилюли,
   список песен, links popup. Снапшоты для отката:
   /tmp/opencode/rollback_menu_polish/ (style.css, index.html, app.js).
   ================================================================ */

:root {
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
}

/* ---- Hamburger: эластичный морфинг, focus ---- */
.hamburger {
  transition: background 240ms ease, border-color 240ms ease, transform 160ms var(--ease-out);
}
.hamburger span {
  width: 18px;
  height: 2px;
  transition: transform 520ms var(--ease-out), opacity 180ms ease;
}
.hamburger.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.hamburger:focus-visible { outline: 2px solid rgba(212,168,83,0.7); outline-offset: 2px; }

/* ---- Focus-visible: общее для меню ---- */
.menu-dropdown button:focus-visible,
.hamburger:focus-visible,
.links-popup button:focus-visible {
  outline: 2px solid rgba(212,168,83,0.7);
  outline-offset: 1px;
}

/* ---- Штора: открытие мягкое, закрытие быстрое (асимметрия) ---- */
.menu-dropdown {
  transition: clip-path 200ms var(--ease-in-out);
}
.menu-dropdown.open {
  transition: clip-path 460ms var(--ease-out);
}

/* ---- Табы: появление со stagger при каждом открытии ---- */
.menu-dropdown.open .menu-tab {
  animation: menuTabIn 240ms var(--ease-out) backwards;
  animation-delay: calc(30ms + 40ms * var(--i, 0));
}
.menu-dropdown.open .menu-tab:nth-child(1) { --i: 0; }
.menu-dropdown.open .menu-tab:nth-child(2) { --i: 1; }
.menu-dropdown.open .menu-tab:nth-child(3) { --i: 2; }
.menu-dropdown.open .menu-tab:nth-child(4) { --i: 3; }
.menu-dropdown.open .menu-tab:nth-child(5) { --i: 4; }
.menu-dropdown.open .menu-tab:nth-child(6) { --i: 5; }
@keyframes menuTabIn {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

/* ---- Контент панели: мягкое появление при открытии/смене вкладки ---- */
.menu-dropdown.open .menu-panel.active {
  animation: menuPanelIn 380ms var(--ease-out) backwards;
}
@keyframes menuPanelIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---- Табы: читаемость + анимированное подчёркивание ---- */
.menu-tab {
  color: var(--text-secondary);
  transition: color 200ms ease, transform 160ms var(--ease-out);
}
.menu-tab:hover { color: var(--text-primary); }
.menu-tab:active { transform: scale(0.97); }
.menu-tab::after {
  left: 0;
  right: 0;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0.25;
  transition: transform 320ms var(--ease-out), opacity 200ms ease;
}
.menu-tab:hover::after { opacity: 0.55; }
.menu-tab.active::after { transform: scaleX(1); opacity: 1; }

/* ---- Поиск: мягкое свечение при фокусе ---- */
.menu-search:focus { box-shadow: 0 0 0 3px rgba(212,168,83,0.14); }

/* ---- Пилюли (lang/sort): отзывчивость и focus ---- */
.lang-btn,
.sort-btn {
  color: var(--text-secondary);
  transition: transform 160ms var(--ease-out), color 200ms ease,
              border-color 200ms ease, background 200ms ease;
}
.lang-btn:active,
.sort-btn:active { transform: scale(0.96); }
.lang-btn:hover,
.sort-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }

/* ---- Список песен: hover-сдвиг, зум обложки, активное состояние без side-stripe ---- */
.menu-list-item {
  transition: background 240ms ease, transform 160ms var(--ease-out), box-shadow 240ms ease;
}
.menu-list-item:active { transform: scale(0.99); }
.menu-list-item-title { transition: color 200ms ease; }
.menu-list-item-thumb img { transition: transform 340ms var(--ease-out); }
.menu-list-item.active {
  background: var(--accent-dim);
  border-left: none;
  box-shadow: inset 0 0 0 1px rgba(212,168,83,0.38);
}
.menu-list-item.active .menu-list-item-title { color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .menu-list-item:hover { background: var(--accent-dim); transform: translateX(3px); }
  .menu-list-item:hover .menu-list-item-thumb img { transform: scale(1.07); }
  .menu-list-item:hover .menu-list-item-title { color: var(--text-primary); }
  .cover-cell img { transition: transform 340ms var(--ease-out); }
  .cover-cell:hover img { transform: scale(1.04); }
}

/* ---- Скроллбар меню ---- */
.menu-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(212,168,83,0.32) transparent;
}
.menu-scroll::-webkit-scrollbar { width: 8px; }
.menu-scroll::-webkit-scrollbar-thumb {
  background: rgba(212,168,83,0.28);
  border-radius: 8px;
}
.menu-scroll::-webkit-scrollbar-thumb:hover { background: rgba(212,168,83,0.45); }
.menu-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---- Links popup: появление, hover/нажатие ---- */
.links-popup-overlay.open { animation: overlayIn 200ms var(--ease-out) backwards; }
.links-popup-overlay.open .links-popup { animation: linksIn 240ms var(--ease-out) backwards; }
.links-popup-item {
  transition: background 200ms ease, transform 160ms var(--ease-out);
}
.links-popup-item:active { transform: scale(0.99); }
@keyframes overlayIn { from { opacity: 0; } }
@keyframes linksIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ---- prefers-reduced-motion: без движения, но с сохранением видимости ---- */
@media (prefers-reduced-motion: reduce) {
  .menu-dropdown,
  .menu-dropdown.open { transition: none; }
  .menu-dropdown.open .menu-tab,
  .menu-dropdown.open .menu-panel.active,
  .links-popup-overlay.open,
  .links-popup-overlay.open .links-popup { animation: none; }
  .hamburger span,
  .menu-tab,
  .menu-tab::after,
  .menu-search,
  .lang-btn,
  .sort-btn,
  .menu-list-item,
  .menu-list-item-title,
  .menu-list-item-thumb img,
  .cover-cell img,
  .links-popup-item { transition: none; }
  .menu-list-item:hover,
  .cover-cell:hover img { transform: none; }
}

/* === Control icons: единый набор, выравнивание SVG === */
.top-right-controls .share-btn,
.top-right-controls .mode-toggle.visible,
.top-right-controls .podcast-toggle-btn,
.top-right-controls .flag-btn {
  box-sizing: content-box;
  padding: 5px;
}

.mode-toggle svg,
.share-btn svg,
.flag-btn svg,
.podcast-toggle-btn svg {
  vertical-align: middle;
}
.main-play-btn svg {
  display: block;
}

/* === CMS: тексты разделов и новости (js/cms.js) === */
/* Контейнер блоков. Для встроенных панелей (Аккаунт) он вставляется первым
   ребёнком, поэтому функциональный UI аккаунта остаётся под ним. */
.cms-section {
  text-align: left;
  padding: 24px 16px;
  max-width: 680px;
  margin: 0 auto;
}
.cms-section:empty { display: none; }

/* Под-вкладки внутри раздела (Автору / Слушателю / Новости) */
.cms-subtabs { margin-bottom: 18px; flex-wrap: wrap; }
.cms-subtab { flex: 0 0 auto; min-width: 96px; }

.cms-subpanel { min-height: 40px; }
.cms-block-body { text-align: left; }
.cms-block-base { margin-top: 22px; }
.cms-block-title { margin-bottom: 12px; }

/* Блок без текста в текущем языке на сайте не показываем — но в CMS он виден,
   чтобы админ понимал, что блок есть и ждёт текста. */
.cms-block-body:empty { display: none; }

/* Новости: архив и анонс последней */
.cms-news { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); }
.cms-news-headline {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: 12px;
  color: var(--accent);
}
.cms-news-item { margin-bottom: 16px; }
.cms-news-item:last-child { margin-bottom: 0; }
.cms-news-date {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.cms-news-title {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.35;
}
.cms-news-body { font-size: 0.88rem; line-height: 1.5; color: var(--text-primary); }
.cms-news-body p { margin-bottom: 6px; }
.cms-news-body a { color: var(--accent); text-decoration: underline; }
.cms-news-body ul, .cms-news-body ol { padding-left: 20px; margin-bottom: 8px; }
.cms-news-list .cms-news-item {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.cms-news-list .cms-news-item:last-child { border-bottom: none; padding-bottom: 0; }
