:root {
  --bg: #dde2e9;
  --panel: #d2d8e2;
  --text: #151821;
  --muted: #525a6b;
  --line: #b8c0cf;
  --card: #eef1f5;
  --shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  --radius: 20px;
  --left-width: 360px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--app-bg, var(--bg));
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  overscroll-behavior: none;
}

.shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* IZQUIERDA */
.left-column {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--left-width);
  height: 100vh;
  background: var(--panel);
  border-right: 1px solid rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.left-header {
  flex: 0 0 auto;
  padding: 26px 22px 14px;
  background: var(--panel);
  position: relative;
  z-index: 2;
}

.app-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.left-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 22px 28px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* DERECHA */
.right-column {
  position: fixed;
  top: 0;
  left: var(--left-width);
  right: 0;
  height: 100vh;
  overflow: hidden;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.right-fixed {
  width: 100%;
  max-width: 980px;
  height: 78vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.detail {
  width: 100%;
  height: 100%;
}

.detail.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 1.05rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
}

.home-logo-link {
  display: inline-block;
  position: relative;
  z-index: 10;
  line-height: 0;
}

.home-logo-link img,
.home-logo img {
  width: 56px;
  height: 56px;
  max-width: 56px;
  max-height: 56px;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 0;
}

.app-title-button {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.app-title-button:hover {
  opacity: 0.72;
}

.app-title-button:focus-visible {
  outline: 2px solid rgba(15, 23, 42, 0.35);
  outline-offset: 4px;
  border-radius: 6px;
}

/* TIMELINE */
.timeline {
  position: relative;
}

.timeline-list {
  position: relative;
  padding-left: 0;
}

.active-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.active-filter-text {
  font-size: 0.82rem;
  line-height: 1.25;
  color: var(--muted);
}

.active-filter-kind {
  color: #6b7280;
}

.filter-bar {
  margin-top: 10px;
  min-height: 0;
}

.filter-bar.visible {
  min-height: 44px;
}

.clear-filter-button {
  border: 0;
  background: transparent;
  color: #1f3b73;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

.clear-filter-button:hover {
  text-decoration: underline;
}

.timeline-empty {
  padding: 6px 0 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
}

.timeline-item {
  position: relative;
  padding: 0;
  margin-bottom: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  border-left: 7px solid var(--item-color, #b8ab95);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.timeline-item:hover {
  background: rgba(255, 255, 255, 0.62);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

.timeline-item.active {
  background: var(--item-color, #b8ab95);
  color: #ffffff;
  border-left-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.timeline-button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 11px 13px 12px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.timeline-button:hover {
  opacity: 0.94;
}

.timeline-year {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 5px;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.timeline-flag {
  margin-left: 6px;
  font-size: 0.9em;
  opacity: 0.9;
}

.timeline-title {
  display: block;
  font-size: 0.94rem;
  line-height: 1.25;
  font-weight: 750;
}

.timeline-author {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 5px;
}

.timeline-item.active .timeline-year,
.timeline-item.active .timeline-title,
.timeline-item.active .timeline-author {
  color: #ffffff;
}

/* HOME */
.home-card .card-inner {
  min-height: 100%;
}

.media-column.home-media {
  background: var(--app-accent, #8b6a43);
  color: #ffffff;

  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.home-content {
  background: #ffffff;
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.75rem;
}

.home-branding {
  width: 100%;
  max-width: 420px;
  text-align: left;
}

.home-logo {
  margin-bottom: 0.9rem;
}

.home-logo img {
  max-width: 56px;
  max-height: 56px;
  width: auto;
  height: auto;
  display: block;
  opacity: 0.85;
}

.home-title {
  margin: 0 0 0.75rem 0;
  font-size: 2.8rem;
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.home-subtitle {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.96);
}

.home-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.home-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.home-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.home-tag {
  font-size: 1rem;
  padding: 0.7rem 1rem;
}

.home-note {
  margin: 0.75rem 0 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--muted);
}

/* FICHA */
.card {
  width: 100%;
  height: 100%;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  position: relative;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

.card-inner {
  display: grid;
  grid-template-columns: minmax(280px, 400px) 1fr;
  gap: 0;
  height: 100%;
}

.media-column {
  background: #edf1f5;
  padding: 22px;
  overflow-y: auto;
}

.media-column img {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  border-radius: 16px;
  object-fit: cover;
  object-position: center;
}

.no-image {
  min-height: 260px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-style: italic;
}

.player {
  margin-top: 16px;
}

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

.icon {
  width: 18px;
  height: 18px;
  display: block;
}

.control-btn {
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #ffffff;
  color: #2f3440;
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.control-btn:hover {
  background: #e9eef6;
  transform: translateY(-1px);
}

.play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.play-symbol {
  position: absolute;
  width: 22px;
  height: 22px;
}

.icon-pause {
  display: none;
}

.play-btn.is-playing .icon-play {
  display: none;
}

.play-btn.is-playing .icon-pause {
  display: block;
}

.play-btn .icon {
  width: 22px;
  height: 22px;
}

.play-btn:hover {
  background: #252a35;
}

.shuffle-btn.active {
  background: #2f3440;
  color: #ffffff;
  border-color: #2f3440;
}

.shuffle-icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.shuffle-icon::before,
.shuffle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.shuffle-icon::before {
  top: 4px;
  transform: rotate(25deg);
}

.shuffle-icon::after {
  bottom: 4px;
  transform: rotate(-25deg);
}

.progress-wrap {
  margin-top: 14px;
}

.progress-bar {
  position: relative;
  height: 6px;
  background: #e3e7ef;
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #2f3440;
  transition: width 0.1s linear;
}

.time-row {
  display: flex;
  justify-content: flex-start;
  margin-top: 6px;
  font-size: 0.75rem;
  color: #6b7280;
}

.audio-wrap {
  margin-top: 16px;
}

.audio-wrap audio {
  width: 100%;
}

.spotify-slot {
  margin-top: 12px;
  text-align: center;
}

/* BOTÓN como etiqueta */
.spotify-slot-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: #2f3440;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition: all 0.18s ease;
}

.spotify-slot-trigger:hover {
  transform: translateY(-1px);
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.18);
}

/* CONTENIDO */
.spotify-slot-content {
  display: none;
  margin-top: 10px;
}

/* ESTADO ABIERTO */
.spotify-slot.is-open .spotify-slot-trigger {
  display: none;
}

.spotify-slot.is-open .spotify-slot-content {
  display: block;
}

.content-column {
  padding: 30px 34px 32px;
  overflow-y: auto;
  min-height: 0;
}

.meta-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.meta-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  color: #2f3440;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.filter-tag {
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.filter-tag:hover {
  transform: translateY(-1px);
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.18);
}

.filter-tag.active {
  background: var(--accent, #2f3440);
  border-color: var(--accent, #2f3440);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.filter-tag.active:hover {
  background: #252a35;
}

.active-rhythm-legend {
  margin-top: 22px;
  margin-left: 12px;
  color: #4b5563;
  font-size: 0.88rem;
  line-height: 1.6;
}

.active-rhythm-legend::first-letter {
  font-weight: 800;
}

.home-return-button {
  position: absolute;
  right: 22px;
  bottom: 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  opacity: 0.65;
}

.home-return-button:hover {
  opacity: 1;
  color: var(--accent, var(--app-accent));
}

.author {
  margin: 0 0 6px;
  font-family: "PT Sans Narrow", "Arial Narrow", Arial, sans-serif;
  font-size: 1.5rem;
  line-height: 1.15;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #2f3440;
}

.work-title {
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  line-height: 1.25;
  font-weight: 400;
  color: #4b5563;
  position: relative;
  padding-left: 14px;
}

.work-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.22em;
  width: 5px;
  height: 1.05em;
  border-radius: 999px;
  background: var(--accent, #c9b79c);
}

.text {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-line;
  color: #2f3440;
}

.loading,
.error {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

.error {
  color: #7a1f1f;
}

.home-random {
  align-self: center;
}

.home-random .home-tag {
  font-size: 1.05rem;
  padding: 0.85rem 1.3rem;
  background: color-mix(in srgb, var(--app-accent) 85%, white);
  border-color: var(--app-accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.home-random .home-tag:hover {
  transform: translateY(-2px);
  background: var(--app-accent);
}

@media (max-width: 980px) {
  html,
  body {
    overflow: auto;
  }

  .shell {
    width: 100%;
    height: auto;
    overflow: visible;
  }

  .left-column,
  .right-column {
    position: static;
    width: 100%;
    height: auto;
  }

  .left-column {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .left-scroll {
    max-height: 42vh;
  }

  .right-column {
    padding: 18px;
    display: block;
    overflow: visible;
  }

  .right-fixed {
    max-width: none;
    width: 100%;
    height: auto;
    display: block;
  }

  .detail {
    height: auto;
  }

  .detail.empty {
    min-height: 40vh;
    height: auto;
  }

  .card {
    height: auto;
  }

  .card:hover {
    transform: none;
  }

  .card-inner {
    grid-template-columns: 1fr;
    height: auto;
  }

  .media-column,
  .content-column {
    overflow: visible;
  }

  .author {
    font-size: 1.35rem;
  }

  .work-title {
    font-size: 1.15rem;
  }
}
