/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --bg-darkest:  #0c0c0c;
  --bg-dark:     #121212;
  --bg-medium:   #1a1a1a;
  --bg-panel:    #1e1e1e;
  --bg-lift:     #252525;
  --border:      #2e2e2e;
  --border-soft: #222;
  --text-1:      #e8e8e8;
  --text-2:      #999;
  --text-3:      #555;
  --accent:      #e8943a;
  --accent-hi:   #f5a84c;
  --accent-dim:  rgba(232, 148, 58, 0.12);
  --chord-color: #6ba3d6;
  --chord-dim:   rgba(107, 163, 214, 0.08);
  --section-color: #7db87d;
  --font-mono:   'Menlo', 'Monaco', 'Courier New', monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg-darkest);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

/* ── App shell ──────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 48px;
  background: var(--bg-medium);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 16px;
}

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

.header-brand h1 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--accent);
  white-space: nowrap;
}

#song-meta {
  font-size: 0.8rem;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#song-meta .meta-title  { color: var(--text-1); font-weight: 500; }
#song-meta .meta-artist { color: var(--text-2); }
#song-meta .meta-capo   { color: var(--accent); }

/* ── Main area ──────────────────────────────────────────────────────────────── */
#main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Editor pane ────────────────────────────────────────────────────────────── */
#editor-pane {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 38px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pane-header span {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-2);
}

#tab-input {
  flex: 1;
  background: var(--bg-dark);
  color: var(--text-1);
  border: none;
  outline: none;
  padding: 14px 12px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.65;
  resize: none;
  tab-size: 4;
}
#tab-input::placeholder { color: var(--text-3); }

.editor-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#parse-status {
  font-size: 0.72rem;
  color: var(--text-2);
}

/* ── Song pane ──────────────────────────────────────────────────────────────── */
#song-pane {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-dark);
  padding: 24px 28px;
}

#song-display {
  max-width: 720px;
  margin: 0 auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  color: var(--text-3);
  gap: 14px;
  text-align: center;
}

.empty-icon {
  font-size: 3.5rem;
  opacity: 0.25;
  line-height: 1;
}

/* ── Song content ───────────────────────────────────────────────────────────── */
.song-section {
  margin-bottom: 32px;
}

.section-header {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--section-color);
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-soft);
}

.song-line {
  margin-bottom: 18px;
}

.chord-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  align-items: center;
}

.chord-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 10px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  background: var(--chord-dim);
  color: var(--chord-color);
  border: 1px solid rgba(107, 163, 214, 0.18);
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}

.chord-cell:hover {
  background: rgba(107, 163, 214, 0.16);
  border-color: rgba(107, 163, 214, 0.4);
}

/* Small beat-count superscript on split-bar chords */
.beat-badge {
  font-size: 0.6em;
  color: var(--text-3);
  margin-left: 2px;
  vertical-align: super;
  font-weight: 400;
  font-family: var(--font-mono);
}

.chord-cell.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(232, 148, 58, 0.55);
  box-shadow: 0 0 12px rgba(232, 148, 58, 0.2);
}

.lyrics-row {
  font-size: 0.875rem;
  color: var(--text-2);
  padding: 0 2px;
  line-height: 1.5;
}

/* ── Player bar ─────────────────────────────────────────────────────────────── */
#player-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  height: 62px;
  background: var(--bg-medium);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Transport buttons */
.player-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

#btn-stop, #btn-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-lift);
  color: var(--text-1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s;
}

#btn-stop:hover { border-color: #666; background: var(--bg-panel); }

#btn-play {
  width: 38px;
  height: 38px;
  font-size: 13px;
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}
#btn-play:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
#btn-play.playing {
  background: var(--bg-lift);
  border-color: var(--accent);
  color: var(--accent);
}

/* Center section */
.player-center {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

#current-chord {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 56px;
  text-align: center;
  letter-spacing: -0.5px;
}

.progress-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

#progress-bar {
  height: 3px;
  background: var(--bg-lift);
  border-radius: 2px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.15s linear;
}

#playback-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#measure-display {
  font-size: 0.68rem;
  color: var(--text-3);
  letter-spacing: 0.3px;
}

/* Strum viz */
#strumming-display {
  display: flex;
  align-items: center;
}

#strum-pattern-viz {
  display: flex;
  gap: 3px;
  align-items: center;
}

.strum-cell {
  width: 20px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 3px;
  background: var(--bg-lift);
  color: var(--text-3);
  transition: background 0.08s, color 0.08s, transform 0.08s;
  line-height: 1;
}

.strum-cell.down  { color: var(--chord-color); background: rgba(107, 163, 214, 0.12); }
.strum-cell.up    { color: #a880d8; background: rgba(168, 128, 216, 0.12); }
.strum-cell.muted { color: var(--text-3); }

.strum-cell.active {
  background: var(--accent) !important;
  color: #000 !important;
  transform: scale(1.2);
}

/* Settings */
.player-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.62rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: default;
}

/* Guitar type selector */
.guitar-type-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.guitar-type-select {
  padding: 3px 22px 3px 7px;
  background: var(--bg-lift);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 0.78rem;
  border-radius: 4px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  min-width: 130px;
}
.guitar-type-select:focus { border-color: var(--accent); }
.guitar-type-select option { background: var(--bg-medium); }

/* Loading spinner */
.loading-indicator {
  display: flex;
  align-items: center;
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#tempo-input {
  width: 58px;
  padding: 3px 6px;
  background: var(--bg-lift);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  text-align: center;
  border-radius: 4px;
  outline: none;
  -moz-appearance: textfield;
}
#tempo-input::-webkit-inner-spin-button { -webkit-appearance: none; }
#tempo-input:focus { border-color: var(--accent); }

#volume-input {
  width: 72px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}
.btn-secondary:hover {
  background: var(--bg-lift);
  border-color: #555;
  color: var(--text-1);
}

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar         { width: 5px; height: 5px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #444; }
