/* Archon Live website. Colours come from the app icon (Support/Brand.swift):
   dark slate ink, its steel-blue glow, accent blue, and orange for "changed". */
:root {
  --ink: #161b23;
  --ink-glow: #2e4567;
  --accent: #4a74b0;
  --accent-strong: #3d6299;
  --accent-soft: #e6eef8;
  --orange: #ef8f3a;
  --danger: #c2413b;
  --danger-soft: #fbeaea;
  --success: #2f8a57;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1b222d;
  --muted: #5c6677;
  --border: #dce2ea;
  --chord: #3d6299;
  --shadow: 0 1px 2px rgba(22, 27, 35, .06), 0 4px 16px rgba(22, 27, 35, .06);
  --shadow-lg: 0 12px 40px rgba(22, 27, 35, .22);

  --radius: 10px;
  --radius-sm: 7px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --topbar-h: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-soft: #1f2e44;
    --danger-soft: #3a1f1f;
    --bg: #0f1319;
    --surface: #18202a;
    --surface-2: #212a36;
    --text: #e6ebf2;
    --muted: #9aa5b5;
    --border: #2b3542;
    --chord: #8fb3e6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent-soft: #1f2e44;
  --danger-soft: #3a1f1f;
  --bg: #0f1319;
  --surface: #18202a;
  --surface-2: #212a36;
  --text: #e6ebf2;
  --muted: #9aa5b5;
  --border: #2b3542;
  --chord: #8fb3e6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Icons ─────────────────────────────────────────────────────────────── */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 22px; height: 22px; }

/* ── Top bar ───────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: linear-gradient(90deg, var(--ink), #1d2633 60%, var(--ink-glow));
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 7px; }
.nav { display: flex; gap: 2px; margin-left: 12px; }
.nav a {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 8px;
  color: rgba(255, 255, 255, .78); font-weight: 600; font-size: .92rem;
}
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255, 255, 255, .14); }
.topbar-spacer { flex: 1; }
.menu-button {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 4px 10px 4px 4px;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .1); color: #fff;
  font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer;
}
.menu-button:hover { background: rgba(255, 255, 255, .16); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem;
}
.menu-team { max-width: 180px; }
.dropdown {
  position: absolute; z-index: 60;
  min-width: 240px; max-width: calc(100vw - 24px);
  padding: 6px; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.dropdown .dd-label { padding: 8px 10px 4px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dropdown button, .dropdown a {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 40px; padding: 8px 10px;
  border: 0; border-radius: var(--radius-sm); background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.dropdown button:hover, .dropdown a:hover { background: var(--surface-2); text-decoration: none; }
.dropdown .dd-check { margin-left: auto; color: var(--accent); }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.mobile-nav { display: none; }

@media (max-width: 760px) {
  .nav { display: none; }
  .brand span { display: none; }
  .menu-team { max-width: 110px; }
  .mobile-nav {
    display: flex; position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .mobile-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 4px; border-radius: 8px;
    color: var(--muted); font-size: .72rem; font-weight: 600;
  }
  .mobile-nav a.active { color: var(--accent); }
  .mobile-nav a:hover { text-decoration: none; }
  body.has-mobile-nav { padding-bottom: 72px; }
}

/* ── Layout ────────────────────────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
.container-narrow { max-width: 720px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { flex: 1; min-width: 200px; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-head h2 { flex: 1; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .9rem; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #a63631; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: .84rem; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-block { width: 100%; }
@media (max-width: 560px) {
  .btn-collapse .btn-label { display: none; }
  .btn-collapse.btn { padding: 0; width: 40px; }
}

/* ── Forms ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label, .field-label { font-weight: 600; font-size: .86rem; }
.field .hint { font-size: .8rem; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 40px; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.45; }
.input:focus, .btn:focus-visible, select:focus, textarea:focus, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.input-mono { font-family: var(--mono); font-size: 14px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 12px; }
.check { display: flex; align-items: center; gap: 9px; min-height: 36px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .input { padding-left: 36px; }
.error-text { color: var(--danger); font-size: .88rem; min-height: 1.2em; }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-2); }
.segmented button {
  min-height: 34px; padding: 5px 12px; border: 0; border-radius: 7px;
  background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Stepper (− value +) */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.stepper button { width: 36px; height: 36px; border: 0; background: none; color: var(--text); cursor: pointer; display: grid; place-items: center; border-radius: 6px; }
.stepper button:hover { background: var(--surface-2); }
.stepper output { min-width: 54px; text-align: center; font-weight: 700; font-size: .9rem; }
.stepper-label { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ── Lists ─────────────────────────────────────────────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; min-height: 56px;
  border-top: 1px solid var(--border);
}
.list-row:first-child { border-top: 0; }
a.list-row { color: inherit; }
a.list-row:hover, .list-row.clickable:hover { background: var(--surface-2); text-decoration: none; cursor: pointer; }
.list-title { font-weight: 600; }
.list-sub { color: var(--muted); font-size: .84rem; }
.list-actions { display: flex; gap: 4px; flex: none; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; margin-bottom: 8px; opacity: .6; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 30px; padding: 3px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-size: .74rem; font-weight: 700;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-orange { background: rgba(239, 143, 58, .16); color: #b8621a; }
.key-badge {
  display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 6px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: .8rem;
}
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button {
  padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }

/* ── Dialogs & toasts ──────────────────────────────────────────────────── */
dialog.modal {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 0; border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal-wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(10, 14, 20, .55); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 8px 18px 4px; overflow-y: auto; max-height: calc(100dvh - 170px); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px 16px; flex-wrap: wrap; }
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 16px; border-radius: 10px; max-width: calc(100vw - 32px);
  background: #2b3748; color: #fff; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg);
  animation: toast-in .18s ease-out;
}
.toast-error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 760px) { .toasts { bottom: 88px; } }

/* ── Auth pages ────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(35deg, var(--ink) 30%, var(--ink-glow));
}
.auth-card { width: min(420px, 100%); padding: 28px 24px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; text-align: center; }
.auth-brand img { width: 64px; height: 64px; border-radius: 15px; }
.auth-brand h1 { font-size: 1.35rem; }
.auth-foot { margin-top: 16px; text-align: center; font-size: .9rem; color: var(--muted); }

/* ── Song rendering (chordpro.js) ──────────────────────────────────────── */
.song-sheet { --song-size: 17px; font-size: var(--song-size); }
.cp-block { margin: 0 0 1.05em; break-inside: avoid; }
.cp-chorus { padding-left: 1.1em; border-left: 3px solid var(--accent-soft); }
.cp-label {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: .2em; font-size: .72em; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
}
.cp-tx { padding: 0 6px; border-radius: 5px; background: rgba(239, 143, 58, .18); color: #b8621a; font-size: .95em; }
.cp-line { display: flex; flex-wrap: wrap; align-items: flex-end; min-height: 1.4em; }
.cp-pair { display: inline-flex; flex-direction: column; white-space: pre; }
.cp-ch { min-height: 1.25em; padding-right: .35em; color: var(--chord); font-weight: 700; font-size: .88em; line-height: 1.25; }
.cp-ly { line-height: 1.35; }
.cp-lyrics-only .cp-ch { display: none; }
.cp-chords-only .cp-ly { display: none; }
.cp-instr-line { color: var(--muted); font-style: italic; }
.song-sheet.no-chords .cp-ch { display: none; }
.song-sheet.no-chords .cp-chords-only { display: none; }
.cp-ch[data-chord] { cursor: pointer; }

/* ── Chord diagrams ────────────────────────────────────────────────────── */
.chord-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.chord-card { display: flex; flex-direction: column; align-items: center; padding: 8px 6px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.chord-card .chord-name { font-weight: 800; font-size: .9rem; margin-bottom: 2px; }
.chord-svg { width: 76px; height: 92px; color: var(--text); }
.chord-svg.large { width: 120px; height: 146px; }

/* ── Misc ──────────────────────────────────────────────────────────────── */
.drag-handle { cursor: grab; color: var(--muted); touch-action: none; display: grid; place-items: center; width: 32px; height: 40px; }
.list-row.dragging { opacity: .5; }
.list-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.list-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.changed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); display: inline-block; }
.kbd { display: inline-block; padding: 1px 7px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; font-family: var(--mono); font-size: .8rem; background: var(--surface-2); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.copy-field { display: flex; gap: 6px; }
.copy-field .input { font-family: var(--mono); font-size: 13px; }
