:root {
  --bg: #f7f5f2;
  --surface: #ffffff;
  --surface-alt: #f0ece8;
  --text: #241f1f;
  --muted: #746b68;
  --border: #ded8d3;
  --accent: #7b1f2d;
  --accent-strong: #5f1621;
  --accent-soft: #f4e7e9;
  --gold: #9a722b;
  --danger: #9c2d2d;
  --success: #2f6b4d;
  --shadow: 0 12px 35px rgba(38, 27, 28, .09);
  --radius: 18px;
  --player-height: 108px;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  padding-bottom: 24px;
}

body.has-player { padding-bottom: calc(var(--player-height) + 34px); }

button, input { font: inherit; }

button { color: inherit; }

a { color: inherit; text-decoration: none; }

.skip-link {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 1000;
  transform: translateY(-160%);
  padding: 9px 14px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 245, 242, .94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.header-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 12px 22px;
  display: grid;
  grid-template-columns: auto minmax(260px, 620px) auto;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 25px;
  box-shadow: 0 6px 18px rgba(123,31,45,.22);
}

.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-size: 18px; }
.brand-copy small { color: var(--muted); font-size: 11px; direction: ltr; text-align: right; margin-top: 3px; }

.header-search {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.header-search:focus-within {
  border-color: rgba(123,31,45,.55);
  box-shadow: 0 0 0 4px rgba(123,31,45,.08);
}
.header-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  padding: 11px 17px;
  color: var(--text);
  background: transparent;
}
.header-search button {
  border: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  padding: 10px 17px;
  font-weight: 700;
}

.icon-button {
  border: 1px solid var(--border);
  background: var(--surface);
  min-width: 42px;
  height: 42px;
  border-radius: 13px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.icon-button:hover { border-color: #c9bdb8; background: #fbfaf9; }

.queue-button { position: relative; }
.queue-count {
  position: absolute;
  top: -6px; left: -7px;
  min-width: 20px; height: 20px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  padding: 0 5px;
}

.main-content {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 64px;
  outline: none;
}

.page-loading, .empty-state, .error-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px;
  text-align: center;
  color: var(--muted);
}

.error-state strong { display: block; color: var(--danger); margin-bottom: 8px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 38px;
}
.hero-main, .hero-stats {
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.hero-main {
  background:
    radial-gradient(circle at 10% 15%, rgba(255,255,255,.13), transparent 36%),
    linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #fff;
  padding: 42px;
}
.hero-kicker { color: #ead4d7; font-size: 14px; margin-bottom: 8px; }
.hero h1 { margin: 0 0 12px; font-size: clamp(30px, 5vw, 52px); line-height: 1.25; }
.hero p { margin: 0; color: #f1e5e7; max-width: 660px; font-size: 16px; }

.hero-search {
  display: flex;
  margin-top: 26px;
  background: #fff;
  border-radius: 16px;
  padding: 5px;
}
.hero-search input {
  flex: 1;
  min-width: 0;
  border: 0; outline: 0;
  padding: 13px 14px;
  border-radius: 12px;
}
.hero-search button {
  border: 0;
  background: var(--text);
  color: #fff;
  padding: 11px 20px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.hero-stats {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.stat {
  background: var(--surface-alt);
  border-radius: 16px;
  padding: 16px;
}
.stat strong { display: block; font-size: 27px; line-height: 1.1; color: var(--accent); }
.stat span { display: block; color: var(--muted); font-size: 13px; margin-top: 7px; }

.section { margin-top: 34px; }
.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 15px;
}
.section-header h2 { margin: 0; font-size: 23px; }
.section-header p { margin: 3px 0 0; color: var(--muted); }
.section-header a { color: var(--accent); font-weight: 700; }

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

.entity-card {
  display: flex;
  flex-direction: column;
  min-height: 145px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.entity-card:hover {
  transform: translateY(-2px);
  border-color: #cbbdb8;
  box-shadow: 0 8px 22px rgba(36,31,31,.06);
}
.entity-card h3 { margin: 0 0 8px; font-size: 18px; }
.entity-card p { margin: 0; color: var(--muted); font-size: 13px; }
.entity-card .card-meta {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 11px;
  padding: 4px 9px;
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.unavailable { background: #f8e7e5; color: var(--danger); }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 18px;
}
.breadcrumbs a:hover { color: var(--accent); }

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-title h1 { margin: 0 0 5px; font-size: clamp(27px, 4vw, 40px); line-height: 1.35; }
.page-title p { margin: 0; color: var(--muted); }
.page-title-actions { display: flex; gap: 8px; }

.primary-button, .secondary-button, .play-row-button {
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}
.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
}
.primary-button:hover { background: var(--accent-strong); }
.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 16px;
}
.secondary-button:hover { background: #fbfaf9; }

.release-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 12px;
}
.release-row {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 17px 18px;
  transition: border-color .14s, background .14s;
}
.release-row:hover { border-color: #cbbdb8; background: #fffdfc; }
.release-row-main { display: flex; justify-content: space-between; gap: 12px; }
.release-row h3 { margin: 0; font-size: 17px; }
.release-row .release-year { color: var(--gold); font-weight: 700; direction: ltr; }
.release-row .release-meta { color: var(--muted); font-size: 12px; margin-top: 8px; }

.track-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.track-row {
  display: grid;
  grid-template-columns: 52px minmax(0,1fr) auto auto;
  align-items: center;
  gap: 13px;
  min-height: 76px;
  padding: 11px 16px;
  border-bottom: 1px solid #ece7e3;
}
.track-row:last-child { border-bottom: 0; }
.track-row:hover { background: #fcfbfa; }
.track-index {
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.track-title { min-width: 0; }
.track-title a { font-weight: 700; }
.track-title a:hover { color: var(--accent); }
.track-title small {
  display: block;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.track-duration { color: var(--muted); font-size: 12px; direction: ltr; }
.play-row-button {
  border: 1px solid var(--border);
  background: var(--surface);
  width: 42px; height: 42px;
  padding: 0;
}
.play-row-button:hover { border-color: var(--accent); color: var(--accent); }
.play-row-button:disabled { cursor: not-allowed; opacity: .45; }

.search-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}
.search-panel form {
  display: flex;
  gap: 9px;
}
.search-panel input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
.search-panel input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(123,31,45,.07); }

.result-count { color: var(--muted); margin: 11px 0 0; font-size: 13px; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin: 22px 0 0;
}
.pagination button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
}
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

.detail-card {
  display: grid;
  grid-template-columns: 1fr minmax(240px, .42fr);
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 24px;
}
.detail-card h1 { margin-top: 0; }
.detail-meta {
  display: grid;
  gap: 10px;
  align-content: start;
}
.meta-item {
  background: var(--surface-alt);
  border-radius: 13px;
  padding: 11px 13px;
}
.meta-item span { display: block; color: var(--muted); font-size: 11px; }
.meta-item strong { display: block; margin-top: 2px; font-size: 14px; }

.lat-id {
  direction: ltr;
  unicode-bidi: isolate;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .92em;
}

.queue-panel {
  position: fixed;
  z-index: 90;
  top: 0; bottom: 0;
  left: 0;
  width: min(430px, 92vw);
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 40px rgba(31,25,25,.18);
  transform: translateX(-105%);
  transition: transform .22s ease;
  display: flex;
  flex-direction: column;
}
.queue-panel.open { transform: translateX(0); }
.queue-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px;
  border-bottom: 1px solid var(--border);
}
.queue-panel-header strong { display: block; }
.queue-panel-header small { color: var(--muted); }
.queue-list { overflow-y: auto; padding: 7px; }
.queue-item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: right;
  cursor: pointer;
  border-radius: 12px;
  padding: 11px;
  display: grid;
  grid-template-columns: 36px minmax(0,1fr);
  gap: 9px;
}
.queue-item:hover { background: var(--surface-alt); }
.queue-item.current { background: var(--accent-soft); color: var(--accent); }
.queue-item-index { text-align: center; color: var(--muted); }
.queue-item small { display: block; color: var(--muted); }
.queue-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: rgba(20,16,17,.42);
}

.player-shell {
  position: fixed;
  z-index: 70;
  bottom: 0;
  left: 0; right: 0;
  min-height: var(--player-height);
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px rgba(36,31,31,.08);
  backdrop-filter: blur(14px);
}
.player-inner {
  max-width: 1280px;
  min-height: var(--player-height);
  margin: 0 auto;
  padding: 10px 18px;
  display: grid;
  grid-template-columns: minmax(190px, .85fr) auto minmax(280px, 1.4fr) auto;
  align-items: center;
  gap: 16px;
}
.player-track { min-width: 0; }
.player-title-button {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  text-align: right;
  cursor: pointer;
  padding: 0;
}
.player-title-button strong,
.player-title-button span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.player-title-button strong { font-size: 14px; }
.player-title-button span { color: var(--muted); font-size: 11px; margin-top: 3px; }

.player-controls { display: flex; align-items: center; gap: 5px; direction: ltr; }
.player-control, .player-play {
  border: 0;
  background: transparent;
  cursor: pointer;
}
.player-control { width: 36px; height: 36px; border-radius: 999px; }
.player-control:hover { background: var(--surface-alt); }
.player-small-control { font-size: 11px; color: var(--muted); }
.player-play {
  width: 48px; height: 48px;
  border-radius: 999px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
}
.player-play:hover { background: var(--accent-strong); }

.player-timeline {
  display: grid;
  grid-template-columns: 44px minmax(120px,1fr) 44px;
  align-items: center;
  gap: 8px;
  direction: ltr;
}
.time {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.player-waveform {
  width: 100%;
  height: 42px;
  cursor: pointer;
  border-radius: 8px;
  outline: none;
}
.player-waveform:focus-visible { box-shadow: 0 0 0 3px rgba(123,31,45,.2); }
.player-actions { display: flex; gap: 5px; direction: ltr; }

.toast {
  position: fixed;
  z-index: 120;
  bottom: calc(var(--player-height) + 22px);
  left: 50%;
  transform: translate(-50%, 20px);
  background: #211d1d;
  color: #fff;
  border-radius: 12px;
  padding: 10px 15px;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
  max-width: min(92vw, 520px);
  text-align: center;
  font-size: 13px;
}
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 900px) {
  :root { --player-height: 152px; }
  .header-inner {
    grid-template-columns: auto 1fr auto;
    padding: 9px 13px;
    gap: 10px;
  }
  .brand-copy small { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .header-search input { padding: 10px 12px; }
  .header-search button { padding: 9px 12px; }
  .hero { grid-template-columns: 1fr; }
  .hero-main { padding: 30px 24px; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
  .card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .player-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "track actions"
      "timeline timeline"
      "controls controls";
    gap: 5px 10px;
    padding: 8px 12px;
  }
  .player-track { grid-area: track; }
  .player-actions { grid-area: actions; }
  .player-timeline { grid-area: timeline; }
  .player-controls { grid-area: controls; justify-content: center; }
}

@media (max-width: 650px) {
  :root { --player-height: 156px; }
  body.has-player { padding-bottom: calc(var(--player-height) + 24px); }
  .header-inner { grid-template-columns: auto 1fr auto; }
  .brand-copy { display: none; }
  .header-search button { font-size: 0; width: 40px; padding: 0; }
  .header-search button::after { content: "⌕"; font-size: 22px; }
  .main-content { width: min(100% - 22px, 1180px); padding-top: 22px; }
  .hero-main { padding: 28px 20px; border-radius: 21px; }
  .hero h1 { font-size: 32px; }
  .hero-stats { grid-template-columns: 1fr 1fr; padding: 14px; border-radius: 20px; }
  .card-grid, .release-list { grid-template-columns: 1fr; }
  .page-title { flex-direction: column; }
  .detail-card { grid-template-columns: 1fr; padding: 18px; }
  .track-row {
    grid-template-columns: 38px minmax(0,1fr) 42px;
    gap: 8px;
    padding: 10px 9px;
  }
  .track-duration { display: none; }
  .player-track { padding-left: 5px; }
  .player-timeline { grid-template-columns: 38px minmax(100px,1fr) 38px; }
  .player-small-control { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
