:root {
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --surface-2: #eee9dc;
  --text: #1f2a22;
  --muted: #627064;
  --border: #ddd6c5;
  --accent: #2f6b45;
  --accent-ink: #ffffff;
  --accent-soft: #dcebdf;
  --warm: #c2702d;
  --danger: #b4432f;
  --shadow: 0 1px 2px rgb(31 42 34 / 6%), 0 4px 16px rgb(31 42 34 / 6%);
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111814;
    --surface: #18211b;
    --surface-2: #212c24;
    --text: #e8ede6;
    --muted: #93a295;
    --border: #2c3a30;
    --accent: #7cc494;
    --accent-ink: #0d1a11;
    --accent-soft: #23392a;
    --warm: #e39a5b;
    --danger: #e0735e;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 8px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); }
.logo { width: 32px; height: 32px; }
h1 { font: 600 26px/1 var(--serif); margin: 0; color: var(--text); letter-spacing: -0.01em; }
h2 { font: 600 17px/1.3 var(--serif); margin: 0; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status.ready .dot { background: var(--accent); }
.status.listening { color: var(--text); }
.status.listening .dot { background: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
.status.error { color: var(--danger); }
.status.error .dot { background: var(--danger); }

@keyframes pulse { 50% { opacity: 0.3; } }

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  display: grid;
  gap: 16px;
}

.hero { text-align: center; padding: 20px 0 4px; }

.listen {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 28px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 17px/1 var(--sans);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s, opacity 0.2s, background 0.2s;
}
.listen:hover:not(:disabled) { transform: translateY(-1px); }
.listen:active:not(:disabled) { transform: translateY(1px); }
.listen:disabled { opacity: 0.45; cursor: progress; }
.listen:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 3px; }
.listen .mic { width: 22px; height: 22px; }
.listen[aria-pressed="true"] { background: var(--danger); color: #fff; }
.listen .ring {
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid var(--danger);
  opacity: 0;
  pointer-events: none;
}
.listen[aria-pressed="true"] .ring { animation: ring 1.6s ease-out infinite; }
@keyframes ring {
  0% { opacity: 0.6; transform: scale(0.96); }
  100% { opacity: 0; transform: scale(1.12); }
}

.mic-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}
.mic-icon { width: 13px; height: 13px; margin-right: -6px; opacity: 0.7; }
.mic-pick.attention .mic-icon { display: none; }
/* Discreet by default: the label is for screen readers and the select reads as plain text. */
.mic-pick > span {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.mic-pick select {
  max-width: min(240px, 62vw);
  padding: 2px 18px 2px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23889488' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 6px center / 8px;
  color: var(--muted);
  font: inherit;
  text-overflow: ellipsis;
  appearance: none;
  cursor: pointer;
  opacity: 0.8;
}
/* When the mic is sending nothing or failed, make switching it obvious. */
.mic-pick.attention { margin-top: 16px; font-size: 14px; color: var(--danger); }
.mic-pick.attention > span { position: static; width: auto; height: auto; clip-path: none; }
.mic-pick.attention select {
  max-width: min(280px, 62vw);
  padding: 6px 28px 6px 10px;
  border-color: var(--danger);
  background-color: var(--surface);
  background-position: right 10px center;
  background-size: 10px;
  color: var(--text);
  opacity: 1;
}
.mic-pick select:hover, .select:hover { border-color: var(--accent); }
.select {
  flex-shrink: 0;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23889488' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center / 10px;
  color: var(--text);
  font: 14px var(--sans);
  appearance: none;
  cursor: pointer;
}
.select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mic-pick select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.progress {
  width: min(320px, 100%);
  height: 4px;
  margin: 18px auto 0;
  border-radius: 2px;
  background: var(--surface-2);
  overflow: hidden;
}
.progress.done { visibility: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.hint { color: var(--muted); font-size: 14px; max-width: 460px; margin: 12px auto 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.meta { color: var(--muted); font-size: 13px; }
.count {
  display: inline-block;
  min-width: 22px;
  padding: 0 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 13px/22px var(--sans);
  text-align: center;
  vertical-align: 2px;
}

/* The live meter text changes every half second; keep the header on one line. */
.spectro-card .card-head { align-items: center; height: 22px; }
.spectro-card .card-head h2 { white-space: nowrap; flex-shrink: 0; }
#inferMeta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }

.spectro-wrap { position: relative; }
#spectrogram {
  display: block;
  width: 100%;
  height: 160px;
  border-radius: 8px;
  background: #0b0d14;
}
.axis {
  position: absolute;
  top: 4px; bottom: 4px; left: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 10px;
  color: rgb(255 255 255 / 55%);
  pointer-events: none;
}

ul { list-style: none; margin: 0; padding: 0; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

.now-list { display: grid; gap: 10px; }
.now-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.now-item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-item .pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.now-item .meter { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.now-item .meter div { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.3s; }
.now-item.maybe .name { font-weight: 400; color: var(--muted); }
.now-item.maybe .meter div { background: var(--muted); opacity: 0.5; }

.log-list { display: grid; gap: 2px; }
.log-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.log-item:first-child { border-top: 0; }
.log-item.fresh { animation: flash 1.5s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.thumb {
  width: 56px; height: 56px;
  border-radius: 10px;
  background: var(--surface-2) center / cover no-repeat;
  display: grid;
  place-items: center;
  color: var(--muted);
  font: 600 18px var(--serif);
}
.thumb.has-img span { display: none; }
.info { min-width: 0; }
.info .name { font-weight: 600; }
.info .sci { font-style: italic; color: var(--muted); font-size: 14px; }
.info .stats { font-size: 13px; color: var(--muted); margin-top: 2px; }
.info .stats b { color: var(--text); font-weight: 600; }
.log-item { align-items: start; }
.log-item .thumb, .log-item .actions { margin-top: 2px; }
.thumb.sm { width: 40px; height: 40px; border-radius: 8px; font-size: 15px; }

.details-btn {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: 500 13px var(--sans);
  cursor: pointer;
}
.details-btn::after { content: " ▾"; font-size: 10px; }
.details-btn[aria-expanded="true"]::after { content: " ▴"; }
.details-btn:hover { text-decoration: underline; }

.actions { display: flex; gap: 4px; }
.act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font: 500 13px var(--sans);
  cursor: pointer;
}
.act svg { width: 16px; height: 16px; flex-shrink: 0; }
.act:hover { color: var(--text); border-color: var(--muted); }
.act:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.act.save { color: var(--accent); border-color: var(--accent); }
.act.save:hover { background: var(--accent-soft); }
.act.save.saved { border-color: transparent; background: none; color: var(--accent); }
.act.save.saved:hover { color: var(--muted); border-color: var(--border); }
.act.save.saved:hover .lbl { display: none; }
.act.save.saved:hover::after { content: "Undo"; }
.act.remove:hover { color: var(--danger); border-color: var(--danger); }
.log-item .act:not(.save) { padding: 0; }

.skipped { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.skipped[hidden] { display: none; }
.skipped summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.skipped summary .count { background: var(--surface-2); color: var(--muted); }
.skipped-list { margin-top: 6px; }
.skipped-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 14px;
}
.skipped-item .name { font-weight: 500; }
.skipped-item .stats { font-size: 12px; color: var(--muted); }
.skipped-item .stats.active { color: var(--warm); }
.skipped-item .act { flex-shrink: 0; }

/* Expanded details */
.detail {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14px;
}
.detail[hidden], .detail .heard[hidden] { display: none; }
.detail .ref, .detail .heard, .detail .learn { display: grid; gap: 8px; }
.detail .ref { gap: 12px; }
.detail h4 { margin: 0; font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.detail .loading { color: var(--muted); }
.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding-bottom: 2px;
}
.photo {
  position: relative;
  flex: 0 0 auto;
  width: 168px;
  height: 126px;
  scroll-snap-align: start;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--border) center / cover no-repeat;
  cursor: zoom-in;
}
.photo:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.photo:hover { filter: brightness(1.06); }
.photo .sex {
  position: absolute;
  left: 4px; bottom: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgb(0 0 0 / 60%);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.sound-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sound {
  --p: 0%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-soft) var(--p), var(--surface) var(--p));
  color: var(--text);
  font: 500 13px var(--sans);
  cursor: pointer;
}
.sound:hover { border-color: var(--accent); }
.sound .icon { width: 14px; height: 14px; color: var(--accent); }
.sound .dur { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.sound.playing { border-color: var(--accent); }
.clip { display: inline-flex; align-items: center; gap: 2px; }
.clip-dl {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--muted);
}
.clip-dl svg { width: 15px; height: 15px; }
.clip-dl:hover { color: var(--accent); background: var(--surface); }
.range-map {
  position: relative;
  overflow: hidden;
  background: var(--border);
}
.map-thumb { overflow: hidden; }
.map-thumb .range-map { position: absolute; inset: 0; pointer-events: none; }
.map-thumb .map-credit { top: 0; bottom: auto; border-radius: 0 0 0 4px; }
.lb-stage .range-map { width: 100%; max-height: 100%; }
.lb-stage img[hidden] { display: none; }
.range-map .layer { position: absolute; inset: 0; }
.range-map .layer img { position: absolute; display: block; max-width: none; }
.range-map .layer:first-child { filter: grayscale(1) contrast(0.7) brightness(1.12); } /* quiet base map */
.range-map .layer:nth-child(2) { opacity: 0.55; } /* expert range, under the sightings */
@media (prefers-color-scheme: dark) {
  .range-map .layer:first-child { filter: grayscale(1) invert(1) contrast(0.75) brightness(0.85); }
}
.range-map .you {
  position: absolute;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #2b7bf3;
  box-shadow: 0 0 0 3px rgb(43 123 243 / 30%);
}
.map-credit {
  position: absolute;
  right: 0; bottom: 0;
  padding: 1px 5px;
  border-top-left-radius: 4px;
  background: rgb(255 255 255 / 70%);
  color: #333;
  font-size: 9px;
  text-decoration: none;
}
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.map-legend a { color: #fff; margin-left: 8px; }
.map-legend .key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.map-legend .key.range { background: #f4b3cf; }
.map-legend .key.obs { background: #f86b1e; margin-left: 6px; }
.map-legend .key.me { background: #2b7bf3; border-radius: 50%; margin-left: 6px; }
.link-row { display: flex; flex-wrap: wrap; gap: 6px; }
.link-chip {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}
.link-chip:hover { border-color: var(--accent); color: var(--accent); }
.facts { display: grid; gap: 6px; line-height: 1.45; }
.facts ul { list-style: disc; padding-left: 18px; margin: 0; }
.facts p { margin: 0; }
.facts .summary { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.detail .credits { font-size: 11px; color: var(--muted); }
.detail .credits a { color: inherit; }

/* Saved sightings */
.saved-list { display: grid; }
.saved-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.saved-item:first-child { border-top: 0; }
.saved-item .name { font-weight: 600; font-size: 15px; }
.saved-item .stats { font-size: 13px; color: var(--muted); }
.saved-item .act { padding: 0; }
.saved-item { align-items: start; }
.saved-item .thumb, .saved-item > .act { margin-top: 2px; }

/* Photo viewer: full screen, full resolution, browsable */
.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  color: #fff;
}
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox::backdrop { background: #000; }
.lb-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 64px;
  border: 0;
  border-radius: 10px;
  background: rgb(0 0 0 / 45%);
  color: #fff;
  font: 36px/1 var(--sans);
  cursor: pointer;
}
.lb-nav:hover { background: rgb(0 0 0 / 70%); }
.lb-nav.prev { left: 8px; }
.lb-nav.next { right: 8px; }
.lightbox.single .lb-nav { display: none; }
.lb-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  font-size: 12px;
  color: rgb(255 255 255 / 75%);
}
.lb-bar .caption {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lb-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-count:empty { display: none; }
.lightbox .close {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 10px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 55%);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.link-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
}
.link-btn:hover { color: var(--danger); }

.settings h2 { margin-bottom: 4px; }
.settings .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.settings .row:first-of-type { border-top: 0; }
.settings small { display: block; color: var(--muted); font-size: 13px; }
.settings output { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 600; margin-left: 4px; }
input[type="range"] { width: 160px; accent-color: var(--accent); flex-shrink: 0; }

.switch {
  appearance: none;
  flex-shrink: 0;
  width: 44px; height: 26px;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
  transition: transform 0.2s;
}
.switch:checked { background: var(--accent); border-color: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
.switch:focus-visible, input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.file-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.file-btn:hover { border-color: var(--accent); }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }

footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 16px 32px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
footer a { color: inherit; }

@media (max-width: 520px) {
  .top { padding-top: 14px; }
  h1 { font-size: 22px; }
  .settings .row { flex-wrap: wrap; }
  input[type="range"] { width: 100%; }
  .log-item { grid-template-columns: 44px 1fr auto; gap: 10px; }
  .log-item .thumb { width: 44px; height: 44px; }
  .act.save .lbl { display: none; }
  .act.save.saved:hover::after { content: none; }
  .log-item .act.save { padding: 0; }
  .photo { width: 136px; height: 102px; }
}

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

/* Record button */
.record {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding: 15px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: 600 15px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  cursor: pointer;
}
.record:hover:not(:disabled) { border-color: var(--danger); }
.record:disabled { opacity: 0.45; cursor: progress; }
.record:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 3px; }
.record .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.record.recording { border-color: var(--danger); color: var(--danger); }
.record.recording .rec-dot { animation: pulse 1.2s ease-in-out infinite; }

/* Recordings library */
.file-btn.small { padding: 5px 12px; font-size: 13px; }
.card-head .meta.push { margin-left: auto; }
.rec-note { margin: 0 0 8px; font-size: 13px; color: var(--danger); }
.rec-list { display: grid; }
.rec-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.rec-item:first-child { border-top: 0; }
.rec-item .act { padding: 0; text-decoration: none; }
.rec-item .act.confirm { padding: 0 8px; color: var(--danger); border-color: var(--danger); }
.rec-main {
  display: grid;
  min-width: 0;
  padding: 4px 6px;
  margin-left: -6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.rec-main:hover:not(:disabled), .rec-item.open .rec-main { background: var(--surface-2); }
.rec-main:disabled { cursor: default; }
.rec-main .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-main .stats { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Player */
.player {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-2);
}
.player[hidden] { display: none; }
.player-head { display: flex; align-items: center; gap: 10px; }
.player-name {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: 600 15px var(--sans);
}
.player-name:hover { border-color: var(--border); }
.player-name:focus { outline: none; border-color: var(--accent); background: var(--surface); }

.det-track { position: relative; overflow: hidden; height: 24px; }
.det-track.empty { display: none; }
.det {
  --c: var(--accent);
  position: absolute;
  top: calc(var(--lane) * 20px + 2px);
  height: 18px;
  padding: 0 6px;
  border: 0;
  border-left: 3px solid var(--c);
  border-radius: 3px;
  background: color-mix(in srgb, var(--c) 28%, transparent);
  color: var(--text);
  font: 500 11px/18px var(--sans);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.det:hover { background: color-mix(in srgb, var(--c) 45%, transparent); }
.det[hidden] { display: none; }

.view-wrap { position: relative; overflow: hidden; border-radius: 6px; }
#playerSpec { display: block; width: 100%; height: 150px; background: #0b0d14; cursor: grab; touch-action: pan-y; }
#playerSpec:active { cursor: grabbing; }
.playhead {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 4px rgb(0 0 0 / 60%);
  pointer-events: none;
}
.playhead[hidden] { display: none; }
.player-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgb(255 255 255 / 75%);
  font-size: 13px;
  pointer-events: none;
}
.player-status[hidden] { display: none; }

.overview { position: relative; height: 30px; border-radius: 4px; overflow: hidden; cursor: pointer; touch-action: none; }
#overview { display: block; width: 100%; height: 100%; background: #0b0d14; }
.overview .window {
  position: absolute;
  top: 0; bottom: 0;
  border: 2px solid #fff;
  border-radius: 3px;
  background: rgb(255 255 255 / 12%);
  pointer-events: none;
}

.transport { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.transport .act { text-decoration: none; }
.transport .act.play { width: 40px; color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.transport .act.play svg { width: 14px; height: 14px; }
.transport .act:disabled { opacity: 0.45; cursor: default; }
.transport .time { margin-left: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.transport .spacer { flex: 1; }

@media (max-width: 520px) {
  .record { margin: 10px 0 0; }
  .transport .spacer { flex-basis: 100%; height: 0; }
}
