:root {
  --bg: #f7f4ef;
  --ink: #111b20;
  --dim: #5c6467;
  --rule: #d4cfc3;
  --card: #ffffff;
  --accent: #9e4b16;
  --active-bg: #ece7de;
  --surface: #ede8df;
  --radius: 6px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.6 Georgia, serif;
}

.wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem;
}

header {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
}

.wordmark {
  font: 700 0.82rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 0.25rem;
  color: var(--ink);
}

.tagline {
  color: var(--dim);
  font-size: 0.95rem;
  margin: 0 0 1rem;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  font: 600 0.75rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

nav a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

nav a:hover, nav a:focus {
  border-bottom-color: var(--ink);
}

h1 {
  font-size: 2.1rem;
  line-height: 1.15;
  margin: 0 0 0.75rem;
  font-weight: 700;
}

.lead {
  font-size: 1.1rem;
  color: var(--dim);
  line-height: 1.55;
  margin: 0 0 2rem;
}

/* Player Dock */
.player-dock {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.player-status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
}

.now-badge {
  font: 700 0.72rem/1 system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.now-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0.25rem 0;
}

.now-motif {
  font-style: italic;
  color: var(--dim);
  font-size: 0.95rem;
  margin: 0;
}

.scrubber-container {
  margin: 1.25rem 0 0.75rem;
}

.scrubber {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--rule);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.scrubber::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #fff;
}

.time-display {
  display: flex;
  justify-content: space-between;
  font: 500 0.8rem system-ui, sans-serif;
  color: var(--dim);
  margin-top: 0.35rem;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
}

.transport-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn {
  font: 600 0.85rem/1 system-ui, sans-serif;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--surface);
  border-color: var(--dim);
}

.btn-primary {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
  padding: 0.75rem 1.4rem;
  font-size: 0.95rem;
}

.btn-primary:hover {
  background: #2b3940;
  border-color: #2b3940;
}

.vol-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font: 500 0.8rem system-ui, sans-serif;
  color: var(--dim);
}

.vol-slider {
  width: 80px;
  height: 5px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--rule);
  border-radius: 3px;
  outline: none;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--dim);
  cursor: pointer;
}

.options-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  font: 500 0.82rem system-ui, sans-serif;
  color: var(--dim);
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.btn-save[aria-pressed="true"] {
  background: #284632;
  color: #fff;
  border-color: #284632;
}

/* Track Queue */
.queue-section {
  margin: 2.5rem 0;
}

h2 {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  margin: 2rem 0 1rem;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
}

.track-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.track-item {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

.track-item:hover {
  background: var(--surface);
  border-color: var(--dim);
}

.track-item.active {
  background: var(--active-bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.track-num {
  font: 700 0.9rem system-ui, sans-serif;
  color: var(--dim);
  min-width: 1.5rem;
}

.track-item.active .track-num {
  color: var(--accent);
}

.track-details h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.track-details p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--dim);
  font-family: system-ui, sans-serif;
}

.track-meta {
  font: 500 0.82rem system-ui, sans-serif;
  color: var(--dim);
  text-align: right;
}

/* Dossier & Commentary Cards */
.dossier-grid {
  display: grid;
  gap: 1.5rem;
  margin: 1.5rem 0;
}

.commentary-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  transition: border-color 0.2s;
}

.commentary-card.focused {
  border-left: 4px solid var(--accent);
}

.commentary-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

.motif-title {
  font: 700 0.82rem system-ui, sans-serif;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

.commentary-track-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.commentary-card p {
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
}

.commentary-card p:last-child {
  margin-bottom: 0;
}

/* Provenance Section */
.provenance-box {
  background: #f0ece3;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: 0.9rem;
  color: var(--dim);
  margin: 2.5rem 0;
}

.provenance-box h3 {
  font-size: 0.95rem;
  color: var(--ink);
  margin: 0 0 0.5rem;
  font-family: system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.provenance-table {
  width: 100%;
  border-collapse: collapse;
  font: 0.8rem/1.4 monospace;
  margin-top: 0.75rem;
}

.provenance-table th, .provenance-table td {
  border: 1px solid var(--rule);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.provenance-table th {
  background: #e6e0d4;
  color: var(--ink);
  font-family: system-ui, sans-serif;
}

footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--dim);
}

footer a {
  color: var(--ink);
}

@media (max-width: 640px) {
  .controls-row {
    flex-direction: column;
    align-items: stretch;
  }
  .transport-buttons {
    justify-content: center;
  }
  .track-item {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .track-meta {
    text-align: left;
  }
}
