:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f1f3f6;
  --bg-subtle: #ebedf2;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --text: #111827;
  --text-muted: #525d70;
  --ink: #111827;
  --ink-hover: #1f2937;
  --accent: #1d4ed8;
  --accent-2: #0f172a;
  --accent-soft: rgba(29, 78, 216, 0.08);
  --root: #dc2626;
  --root-dark: #b91c1c;
  --root-soft: rgba(220, 38, 38, 0.07);
  --chord: #0369a1;
  --chord-soft: rgba(3, 105, 161, 0.08);
  --scale-dot: #334155;
  --good: #047857;
  --good-bright: #059669;
  --good-soft: rgba(5, 150, 105, 0.10);
  --brass: #b45309;
  --brass-soft: #faf7f2;
  --warn: #d97706;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Thai", Roboto, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

button, a, select, input[type="checkbox"], input[type="range"], .fb-note {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(17, 24, 39, 0.08);
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 1320px;
  margin: 0 auto;
  padding:
    max(14px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  gap: 14px;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  border-radius: 9px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.badge-offline {
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--good);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge-offline::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--good-bright);
}

.mode-switcher {
  display: inline-flex;
  background: var(--bg-input);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
  gap: 3px;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.mode-btn:hover {
  color: var(--text);
}

.mode-btn.is-active {
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
}

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

button, select, input {
  font: inherit;
  color: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
.fb-note:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-ghost {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.14s, border-color 0.14s;
}

.btn-ghost:hover {
  background: var(--bg-input);
  border-color: rgba(15, 23, 42, 0.28);
}

.btn-install {
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.btn-install:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}

.btn-back-shelf {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.14s, border-color 0.14s;
}

.btn-back-shelf:hover {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-pro-status {
  border: 1px solid rgba(180, 83, 9, 0.3);
  background: #fef9ee;
  color: #92400e;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-pro-status.is-pro {
  border-color: rgba(4, 120, 87, 0.28);
  background: #ecfdf5;
  color: #065f46;
}

.unlock-modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.unlock-lead {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.redeem-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.unlock-feedback {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  min-height: 1.2em;
}

.unlock-feedback.is-error { color: #b91c1c; }
.unlock-feedback.is-ok { color: #047857; }

.unlock-demo-box {
  background: var(--bg-input);
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.code-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Main Cards */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

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

/* Selector Card */
.selector-row {
  display: grid;
  grid-template-columns: minmax(290px, 1.25fr) minmax(260px, 1fr);
  gap: 18px;
  align-items: start;
}

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

.label-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.accidental-switch {
  display: inline-flex;
  gap: 4px;
}

.mini-pill {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.mini-pill:hover {
  border-color: rgba(15, 23, 42, 0.35);
  color: var(--text);
}

.mini-pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.root-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 5px;
}

.root-btn {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  padding: 9px 1px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, background 0.14s, border-color 0.14s, color 0.14s;
}

.root-btn:hover {
  border-color: var(--ink);
  background: var(--bg-input);
}

.root-btn.is-active {
  background: var(--root);
  border-color: var(--root-dark);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.28);
}

.scale-selects {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 8px;
}

.select-input {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 0.87rem;
  color: var(--text);
  min-width: 0;
  width: 100%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.14s;
}

.select-input:hover {
  border-color: rgba(15, 23, 42, 0.32);
}

.select-input--primary {
  border-color: rgba(15, 23, 42, 0.24);
  background: #fcfcfd;
  font-weight: 600;
}

.select-input--sm {
  padding: 6px 9px;
  font-size: 0.81rem;
  width: auto;
  max-width: 100%;
}

.btn-fav {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.btn-fav.is-fav {
  color: #92400e;
  border-color: rgba(180, 83, 9, 0.35);
  background: #fef9ee;
}

/* Scale Summary Banner */
.scale-banner {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.scale-banner-main h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.scale-mood {
  margin: 3px 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.scale-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.meta-label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.meta-chip strong,
.meta-chip code {
  font-size: 0.86rem;
  color: var(--ink);
  font-weight: 700;
}

/* Transport Controls */
.transport-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.transport-primary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #ffffff;
  border: 0;
  border-radius: 10px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.22);
  transition: background 0.14s, transform 0.1s;
}

.btn-play:hover {
  background: var(--ink-hover);
}

.btn-play.is-playing {
  background: var(--root);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.3);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 13px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.btn-secondary:hover {
  background: var(--bg-input);
  border-color: rgba(15, 23, 42, 0.3);
}

.btn-secondary.is-on {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}

.bpm-control {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 10px;
}

.btn-step {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 0.79rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-step:hover {
  background: var(--bg-subtle);
  border-color: var(--ink);
}

.bpm-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 148px;
}

.bpm-display input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
  cursor: pointer;
}

.bpm-readout {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.bpm-readout strong {
  font-size: 0.96rem;
  color: var(--ink);
}

.transport-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}

.field-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text-muted);
}

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.79rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}

.toggle-chip input {
  accent-color: var(--ink);
  margin: 0;
}

.metro-vol-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.77rem;
}

.metro-vol-icon {
  font-size: 0.84rem;
}

.btn-metro-vol {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  font-size: 0.84rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-metro-vol:hover {
  border-color: var(--ink);
  background: var(--bg-subtle);
}

.metro-vol-control input[type="range"] {
  width: 64px;
  accent-color: var(--ink);
  cursor: pointer;
}

.metro-vol-val {
  min-width: 34px;
  text-align: right;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* Live Status Bar */
.live-status-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.86rem;
  color: var(--text);
}

.status-badge {
  background: var(--ink);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 999px;
}

.guided-progress {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guided-bar {
  width: 130px;
  height: 7px;
  background: rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.guided-fill {
  height: 100%;
  width: 0%;
  background: var(--good-bright);
  transition: width 0.2s ease;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.section-title h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--text);
}

.hint-text {
  font-size: 0.79rem;
  color: var(--text-muted);
}

.section-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Unified Fingering Bar */
.box-tour-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.fingering-system-switch {
  display: inline-flex;
  gap: 3px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: 999px;
}

.box-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.box-pill {
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 0.79rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.box-pill small {
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--text-muted);
}

.box-pill:hover {
  border-color: var(--ink);
  background: #fafafa;
}

.box-pill.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.box-pill.is-active small {
  color: rgba(255, 255, 255, 0.78);
}

.box-pill.is-done {
  border-color: rgba(4, 120, 87, 0.35);
  background: #ecfdf5;
  color: #065f46;
}

.box-pill.is-locked {
  opacity: 0.72;
  background: var(--bg-input);
}

.free-trial-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--brass-soft);
  border: 1px solid rgba(180, 83, 9, 0.28);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.ftb-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ftb-text strong {
  color: #92400e;
  font-size: 0.86rem;
}

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

.toggle-chip--tour {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--ink);
  font-weight: 700;
}

/* Guitar Fretboard SVG */
.fretboard-swipe-hint {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  margin-bottom: 8px;
}

.fretboard-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  padding-bottom: 6px;
  scrollbar-color: rgba(15, 23, 42, 0.22) transparent;
}

.fretboard-svg {
  width: 100%;
  min-width: 760px;
  height: auto;
  display: block;
  user-select: none;
}

.fb-fret-num {
  fill: #64748b;
  font-size: 11.5px;
  font-weight: 600;
}

.fb-fret-num--mark {
  fill: #111827;
  font-weight: 800;
}

.fb-string-label {
  fill: #334155;
  font-size: 12px;
  font-weight: 800;
}

.fb-note {
  cursor: pointer;
  transition: opacity 0.15s;
}

.fb-note--ghost {
  opacity: 0.24;
}

.fb-note--ghost:hover {
  opacity: 0.88;
}

.fb-note-halo {
  fill: transparent;
  stroke: transparent;
  stroke-width: 3;
  transition: stroke 0.14s, fill 0.14s;
}

/* Disciplined Pro Audio Fretboard Note Colors */
.fb-note--root .fb-note-circle {
  fill: #dc2626;
  stroke: #ffffff;
  stroke-width: 2.2;
}

.fb-note--chord .fb-note-circle {
  fill: #0369a1;
  stroke: #e0f2fe;
  stroke-width: 1.5;
}

.fb-note--scale .fb-note-circle {
  fill: #334155;
  stroke: #cbd5e1;
  stroke-width: 1.3;
}

.fb-note-text {
  fill: #ffffff;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.fb-note.is-active {
  opacity: 1;
}

.fb-note.is-active .fb-note-circle {
  fill: #059669;
  stroke: #ffffff;
  stroke-width: 2.5;
}

.fb-note.is-active .fb-note-halo {
  stroke: #34d399;
  fill: rgba(16, 185, 129, 0.26);
}

.fb-note.is-flash .fb-note-halo {
  stroke: #d97706;
  fill: rgba(217, 119, 6, 0.26);
}

.fb-note.is-mic {
  opacity: 1;
}

.fb-note.is-mic .fb-note-circle {
  stroke: #ffffff;
  stroke-width: 2.5;
}

.fb-note.is-mic .fb-note-halo {
  stroke: #0284c7;
  fill: rgba(2, 132, 199, 0.34);
  stroke-width: 3.8;
}

.fb-mic-out-circle {
  fill: #b91c1c;
  stroke: #ffffff;
  stroke-width: 2;
}

.fb-mic-out-halo {
  fill: rgba(220, 38, 38, 0.28);
  stroke: #ef4444;
  stroke-width: 3;
  stroke-dasharray: 4 3;
}

.fb-note.is-chord-resolve {
  opacity: 1;
}

.fb-note.is-chord-resolve .fb-note-circle {
  fill: #b45309;
  stroke: #ffffff;
  stroke-width: 2.4;
}

.fb-note.is-chord-resolve .fb-note-halo {
  stroke: #f59e0b;
  fill: rgba(245, 158, 11, 0.30);
  stroke-width: 3.5;
}

.fretboard-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 0.77rem;
  font-weight: 500;
  color: var(--text-muted);
}

.fretboard-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot--root { background: #dc2626; }
.dot--chord { background: #0369a1; }
.dot--scale { background: #334155; }
.dot--active { background: #059669; }
.dot--resolve { background: #b45309; }
.dot--mic { background: transparent; border: 2px solid #0284c7; }
.dot--mic-out { background: #b91c1c; border: 2px dashed #ef4444; }

/* Pro Guitar / Audio Interface Live Monitor Strip */
.btn-input-toggle {
  padding: 6px 11px;
  font-size: 0.8rem;
  border-radius: 9px;
}

.guitar-live-monitor {
  background: #f8fafc;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guitar-live-monitor.is-live {
  border-color: rgba(3, 105, 161, 0.38);
  box-shadow: 0 0 0 2px rgba(3, 105, 161, 0.08);
}

.glm-readout-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.glm-note-badge {
  min-width: 78px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s, background 0.12s;
}

.glm-note-badge.is-in {
  border-color: var(--good);
  background: #ecfdf5;
}

.glm-note-badge.is-out {
  border-color: var(--root);
  background: #fef2f2;
}

.glm-note {
  font-size: 1.48rem;
  font-weight: 800;
  line-height: 1.08;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.glm-freq {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.glm-center-col {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.glm-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.glm-pos-text {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
}

.glm-meters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.glm-cents-wrap {
  flex: 1;
  min-width: 150px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.glm-tuner-track {
  flex: 1;
  height: 10px;
}

.glm-cents-val {
  min-width: 42px;
  text-align: right;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.glm-vu-wrap {
  width: 128px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.glm-vu-lbl {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.glm-vu-track {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.glm-vu-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #059669 0%, #10b981 68%, #d97706 88%, #dc2626 100%);
  border-radius: 999px;
  transition: width 0.05s linear;
}

.glm-mic-btn {
  white-space: nowrap;
}

.glm-controls-row {
  display: grid;
  grid-template-columns: minmax(210px, 1.45fr) minmax(170px, 1fr) minmax(160px, 1fr) minmax(165px, 1fr);
  gap: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  align-items: end;
}

.glm-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 0;
}

.glm-field .select-input--sm {
  width: 100%;
}

.glm-device-wrap {
  display: flex;
  gap: 5px;
  align-items: center;
}

.glm-refresh-btn {
  padding: 5px 9px;
  min-height: 32px;
  flex-shrink: 0;
}

.glm-field--gain input[type="range"] {
  width: 100%;
  accent-color: var(--ink);
  cursor: pointer;
  margin: 4px 0;
}

@media (max-width: 960px) {
  .glm-controls-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .glm-readout-row {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 9px;
    align-items: center;
  }
  .glm-center-col {
    min-width: 0;
  }
  .glm-mic-btn {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }
  .glm-vu-wrap {
    width: 100%;
  }
  .glm-controls-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .section-controls .btn-input-toggle {
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 38px;
  }
}

/* Recommended Closing Chord Strip (Refined Ivory & Brass) */
.closing-chord-strip {
  margin-top: 12px;
  padding: 12px 15px;
  background: var(--brass-soft);
  border: 1px solid rgba(180, 83, 9, 0.22);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow 0.18s, border-color 0.18s;
}

.closing-chord-strip.is-resolving {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.14);
}

.closing-chord-diagram {
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.closing-chord-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.closing-chord-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.closing-kicker {
  font-size: 0.77rem;
  font-weight: 800;
  color: var(--brass);
}

.closing-chord-info h4 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--ink);
}

.closing-chord-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

/* Vocal Section */
.tuner-strip {
  display: grid;
  grid-template-columns: 130px 1fr 150px;
  align-items: center;
  gap: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.tuner-note-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tuner-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tuner-note {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
}

.tuner-freq {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.tuner-meter-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tuner-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.tuner-center-lbl {
  font-weight: 700;
  color: var(--text);
}

.tuner-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: #e2e6ec;
  overflow: hidden;
}

.tuner-sweet-spot {
  position: absolute;
  left: 42%;
  width: 16%;
  top: 0;
  bottom: 0;
  background: rgba(5, 150, 105, 0.22);
  border-left: 1px solid rgba(5, 150, 105, 0.5);
  border-right: 1px solid rgba(5, 150, 105, 0.5);
}

.tuner-needle {
  position: absolute;
  top: 1px;
  bottom: 1px;
  width: 6px;
  border-radius: 999px;
  background: #475569;
  left: 50%;
  transform: translateX(-50%);
  transition: left 0.06s linear, background 0.1s;
}

.tuner-scale-check {
  display: flex;
  justify-content: center;
}

.check-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e5e7eb;
  color: var(--text-muted);
  text-align: center;
}

.check-pill.is-in {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid rgba(4, 120, 87, 0.3);
}

.check-pill.is-out {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid rgba(185, 28, 28, 0.28);
}

.vocal-guide-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f0f9ff;
  border: 1px solid rgba(2, 132, 199, 0.22);
  border-radius: 11px;
  padding: 10px 13px;
  margin-bottom: 12px;
}

.vocal-guide-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #0c4a6e;
}

.vocal-presets-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.vocal-canvas-wrap {
  width: 100%;
  min-height: 240px;
  border-radius: 11px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  margin-bottom: 12px;
  background: #fafbfc;
}

#vocalCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.vocal-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vocal-pill {
  flex: 1 1 72px;
  max-width: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 9px 6px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, border-color 0.14s, background 0.14s;
}

.vocal-pill:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.vocal-pill--root {
  border-color: rgba(220, 38, 38, 0.38);
  background: #fef2f2;
}

.vocal-pill--chord {
  border-color: rgba(3, 105, 161, 0.32);
  background: #f0f9ff;
}

.vocal-pill.is-active,
.vocal-pill.is-target {
  background: #ecfdf5;
  border-color: var(--good);
  box-shadow: 0 0 0 2px rgba(4, 120, 87, 0.16);
}

.vocal-pill.is-mic {
  outline: 2px solid var(--chord);
}

.vocal-pill.is-flash {
  transform: scale(0.96);
  border-color: var(--brass);
}

.vp-solfege {
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--chord);
}

.vocal-pill--root .vp-solfege {
  color: var(--root);
}

.vp-note {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--ink);
}

.vp-interval {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Chords & Backing Track Section */
.btn-backing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--good);
  color: #ffffff;
  border: 0;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(4, 120, 87, 0.22);
  transition: filter 0.14s;
}

.btn-backing:hover {
  filter: brightness(1.06);
}

.btn-backing.is-playing {
  background: var(--root);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.28);
}

.prog-bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.prog-bar {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}

.prog-bar:hover {
  border-color: var(--ink);
  background: #ffffff;
}

.prog-bar.is-active {
  background: #ecfdf5;
  border-color: var(--good);
  box-shadow: 0 0 0 2px rgba(4, 120, 87, 0.14);
}

.prog-bar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.prog-bar-chord {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--ink);
}

.prog-beats {
  display: flex;
  gap: 5px;
  margin-top: 2px;
}

.prog-beat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
}

.prog-beat-dot.is-lit {
  background: var(--good-bright);
}

.scale-chords-block {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.chords-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chord-card {
  flex: 1 1 92px;
  max-width: 140px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s, border-color 0.14s, background 0.14s;
}

.chord-card--with-svg {
  flex: 1 1 124px;
  max-width: 158px;
  padding: 10px 8px 9px;
  gap: 3px;
}

.chord-svg--compact {
  width: 98px;
  height: auto;
  display: block;
}

.chord-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.chord-card--root {
  border-color: rgba(220, 38, 38, 0.35);
  background: #fffafa;
}

.chord-card.is-flash {
  border-color: var(--good);
  background: #ecfdf5;
  transform: scale(0.97);
}

.chord-roman {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--chord);
}

.chord-card--root .chord-roman {
  color: var(--root);
}

.chord-sym {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.chord-notes {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Native Dialog Modals */
.modal-dialog {
  width: min(760px, 94vw);
  max-height: 85dvh;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 0;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
}

.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 1.04rem;
}

.btn-close {
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

.btn-close:hover {
  background: var(--bg-subtle);
}

.modal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}

.search-input {
  flex: 1;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.library-list {
  padding: 12px 18px 18px;
  overflow-y: auto;
  max-height: 60dvh;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
}

.lib-item {
  text-align: left;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.14s, background 0.14s;
}

.lib-item:hover {
  border-color: var(--ink);
  background: #ffffff;
}

.lib-item.is-selected {
  border-color: var(--good);
  background: #ecfdf5;
}

.lib-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.lib-item-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}

.lib-item-cat {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--chord);
}

.lib-item-desc {
  font-size: 0.77rem;
  color: var(--text-muted);
}

.lib-item-notes {
  font-size: 0.78rem;
  color: var(--ink);
  font-weight: 700;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 18px 10px;
}

.stat-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.stat-box strong {
  display: block;
  font-size: 1.5rem;
  color: var(--ink);
}

.stat-box span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stats-records {
  padding: 8px 18px 16px;
  max-height: 45dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 0.85rem;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

.btn-danger-ghost {
  background: #fef2f2;
  border: 1px solid rgba(185, 28, 28, 0.3);
  color: #b91c1c;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

/* Footer & Toast */
.app-footer {
  text-align: center;
  font-size: 0.76rem;
  color: var(--text-muted);
  padding: 6px 0;
}

kbd {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.1);
}

.toast {
  position: fixed;
  bottom: max(20px, calc(14px + env(safe-area-inset-bottom)));
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 28px);
  text-align: center;
  background: var(--ink);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.22);
  z-index: 100;
}

.modal-dialog[open] {
  display: flex;
  flex-direction: column;
}

.modal-dialog .library-list,
.modal-dialog .stats-records,
.modal-dialog .unlock-modal-body,
.modal-dialog .pwa-dialog-body,
.modal-dialog .stripe-modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Stripe Checkout Modal (PromptPay + Card + Apple Pay) */
.stripe-checkout-dialog {
  width: min(640px, 95vw);
}

.stripe-modal-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

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

.stripe-sku-card {
  text-align: left;
  background: #ffffff;
  border: 1.5px solid var(--border-strong);
  border-left-width: 5px;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.14s, background 0.14s, box-shadow 0.14s, transform 0.12s;
}

.stripe-sku-card:hover {
  transform: translateY(-1px);
}

/* 1) Bundle VIP — Warm Gold / Amber */
.stripe-sku-card.is-bundle {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
  border-left-color: #d97706;
}
.stripe-sku-card.is-bundle.is-selected {
  border-color: #b45309;
  border-left-color: #b45309;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.24);
}
.stripe-sku-card.is-bundle .stripe-sku-badge {
  background: #b45309;
  color: #ffffff;
}
.stripe-sku-card.is-bundle .stripe-sku-price strong {
  color: #b45309;
}
.stripe-sku-card.is-bundle.is-selected .stripe-sku-radio {
  background: #b45309;
  border-color: #b45309;
  color: #ffffff;
}

/* 2) Dark Hole Scale — Royal Cobalt Blue */
.stripe-sku-card.is-scale {
  background: linear-gradient(135deg, #f0f7ff 0%, #dbeafe 100%);
  border-color: #93c5fd;
  border-left-color: #2563eb;
}
.stripe-sku-card.is-scale.is-selected {
  border-color: #1d4ed8;
  border-left-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24);
}
.stripe-sku-card.is-scale .stripe-sku-badge {
  background: #1d4ed8;
  color: #ffffff;
}
.stripe-sku-card.is-scale .stripe-sku-price strong {
  color: #1d4ed8;
}
.stripe-sku-card.is-scale.is-selected .stripe-sku-radio {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

/* 3) Dark Hole Theory — Rich Royal Violet */
.stripe-sku-card.is-theory {
  background: linear-gradient(135deg, #faf5ff 0%, #ede9fe 100%);
  border-color: #c4b5fd;
  border-left-color: #7c3aed;
}
.stripe-sku-card.is-theory.is-selected {
  border-color: #6d28d9;
  border-left-color: #6d28d9;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.24);
}
.stripe-sku-card.is-theory .stripe-sku-badge {
  background: #6d28d9;
  color: #ffffff;
}
.stripe-sku-card.is-theory .stripe-sku-price strong {
  color: #6d28d9;
}
.stripe-sku-card.is-theory.is-selected .stripe-sku-radio {
  background: #6d28d9;
  border-color: #6d28d9;
  color: #ffffff;
}

.stripe-sku-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.stripe-sku-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stripe-sku-radio {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 2px solid #94a3b8;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  flex-shrink: 0;
  transition: background 0.14s, border-color 0.14s;
}

.stripe-sku-top strong {
  font-size: 0.96rem;
  color: var(--ink);
}

.stripe-sku-badge {
  font-size: 0.71rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-muted);
}

.stripe-sku-sub {
  margin: 0;
  padding-left: 28px;
  font-size: 0.8rem;
  color: #334155;
  line-height: 1.45;
}

.stripe-sku-price {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 2px;
  padding-left: 28px;
}

.stripe-sku-price del {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.stripe-sku-price strong {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--ink);
}

.stripe-sku-price span {
  font-size: 0.74rem;
  font-weight: 600;
  color: #475569;
}

.stripe-methods-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stripe-method-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--ink);
}

.stripe-method-badge--secure {
  background: #ecfdf5;
  border-color: rgba(4, 120, 87, 0.28);
  color: #065f46;
}

.stripe-summary-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  padding: 11px 14px;
}

.stripe-summary-box.is-bundle {
  background: #fffbeb;
  border-color: #f59e0b;
}

.stripe-summary-box.is-scale {
  background: #eff6ff;
  border-color: #93c5fd;
}

.stripe-summary-box.is-theory {
  background: #f5f3ff;
  border-color: #c4b5fd;
}

.stripe-summary-total {
  text-align: right;
  display: flex;
  flex-direction: column;
}

.stripe-summary-total span {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.stripe-summary-total strong {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--ink);
}

.stripe-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stripe-pay-btn {
  width: 100%;
  justify-content: center;
  min-height: 46px;
  font-size: 0.94rem;
}

.stripe-mode-note {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* PWA Install Modal */
.pwa-install-dialog {
  width: min(560px, 94vw);
}

.pwa-dialog-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pwa-hero-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}

.pwa-app-icon {
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.16);
}

.pwa-platform-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pwa-platform-tabs .mini-pill {
  flex: 1 1 auto;
  text-align: center;
  padding: 7px 10px;
  font-size: 0.8rem;
}

.pwa-steps-box {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 12px 14px;
}

.pwa-steps-list {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text);
}

.pwa-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pwa-check-chip {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pwa-check-chip.is-ok {
  background: #ecfdf5;
  border-color: rgba(4, 120, 87, 0.28);
  color: #065f46;
}

/* Touch Devices (Phones & Tablets) */
@media (pointer: coarse) {
  .btn-metro-vol {
    width: 30px;
    height: 30px;
    font-size: 0.96rem;
  }
  .btn-step {
    min-height: 38px;
    padding: 6px 12px;
  }
  .mini-pill {
    min-height: 32px;
    padding: 5px 11px;
  }
  .box-pill {
    min-height: 36px;
    padding: 6px 12px;
  }
  .root-btn {
    min-height: 40px;
  }
  .toggle-chip {
    min-height: 36px;
    padding: 6px 11px;
  }
  .footer-shortcuts {
    display: none;
  }
}

/* Tablet & Compact Laptop Layout (<= 1024px) */
@media (max-width: 1024px) {
  .app-shell {
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(28px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
    gap: 12px;
  }
  .card {
    padding: 14px 15px;
  }
  .selector-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .bpm-control {
    margin-left: 0;
    flex: 1 1 260px;
    justify-content: space-between;
  }
  .toggle-group {
    margin-left: 0;
  }
  .metro-vol-control input[type="range"] {
    width: 82px;
  }
}

/* Tablet Portrait & Phablet (<= 820px) */
@media (max-width: 820px) {
  .fretboard-swipe-hint {
    display: flex;
  }
  .topbar {
    padding: 10px 12px;
    gap: 10px;
  }
  .mode-switcher {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mode-btn {
    padding: 8px 6px;
    text-align: center;
    font-size: 0.85rem;
    min-height: 38px;
  }
  .root-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
  }
  .tuner-strip {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .vocal-canvas-wrap {
    min-height: 220px;
  }
  .prog-bars {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .box-tour-bar {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }
  .box-tour-bar > * {
    min-width: 0;
    max-width: 100%;
  }
  .fingering-system-switch {
    display: flex;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-radius: 10px;
  }
  .fingering-system-switch::-webkit-scrollbar {
    display: none;
  }
  .fingering-system-switch .mini-pill {
    flex: 1 0 auto;
    text-align: center;
    white-space: nowrap;
  }
  .box-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }
  .box-pill {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

.show-on-mobile {
  display: none;
}

/* Mobile Phone Layout (<= 640px) */
@media (max-width: 640px) {
  .hide-on-mobile {
    display: none !important;
  }
  .show-on-mobile {
    display: inline;
  }
  .app-shell {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
    gap: 10px;
  }
  .card {
    padding: 13px 12px;
    border-radius: 12px;
  }
  .topbar {
    padding: 10px 11px;
    gap: 8px;
    border-radius: 13px;
  }
  .brand {
    flex: 1 1 100%;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .brand-logo {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
  }
  .btn-back-shelf {
    padding: 5px 9px;
    font-size: 0.76rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .brand-text {
    min-width: 0;
    flex: 1;
  }
  .brand-text h1 {
    font-size: 0.98rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .brand-text .badge-offline {
    display: none;
  }
  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }
  .topbar-actions > button,
  .topbar-actions > a {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.79rem;
    white-space: nowrap;
  }
  .topbar-actions > .btn-theme-toggle {
    flex: 0 0 38px;
    width: 38px;
    min-width: 38px;
    max-width: 38px;
    padding: 0;
    justify-content: center;
  }
  .free-trial-banner {
    padding: 10px 12px;
    gap: 8px;
    border-radius: 12px;
  }
  .free-trial-banner .ftb-text strong {
    font-size: 0.86rem;
  }
  .free-trial-banner .ftb-text span {
    font-size: 0.78rem;
    line-height: 1.5;
  }
  .free-trial-banner .ftb-actions {
    width: 100%;
  }
  .free-trial-banner .ftb-actions > button {
    width: 100%;
    justify-content: center;
    min-height: 38px;
    font-size: 0.8rem !important;
  }

  /* Prevent iOS Safari auto-zoom when focusing inputs/selects */
  .select-input,
  .select-input--sm,
  .search-input,
  .text-input {
    font-size: 16px;
  }

  .scale-selects {
    grid-template-columns: 1fr;
  }
  .scale-banner {
    gap: 10px;
  }
  .scale-banner-main h2 {
    font-size: 1.08rem;
  }
  .scale-meta {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  /* Primary transport: full-width Play + 3-col action row + full-width BPM */
  .transport-primary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }
  .transport-primary .btn-play {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    min-height: 46px;
    font-size: 0.96rem;
  }
  .transport-primary .btn-secondary {
    justify-content: center;
    text-align: center;
    padding: 9px 6px;
    font-size: 0.78rem;
    min-height: 42px;
    white-space: nowrap;
  }
  .transport-primary .bpm-control {
    grid-column: 1 / -1;
    width: 100%;
    padding: 7px 10px;
  }
  .bpm-display {
    flex: 1;
    min-width: 0;
  }

  /* Secondary transport: tidy 2-column selects + full-width volume sliders */
  .transport-secondary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .field-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    min-width: 0;
  }
  .field-inline .select-input--sm {
    width: 100%;
    padding: 8px 10px;
  }
  .transport-secondary > .metro-vol-control {
    grid-column: 1 / -1;
    width: 100%;
    padding: 6px 10px;
    border-radius: 10px;
  }
  .metro-vol-control input[type="range"] {
    flex: 1;
    width: auto;
    min-width: 80px;
  }
  .toggle-group {
    grid-column: 1 / -1;
    width: 100%;
    gap: 6px;
  }
  .toggle-group .metro-vol-control {
    width: 100%;
    padding: 6px 10px;
    border-radius: 10px;
  }
  .toggle-chip {
    font-size: 0.8rem;
  }

  /* Section controls full-width clean wrapping */
  .section-header {
    align-items: stretch;
  }
  .section-controls {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  .section-controls .btn-backing {
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 42px;
    font-size: 0.9rem;
  }
  .section-controls .select-input--sm {
    width: 100%;
    padding: 8px 9px;
  }
  .section-controls .toggle-chip {
    justify-content: center;
  }

  .closing-chord-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }
  .closing-chord-diagram {
    align-self: center;
  }
  .closing-chord-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .closing-chord-actions button {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  .vocal-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }
  .vocal-pill {
    max-width: none;
    padding: 9px 4px;
    min-height: 62px;
  }

  .chords-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .chord-card,
  .chord-card--with-svg {
    max-width: none;
    width: 100%;
  }

  /* Modals full-bleed friendly on mobile */
  .modal-dialog {
    width: calc(100vw - 16px);
    max-height: 90dvh;
    border-radius: 14px;
  }
  .library-list {
    grid-template-columns: 1fr;
    padding: 10px 12px 14px;
  }
  .stats-summary {
    grid-template-columns: 1fr;
  }
  .redeem-row {
    flex-direction: column;
  }
  .redeem-row .btn-play {
    width: 100%;
    justify-content: center;
  }
  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
  }
}

@media (max-width: 390px) {
  .root-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .vocal-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}


/* ==========================================================================
   Dark Hole Studio v5.0 — Pro Audio Studio Visual Polish & Dual Theme (Light + Obsidian Dark)
   ========================================================================== */

html, body {
  background:
    radial-gradient(ellipse 900px 360px at 50% -140px, rgba(29, 78, 216, 0.055), transparent 70%),
    #f2f4f8;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 40;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 28px -10px rgba(15, 23, 42, 0.09);
}

.card {
  border-color: rgba(15, 23, 42, 0.085);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035), 0 10px 26px -10px rgba(15, 23, 42, 0.07);
}

/* Tabular numbers so BPM, % and Hz never jitter */
#bpmValue,
.metro-vol-val,
#tunerFreq,
.stripe-sku-price strong,
.stripe-summary-total strong {
  font-variant-numeric: tabular-nums;
}

/* Crisp Theme Switcher Button (☀️ สว่าง / 🌙 มืด) */
.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--ink);
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}

.btn-theme-toggle:hover {
  background: var(--bg-subtle);
  transform: translateY(-1px);
}

/* Pro Studio 2-Zone Transport & 3-Channel Mixer Deck */
.transport-secondary {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.transport-setup-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.transport-mixer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.studio-mixer-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 6px 10px;
}

.studio-mixer-strip .metro-vol-control {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  gap: 5px;
}

.mixer-ch-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  margin-right: 2px;
}

.toggle-chip {
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.toggle-chip:has(input:checked) {
  background: rgba(29, 78, 216, 0.08);
  border-color: rgba(29, 78, 216, 0.32);
  color: #1e3a8a;
}

/* Scale Banner subtle studio polish */
.scale-banner {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid rgba(15, 23, 42, 0.09);
  border-left: 4px solid var(--root);
}

/* ==========================================================================
   DARK HOLE OBSIDIAN THEME (html[data-theme="dark"])
   Inspired by Neural DSP / Ableton Live / Linear Dark Studio Console
   ========================================================================== */

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e14;
  --bg-elev: #121722;
  --bg-card: #121722;
  --bg-input: #1a2130;
  --bg-subtle: #232c3f;
  --border: rgba(148, 163, 184, 0.15);
  --border-strong: rgba(148, 163, 184, 0.25);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --ink: #f8fafc;
  --ink-hover: #e2e8f0;
  --accent: #60a5fa;
  --accent-2: #e2e8f0;
  --accent-soft: rgba(96, 165, 250, 0.16);
  --root: #f43f5e;
  --root-dark: #e11d48;
  --root-soft: rgba(244, 63, 94, 0.16);
  --chord: #38bdf8;
  --chord-soft: rgba(56, 189, 248, 0.16);
  --scale-dot: #cbd5e1;
  --good: #34d399;
  --good-bright: #10b981;
  --good-soft: rgba(16, 185, 129, 0.16);
  --brass: #fbbf24;
  --brass-soft: rgba(245, 158, 11, 0.12);
  --warn: #fbbf24;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 34px -8px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
}

html[data-theme="dark"],
html[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 800px 360px at 18% -100px, rgba(225, 29, 72, 0.11), transparent 65%),
    radial-gradient(ellipse 760px 340px at 85% -120px, rgba(56, 189, 248, 0.08), transparent 65%),
    #0b0e14;
  color: var(--text);
}

html[data-theme="dark"] .topbar {
  background: rgba(15, 20, 30, 0.86);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-dialog {
  background: #121722;
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 34px -10px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .modal-dialog::backdrop {
  background: rgba(2, 6, 14, 0.72);
  backdrop-filter: blur(5px);
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer {
  background: #0f141e;
  border-color: rgba(148, 163, 184, 0.15);
}

html[data-theme="dark"] .mode-switcher,
html[data-theme="dark"] .fingering-system-switch {
  background: #0e131d;
  border-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .mode-btn.is-active {
  background: #1e293b;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-step,
html[data-theme="dark"] .btn-metro-vol,
html[data-theme="dark"] .btn-fav,
html[data-theme="dark"] .btn-close {
  background: #1a2130;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-step:hover,
html[data-theme="dark"] .btn-metro-vol:hover {
  background: #243047;
  border-color: rgba(148, 163, 184, 0.36);
}

html[data-theme="dark"] .btn-secondary.is-on {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #7dd3fc;
}

html[data-theme="dark"] .btn-back-shelf {
  background: #1a2130;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

html[data-theme="dark"] .btn-back-shelf:hover {
  background: #243047;
}

html[data-theme="dark"] .btn-install {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.28);
  color: #e2e8f0;
}

html[data-theme="dark"] .btn-install:hover {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(96, 165, 250, 0.45);
}

html[data-theme="dark"] .btn-theme-toggle {
  background: rgba(251, 191, 36, 0.13);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}

html[data-theme="dark"] .btn-theme-toggle:hover {
  background: rgba(251, 191, 36, 0.22);
}

/* Primary Action CTA in Dark Hole Obsidian — Luminous Crimson Glow */
html[data-theme="dark"] .btn-play {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  border-color: rgba(251, 113, 133, 0.35);
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.32);
}

html[data-theme="dark"] .btn-play:hover {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
}

html[data-theme="dark"] .btn-play.is-playing {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.35);
}

html[data-theme="dark"] .btn-backing {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.35);
}

html[data-theme="dark"] .btn-pro-status.is-pro {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.38);
  color: #6ee7b7;
}

html[data-theme="dark"] .root-btn,
html[data-theme="dark"] .box-pill,
html[data-theme="dark"] .select-input,
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .toggle-chip,
html[data-theme="dark"] .bpm-control,
html[data-theme="dark"] .meta-chip {
  background: #1a2130;
  border-color: rgba(148, 163, 184, 0.2);
  color: #f1f5f9;
}

html[data-theme="dark"] .root-btn:hover,
html[data-theme="dark"] .box-pill:hover {
  background: #243047;
  border-color: rgba(148, 163, 184, 0.36);
}

html[data-theme="dark"] .root-btn.is-active {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  border-color: #fb7185;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35);
}

html[data-theme="dark"] .box-pill.is-active,
html[data-theme="dark"] .mini-pill.is-active {
  background: #2563eb;
  border-color: #60a5fa;
  color: #ffffff;
}

html[data-theme="dark"] .mini-pill {
  background: #1a2130;
  border-color: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
}

html[data-theme="dark"] .toggle-chip:has(input:checked) {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.42);
  color: #bae6fd;
}

html[data-theme="dark"] .scale-banner {
  background: linear-gradient(135deg, #161d2b 0%, #111622 100%);
  border-color: rgba(148, 163, 184, 0.18);
  border-left-color: #f43f5e;
}

html[data-theme="dark"] .studio-mixer-strip {
  background: #0e131d;
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .studio-mixer-strip .metro-vol-control {
  background: #161d2b;
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .box-tour-bar,
html[data-theme="dark"] .guitar-input-panel,
html[data-theme="dark"] .tuner-strip,
html[data-theme="dark"] .live-status-bar,
html[data-theme="dark"] .prog-bar,
html[data-theme="dark"] .chord-card,
html[data-theme="dark"] .vocal-pill,
html[data-theme="dark"] .stat-box,
html[data-theme="dark"] .library-item {
  background: #171e2d;
  border-color: rgba(148, 163, 184, 0.18);
  color: #f1f5f9;
}

html[data-theme="dark"] .tuner-note-box,
html[data-theme="dark"] .tuner-meter-wrap,
html[data-theme="dark"] .tuner-scale-check,
html[data-theme="dark"] .live-note-readout {
  background: #111622;
  border-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .vocal-guide-bar {
  background: rgba(14, 165, 233, 0.1);
  border-color: rgba(56, 189, 248, 0.28);
}

html[data-theme="dark"] .vocal-guide-steps {
  color: #bae6fd;
}

html[data-theme="dark"] .vocal-canvas-wrap {
  background: #0f141e;
  border-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .vocal-pill--root {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.42);
}

html[data-theme="dark"] .vocal-pill--chord {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
}

html[data-theme="dark"] .chord-card--root {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.42);
}

/* Keep chord diagram SVGs crisp on clean ivory paper card inside dark mode */
html[data-theme="dark"] .chord-svg,
html[data-theme="dark"] .staff-svg {
  background: #f8fafc;
  border-radius: 8px;
  padding: 4px;
}

html[data-theme="dark"] .free-trial-banner {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(251, 191, 36, 0.3);
  color: #fef3c7;
}

html[data-theme="dark"] .free-trial-banner .ftb-text strong {
  color: #fde68a;
}

html[data-theme="dark"] .free-trial-banner .ftb-text span {
  color: #e2e8f0;
}

/* Dark Mode 3-Color Package Checkout Cards */
html[data-theme="dark"] .stripe-sku-card.is-bundle {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(180, 83, 9, 0.12) 100%);
  border-color: rgba(245, 158, 11, 0.55);
  border-left-color: #f59e0b;
}
html[data-theme="dark"] .stripe-sku-card.is-bundle .stripe-sku-price strong {
  color: #fbbf24;
}

html[data-theme="dark"] .stripe-sku-card.is-scale {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18) 0%, rgba(29, 78, 216, 0.12) 100%);
  border-color: rgba(96, 165, 250, 0.45);
  border-left-color: #3b82f6;
}
html[data-theme="dark"] .stripe-sku-card.is-scale .stripe-sku-price strong {
  color: #60a5fa;
}

html[data-theme="dark"] .stripe-sku-card.is-theory {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.18) 0%, rgba(109, 40, 217, 0.12) 100%);
  border-color: rgba(167, 139, 250, 0.45);
  border-left-color: #8b5cf6;
}
html[data-theme="dark"] .stripe-sku-card.is-theory .stripe-sku-price strong {
  color: #c084fc;
}

html[data-theme="dark"] .stripe-sku-top strong {
  color: #f8fafc;
}
html[data-theme="dark"] .stripe-sku-sub,
html[data-theme="dark"] .stripe-sku-price span {
  color: #cbd5e1;
}
html[data-theme="dark"] .stripe-sku-radio {
  background: #0f141e;
  border-color: #64748b;
}
html[data-theme="dark"] .stripe-method-badge {
  background: #1a2130;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}
html[data-theme="dark"] .stripe-method-badge--secure {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
}
html[data-theme="dark"] .stripe-summary-box.is-bundle {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.5);
}
html[data-theme="dark"] .stripe-summary-box.is-scale {
  background: rgba(37, 99, 235, 0.15);
  border-color: rgba(96, 165, 250, 0.45);
}
html[data-theme="dark"] .stripe-summary-box.is-theory {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(167, 139, 250, 0.45);
}

html[data-theme="dark"] .toast {
  background: #f8fafc;
  color: #0b0e14;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* High-contrast active status & live playback badges in Dark Hole Obsidian */
html[data-theme="dark"] .status-badge {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

html[data-theme="dark"] .guided-bar {
  background: rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .check-pill {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .check-pill.is-in {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.42);
}

html[data-theme="dark"] .check-pill.is-out {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.42);
}

html[data-theme="dark"] .prog-bar.is-active {
  background: rgba(16, 185, 129, 0.16);
  border-color: #34d399;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

/* Complete sweep of secondary dark-mode surfaces (kbd, modals, live monitor, selects, fav) */
html[data-theme="dark"] kbd {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.35);
  color: #f8fafc;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .select-input--primary {
  background: #1a2234;
  border-color: rgba(96, 165, 250, 0.38);
  color: #f8fafc;
}

html[data-theme="dark"] .btn-fav.is-fav {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

html[data-theme="dark"] .box-pill.is-done {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.42);
  color: #6ee7b7;
}

html[data-theme="dark"] .toggle-chip--tour {
  background: #1a2130;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

html[data-theme="dark"] .guitar-live-monitor {
  background: #111622;
  border-color: rgba(148, 163, 184, 0.2);
}

html[data-theme="dark"] .glm-note-badge {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

html[data-theme="dark"] .glm-note-badge.is-in {
  background: rgba(16, 185, 129, 0.22);
  border-color: #34d399;
  color: #6ee7b7;
}

html[data-theme="dark"] .glm-note-badge.is-out {
  background: rgba(244, 63, 94, 0.22);
  border-color: #fb7185;
  color: #fda4af;
}

html[data-theme="dark"] .glm-vu-track,
html[data-theme="dark"] .tuner-track {
  background: #1e293b;
}

html[data-theme="dark"] .closing-chord-diagram,
html[data-theme="dark"] .modal-toolbar,
html[data-theme="dark"] .lib-item,
html[data-theme="dark"] .pwa-steps-box {
  background: #161d2b;
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

html[data-theme="dark"] .lib-item:hover,
html[data-theme="dark"] .prog-bar:hover {
  background: #1f2a3f;
  border-color: rgba(96, 165, 250, 0.42);
}

html[data-theme="dark"] .chord-card.is-flash {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38bdf8;
}

html[data-theme="dark"] .btn-danger-ghost {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(251, 113, 133, 0.35);
  color: #fda4af;
}

html[data-theme="dark"] .pwa-check-chip.is-ok {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.38);
  color: #6ee7b7;
}


/* Mobile Portrait, Mobile Landscape & Short Viewports — Unstick Topbar for 100% Reading/Fretboard Space */
@media (max-width: 900px), (max-height: 540px) {
  .topbar {
    position: static;
    top: auto;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .app-shell,
  .portal-shell {
    padding-top: max(8px, env(safe-area-inset-top));
    gap: 10px;
  }
  .topbar {
    padding: 8px 12px;
    gap: 8px;
  }
  .brand-text h1 {
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 9px 11px;
    gap: 8px;
  }
  .studio-mixer-strip {
    width: 100%;
    padding: 6px;
    gap: 6px;
  }
  .studio-mixer-strip .metro-vol-control {
    width: 100%;
    justify-content: space-between;
  }
  .studio-mixer-strip .metro-vol-control input[type="range"] {
    flex: 1;
    min-width: 80px;
  }
  .mixer-ch-label {
    min-width: 66px;
  }
  .btn-theme-toggle .theme-label {
    display: none;
  }
  .btn-theme-toggle {
    padding: 6px 9px;
  }
}


/* ==========================================================================
   v5.3.0 — Collapsible Audio & Mixer Drawer + Cinema Fullscreen Fretboard
   ========================================================================== */

.transport-drawer-bar {
  display: flex;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.btn-drawer-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.btn-drawer-toggle:hover {
  border-color: var(--primary);
  background: var(--bg-card);
}

.btn-drawer-toggle.is-open {
  border-color: var(--primary);
  background: var(--bg-card);
}

.drawer-toggle-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.drawer-summary-pill {
  margin-left: auto;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.drawer-chevron {
  font-size: 0.88rem;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.btn-drawer-toggle.is-open .drawer-chevron {
  transform: rotate(180deg);
}

#transportSettingsDrawer {
  padding-top: 10px;
}

html[data-theme="dark"] .btn-drawer-toggle {
  background: #121824;
  border-color: rgba(148, 163, 184, 0.2);
  color: #f1f5f9;
}

html[data-theme="dark"] .btn-drawer-toggle:hover,
html[data-theme="dark"] .btn-drawer-toggle.is-open {
  background: #182030;
  border-color: rgba(96, 165, 250, 0.45);
}

html[data-theme="dark"] .drawer-summary-pill {
  background: #0b0e14;
  border-color: rgba(148, 163, 184, 0.18);
  color: #94a3b8;
}

/* Cinema Fullscreen Button & Overlay */
.btn-cinema-fs {
  font-weight: 700;
}

.cinema-hud,
.cinema-rotate-tip {
  display: none;
}

body.has-cinema-fs {
  overflow: hidden !important;
}

.guitar-card.is-cinema-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: 0 !important;
  background: #f8fafc !important;
  padding:
    max(10px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left)) !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  gap: 8px !important;
  overflow-y: auto !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .guitar-card.is-cinema-fullscreen {
  background: #05070c !important;
}

.guitar-card.is-cinema-fullscreen > .section-header,
.guitar-card.is-cinema-fullscreen > .closing-chord-strip,
.guitar-card.is-cinema-fullscreen > .fretboard-swipe-hint {
  display: none !important;
}

.guitar-card.is-cinema-fullscreen > .cinema-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  flex-shrink: 0;
}

html[data-theme="dark"] .guitar-card.is-cinema-fullscreen > .cinema-hud {
  background: rgba(17, 23, 35, 0.94);
  border-color: rgba(148, 163, 184, 0.2);
}

.cinema-hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.cinema-scale-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.cinema-note-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}

html[data-theme="dark"] .cinema-note-pill {
  background: #0b0e14;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

.cinema-hud-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.cinema-btn-play {
  padding: 6px 14px !important;
  min-height: 34px !important;
  font-size: 0.84rem !important;
}

.cinema-btn {
  padding: 6px 11px !important;
  min-height: 34px !important;
  font-size: 0.8rem !important;
  white-space: nowrap;
}

.cinema-btn-exit {
  border-color: rgba(220, 38, 38, 0.35) !important;
  color: #dc2626 !important;
}

html[data-theme="dark"] .cinema-btn-exit {
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
}

.cinema-bpm-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 9px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

html[data-theme="dark"] .cinema-bpm-pill {
  background: #0b0e14;
  border-color: rgba(148, 163, 184, 0.2);
}

.cinema-btn-step {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.guitar-card.is-cinema-fullscreen > .box-tour-bar {
  margin: 0 !important;
  padding: 6px 10px !important;
  flex-shrink: 0;
}

.guitar-card.is-cinema-fullscreen > .fretboard-scroll {
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  min-height: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 4px 0 !important;
}

.guitar-card.is-cinema-fullscreen .fretboard-svg {
  width: 100% !important;
  min-width: 780px;
  height: auto !important;
  max-height: 68dvh !important;
}

.guitar-card.is-cinema-fullscreen > .fretboard-legend {
  margin-top: 0 !important;
  padding-top: 4px !important;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.74rem;
}

@media (max-width: 760px) and (orientation: portrait) {
  .guitar-card.is-cinema-fullscreen > .cinema-rotate-tip {
    display: block;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 9px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--primary);
    flex-shrink: 0;
  }
}

@media (max-width: 640px) {
  .btn-drawer-toggle {
    font-size: 0.8rem;
    padding: 8px 10px;
    gap: 6px;
  }
  .drawer-summary-pill {
    font-size: 0.7rem;
    padding: 2px 7px;
    max-width: 145px;
  }
  .guitar-card.is-cinema-fullscreen > .cinema-hud {
    padding: 6px 8px;
    gap: 6px;
  }
  .cinema-scale-title {
    font-size: 0.85rem;
  }
  .cinema-hud-controls {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-height: 480px) {
  .guitar-card.is-cinema-fullscreen {
    padding-top: max(6px, env(safe-area-inset-top)) !important;
    padding-bottom: max(6px, env(safe-area-inset-bottom)) !important;
    gap: 5px !important;
  }
  .guitar-card.is-cinema-fullscreen > .cinema-hud {
    padding: 5px 10px;
  }
  .guitar-card.is-cinema-fullscreen > .box-tour-bar {
    padding: 4px 8px !important;
  }
  .guitar-card.is-cinema-fullscreen > .fretboard-legend {
    display: none !important;
  }
  .guitar-card.is-cinema-fullscreen .fretboard-svg {
    max-height: 76dvh !important;
  }
}


/* ==========================================================================
   v5.3.2 — Unified Collapsible Studio Drawers (Key/Scale, Fretboard, Backing)
   ========================================================================== */

.studio-fold-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.fold-bar-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.key-root-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--root) 0%, #ef4444 100%);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
  flex-shrink: 0;
}

.fold-bar-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fold-bar-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fold-bar-sub {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fold-bar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fold-action-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--ink);
  white-space: nowrap;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.studio-fold-bar:hover .fold-action-pill,
.studio-fold-bar.is-open .fold-action-pill {
  border-color: var(--primary);
  background: var(--bg-card);
}

.studio-fold-bar.is-open .drawer-chevron {
  transform: rotate(180deg);
}

.studio-fold-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 12px;
  margin-top: 10px;
  border-top: 1px dashed var(--border);
}

.fret-settings-drawer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.backing-fold-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.backing-controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.guitar-card.is-cinema-fullscreen > .fret-settings-drawer {
  display: none !important;
}

html[data-theme="dark"] .fold-action-pill {
  background: #121824;
  border-color: rgba(148, 163, 184, 0.22);
  color: #f1f5f9;
}

html[data-theme="dark"] .fret-settings-drawer,
html[data-theme="dark"] .backing-controls-row {
  background: #0e131d;
  border-color: rgba(148, 163, 184, 0.16);
}

@media (max-width: 640px) {
  .key-root-badge {
    min-width: 34px;
    height: 34px;
    font-size: 0.9rem;
    border-radius: 9px;
  }
  .fold-bar-title {
    font-size: 0.9rem;
  }
  .fold-bar-sub {
    font-size: 0.72rem;
  }
  .fold-action-pill {
    padding: 5px 9px;
    font-size: 0.75rem;
  }
  .backing-fold-head .section-controls {
    width: 100%;
    display: flex;
  }
  .backing-fold-head .section-controls > button {
    width: 100%;
    justify-content: center;
  }
}
