:root {
  --bg: #f3f7fb;
  --panel: #ffffff;
  --text: #1f2a37;
  --muted: #617085;
  --line: #d7e1ef;
  --brand: #0f6ad7;
  --chip-bg: #edf4ff;
  --danger: #c03535;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 0% 0%, #e8f3ff 0, transparent 33%),
    radial-gradient(circle at 100% 0%, #eef8f4 0, transparent 30%),
    var(--bg);
  color: var(--text);
  padding-bottom: 84px;
}

.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(5px);
}

.brand {
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 20px;
  text-decoration: none;
  color: var(--text);
}

.container {
  max-width: 1040px;
  margin: 20px auto;
  padding: 0 14px 30px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.panel-soft { background: #fafcff; }
.narrow { max-width: 420px; margin: 40px auto; }
.muted { color: var(--muted); }
.small { font-size: 12px; margin-top: 4px; }

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.inline-links a { margin-left: 12px; color: var(--brand); text-decoration: none; }
.inline-links a:first-child { margin-left: 0; }

.landing-head {
  margin: 8px 0 16px;
}

.page-title {
  margin: 0 0 8px;
  font-size: 34px;
  letter-spacing: 0.2px;
}

.filter-block {
  margin-top: 12px;
}

.filters-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.filter-block-right .filter-title {
  text-align: right;
}

.filter-block-right .chips {
  justify-content: flex-end;
}

.filter-title {
  font-weight: 700;
  font-size: 14px;
  color: #30435e;
  margin-bottom: 8px;
}

.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #cfd8ef;
  color: #2a3a63;
  background: var(--chip-bg);
  font-size: 14px;
  transition: all 0.2s ease;
}

.chips-fancy .chip {
  box-shadow: 0 4px 10px rgba(15, 48, 94, 0.08);
  border-color: #c8daf7;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: #adc7f0;
}

.chip.selected {
  background: linear-gradient(135deg, #0f6ad7, #2f8eff);
  border-color: #0f6ad7;
  color: #fff;
}

.audio-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chapter-accordion,
.season-accordion {
  border: 1px solid #ccdaf1;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  margin-top: 12px;
  box-shadow: 0 8px 18px rgba(20, 58, 114, 0.07);
  overflow: hidden;
}

.chapter-accordion > summary,
.season-accordion > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  padding: 12px 36px 12px 14px;
  font-weight: 700;
  position: relative;
  transition: background 0.2s ease;
}

.chapter-accordion > summary:hover,
.season-accordion > summary:hover {
  background: #f3f8ff;
}

.chapter-accordion[open],
.season-accordion[open] {
  border-color: #a9c4ea;
}

.chapter-accordion[open] > summary {
  background: linear-gradient(90deg, #edf5ff, #f6fbff);
}

.season-accordion[open] > summary {
  background: #f6faff;
}

.chapter-accordion > summary::-webkit-details-marker,
.season-accordion > summary::-webkit-details-marker {
  display: none;
}

.chapter-accordion > summary::after,
.season-accordion > summary::after {
  content: "▾";
  color: #2d527f;
  font-size: 11px;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.2s ease;
}

.chapter-accordion:not([open]) > summary::after,
.season-accordion:not([open]) > summary::after {
  transform: translateY(-50%) rotate(-90deg);
}

.chapter-accordion > .chapter-block,
.season-accordion > .season-block {
  margin-top: 0;
  border-top: 1px solid #d8e4f5;
  border-radius: 0;
}

.chapter-block {
  border: 0;
  border-radius: 0;
  padding: 10px;
  margin-top: 0;
  background: #fafdff;
}

.chapter-block h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.season-block {
  margin-top: 0;
  padding: 8px;
  background: #fbfdff;
}

.season-block h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #30435e;
}

.audio-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.audio-row:hover {
  border-color: #b7cbeb;
  box-shadow: 0 6px 12px rgba(17, 65, 128, 0.08);
  transform: translateY(-1px);
}

.accordion-title {
  font-size: 14px;
  color: #223a60;
}

.accordion-count {
  margin-left: auto;
  font-size: 11px;
  color: #2f4f79;
  border: 1px solid #c5d9f6;
  background: #ecf4ff;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.audio-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #edf1fb;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.audio-icon:focus-visible {
  outline: 2px solid #76a8f4;
  outline-offset: 2px;
}

.audio-wave {
  display: none;
  gap: 2px;
  align-items: end;
}

.audio-wave span {
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: #1456ba;
  animation: waveBounce 0.8s ease-in-out infinite;
}

.audio-wave span:nth-child(2) { animation-delay: 0.15s; }
.audio-wave span:nth-child(3) { animation-delay: 0.3s; }

.audio-row.is-playing .audio-emoji { display: none; }
.audio-row.is-playing .audio-wave { display: flex; }
.audio-row.is-playing {
  border-color: #9fc1f5;
  box-shadow: 0 0 0 2px #e6f0ff inset, 0 6px 14px rgba(32, 96, 180, 0.08);
}

.audio-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  border: 1px solid #cfd8ef;
  background: #f6f9ff;
  color: #29436f;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.icon-btn:hover {
  background: #eaf1ff;
}

@keyframes waveBounce {
  0%, 100% { height: 6px; }
  50% { height: 16px; }
}

.audio-title {
  font-weight: 600;
  line-height: 1.2;
}

.audio-tracks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.btn {
  border: 0;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}

.btn.danger { background: var(--danger); }

.btn.track-btn {
  padding: 6px 10px;
  font-size: 12px;
  background: #f2f7ff;
  color: #1f3f72;
  border: 1px solid #c4d8f8;
}

.btn.track-btn.is-current-track {
  background: linear-gradient(135deg, #0f6ad7, #2f8eff);
  color: #fff;
  border-color: #0f6ad7;
}

.form {
  display: grid;
  gap: 8px;
}

.asset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.asset-list {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.asset-item {
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: #fff;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}

.inline-form label {
  font-size: 13px;
  color: var(--muted);
}

.inline-form select {
  width: auto;
  min-width: 140px;
}

input[type="text"], input[type="password"], select, input[type="file"] {
  border: 1px solid #cfd8ef;
  border-radius: 8px;
  padding: 9px 10px;
  width: 100%;
}

.progress-wrap { margin-top: 14px; }
.progress {
  margin-top: 6px;
  height: 11px;
  border: 1px solid #cfd8ef;
  border-radius: 999px;
  background: #eef2fa;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #3c8aff, #5fb3ff);
}

.hidden { display: none; }
.inline-actions { margin-top: 10px; }

.flash {
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #f2cccc;
  background: #fff5f5;
}

.flash.success {
  border-color: #cdebd3;
  background: #f3fff5;
}

.player-dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(1040px, calc(100vw - 20px));
  margin-top: 0;
  border-radius: 12px 12px 0 0;
  background: #0f1725;
  color: #e8eef9;
  padding: 10px 12px 12px;
  border: 1px solid #1f2e48;
  z-index: 120;
}

.player-dock-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.player-dock-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-dock-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #355988;
  background: #132238;
  color: #d9ebff;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.player-dock-toggle:hover {
  background: #1b2f4d;
}

.player-dock-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.player-now-title {
  font-size: 13px;
  font-weight: 600;
  color: #d5e4ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-total {
  font-size: 12px;
  color: #9fb6dc;
  flex-shrink: 0;
}

.player-progress {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  background: #25354f;
  overflow: hidden;
  position: relative;
  cursor: pointer;
}

.player-buffered-fill {
  width: 0;
  height: 100%;
  background: #4f6d96;
  position: absolute;
  left: 0;
  top: 0;
  transition: width 0.12s linear;
}

.player-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #35a7ff, #7bc8ff);
  position: absolute;
  left: 0;
  top: 0;
  transition: width 0.1s linear;
}

.player-progress-handle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e5f4ff;
  border: 1px solid #6ebeff;
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

@media (max-width: 700px) {
  .page-title {
    font-size: 28px;
  }
  .filters-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .filter-block-right .filter-title {
    text-align: left;
  }
  .filter-block-right .chips {
    justify-content: flex-start;
  }
  .audio-row {
    grid-template-columns: 32px 1fr;
  }
  .audio-row .audio-actions {
    grid-column: 1 / -1;
    margin-top: 4px;
  }
  .audio-row .btn {
    margin-top: 4px;
  }
  .inline-form select {
    width: 100%;
  }
  .asset-grid {
    grid-template-columns: 1fr;
  }
  .player-dock {
    width: calc(100vw - 8px);
    padding: 10px 10px 12px;
  }
}
