:root {
  color-scheme: dark;
  --bg: #101215;
  --panel: #171a1f;
  --panel-2: #1e232a;
  --line: #2a3038;
  --text: #e8eaed;
  --muted: #9aa3ad;
  --accent: #6fb3ff;
  --danger: #ff7b7b;
  --ok: #6ee7a8;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.status {
  font-size: 12px;
  color: var(--muted);
}

.status.ok {
  color: var(--ok);
}

.status.error,
.hint.error {
  color: var(--danger);
}

.actions {
  display: flex;
  gap: 8px;
}

button {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--accent);
  color: #08111d;
  cursor: pointer;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.ghost,
a.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
  text-decoration: none;
}

button.small {
  font-size: 11px;
  padding: 3px 8px;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 0;
}

.list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.list input {
  margin: 10px;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.list ul {
  list-style: none;
  margin: 0;
  padding: 0 0 20px;
  overflow-y: auto;
}

.list li button {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 2px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 12px;
}

.list li button:hover {
  background: var(--panel-2);
}

.list li.active button {
  background: var(--panel-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

.list time {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.list .empty {
  padding: 12px;
  color: var(--muted);
}

.editor {
  padding: 14px 18px 40px;
  overflow-y: auto;
}

.headline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.title-field {
  display: grid;
  gap: 4px;
  flex: 1 1 320px;
}

.title-field span,
.token-field span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.title-field input {
  font: inherit;
  font-size: 18px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.player {
  margin: 14px 0 18px;
  display: grid;
  gap: 8px;
}

.player audio {
  width: 100%;
}

#wave {
  width: 100%;
  height: 64px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: crosshair;
}

.tracks {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tracks th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}

.tracks td {
  padding: 3px 4px;
  border-bottom: 1px solid rgba(42, 48, 56, 0.5);
}

.tracks td.num {
  width: 76px;
}

.tracks input {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 5px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.tracks input:hover {
  border-color: var(--line);
}

.tracks input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--panel-2);
}

.tracks tr.hidden-track {
  opacity: 0.45;
}

.tracks tr.hidden-track input {
  text-decoration: line-through;
}

.hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  max-width: 460px;
  padding: 20px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form h2 {
  margin: 0;
  font-size: 17px;
}

.login-form p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

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

.token-field {
  display: grid;
  gap: 4px;
}

.token-field input {
  font: inherit;
  font-size: 13px;
  padding: 7px 9px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.login-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.error {
  color: var(--danger);
  min-height: 1em;
  font-size: 12px;
}

.footer {
  border-top: 1px solid var(--line);
  border-bottom: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.footer .watermark,
.footer .version {
  color: var(--muted);
  text-decoration: none;
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .list {
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .tracks td.num {
    width: 62px;
  }
}

.tracks th.tick,
.tracks td.done-cell {
  width: 30px;
  text-align: center;
}

.tracks td.done-cell input {
  width: 15px;
  height: 15px;
  accent-color: var(--ok);
  cursor: pointer;
}

.progress {
  margin-left: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.tab {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 7px 14px;
}

.tab[aria-selected='true'] {
  background: var(--bg);
  color: var(--text);
  border-color: var(--line);
}

.tags {
  padding: 14px 18px 60px;
  max-width: 900px;
  overflow-y: auto;
}

.tags h2 {
  font-size: 14px;
  margin: 22px 0 6px;
}

.tags h2:first-of-type {
  margin-top: 0;
}

.tags p {
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0 10px;
}

.tags code {
  font-size: 11px;
  color: var(--accent);
}

.alias-table,
.tag-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.alias-table th,
.tag-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
}

.alias-table td,
.tag-table td {
  padding: 3px 4px;
  border-bottom: 1px solid rgba(42, 48, 56, 0.5);
}

.alias-table td:first-child {
  width: 42%;
}

.alias-table input,
.tags input[type='search'],
.tags select,
.alias-add input {
  font: inherit;
  font-size: 13px;
  padding: 5px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.alias-table input {
  width: 100%;
}

.alias-add {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.alias-add input {
  flex: 1 1 220px;
}

.tags input[type='search'] {
  width: 100%;
  max-width: 320px;
}

.tags select {
  font-size: 12px;
  padding: 2px 4px;
}

.tag-table td.num,
.alias-table td.num {
  width: 84px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tag-table td.alias-of {
  color: var(--accent);
  font-size: 12px;
}

.candidates {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.candidates li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(42, 48, 56, 0.5);
  flex-wrap: wrap;
}

.candidates .arrow {
  color: var(--muted);
}

.tags-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding: 10px 0;
  background: linear-gradient(transparent, var(--bg) 40%);
}
