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

:root {
  --bg:         #0f0f13;
  --surface:    #1a1a24;
  --surface2:   #22222f;
  --border:     rgba(255,255,255,0.08);
  --border2:    rgba(255,255,255,0.14);
  --accent:     #6C63FF;
  --accent-dim: rgba(108,99,255,0.15);
  --text:       #f0f0f5;
  --muted:      #7a7a95;
  --success:    #22c55e;
  --success-bg: rgba(34,197,94,0.1);
  --danger:     #ef4444;

  --chip-v-bg:  rgba(56,107,235,0.18); --chip-v-border: rgba(56,107,235,0.4);  --chip-v-text: #7eaaff;
  --chip-c-bg:  rgba(34,197,120,0.15); --chip-c-border: rgba(34,197,120,0.4);  --chip-c-text: #4ade94;
  --chip-b-bg:  rgba(234,179,8,0.15);  --chip-b-border: rgba(234,179,8,0.4);   --chip-b-text: #fbbf24;
  --chip-p-bg:  rgba(236,72,153,0.15); --chip-p-border: rgba(236,72,153,0.4);  --chip-p-text: #f472b6;
  --chip-x-bg:  rgba(120,120,150,0.15);--chip-x-border: rgba(120,120,150,0.35);--chip-x-text: #a0a0b8;

  --radius:     10px;
  --radius-sm:  6px;
  --font:       'Inter', system-ui, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

header {
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky; top: 0; z-index: 10;
  background: rgba(15,15,19,0.85);
  backdrop-filter: blur(12px);
}
.header-inner {
  max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  height: 56px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
}
.version-badge {
  font-size: 11px; padding: 2px 8px;
  background: var(--accent-dim); color: var(--accent);
  border-radius: 20px; border: 1px solid rgba(108,99,255,0.3);
  margin-left: auto;
}

/* ── Main layout ─────────────────────────────────────────────────────────── */

main {
  max-width: 720px; margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex; flex-direction: column; gap: 20px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}
.card.hidden { display: none; }

.step-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px;
}
.card h2 {
  font-size: 20px; font-weight: 600; letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }

/* ── Drop zone ───────────────────────────────────────────────────────────── */

.drop-zone {
  margin-top: 1.5rem;
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}
.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.drop-zone svg { color: var(--muted); margin-bottom: 12px; }
.drop-zone p { font-size: 14px; color: var(--muted); }
.drop-zone .link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.drop-zone.loaded {
  border-color: var(--success);
  background: var(--success-bg);
}
.drop-zone.loaded svg { color: var(--success); }

/* ── Divider ─────────────────────────────────────────────────────────────── */

.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 1.5rem 0;
  color: var(--muted); font-size: 13px;
}
.divider::before, .divider::after {
  content: ''; flex: 1;
  border-top: 1px solid var(--border);
}

/* ── Chord sheet toggle ──────────────────────────────────────────────────── */

.chord-toggle {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer;
  margin-bottom: 14px;
}
.chord-toggle input { accent-color: var(--accent); cursor: pointer; }
.wip-badge {
  display: inline-block; margin-left: 6px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  background: rgba(234,179,8,0.15); color: #fbbf24; border: 1px solid rgba(234,179,8,0.35);
  border-radius: 4px; padding: 1px 5px; vertical-align: middle;
}
.chord-wip-note { margin-top: 6px; line-height: 1.5; }

/* ── CCLI row ────────────────────────────────────────────────────────────── */

.ccli-row { margin: 12px 0 4px; }
.ccli-checks { display: flex; gap: 20px; flex-wrap: wrap; }
.ccli-toggle-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.ccli-toggle-label input { accent-color: var(--accent); cursor: pointer; }
.ccli-preview { margin-top: 5px; font-size: 11px; line-height: 1.4; }

/* ── Paste section ───────────────────────────────────────────────────────── */

.paste-section label {
  display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px;
}
.paste-section textarea {
  width: 100%; resize: vertical;
}
.paste-section .row {
  display: flex; gap: 10px; margin-top: 10px;
}
.paste-section .row input { flex: 1; }

/* ── Inputs ──────────────────────────────────────────────────────────────── */

input[type="text"], textarea {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
input[type="text"]:focus, textarea:focus {
  border-color: var(--accent);
}
textarea { line-height: 1.6; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

button { font-family: var(--font); cursor: pointer; border: none; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  font-size: 14px; font-weight: 500;
  padding: 9px 20px; border-radius: var(--radius-sm);
  transition: opacity 0.15s, transform 0.1s;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 14px; padding: 9px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border2); }

.btn-ghost {
  background: none;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 13px; padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--border2); color: var(--text); }
.btn-ghost.small { font-size: 12px; padding: 5px 10px; }

/* ── Step 2 ──────────────────────────────────────────────────────────────── */

.step2-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 1.5rem;
}
.section-pills-label, .order-label {
  font-size: 12px; font-weight: 500; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px;
}
.order-label { margin-top: 1.25rem; }

.pill-row {
  display: flex; flex-wrap: wrap; gap: 8px;
}

/* Section pills (clickable to add) */
.section-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; user-select: none;
  transition: opacity 0.1s, transform 0.1s;
  border: 1px solid;
}
.section-pill:hover { opacity: 0.85; transform: translateY(-1px); }
.section-pill:active { transform: scale(0.97); }

/* Order chips (draggable) */
.order-zone {
  min-height: 52px;
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  transition: border-color 0.15s, background 0.15s;
}
.order-zone.drag-over { border-color: var(--accent); background: var(--accent-dim); }
.order-empty { font-size: 13px; color: var(--muted); }

.order-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 20px;
  font-size: 13px; font-weight: 500;
  cursor: grab; user-select: none;
  border: 1px solid;
  transition: opacity 0.15s, box-shadow 0.1s;
}
.order-chip.dragging { opacity: 0.35; cursor: grabbing; }
.order-chip.drop-target { box-shadow: -3px 0 0 var(--accent); }

.grip { opacity: 0.4; font-size: 12px; }
.remove-btn {
  background: none; border: none; cursor: pointer;
  color: inherit; opacity: 0.5; font-size: 16px; line-height: 1;
  display: flex; align-items: center; padding: 0;
}
.remove-btn:hover { opacity: 1; }

/* Color variants */
.chip-v { background: var(--chip-v-bg); border-color: var(--chip-v-border); color: var(--chip-v-text); }
.chip-c { background: var(--chip-c-bg); border-color: var(--chip-c-border); color: var(--chip-c-text); }
.chip-b { background: var(--chip-b-bg); border-color: var(--chip-b-border); color: var(--chip-b-text); }
.chip-p { background: var(--chip-p-bg); border-color: var(--chip-p-border); color: var(--chip-p-text); }
.chip-x { background: var(--chip-x-bg); border-color: var(--chip-x-border); color: var(--chip-x-text); }

/* ── Lyrics editor ───────────────────────────────────────────────────────── */

.lyrics-editor {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.lyrics-editor-summary {
  list-style: none;
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px;
  font-size: 13px; color: var(--muted);
  cursor: pointer; user-select: none;
  transition: background 0.15s, color 0.15s;
}
.lyrics-editor-summary::-webkit-details-marker { display: none; }
.lyrics-editor-summary:hover { background: var(--surface2); color: var(--text); }
.lyrics-editor[open] .lyrics-editor-summary {
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.lyrics-panels {
  padding: 14px; display: flex; flex-direction: column; gap: 14px;
}
.lyrics-panel-header {
  display: flex; align-items: center; gap: 8px;
}
.lyrics-panel-header .muted { flex: 1; }
.section-badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 12px; border: 1px solid;
}
.section-badge[contenteditable] { cursor: text; outline: none; }
.section-badge[contenteditable]:hover { box-shadow: 0 0 0 2px var(--border2); }
.section-badge[contenteditable]:focus { box-shadow: 0 0 0 2px var(--accent); }

/* ── Edit mode ────────────────────────────────────────────────────────────── */

.edit-mode-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 10px; gap: 8px;
}
.edit-header-btns { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.slide-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); padding: 8px 0 4px;
}
.slide-label:first-child { padding-top: 0; }
.edit-items { display: flex; flex-direction: column; gap: 2px; }

.line-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px;
  background: var(--surface2); border: 1px solid transparent;
  cursor: grab; transition: border-color 0.1s;
}
.line-item:hover { border-color: var(--border2); }
.line-item.dragging { opacity: 0.35; }
.line-item.drop-target { border-color: var(--accent); }

.line-text {
  flex: 1; font-size: 13px; outline: none;
  cursor: text; min-width: 0;
}
.line-text:focus { cursor: text; }

.add-break-btn, .delete-line-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--muted); padding: 0 2px;
  transition: opacity 0.1s, color 0.1s;
  line-height: 1; display: flex; align-items: center;
}
.add-break-btn:hover { color: var(--accent); }
.break-btn-label { font-size: 11px; }
.delete-line-btn { color: var(--danger); opacity: 0.45; }
.delete-line-btn:hover { opacity: 1; }

.break-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px; margin: 4px 0;
  border: 1px dashed var(--border2); border-radius: 6px;
  cursor: grab;
}
.break-item.dragging { opacity: 0.35; }
.break-item.drop-target { border-color: var(--accent); }
.break-label { flex: 1; font-size: 11px; color: var(--muted); text-align: center; }
.remove-break-btn {
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--muted); padding: 0;
  transition: color 0.1s;
}
.remove-break-btn:hover { color: var(--danger); }

.edit-footer { padding-top: 8px; }

/* ── Actions row ─────────────────────────────────────────────────────────── */

.order-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px;
}
.slide-count { font-size: 12px; color: var(--muted); margin-left: auto; }

.generate-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.status-msg { font-size: 13px; color: var(--muted); }
.status-msg.error { color: var(--danger); }
.status-msg.success { color: var(--success); }

/* ── Song queue ──────────────────────────────────────────────────────────── */

.song-queue { display: flex; flex-direction: column; gap: 10px; margin: 1rem 0; }

.queue-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.queue-item .q-title { font-weight: 500; font-size: 14px; flex: 1; }
.queue-item .q-meta  { font-size: 12px; color: var(--muted); }
.queue-item .q-remove { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 18px; }
.queue-item .q-remove:hover { color: var(--danger); }

/* ── Modal ───────────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 380px;
}
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal input { margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
