/* Scale Randomizer. Colours come from the shared tokens in core/site.css;
   these aliases just keep the names this stylesheet was written with. */
.randomizer {
  --card: var(--surface);
  --muted: var(--text-dim);
  --done: var(--success);
  --problem: var(--danger);

  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.randomizer h1 {
  font-size: 1.6rem;
  margin: 0;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

#filter {
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  cursor: pointer;
}

#results {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  /* Every card matches the tallest one if text wraps past the minimum */
  grid-auto-rows: 1fr;
  gap: 12px;
}

.entry {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  /* Room for all four lines plus one wrapped line on narrow screens */
  min-height: 8.25rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  column-gap: 16px;
  row-gap: 12px;
  align-items: center;
}

.entry.expanded {
  border-color: var(--accent);
}

.num {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--muted);
}

.info {
  display: flex;
  flex-direction: column;
}

.key {
  font-size: 1.25rem;
  font-weight: 600;
}

.detail {
  color: var(--muted);
  font-size: 0.95rem;
}

#shuffle {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

#shuffle:hover { filter: brightness(1.08); }

.progress {
  margin: 0 0 24px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

.progress-track {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--done);
  border-radius: 999px;
  transition: width 0.3s ease;
}

#reset {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}

#reset:hover { color: var(--text); }

.entry.done {
  border-color: var(--done);
}

.entry.done.expanded {
  border-color: var(--accent);
}

.done-toggle {
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.done-toggle:hover { border-color: var(--muted); }

.entry.done .done-toggle {
  color: var(--on-accent);
  background: var(--done);
  border-color: var(--done);
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.problem-toggle {
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.problem-toggle:hover { border-color: var(--problem); }

.entry.problem .problem-toggle {
  color: var(--on-accent);
  background: var(--problem);
  border-color: var(--problem);
}

.empty-message {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
}

.sheet-toggle {
  grid-column: 1 / -1;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.sheet-toggle:hover { border-color: var(--accent); }

.entry.expanded .sheet-toggle {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

/* Sheet music modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  overflow-y: auto;
  padding: 20px;
}

.sheet-section + .sheet-section {
  margin-top: 28px;
}

.sheet-section h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--muted);
}

.osmd-container {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 8px;
  min-height: 120px;
  overflow-x: auto;
  color: #1d1d1f;
  font-size: 0.9rem;
}
