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

:root {
  --bg:      #111110;
  --surface: #171715;
  --border:  #252320;
  --text:    #ccc8bc;
  --muted:   #888480;
  --chord:   #c8a84a;
  --section: #7a9870;
  --error:   #b85858;
  --font:    'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ── */

header {
  padding: 32px 0 2px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: block;
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.04em;
  margin-bottom: 16px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.logo:hover { color: var(--chord); }

#url-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt {
  color: var(--chord);
  font-size: 15px;
  font-weight: 500;
  flex-shrink: 0;
  user-select: none;
}

#url-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 300;
  padding: 5px 0;
  outline: none;
  caret-color: var(--chord);
  transition: border-color 0.15s;
  min-width: 0;
}
#url-input::placeholder { color: var(--muted); }
#url-input:focus { border-bottom-color: var(--chord); }

#error-box {
  display: none;
  color: var(--error);
  font-size: 12px;
  margin-top: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--error);
}

/* ── Sections (all start hidden) ── */

#landing, #loading, #search-results, #tab-view {
  display: none;
}

/* ── Loading ── */

#loading {
  color: var(--muted);
  font-size: 12px;
  padding: 4px 0;
}

.dots::after {
  content: '';
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
}

/* ── Search results ── */

#search-list {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  column-gap: 16px;
}

.search-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: color 0.1s;
  min-height: 44px;
}
.search-row:hover .sr-title { color: var(--chord); }

.sr-title {
  font-size: 13px;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.1s;
}
.sr-artist { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.sr-type   { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; }
.sr-rating { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; }
.sr-star  { color: var(--chord); margin-right: 3px; }
.sr-votes { font-size: 11px; color: var(--muted); white-space: nowrap; text-align: right; }

/* ── Tab view ── */

#tab-meta {
  font-size: 12px;
  font-weight: 300;
  color: var(--muted);
  margin-bottom: 28px;
  line-height: 1.9;
}
#tab-meta .meta-title {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
}

#tab-content {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.75;
  white-space: pre;
  color: var(--text);
  tab-size: 4;
  overflow-x: auto;
  padding-bottom: 80px;
}
#tab-content .chord {
  color: var(--chord);
  font-weight: 500;
}
#tab-content .section-header {
  color: var(--section);
}

/* ── Controls bar ── */

#controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 24px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  z-index: 100;
  flex-wrap: wrap;
}

.ctrl-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctrl-sep {
  color: var(--border);
}

.ctrl-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  transition: color 0.12s, border-color 0.12s;
}
.ctrl-btn:hover { color: var(--text); border-color: var(--muted); }

.ctrl-link {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 5px 6px;
  cursor: pointer;
  min-height: 36px;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border);
  transition: color 0.12s;
}
.ctrl-link:hover { color: var(--text); }
.ctrl-link.active { color: var(--chord); }

#transpose-offset {
  font-size: 12px;
  color: var(--text);
  min-width: 24px;
  text-align: center;
}

.ctrl-label {
  font-size: 12px;
  color: var(--text);
  user-select: none;
}

.ctrl-val {
  font-size: 12px;
  color: var(--text);
  min-width: 32px;
  text-align: center;
  user-select: none;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); }

/* ── Responsive ── */
@media (max-width: 500px) {
  #app { padding: 0 16px; }
  header { padding-top: 20px; }
  #tab-content {
    font-size: 10px;
    padding-bottom: 120px;
  }
  #controls { padding: 8px 16px; }
  .ctrl-sep { display: none; }
  #search-list { display: flex; flex-direction: column; }
  .search-row { display: grid; grid-template-columns: 1fr auto auto; grid-column: unset; }
  .sr-rating { display: none; }
  .sr-votes  { display: none; }
}
