:root {
  --bg: #0f1115;
  --bg-soft: #15181f;
  --panel: #1a1e27;
  --panel-2: #212631;
  --border: #2a2f3c;
  --border-soft: #232733;
  --text: #e6e9ef;
  --text-dim: #9aa3b2;
  --text-faint: #5e6675;
  --accent: #7c8cff;
  --accent-soft: #7c8cff22;
  --accent-2: #4fd1c5;
  --danger: #ff6b6b;
  --warn: #ffb454;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 8px 28px rgba(0,0,0,.35);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: linear-gradient(180deg, #161922, #12141b);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: #fdf8e7;
  color: #b8862b;
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(184,134,43,.28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-faint); }

.title-field { flex: 1; display: flex; justify-content: center; }
.title-field input {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  width: 360px;
  transition: background .15s, border-color .15s;
}
.title-field input:hover { background: var(--panel); }
.title-field input:focus { outline: none; background: var(--panel); border-color: var(--accent); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.tbtn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.tbtn:hover { background: var(--panel-2); border-color: #363c4d; }
.tbtn:active { transform: translateY(1px); }
.tbtn.sm { padding: 6px 10px; font-size: 12px; }
.tbtn svg { opacity: .9; }
.tbtn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #c8d0ff;
}
.divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* ---------- Workspace ---------- */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 232px 1fr 268px;
  min-height: 0;
}

/* ---------- Palette ---------- */
.palette {
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 12px;
}
.palette-section { margin-bottom: 18px; }
.palette-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 8px;
  padding-left: 2px;
}
.palette-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.palette-col { display: flex; flex-direction: column; gap: 6px; }

.pbtn {
  display: grid; place-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  height: 38px;
  transition: background .12s, border-color .12s, transform .05s;
  user-select: none;
}
.pbtn.grid { padding: 0; }
.pbtn .dur-ic { width: 22px; height: 22px; color: var(--text); }
.pbtn.active .dur-ic { color: #c8d0ff; }
.pbtn.struct {
  height: 30px; font-size: 12px; width: 100%;
  display: flex; align-items: center; justify-content: flex-start;
  padding: 0 10px; gap: 9px; text-align: left;
}
.pbtn.struct .struct-ic { display: grid; place-items: center; width: 16px; height: 16px; color: var(--text-dim); flex-shrink: 0; }
.pbtn.struct.active .struct-ic, .pbtn.struct:hover .struct-ic { color: var(--accent); }
.pbtn.struct .struct-label { flex: 1; }
.pbtn.wide { height: 32px; font-size: 12px; width: 100%; justify-content: flex-start; padding: 0 10px; gap: 8px; }
.pbtn:hover { background: var(--panel-2); border-color: #363c4d; }
.pbtn:active { transform: translateY(1px); }
.pbtn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #c8d0ff;
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.pbtn .sym { font-size: 17px; font-family: 'Times New Roman', serif; line-height: 1; }
.pbtn .kbd { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--text-faint); }

/* Voice picker — the swatch carries the subtle tint each voice is engraved in
   under the per-voice beaming view, so the palette, status bar and score agree
   on which line is which. (In the default "together" view the notes are black;
   the swatch is still the voice's identity colour.) */
.pbtn.voice {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 4px; height: 38px;
  min-width: 0; padding: 0;
}
.voice-dot {
  width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset;
  flex-shrink: 0;
  display: inline-block;
}
.pbtn.voice .voice-dot { width: 8px; height: 8px; }
.palette-hint {
  margin-top: 7px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--text-faint);
  padding-left: 2px;
}
.palette-hint kbd {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
}

/* ---------- Canvas ---------- */
.canvas-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;       /* grid item: allow it to shrink/scroll, not grow with content */
  background:
    radial-gradient(circle at 30% 0%, #181c26, var(--bg) 60%);
}
.canvas-scroll {
  flex: 1;
  min-height: 0;       /* flex item: allow scrolling instead of growing past the viewport */
  overflow: auto;
  padding: 36px 24px 60px;
  /* Block (not flex) so #scoreHost sizes to its SVG content height and the
     container actually scrolls vertically when the score grows tall. */
  text-align: center;
}
#scoreHost {
  background: #fdfdfb;
  border-radius: 6px;
  box-shadow: var(--shadow);
  /* Centered horizontally via auto margins (works on a block container too). */
  margin: 0 auto;
  /* Inline-block so it shrinks to the SVG's width while still being centerable,
     and sizes to the SVG's height so the scroll area grows with the score. */
  display: inline-block;
  text-align: left;
  /* Page-like width when there's room, but never wider than the space available
     — otherwise a narrow window scrolls sideways with nothing out there. */
  min-width: min(820px, 100%);
}
/* `margin: 0 auto` keeps the staves centred when the score is narrower than the
   page (the page has a min-width, the score is only as wide as its bars). */
#scoreHost svg { display: block; margin: 0 auto; border-radius: 6px; user-select: none; -webkit-user-select: none; }
#scoreHost svg text { user-select: none; -webkit-user-select: none; pointer-events: none; }
/* The cursor is managed dynamically in JS (grab over noteheads, copy over open
   staff space), so the note groups themselves must not override it. */
#scoreHost svg g.vf-stavenote { pointer-events: bounding-box; cursor: inherit; }
body.dragging, body.dragging #scoreHost svg { cursor: grabbing !important; user-select: none !important; }
body.dragging * { user-select: none !important; }

.statusbar {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.status-item { font-family: var(--mono); font-size: 11.5px; }
#statusVoice { display: inline-flex; align-items: center; gap: 6px; }
.status-item b { color: var(--text); font-weight: 600; }
.status-spacer { flex: 1; }

/* ---------- Inspector ---------- */
.inspector {
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px 14px 30px;
}
.inspector-section { margin-bottom: 22px; }
.inspector-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 10px;
}
.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 13px;
  color: var(--text-dim);
}
.field span { flex-shrink: 0; }
.field select, .field input {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 12.5px;
  font-family: inherit;
  width: 130px;
}
.field input { width: 90px; }
.field select:focus, .field input:focus { outline: none; border-color: var(--accent); }

.note-info {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
}
.note-info-empty { color: var(--text-faint); font-size: 12px; line-height: 1.5; }
.note-info-row { display: flex; justify-content: space-between; padding: 4px 0; }
.note-info-row span:first-child { color: var(--text-faint); }
.note-info-row span:last-child { color: var(--text); font-family: var(--mono); font-size: 12px; }
.note-info-actions { display: flex; gap: 6px; margin-top: 10px; }
.note-info-actions .tbtn { flex: 1; justify-content: center; }

.history-row { display: flex; gap: 8px; }
.history-row .tbtn { flex: 1; justify-content: center; }

/* Repeats & Jumps: scope line above the fields, resolved play order below. */
.repeat-scope {
  color: var(--text-faint);
  font-size: 11.5px;
  margin-bottom: 10px;
}
.repeat-order {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--bg-inset, rgba(255, 255, 255, 0.03));
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.6;
  word-break: break-word;
}
.field select:disabled, .field input:disabled { opacity: 0.45; cursor: not-allowed; }

.shortcuts { font-size: 12px; line-height: 1.9; }
.shortcuts .row { display: flex; justify-content: space-between; gap: 8px; }
.shortcuts .row span:first-child { color: var(--text-dim); }
.shortcuts kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--text);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2c3140; border-radius: 6px; border: 2px solid var(--bg-soft); }
::-webkit-scrollbar-thumb:hover { background: #3a4154; }

/* playhead pulse */
@keyframes pulse { 0%,100% { opacity: .9; } 50% { opacity: .5; } }
/* ---------- Score Setup modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 8, 12, 0.62);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 28px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: min(1120px, 96vw);
  height: min(720px, 92vh);
  display: flex; flex-direction: column;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #171b24, #141821);
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-tabs { display: flex; gap: 4px; margin-left: 8px; }
.modal-tab {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font: inherit; font-weight: 600;
  padding: 6px 12px; border-radius: 7px;
}
.modal-tab:hover { color: var(--text); background: var(--panel-2); }
.modal-tab.active { color: var(--text); background: var(--accent-soft); }
.modal-close {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-size: 16px; line-height: 1;
  width: 30px; height: 30px; border-radius: 7px;
}
.modal-close:hover { color: var(--text); background: var(--panel-2); }
.modal-body { flex: 1; min-height: 0; padding: 18px; overflow: hidden; }
.setup-panel { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.setup-panel[hidden] { display: none; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}

/* three-column picker */
.picker {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 210px 1fr 44px 1fr;
  gap: 20px;
}
.picker-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.picker-label {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text-dim);
  margin-bottom: 10px;
}
.picker-list {
  flex: 1; min-height: 0; overflow-y: auto;
  border-top: 1px solid var(--border-soft);
}
.picker-item {
  padding: 11px 12px; cursor: pointer;
  font-size: 14px; font-weight: 600; color: var(--text);
  border-bottom: 1px solid var(--border-soft);
  user-select: none;
  display: flex; align-items: center; gap: 8px;
}
.picker-item:hover { background: var(--panel); }
.picker-item.selected { background: var(--accent); color: #fff; }
.picker-item .pi-sub { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--text-faint); }
.picker-item.selected .pi-sub { color: rgba(255,255,255,.7); }
.picker-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px; margin-bottom: 10px;
  height: 40px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text-faint);
}
.picker-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 14px;
}
.picker-search:focus-within { border-color: var(--accent); }
.picker-mid { display: flex; align-items: center; justify-content: center; }
.picker-add {
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 18px; cursor: pointer;
}
.picker-add:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.picker-scorehead { margin-bottom: 10px; }
.picker-scoretools { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.picker-scoretools select {
  flex: 1; height: 36px; padding: 0 10px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit; font-size: 13px;
}
.picker-trash {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer;
  display: grid; place-items: center;
}
.picker-trash:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.picker-score { position: relative; }
.picker-yourscore { position: relative; }
.picker-yourscore.empty {
  display: grid; place-items: center; text-align: center;
  color: var(--text-faint); font-size: 14px; padding: 24px;
}
.picker-reorder {
  position: absolute; right: -34px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 10px;
}
.picker-reorder button {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; font-size: 14px;
}
.picker-reorder button:hover { background: var(--panel); color: var(--text); }
.picker-reorder button:disabled { opacity: .35; cursor: default; }
.pi-active {
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--accent-2);
  border: 1px solid var(--accent-2); border-radius: 5px;
  padding: 1px 5px; margin-left: auto;
}
.picker-item.selected .pi-active { color: #fff; border-color: rgba(255,255,255,.6); }
.picker-note {
  margin-top: 14px; font-size: 12.5px; line-height: 1.5;
  color: var(--text-dim);
}
.layout-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 320px)); gap: 16px 24px; max-width: 700px; }

/* ── Mixer ───────────────────────────────────────────────────────────────── */
.mixer-modal { width: min(1120px, 96vw); height: auto; max-height: 92vh; }
.mixer-head-note { color: var(--text-faint); font-size: 11.5px; margin-left: auto; margin-right: 8px; }
.mixer-body { display: flex; gap: 14px; align-items: stretch; overflow: hidden; padding: 18px; }
.mixer-strips {
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 6px;
  flex: 1 1 auto;
}
.mixer-master { flex: 0 0 auto; border-left: 1px solid var(--border); padding-left: 14px; }
.mixer-empty { color: var(--text-faint); font-size: 12.5px; align-self: center; padding: 40px 8px; }

.mix-strip {
  flex: 0 0 118px;
  max-width: 118px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 12px 10px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: opacity .12s, border-color .12s;
}
.mix-strip.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.mix-strip.master { background: var(--panel-2); }
.mix-strip.silenced { opacity: 0.45; }

.mix-name {
  width: 100%; text-align: center;
  font-size: 11.5px; font-weight: 600; line-height: 1.3;
  min-height: 30px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border-radius: 5px; padding: 2px 4px;
}
.mix-strip:not(.master) .mix-name:hover { background: var(--panel-2); color: var(--accent); }
.mix-sub { color: var(--text-faint); font-size: 10.5px; text-align: center; }

.mix-sound {
  width: 100%; max-width: 100%; min-width: 0;
  font: inherit; font-size: 10.5px;
  padding: 4px 22px 4px 6px;
  text-overflow: ellipsis;
  color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 5px;
}

.mix-knobs { display: flex; gap: 8px; justify-content: center; }
.knob { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.knob-dial { width: 38px; height: 38px; cursor: ns-resize; touch-action: none; }
.knob-track { fill: none; stroke: var(--border); stroke-width: 4; stroke-linecap: round; }
.knob-fill { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.knob-pointer { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.knob-read { font-family: var(--mono); font-size: 9.5px; color: var(--text-dim); }
.knob-label { font-size: 9.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }

.mix-fader { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mix-range {
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 26px; height: 130px;
  accent-color: var(--accent);
  cursor: ns-resize;
}
.mix-read { font-family: var(--mono); font-size: 10.5px; color: var(--text-dim); }

.mix-btns { display: flex; gap: 6px; }
.mix-btn {
  width: 28px; height: 24px;
  font: inherit; font-size: 11px; font-weight: 700;
  color: var(--text-dim); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 5px;
  cursor: pointer;
}
.mix-btn:hover { color: var(--text); border-color: var(--text-faint); }
.mix-btn.on.mute { color: #12151c; background: var(--danger); border-color: var(--danger); }
.mix-btn.on.solo { color: #12151c; background: var(--warn); border-color: var(--warn); }

/* ---------- Account menu (top bar) ---------- */
.account { position: relative; }
.account-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 140px; padding: 5px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  z-index: 40;
}
.account-menu-item {
  display: block; width: 100%;
  padding: 7px 10px; text-align: left;
  font: inherit; font-size: 13px; color: var(--text);
  background: none; border: 0; border-radius: 5px; cursor: pointer;
}
.account-menu-item:hover { background: var(--panel-2); }

/* ---------- Auth pages (sign in / register) ---------- */
body.auth-page { overflow: auto; display: grid; place-items: center; padding: 32px 16px; }
.auth-shell { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 22px; align-items: center; }
.auth-brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.auth-card {
  width: 100%; padding: 6px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.auth-tabs { display: flex; gap: 4px; padding: 4px; }
.auth-tab {
  flex: 1; padding: 9px 10px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-dim);
  background: none; border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { color: var(--text); background: var(--panel-2); }
.auth-panel { display: none; flex-direction: column; gap: 13px; padding: 16px 18px 20px; }
.auth-panel.active { display: flex; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field > span { font-size: 11.5px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.auth-input {
  width: 100%; padding: 9px 11px;
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.auth-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.auth-help { font-size: 11.5px; font-style: normal; color: var(--text-faint); line-height: 1.5; }
.auth-help ul { margin: 3px 0 0 14px; }
.auth-field-error, .auth-error { font-size: 12px; font-style: normal; color: var(--danger); line-height: 1.5; }
.auth-error { padding: 9px 11px; background: #ff6b6b16; border: 1px solid #ff6b6b44; border-radius: var(--radius-sm); }
.auth-submit {
  margin-top: 4px; padding: 10px 14px;
  font: inherit; font-size: 14px; font-weight: 600; color: #12151c;
  background: var(--accent); border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.auth-submit:hover { filter: brightness(1.08); }
.auth-submit-inline { display: inline-block; text-decoration: none; }
.auth-note { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; }
.auth-note a, .auth-link {
  font: inherit; font-size: inherit; color: var(--accent);
  background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none;
}
.auth-note a:hover, .auth-link:hover { text-decoration: underline; }

/* ---------- Saved scores modal ---------- */
.scores-modal { width: min(620px, 94vw); height: auto; max-height: 92vh; }
.scores-modal .modal-body { overflow-y: auto; }
.scores-body { display: flex; flex-direction: column; gap: 14px; }
.scores-list { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.score-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--bg-soft); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  cursor: pointer;
}
.score-row:hover { border-color: var(--text-faint); }
.score-row.current { border-color: var(--accent); background: var(--accent-soft); }
.score-row-main { flex: 1; min-width: 0; }
.score-row-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-row-meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
.score-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.score-row-btn {
  padding: 5px 9px;
  font: inherit; font-size: 12px; color: var(--text-dim);
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 5px; cursor: pointer;
}
.score-row-btn:hover { color: var(--text); border-color: var(--text-faint); }
.score-row-btn.danger:hover { color: var(--danger); border-color: var(--danger); }
.scores-empty { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 8px 2px 4px; }
.scores-empty h3 { font-size: 16px; font-weight: 600; }
.scores-empty p { font-size: 13px; color: var(--text-dim); line-height: 1.65; }
.tbtn.primary { color: #12151c; background: var(--accent); border-color: var(--accent); }
.tbtn.primary:hover { filter: brightness(1.08); }
.score-row-btn.danger.armed,
.score-row-btn.danger.armed:hover {
  /* Must out-specify .score-row-btn.danger:hover, which would otherwise paint
     the label the same red as this background while the cursor is still on it. */
  color: #12151c; background: var(--danger); border-color: var(--danger);
}
