:root {
  color-scheme: light;
  --bg: #f7f3ea;
  --paper: #fffdf8;
  --paper-strong: #ffffff;
  --ink: #17211d;
  --muted: #6f7b75;
  --line: #e4ded1;
  --line-strong: #d5cbb9;
  --teal: #2d8f83;
  --teal-soft: #e4f4f1;
  --gold: #b98524;
  --rose: #c56a76;
  --shadow: 0 18px 55px rgba(42, 38, 28, .11);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.78), rgba(247,243,234,.92)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input { font: inherit; }

button {
  color: inherit;
  cursor: pointer;
}

a {
  color: var(--teal);
  text-decoration: none;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 4.2vw, 50px);
  line-height: .98;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.page-shell {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.muted {
  color: var(--muted);
}

.kind-nav,
.language-tabs,
.asset-switcher,
.meta-row,
.chord-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.kind-nav button,
.language-tabs button,
.asset-switcher button,
.meta-row span,
.chord-pill,
.soft-note {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.74);
  color: var(--ink);
  padding: 8px 12px;
}

.kind-nav button.active,
.language-tabs button.active,
.asset-switcher button.active,
.chord-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.library-strip {
  margin-bottom: 16px;
}

.media-library {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.media-chip {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  padding: 12px 14px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(42,38,28,.06);
}

.media-chip span,
.media-chip strong {
  display: block;
}

.media-chip span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.media-chip strong {
  margin-top: 5px;
  font-size: 15px;
  line-height: 1.2;
}

.media-chip.active {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, .72fr);
  gap: 18px;
  align-items: stretch;
}

.player-card,
.lyrics-card,
.full-lyrics-section {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,253,248,.94);
  box-shadow: var(--shadow);
}

.player-card,
.lyrics-card {
  padding: 18px;
}

.title-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.cover-thumb {
  width: 96px;
  aspect-ratio: 1;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(42,38,28,.13);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.title-row p,
.lyrics-head p {
  margin: 0;
  color: var(--muted);
}

.stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #eff4f1;
}

#visualizer,
#video,
#external-player,
.cover-art,
.stage-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cover-art {
  object-fit: cover;
  opacity: .82;
  filter: saturate(1.03) contrast(1.02);
}

#video {
  object-fit: cover;
  background: #111;
}

#external-player {
  border: 0;
  background: #111;
  z-index: 1;
}

#video[hidden],
#external-player[hidden] {
  display: none;
}

.stage-shade {
  background:
    linear-gradient(180deg, rgba(255,255,255,.03), rgba(13,31,28,.6)),
    linear-gradient(90deg, rgba(13,31,28,.16), transparent);
  pointer-events: none;
}

.stage-copy {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  color: #fff;
}

.stage-copy p {
  margin-bottom: 9px;
  color: rgba(255,255,255,.78);
}

.stage-line {
  max-width: 760px;
  font-size: clamp(26px, 3.2vw, 42px);
  font-weight: 850;
  line-height: 1.04;
}

.transport {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 16px;
}

.play-button {
  width: 58px;
  height: 58px;
  border: 0;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 900;
}

.play-button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.time-readout {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.seek-wrap {
  position: relative;
  height: 28px;
  display: grid;
  align-items: center;
}

#seek {
  width: 100%;
  appearance: none;
  height: 7px;
  border-radius: 999px;
  background: #e3ddcf;
  outline: none;
}

#seek::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid #fff;
}

.progress-fill {
  position: absolute;
  left: 0;
  top: 10.5px;
  width: 0%;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
  pointer-events: none;
}

.meta-row,
.asset-switcher {
  margin-top: 12px;
}

.meta-row span {
  color: var(--muted);
  font-size: 13px;
}

.lyrics-card {
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
}

.lyrics-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.lyric-carousel {
  min-height: 230px;
  display: grid;
  align-content: center;
  gap: 14px;
}

.carousel-line {
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  opacity: .42;
  transform: scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}

.carousel-line.active {
  opacity: 1;
  transform: scale(1);
}

.carousel-line > span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.plain-line,
.token-line,
.ruby-line {
  font-size: clamp(25px, 2.7vw, 38px);
  font-weight: 780;
  line-height: 1.18;
}

.token-line {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.text-token {
  color: #2e3833;
}

.text-token.active {
  color: var(--teal);
}

.ruby-line {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  align-items: end;
}

.ruby-line.compact,
.full-row .plain-line {
  font-size: 19px;
  font-weight: 650;
  line-height: 1.45;
}

ruby {
  ruby-position: over;
}

rt {
  color: var(--rose);
  font-size: .5em;
  font-weight: 750;
}

.chord-row {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chord-pill {
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
  padding: 7px 10px;
}

.chord-pill span {
  color: inherit;
  opacity: .68;
  font-size: 12px;
}

.full-lyrics-section {
  margin-top: 16px;
  padding: 20px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.full-lyrics {
  display: grid;
  gap: 10px;
}

.full-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.full-row.active {
  background: linear-gradient(90deg, rgba(45,143,131,.08), transparent);
  border-radius: 12px;
  padding-left: 10px;
}

.line-index {
  color: var(--teal);
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.line-index span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.language-lines {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.language-lines label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty-state {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.empty-state p {
  color: var(--muted);
}

@media (max-width: 980px) {
  .site-header,
  .lyrics-head,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero-grid,
  .language-lines {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 14px;
  }
  .title-row {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .cover-thumb {
    width: 76px;
  }
  .transport,
  .full-row {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 36px;
  }
}
