:root {
  --ink: #2b2118;
  --paper: #faf6ef;
  --accent: #a0522d;
  --muted: #7d6f61;
  --card: #ffffff;
  --border: #e5dccd;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

header {
  border-bottom: 2px solid var(--border);
  padding: 1rem 0;
  background: var(--card);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

header .brand {
  font-size: 1.6rem;
  font-weight: bold;
  text-decoration: none;
  color: var(--ink);
}

header .brand span {
  color: var(--accent);
}

main {
  padding: 2rem 0 4rem;
}

h1 {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.lede {
  color: var(--muted);
  margin-top: 0;
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.breadcrumb a {
  color: var(--accent);
}

/* directory toolbar */

.toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.25rem 0;
}

.toolbar input[type="search"] {
  flex: 1 1 260px;
  font: inherit;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
}

.toolbar select {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
}

/* tune list */

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

.tune-list li {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.tune-list li[hidden] {
  display: none;
}

.tune-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  text-decoration: none;
  color: var(--ink);
}

.tune-list li:hover {
  border-color: var(--accent);
  background: #fff9f0;
}

.tune-list .title {
  font-size: 1.1rem;
  font-weight: bold;
}

.row-side {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

/* phone width: stack card contents instead of forcing one row */
@media (max-width: 600px) {
  .tune-list a {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .row-side {
    white-space: normal;
  }

  .chevron {
    display: none;
  }
}

.chips {
  color: var(--muted);
  font-size: 0.85rem;
}

.chevron {
  color: var(--muted);
  font-size: 1.3rem;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  margin-right: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* tune page */

section {
  margin-top: 2rem;
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.player-placeholder {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--muted);
}

.player-placeholder p {
  margin: 0;
}

/* loop player */

.loop-player .video-frame {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}

.loop-player .video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.video-choice {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.9rem;
}

.video-choice.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.timeline {
  position: relative;
  height: 44px;
  margin: 1.75rem 0 0.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  touch-action: none;
  cursor: pointer;
}

.tl-region {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(160, 82, 45, 0.18);
  pointer-events: none;
}

.timeline.looping .tl-region {
  background: rgba(160, 82, 45, 0.32);
}

.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--muted);
  pointer-events: none;
}

.tl-marker {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 14px;
  margin-left: -7px;
  cursor: ew-resize;
  touch-action: none;
}

.tl-marker::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.tl-marker.dragging::after,
.tl-marker:hover::after {
  background: var(--ink);
}

.tl-marker-label {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--accent);
}

.tl-duration {
  position: absolute;
  right: 8px;
  bottom: 4px;
  font-size: 0.75rem;
  color: var(--muted);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.transport-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.t-btn {
  padding: 0.35rem 0.7rem;
}

.t-nudge {
  background: var(--card);
  color: var(--ink);
  border-color: var(--border);
  min-width: 2.2rem;
}

.t-time {
  font-variant-numeric: tabular-nums;
  min-width: 4.6rem;
  text-align: center;
}

.t-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.t-speed {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
}

.t-loop[aria-pressed="false"] {
  background: var(--card);
  color: var(--ink);
  border-color: var(--border);
}

.player-hint {
  margin-top: 0.75rem;
}

/* shared loop presets */

.presets {
  margin-top: 1.5rem;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.presets-title {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.preset-list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.preset-apply {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font-size: 0.9rem;
}

.preset-apply:hover {
  border-color: var(--accent);
}

.preset-name {
  font-weight: bold;
}

.preset-times {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.preset-save {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preset-label {
  flex: 1 1 220px;
  font: inherit;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.preset-status {
  margin: 0.6rem 0 0;
}

.preset-status:empty {
  display: none;
}

.notation {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
}

.controls {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  font: inherit;
  padding: 0.45rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

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

.resource-list a {
  color: var(--accent);
}

.note,
.error {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.error {
  color: #a03030;
}

footer {
  border-top: 1px solid var(--border);
  padding: 1rem 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

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