:root {
  color-scheme: light;
  --bg: #f6f4f1;
  --surface: #ffffff;
  --surface-soft: #f0eeea;
  --text: #181716;
  --muted: #6f6a63;
  --line: #d8d3cc;
  --strong-line: #201f1d;
  --open-fret-bg: #ebe7df;
  --accent: #d93025;
  --accent-soft: #ffe7e3;
  --marker: #22201e;
  --marker-text: #ffffff;
  --root: #d93025;
  --shadow: 0 18px 50px rgba(24, 23, 22, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151515;
  --surface: #202020;
  --surface-soft: #2a2927;
  --text: #f5f2ec;
  --muted: #b8b0a6;
  --line: #44413d;
  --strong-line: #eee8dc;
  --open-fret-bg: #302f2d;
  --accent: #ff5a4f;
  --accent-soft: rgba(255, 90, 79, 0.16);
  --marker: #f5f2ec;
  --marker-text: #171615;
  --root: #ff5a4f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: var(--text);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border: 3px solid var(--strong-line);
  border-radius: 50%;
  box-shadow: inset 0 0 0 8px var(--accent);
  flex: 0 0 auto;
}

.brand h1,
.workspace-toolbar h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand h1 {
  font-size: clamp(1.35rem, 2.8vw, 2.1rem);
}

.brand p,
.workspace-toolbar p,
.tone-detail,
.sequence {
  color: var(--muted);
}

.brand p {
  margin: 6px 0 0;
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.account-button:hover,
.account-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.plan-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.plan-switch > span {
  padding: 0 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.plan-switch button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.plan-switch button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(24, 23, 22, 0.1);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.install-button {
  display: none;
}

.install-button.is-visible {
  display: inline-grid;
}

.app-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: clamp(14px, 2.2vw, 28px);
  padding: clamp(14px, 3vw, 34px);
}

.control-panel,
.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.control-panel {
  align-self: start;
  padding: 16px;
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.category-tabs button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.category-tabs button:hover,
.category-tabs button:focus-visible,
.category-tabs button.is-active {
  border-color: var(--accent);
  color: var(--text);
  outline: none;
}

.category-tabs button.is-active {
  background: var(--accent-soft);
}

.category-tabs button.is-locked,
.toggle.is-locked {
  border-style: dashed;
}

.pro-badge {
  display: inline-grid;
  place-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.pro-badge[hidden] {
  display: none;
}

.field-group,
.segmented-field {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.field-group label,
.segmented-field legend {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 12px;
}

select:focus-visible,
.toggle input:focus-visible + span {
  border-color: var(--accent);
  outline: none;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.segmented-field {
  border: 0;
  padding: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(24, 23, 22, 0.1);
}

.toggle-list {
  display: grid;
  gap: 8px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.toggle input {
  accent-color: var(--accent);
}

.toggle .pro-badge {
  margin-left: auto;
}

.fingering-guide {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.fingering-guide[hidden] {
  display: none;
}

.fingering-guide h3,
.fingering-guide p {
  margin: 0;
}

.fingering-guide h3 {
  font-size: 0.88rem;
}

.fingering-unavailable {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

.fingering-guide p {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.fingering-guide-content {
  display: grid;
  grid-template-columns: minmax(82px, 0.8fr) minmax(112px, 1.2fr);
  align-items: center;
  gap: 10px;
}

.fingering-hand {
  display: block;
  width: 100%;
  max-height: 128px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

.fingering-guide-legend {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fingering-guide-legend li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
}

.fingering-guide-legend strong {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.72rem;
}

.favorites-panel {
  display: grid;
  gap: 9px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.favorites-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.favorites-heading h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.save-favorite-button,
.export-all-favorites-button,
.open-account-favorites-button {
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
}

.open-account-favorites-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.favorites-status,
.favorites-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.favorites-status:empty {
  display: none;
}

.favorites-empty[hidden] {
  display: none;
}

.favorites-list {
  display: grid;
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.favorites-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 30px;
  gap: 5px;
}

.favorite-load-button,
.favorite-pdf-button,
.favorite-delete-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.favorite-load-button {
  overflow: hidden;
  padding: 0 9px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-delete-button {
  padding: 0;
  color: var(--muted);
  font-size: 1rem;
}

.favorite-pdf-button {
  padding: 0 9px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.favorite-pdf-button.is-locked,
.favorite-load-button.is-locked,
.favorite-delete-button.is-locked,
.save-favorite-button.is-locked,
.export-all-favorites-button.is-locked {
  border-style: dashed;
  color: var(--muted);
}

.export-all-favorites-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.save-favorite-button.is-locked,
.export-all-favorites-button.is-locked {
  border-color: var(--accent);
  color: #ffffff;
}

.favorite-load-button:hover,
.favorite-load-button:focus-visible,
.favorite-pdf-button:hover,
.favorite-pdf-button:focus-visible,
.favorite-delete-button:hover,
.favorite-delete-button:focus-visible,
.save-favorite-button:hover,
.save-favorite-button:focus-visible,
.export-all-favorites-button:hover,
.export-all-favorites-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.save-favorite-button:hover,
.save-favorite-button:focus-visible,
.export-all-favorites-button:hover,
.export-all-favorites-button:focus-visible {
  border-color: #b3261e;
  background: #b3261e;
  color: #ffffff;
}

.open-account-favorites-button:hover,
.open-account-favorites-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.pdf-export-stage {
  position: fixed;
  top: 0;
  left: -12000px;
  z-index: -1;
  display: grid;
  gap: 20px;
  width: 1120px;
  pointer-events: none;
  color-scheme: light;
  --surface: #ffffff;
  --surface-soft: #f5f3ef;
  --text: #181716;
  --muted: #5f5a54;
  --line: #cfc9c1;
  --strong-line: #201f1d;
  --open-fret-bg: #ebe7df;
  --root: #d93025;
}

.pdf-export-card {
  overflow: hidden;
  width: 1120px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #181716;
}

.pdf-export-card h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.pdf-export-brand {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pdf-export-details,
.pdf-export-summary {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.pdf-export-legend {
  justify-content: flex-start;
  max-width: none;
  margin: 12px 0;
}

.pdf-export-stage .fretboard-shell {
  padding: 0;
}

.pdf-export-stage .fretboard-scroll {
  overflow: visible;
}

.pdf-export-stage .string-label {
  position: static;
}

.pdf-export-footer {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.upsell-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 14px;
  width: min(440px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(24, 23, 22, 0.22);
}

.upsell-panel[hidden] {
  display: none;
}

.auth-panel {
  position: fixed;
  top: 78px;
  right: 18px;
  z-index: 25;
  display: grid;
  gap: 14px;
  width: min(520px, calc(100vw - 36px));
  max-height: calc(100dvh - 96px);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel.is-account {
  width: min(560px, calc(100vw - 36px));
}

.auth-panel[hidden],
.auth-panel [hidden] {
  display: none;
}

.auth-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-heading h2,
.auth-panel p {
  margin: 0;
}

.auth-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.15rem;
}

.auth-form,
.auth-account,
#authSignedOut {
  display: grid;
  gap: 10px;
}

#authSignedOut {
  gap: 14px;
}

.auth-account {
  gap: 16px;
}

.auth-primary-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

#authSignedOut[hidden],
#authSignedIn[hidden],
.auth-google-button[hidden],
.auth-divider[hidden],
.auth-primary-form[hidden],
.auth-password-details[hidden],
.auth-password-form button[hidden] {
  display: none;
}

.auth-form label,
.auth-password-details summary {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.auth-help {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.auth-form input {
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.auth-form button,
.auth-google-button {
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.auth-form button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.auth-google-button {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(24, 23, 22, 0.08);
}

.auth-google-button:hover,
.auth-google-button:focus-visible {
  border-color: var(--strong-line);
  background: var(--surface-soft);
  outline: none;
}

.auth-google-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.auth-google-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.auth-primary-form button,
.auth-password-form button,
.account-favorite-actions button,
.account-signout-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.auth-primary-form button:hover,
.auth-primary-form button:focus-visible,
.auth-password-form button:hover,
.auth-password-form button:focus-visible,
.account-favorite-actions button:hover,
.account-favorite-actions button:focus-visible,
.account-signout-button:hover,
.account-signout-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.auth-password-details {
  border: 0;
  background: transparent;
}

.auth-password-details summary {
  cursor: pointer;
  list-style-position: inside;
  padding: 2px 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.auth-password-form {
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.auth-password-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.account-intro,
.account-section p {
  color: var(--muted);
  line-height: 1.5;
}

.account-panel-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.account-tabs button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
}

.account-tabs button:hover,
.account-tabs button:focus-visible,
.account-tabs button[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.account-tabs button[aria-pressed="true"] {
  background: var(--accent-soft);
}

.account-section {
  display: grid;
  gap: 12px;
}

.account-section h3,
.account-section p,
.account-section ul {
  margin: 0;
}

.account-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.account-summary-grid p {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.account-summary-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.account-summary-grid strong,
.account-section strong {
  overflow-wrap: anywhere;
}

.account-favorites-list {
  max-height: 320px;
}

.account-favorites-list li {
  grid-template-columns: minmax(0, 1fr);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.account-favorite-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.account-signout-button {
  justify-self: start;
}

.account-panel-top .account-signout-button {
  justify-self: end;
  white-space: nowrap;
}

.auth-status {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.upsell-panel h2,
.upsell-panel p {
  margin: 0;
}

.upsell-panel h2 {
  font-size: 1.2rem;
}

.upsell-panel > p {
  color: var(--muted);
  line-height: 1.5;
}

.upsell-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upsell-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pricing-grid article {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.pricing-grid strong {
  font-size: 0.78rem;
}

.pricing-grid span {
  font-size: 0.88rem;
}

.unlock-pro-button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.upsell-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upsell-actions .unlock-pro-button {
  width: 100%;
}

.unlock-pro-button[hidden] {
  display: none;
}

.payment-placeholder {
  padding: 10px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text) !important;
  font-size: 0.82rem;
}

.payment-placeholder[hidden] {
  display: none;
}

.workspace {
  min-width: 0;
  overflow: hidden;
}

.workspace-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.workspace-toolbar h2 {
  font-size: clamp(1.2rem, 2.1vw, 1.8rem);
}

.workspace-toolbar p {
  margin: 8px 0 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 420px;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.84rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--marker);
}

.fretboard-shell {
  padding: 18px;
}

.fretboard-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-soft) 100%);
}

.fretboard {
  display: grid;
  grid-template-columns: 54px repeat(25, minmax(52px, 1fr));
  min-width: 1354px;
}

.fretboard.is-shape-view {
  width: max-content;
}

.fret-label,
.string-label,
.fret-cell {
  min-height: 58px;
}

.fret-label {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}

.fret-label.is-open-fret,
.fret-cell.is-open-fret {
  background: var(--open-fret-bg);
}

.fret-label.has-nut-separator,
.fret-cell.has-nut-separator {
  border-left: 5px double var(--strong-line);
}

.string-label {
  display: grid;
  place-items: center;
  color: var(--text);
  font-weight: 800;
  border-top: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  left: 0;
  z-index: 4;
}

.fret-cell {
  position: relative;
  display: grid;
  place-items: center;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.fret-cell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: var(--strong-line);
  opacity: 0.82;
}

.note-marker {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--marker);
  color: #ffffff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.note-marker.is-root {
  background: var(--root);
  color: #ffffff;
}

.note-marker:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.note-marker small {
  display: block;
  margin-top: 2px;
  font-size: 0.64rem;
  font-weight: 700;
  opacity: 0.88;
}

.finger-badge {
  position: absolute;
  right: -5px;
  bottom: -5px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.68rem;
}

.info-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr);
  gap: 12px;
  padding: 0 18px 18px;
}

.tone-detail,
.sequence {
  min-height: 48px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.tone-detail strong {
  color: var(--text);
}

.sequence {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.sequence[hidden] {
  display: none;
}

.sequence span {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 980px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .category-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 680px) {
  .app-header,
  .workspace-toolbar,
  .info-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .app-header {
    padding: 16px;
  }

  .brand {
    align-items: flex-start;
  }

  .header-actions {
    align-self: flex-end;
  }

  .upsell-panel {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }

  .upsell-actions {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 100dvh;
    padding: 16px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
  }

  .auth-panel.is-account {
    width: 100%;
  }

  .account-tabs {
    gap: 4px;
    border-radius: var(--radius);
  }

  .account-panel-top {
    grid-template-columns: 1fr;
  }

  .account-panel-top .account-signout-button {
    justify-self: start;
  }

  .account-tabs button {
    min-height: 30px;
    padding: 0 8px;
    font-size: 0.76rem;
  }

  .account-summary-grid,
  .auth-password-actions,
  .account-favorite-actions {
    grid-template-columns: 1fr;
  }

  .app-layout {
    padding: 10px;
  }

  .control-panel,
  .workspace {
    border-radius: 0;
  }

  .category-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-grid,
  .info-strip {
    grid-template-columns: 1fr;
  }

  .workspace-toolbar {
    display: grid;
  }

  .legend {
    justify-content: flex-start;
    max-width: none;
  }

  .fretboard-shell {
    padding: 12px;
  }

  .fretboard {
    grid-template-columns: 46px repeat(25, 48px);
  }

  .fret-label,
  .string-label,
  .fret-cell {
    min-height: 54px;
  }

  .note-marker {
    width: 34px;
    height: 34px;
    font-size: 0.76rem;
  }

}
