:root {
  color-scheme: light;
  --paper: #f5f2ea;
  --paper-strip: #fffdf7;
  --paper-hover: #efeade;
  --ink: #181712;
  --ink-soft: #3a382f;
  --ink-muted: #6f6b60;
  --ink-faint: #9c988c;
  --rule: #ded9cb;
  --rule-soft: #d3cec0;
  --perf: #e7e2d4;
  --accent: oklch(0.52 0.15 25);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: 26px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  overflow-x: hidden;
}

body {
  min-width: 18rem;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

button:focus,
a:focus,
input:focus {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: var(--paper);
  background: var(--ink);
  letter-spacing: 0.12em;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- the page is one sheet of paper ---------- */

.sheet-of-paper {
  display: flex;
  flex-direction: column;
  width: min(100%, 30rem);
  min-height: 100svh;
  margin-inline: auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 26px var(--gutter) 14px;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.side-mark {
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.deck {
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* ---------- now playing ---------- */

.now-playing {
  padding: 44px var(--gutter) 0;
}

.slug {
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.18em;
}

#title {
  display: -webkit-box;
  margin: 14px 0 0;
  overflow: hidden;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.24;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.style-line {
  display: -webkit-box;
  margin: 16px 0 0;
  overflow: hidden;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.7;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

/* ---------- punched paper seek strip ---------- */

.timeline {
  padding: 40px var(--gutter) 0;
}

.strip {
  position: relative;
  height: 52px;
  overflow: hidden;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-strip);
}

.strip-perf {
  position: absolute;
  background: repeating-linear-gradient(90deg, var(--perf) 0 1px, transparent 1px 13px);
  inset: 0;
}

.strip-buffer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--buffered, 0%);
  background: var(--perf);
  transition: width 240ms linear;
}

.strip-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--progress, 0%);
  background: var(--ink);
}

.strip-edge {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--progress, 0%);
  width: 1px;
  background: var(--ink);
}

.strip-knob {
  position: absolute;
  top: 50%;
  left: var(--progress, 0%);
  width: 12px;
  height: 12px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  transform: translate(-50%, -50%);
}

.strip input[type="range"] {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
  inset: 0;
}

.strip input[type="range"]::-webkit-slider-runnable-track {
  height: 100%;
  background: transparent;
}

.strip input[type="range"]::-webkit-slider-thumb {
  width: 14px;
  height: 52px;
  appearance: none;
  border: 0;
  background: transparent;
}

.strip input[type="range"]::-moz-range-track {
  height: 100%;
  background: transparent;
}

.strip input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 52px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.time-row {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  color: var(--ink-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.time-row time::before {
  content: "[ ";
}

.time-row time::after {
  content: " ]";
}

/* ---------- typed-label controls ---------- */

.transport {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 38px var(--gutter) 0;
}

.cmd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  cursor: pointer;
  transition: color 120ms ease;
}

.cmd-main {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.cmd-pair {
  display: flex;
  gap: 2px;
}

.cmd-half {
  flex: 1;
  display: block;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-align: left;
}

.cmd-right {
  text-align: right;
}

.cmd:disabled {
  color: var(--ink-faint);
  cursor: not-allowed;
}

.player-status {
  min-height: 18px;
  margin: 14px 0 0;
  padding-inline: var(--gutter);
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* ---------- the typed index at the foot ---------- */

.index-links {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: auto;
  padding: 40px var(--gutter) 34px;
}

.index-links button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-align: left;
  cursor: pointer;
  transition: color 120ms ease;
}

/* ---------- full-page overlays ---------- */

.sheet {
  position: fixed;
  z-index: 15;
  display: flex;
  flex-direction: column;
  width: min(100%, 30rem);
  background: var(--paper);
  animation: fade-in 180ms ease;
  inset: 0;
  margin-inline: auto;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

.sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 48px var(--gutter) 14px;
  border-bottom: 1px solid var(--rule);
}

.sheet-close {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: color 120ms ease;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px var(--gutter) 34px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* index of tracks */

.track-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.track-item {
  border-bottom: 1px dotted var(--rule-soft);
}

.track-select {
  display: grid;
  width: 100%;
  padding: 11px 0;
  border: 0;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease;
}

.track-number,
.track-length {
  color: var(--ink-faint);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.track-title {
  font-size: 13px;
  line-height: 1.45;
  text-wrap: pretty;
}

.track-item.is-current .track-title {
  font-weight: 600;
}

.track-item.is-current .track-number {
  color: var(--accent);
}

/* words */

.panel-title {
  margin: 0;
  padding: 16px 0 10px;
  font-size: 20px;
  font-weight: 400;
  line-height: 1.3;
  text-wrap: pretty;
}

.lyrics {
  display: grid;
  gap: 18px;
  padding-bottom: 8px;
}

.lyrics p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-line;
}

.lyrics .section-label {
  margin-bottom: -12px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.18em;
}

/* source */

.record-card {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 16px 0;
}

.record-card dt {
  margin-bottom: 7px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.18em;
}

.record-card dd {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.8;
  text-wrap: pretty;
}

.record-card dd:last-child {
  margin-bottom: 0;
}

.record-card a {
  display: block;
  width: fit-content;
  margin-top: 10px;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.06em;
}

.empty-state {
  padding: 48px 0;
}

.empty-state h2 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.empty-state p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.7;
}

.empty-state code {
  font: inherit;
  color: var(--ink);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}

[hidden] {
  display: none !important;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (hover: hover) {
  .cmd:hover:not(:disabled),
  .sheet-close:hover {
    color: var(--accent);
  }

  .index-links button:hover {
    color: var(--ink);
  }

  .track-select:hover {
    background: var(--paper-hover);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
