:root {
  color-scheme: light;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --bg-gradient: radial-gradient(circle at top, #f9f6ff 0%, #eef2ff 55%, #f8fafc 100%);
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: rgba(148, 163, 184, 0.35);
  --card-shadow: 0 28px 50px -28px rgba(79, 70, 229, 0.45);
  --surface-shadow: 0 30px 80px -40px rgba(37, 99, 235, 0.35);
  --primary: #4338ca;
  --primary-accent: #7c3aed;
  --text-strong: #10163a;
  --text: #1f2937;
  --muted: #526387;
  --chip-note: rgba(59, 130, 246, 0.08);
  --chip-rest: rgba(16, 185, 129, 0.12);
  --chip-barline: rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text);
  display: flex;
  justify-content: center;
  width: 100%;
}

body.menu-open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(4px);
  pointer-events: none;
  z-index: 30;
}

input,
select,
button {
  font: inherit;
}

.app-shell {
  width: min(1180px, 100%);
  padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 5vw, 2.75rem) 4rem;
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 5vw, 3rem);
}

.site-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  margin: -0.5rem 0 0;
  z-index: 40;
  width: 100%;
  gap: 1.25rem;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: rgba(67, 56, 202, 0.92);
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.15rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-logo img {
  width: clamp(38px, 6vw, 48px);
  height: clamp(38px, 6vw, 48px);
  border-radius: 14px;
  box-shadow: 0 18px 32px -20px rgba(79, 70, 229, 0.6);
}

.site-logo-text {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.site-menu-controls {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.site-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(79, 70, 229, 0.22);
  background: rgba(79, 70, 229, 0.1);
  color: rgba(30, 64, 175, 0.92);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 16px 35px -24px rgba(30, 64, 175, 0.55);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    box-shadow 0.2s ease;
}

.site-menu-toggle:hover,
.site-menu-toggle:focus-visible {
  background: rgba(79, 70, 229, 0.16);
  border-color: rgba(79, 70, 229, 0.32);
  color: var(--primary);
  outline: none;
  box-shadow: 0 20px 40px -22px rgba(79, 70, 229, 0.55);
}

.site-menu-toggle-label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 700;
}

.site-menu-toggle-icon {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.28rem;
  width: 1.25rem;
}

.site-menu-toggle-icon span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 999px;
  background: currentColor;
  transition: transform 0.28s ease, opacity 0.28s ease;
}

.site-menu.is-open .site-menu-toggle-icon span:nth-child(1) {
  transform: translateY(0.48rem) rotate(45deg);
}

.site-menu.is-open .site-menu-toggle-icon span:nth-child(2) {
  opacity: 0;
}

.site-menu.is-open .site-menu-toggle-icon span:nth-child(3) {
  transform: translateY(-0.48rem) rotate(-45deg);
}

.site-menu-drawer {
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: min(280px, 92vw);
  padding: 1.1rem 1.25rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 30px 60px -35px rgba(15, 23, 42, 0.6);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  backdrop-filter: blur(12px);
}

.site-menu.is-open .site-menu-drawer {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.site-menu-drawer a {
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(30, 64, 175, 0.92);
  text-decoration: none;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  transition: background 0.2s ease, color 0.2s ease;
}

.site-menu-drawer a:hover,
.site-menu-drawer a:focus-visible {
  background: rgba(79, 70, 229, 0.12);
  color: var(--primary);
  outline: none;
}

.workspace-layout {
  display: flex;
  flex-direction: row;
  gap: clamp(1.5rem, 4vw, 2.75rem);
  align-items: flex-start;
  width: 100%;
}

.workspace-primary {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}

.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 3vw, 1.75rem);
}

.hero h1 {
  font-family: 'Newsreader', 'Inter', serif;
  font-size: clamp(2.8rem, 5vw, 3.6rem);
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text-strong);
}

.hero .lead {
  margin: 1rem auto 0;
  max-width: 620px;
  line-height: 1.65;
  color: var(--muted);
}

.hero-cta {
  display: flex;
  justify-content: center;
  width: 100%;
}

.hero-cta-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
  width: min(520px, 100%);
  margin: 0 auto;
}

.cta-button {
  width: 100%;
  font-size: clamp(1.05rem, 3vw, 1.28rem);
  padding: clamp(1rem, 3vw, 1.35rem) clamp(1.8rem, 6vw, 3.4rem);
  border-radius: 999px;
  box-shadow: 0 35px 70px -30px rgba(79, 70, 229, 0.55),
    0 10px 30px -20px rgba(45, 212, 191, 0.35);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.cta-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 20% 20%,
    rgba(255, 255, 255, 0.4) 0%,
    transparent 60%
  );
  pointer-events: none;
  mix-blend-mode: screen;
}

.cta-caption {
  margin: 0;
  font-size: 0.95rem;
  color: rgba(15, 23, 42, 0.7);
  line-height: 1.6;
}

.download-status {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(30, 41, 59, 0.8);
}

.download-status::before {
  content: '';
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  border: 3px solid rgba(79, 70, 229, 0.22);
  border-top-color: rgba(79, 70, 229, 0.75);
  animation: download-spin 0.9s linear infinite;
}

.download-status.is-active {
  display: inline-flex;
}

.download-status.is-success::before {
  animation: none;
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.12);
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.4);
}

@keyframes download-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.cta-button-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.cta-button-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.9rem;
  height: 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.65);
  transform-origin: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.cta-button-spinner::before {
  content: '';
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.14);
  opacity: 0.6;
}

.cta-button-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.55);
  border-top-color: #ffffff;
  border-right-color: rgba(255, 255, 255, 0.3);
  border-bottom-color: rgba(255, 255, 255, 0.3);
  border-left-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.15);
  animation: cta-spinner 0.75s linear infinite;
}

.cta-button:not(.is-loading) .cta-button-spinner {
  visibility: hidden;
}

.cta-button.is-loading .cta-button-label {
  opacity: 0;
  transform: translateY(0.35rem);
}

.cta-button.is-loading .cta-button-spinner {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  visibility: visible;
}

@keyframes cta-spinner {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.card {
  border-radius: 22px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  padding: clamp(1.35rem, 3vw, 1.9rem) clamp(1.1rem, 3.5vw, 1.85rem);
  backdrop-filter: blur(6px);
}

.score-details-section {
  width: 100%;
}

.score-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.42fr) minmax(0, 1fr);
  gap: clamp(0.9rem, 2.5vw, 1.4rem);
  align-items: stretch;
  padding: clamp(0.85rem, 2.2vw, 1.25rem) clamp(1rem, 2.6vw, 1.5rem);
}

.score-card.is-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

.sequence-section {
  width: 100%;
}

.sequence-card {
  display: flex;
  flex-direction: column;
  gap: clamp(0.9rem, 2vw, 1.2rem);
}

.sequence-card-body {
  display: flex;
  flex-direction: column;
  gap: clamp(0.75rem, 1.8vw, 1rem);
}

#sequence-display {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card .card-header {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.card .card-header.with-toggle {
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.card-header-text {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.card-header.with-toggle .card-header-text p {
  margin: 0;
  line-height: 1.45;
}

.card-header h2 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--text-strong);
}

.card-header p {
  margin: 0.4rem 0 1.5rem;
  color: var(--muted);
  line-height: 1.6;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(0.6rem, 2vw, 0.95rem);
}

.score-card.is-collapsed .field-grid {
  display: none;
}

.card-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.card-toggle:hover,
.card-toggle:focus-visible {
  background: rgba(79, 70, 229, 0.12);
  border-color: rgba(79, 70, 229, 0.35);
  outline: none;
}

.card-toggle-icon {
  width: 0.65rem;
  height: 0.65rem;
  border-bottom: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.card.is-collapsed .card-toggle-icon {
  transform: rotate(-135deg);
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-strong);
}

.clef-selector-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: clamp(0.4rem, 1.6vw, 0.75rem);
}

.clef-track-control {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.03);
}

.clef-track-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.clef-track-select {
  width: 100%;
}

input,
select {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.9);
  padding: 0.45rem 0.75rem;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.duration-row,
.entry-toolbar,
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(0.55rem, 2vw, 0.85rem);
}

.duration-row {
  margin-bottom: clamp(0.5rem, 2vw, 0.85rem);
}

.group-label {
  font-weight: 700;
  color: var(--text-strong);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-accent));
  box-shadow: 0 6px 12px -8px rgba(79, 70, 229, 0.5);
}

.group-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.note-group-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.note-toolbar .group-hint {
  line-height: 1.5;
}

.duration-button {
  font-size: 1.2rem;
}

.toggle-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  padding: 0.55rem 1rem;
  background: rgba(236, 239, 253, 0.75);
  font-weight: 600;
  color: var(--text-strong);
  cursor: pointer;
  transition: all 0.18s ease;
}

.toggle-pill.active,
.toggle-pill[aria-pressed='true'] {
  background: linear-gradient(135deg, var(--primary), var(--primary-accent));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 28px -18px rgba(79, 70, 229, 0.6);
}

.toggle-pill:focus-visible {
  outline: 3px solid rgba(129, 140, 248, 0.6);
  outline-offset: 3px;
}

.chord-tools {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.1rem 0 0;
}

.chord-tools.visible {
  display: flex;
}

.chord-summary {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px dashed rgba(59, 130, 246, 0.5);
  background: rgba(219, 234, 254, 0.55);
  color: #1d4ed8;
  font-weight: 600;
  line-height: 1.45;
}

.chord-summary.empty {
  border-color: rgba(148, 163, 184, 0.55);
  background: rgba(226, 232, 240, 0.4);
  color: rgba(71, 85, 105, 0.95);
  font-weight: 500;
}

.chord-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

button.primary.small {
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
}

button.ghost.small {
  padding: 0.45rem 1.1rem;
  font-size: 0.9rem;
}

.select-inline {
  min-width: 150px;
}

.note-button {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.note-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -14px rgba(37, 99, 235, 0.35);
}

.note-toolbar {
  width: clamp(280px, 30vw, 320px);
  flex: 0 0 clamp(280px, 30vw, 320px);
  position: sticky;
  top: clamp(1.5rem, 4vw, 2.4rem);
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: clamp(1rem, 2.5vw, 1.45rem) clamp(1rem, 2.5vw, 1.45rem);
}

.note-toolbar-header {
  padding: 0;
  align-items: center;
}

.note-toolbar-header .card-header-text p {
  margin: 0;
}

.note-toolbar-body {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2.5vw, 1.6rem);
  max-height: var(--note-toolbar-body-max, 1200px);
  overflow: hidden;
  opacity: 1;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}

.track-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.8rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.9);
}

.track-selector-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-strong);
}

.track-selector-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.track-toggle {
  border: 1px solid rgba(59, 130, 246, 0.35);
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.track-toggle.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-accent));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 20px -14px rgba(79, 70, 229, 0.6);
}

.track-toggle:focus-visible {
  outline: 2px solid rgba(79, 70, 229, 0.45);
  outline-offset: 2px;
}

.track-selector.is-multi {
  border-color: rgba(148, 163, 184, 0.5);
}

.note-toolbar.is-collapsed .note-toolbar-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.note-toolbar-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.control-stack {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.icon-button-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.note-letter-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(79, 70, 229, 0.28);
  background: rgba(79, 70, 229, 0.08);
  color: #312e81;
  font-weight: 600;
  padding: 0.55rem 0.35rem;
  min-height: 2.8rem;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: none;
  font-size: 1.35rem;
}

.icon-button .note-glyph {
  font-size: 1.6rem;
  line-height: 1;
}

.duration-button {
  background: rgba(79, 70, 229, 0.08);
}

.note-button {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.3);
  color: #1d4ed8;
}

.rest-button {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
}

.icon-button:hover {
  background: rgba(79, 70, 229, 0.16);
}

.rest-button:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.45);
  color: #047857;
}

.rest-button.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #047857;
  box-shadow: none;
}

.icon-button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-accent));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 28px -16px rgba(79, 70, 229, 0.6);
}

.note-toolbar .toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.toggle-pill.icon {
  justify-content: center;
  width: 100%;
  min-height: 2.8rem;
  font-size: 1.25rem;
}

.toggle-pill.icon span {
  line-height: 1;
}

.stacked-chord-icon {
  position: relative;
  display: inline-block;
  width: 1.4em;
  height: 1.8em;
}

.stacked-chord-icon span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.08rem;
  line-height: 1;
}

.stacked-chord-icon span:nth-child(1) {
  top: 0;
}

.stacked-chord-icon span:nth-child(2) {
  top: 0.55em;
}

.stacked-chord-icon span:nth-child(3) {
  top: 1.1em;
}

.select-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  align-items: center;
  gap: 0.15rem;
  line-height: 1;
}

.select-row select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.7);
  padding: 0.4rem 0.35rem;
  font-weight: 600;
}

.note-toolbar .note-letter-grid {
  margin-top: 0.5rem;
}

.note-button {
  font-size: 1.1rem;
}

.action-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  padding: 0.55rem 0;
}

button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.8rem;
  border-radius: 999px;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-accent));
  box-shadow: var(--surface-shadow);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button.primary:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

button.primary:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 30px 60px -36px rgba(79, 70, 229, 0.55);
}

button.ghost {
  background: rgba(15, 23, 42, 0.05);
  border-radius: 999px;
  padding: 0.5rem 1.35rem;
  font-weight: 600;
  color: var(--text-strong);
  border: 1px solid rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

button.ghost:hover {
  background: rgba(30, 64, 175, 0.08);
  transform: translateY(-1px);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sequence-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}

.sequence-chip.note {
  background: var(--chip-note);
  border-color: rgba(59, 130, 246, 0.2);
  color: #1d4ed8;
}

.sequence-chip.note.chord {
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.18), rgba(129, 140, 248, 0.15));
  border-color: rgba(59, 130, 246, 0.45);
  color: #1e3a8a;
}

.sequence-chip.rest {
  background: var(--chip-rest);
  border-color: rgba(16, 185, 129, 0.25);
  color: #047857;
}

.sequence-chip.barline {
  background: var(--chip-barline);
  border-color: rgba(71, 85, 105, 0.2);
  color: #334155;
}

.sequence-chip.empty {
  background: rgba(226, 232, 240, 0.5);
  border-color: rgba(148, 163, 184, 0.4);
  color: rgba(71, 85, 105, 0.9);
  font-weight: 500;
}

.sequence-track {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sequence-track-header {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-strong);
}

.sequence-track-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sequence-placeholder {
  padding: 0.7rem 1rem;
  border-radius: 16px;
  background: rgba(226, 232, 240, 0.45);
  color: rgba(71, 85, 105, 0.85);
  font-size: 0.9rem;
}

.preview-stage {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 1.8rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 35px 60px -40px rgba(30, 64, 175, 0.45);
  flex: 1 1 auto;
}

.stage-header {
  text-align: center;
  max-width: 540px;
  margin: 0 auto;
}

.stage-header h2 {
  margin: 0;
  font-size: 1.55rem;
  color: var(--text-strong);
}

.stage-header p {
  margin: 0.75rem 0 0;
  line-height: 1.6;
  color: var(--muted);
}

.preview-canvas {
  position: relative;
  border-radius: 22px;
  padding: clamp(0.75rem, 2.5vw, 1.35rem) clamp(1.5rem, 5vw, 2.75rem);
  background: transparent;
  overflow: hidden;
  max-height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: clamp(0.35rem, 2vw, 0.85rem) 0;
}

.preview-staff {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(2.4rem, 6vw, 3rem);
  height: clamp(2.4rem, 6vw, 3rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(79, 70, 229, 0.28);
  background: rgba(255, 255, 255, 0.88);
  color: var(--primary);
  font-size: 1.65rem;
  cursor: pointer;
  box-shadow: 0 18px 38px -26px rgba(15, 23, 42, 0.55);
  transition: all 0.2s ease;
  z-index: 2;
}

.preview-nav span {
  line-height: 1;
}

.preview-nav:hover:not(:disabled) {
  transform: translateY(-50%) scale(1.05);
  box-shadow: 0 18px 45px -22px rgba(59, 130, 246, 0.4);
}

.preview-nav:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.preview-nav.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preview-nav-prev {
  left: clamp(0.75rem, 2vw, 1.5rem);
}

.preview-nav-next {
  right: clamp(0.75rem, 2vw, 1.5rem);
}

.preview-pagination {
  margin: 0.5rem 0 0;
  text-align: center;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.82);
}

.preview-page-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.25s ease, filter 0.25s ease;
  will-change: transform;
}

.preview-page-wrapper:hover {
  transform: translateY(-6px);
  filter: drop-shadow(0 20px 35px rgba(15, 23, 42, 0.18));
}

.preview-page-scale {
  transform-origin: top center;
  transition: transform 0.2s ease;
}

.preview-page {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.preview-page svg {
  width: 100%;
  height: 100%;
  display: block;
}

.preview-page-number {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.8);
}

.preview-placeholder {
  text-align: center;
  color: rgba(71, 85, 105, 0.8);
  line-height: 1.6;
  font-weight: 500;
}

.preview-intro-hint {
  width: 100%;
  text-align: center;
  margin: -0.25rem 0 0;
  font-weight: 600;
  color: rgba(71, 85, 105, 0.85);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}


@media (max-width: 900px) {
  body {
    justify-content: stretch;
  }

  .app-shell {
    padding: clamp(2rem, 8vw, 3rem) clamp(1rem, 6vw, 2rem) 3.5rem;
  }

  .site-menu {
    flex-wrap: wrap;
    gap: 1rem;
  }

  .site-menu-controls {
    margin-left: auto;
  }

  .hero {
    text-align: center;
  }

  .hero-cta {
    width: 100%;
  }

  .hero-cta-actions {
    text-align: center;
  }

  .hero-mini-preview {
    max-width: 320px;
    margin: 0 auto;
  }

  .preview-stage {
    border-radius: 22px;
  }
}

@media (max-width: 960px) {
  .workspace-layout {
    flex-direction: column;
  }

  .workspace-primary {
    width: 100%;
  }

  .score-card {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .note-toolbar {
    position: sticky;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -24px 48px -28px rgba(15, 23, 42, 0.6);
    z-index: 15;
    padding: clamp(1rem, 4vw, 1.35rem) clamp(1rem, 4vw, 1.65rem) clamp(0.75rem, 3vw, 1.2rem);
    gap: 0.65rem;
  }

  .note-toolbar.is-collapsed {
    padding-bottom: clamp(0.5rem, 3vw, 0.8rem);
  }

  .note-toolbar-body {
    gap: clamp(0.75rem, 3vw, 1.25rem);
  }

  .note-toolbar-grid {
    gap: clamp(0.65rem, 2.5vw, 1rem);
  }

  .note-toolbar .icon-button {
    min-height: 2.4rem;
    font-size: 1.1rem;
    padding: 0.45rem 0.3rem;
  }

  .track-selector {
    flex-direction: column;
    align-items: flex-start;
  }

  .track-selector-buttons {
    width: 100%;
  }

  .track-toggle {
    flex: 1 1 auto;
    text-align: center;
  }

  .note-toolbar .toggle-pill.icon {
    min-height: 2.4rem;
    font-size: 1.1rem;
  }

  .note-letter-grid {
    gap: 0.4rem;
  }

  .preview-canvas {
    max-height: none;
    padding: clamp(0.85rem, 4vw, 1.25rem) clamp(1.75rem, 7vw, 2.5rem);
  }
}

@media (max-width: 640px) {
  body {
    display: block;
  }

  .hero h1 {
    font-size: clamp(2.2rem, 9vw, 2.7rem);
  }

  .hero-cta {
    width: 100%;
  }

  .preview-stage {
    padding: clamp(1.25rem, 6vw, 1.75rem);
  }

  .preview-nav {
    width: clamp(2rem, 10vw, 2.5rem);
    height: clamp(2rem, 10vw, 2.5rem);
    font-size: 1.4rem;
  }

  .preview-nav-prev {
    left: clamp(0.5rem, 4vw, 1rem);
  }

  .preview-nav-next {
    right: clamp(0.5rem, 4vw, 1rem);
  }

  .note-toolbar {
    border-radius: 20px 20px 0 0;
  }

  .note-letter-grid {
    grid-template-columns: repeat(auto-fit, minmax(2.3rem, 1fr));
  }

  .note-toolbar .icon-button {
    font-size: 1rem;
    min-height: 2.2rem;
  }

  .note-toolbar .toggle-pill.icon {
    font-size: 1rem;
  }
}
