@font-face { font-family: "Bravura"; src: url("./assets/Bravura.otf") format("opentype"); font-display: block; }

:root {
  color-scheme: light;
  --ink: #121a20;
  --muted: #5d6a72;
  --blue: #147cad;
  --blue-dark: #0d5f88;
  --blue-pale: #e8f5fa;
  --cream: #f8f3e8;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(32, 45, 53, 0.2);
  --shadow: 0 16px 42px rgba(23, 35, 42, 0.14);
  font-family: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2f6f8;
  --muted: #b6c4cb;
  --blue: #68b7df;
  --blue-dark: #9ed7f1;
  --blue-pale: #19384a;
  --panel: rgba(21, 36, 45, .96);
  --line: rgba(255,255,255,.18);
}
:root[data-theme="dark"] html,
:root[data-theme="dark"] body { background: #101d25; }
:root[data-theme="dark"] body::before { opacity: .07; filter: grayscale(.35); }
:root[data-theme="dark"] .chord-card,
:root[data-theme="dark"] .utility-card,
:root[data-theme="dark"] .results-card { border-color: #3b5663; }
:root[data-theme="dark"] .type-family,
:root[data-theme="dark"] .type-family-column > .omission-picker { background: #20343f; }
:root[data-theme="dark"] .status { color: var(--ink); }
:root[data-theme="dark"] .status.warning { border-color: #4b86a1; background: #19384a; color: var(--ink); }
:root[data-theme="dark"] .app-dialog input,
:root[data-theme="dark"] .app-dialog textarea,
:root[data-theme="dark"] .feedback-dialog input,
:root[data-theme="dark"] .feedback-dialog textarea { border-color: #48606c; background: #172832; color: var(--ink); }
:root[data-theme="dark"] button,
:root[data-theme="dark"] select,
:root[data-theme="dark"] .type-family,
:root[data-theme="dark"] .type-family-column > .omission-picker { border-color: #48606c; }
:root[data-theme="dark"] .root-buttons button,
:root[data-theme="dark"] .type-buttons button,
:root[data-theme="dark"] .omission-buttons button,
:root[data-theme="dark"] .bass-buttons button,
:root[data-theme="dark"] .utility-button,
:root[data-theme="dark"] .clear-button,
:root[data-theme="dark"] .interpretation-list button,
:root[data-theme="dark"] .playability-filter,
:root[data-theme="dark"] .result-list button,
:root[data-theme="dark"] .app-dialog,
:root[data-theme="dark"] .feedback-dialog,
:root[data-theme="dark"] select { background: #172832; color: var(--ink); }
:root[data-theme="dark"] .finger-strip,
:root[data-theme="dark"] .notation-panel,
:root[data-theme="dark"] .staff-chord-name { color: #fff; }
:root[data-theme="dark"] .grand-staff .staff-notehead { fill: #fff; }
:root[data-theme="dark"] .grand-staff .staff-stem { stroke: #fff; }
:root[data-theme="dark"] .grand-staff .staff-line,
:root[data-theme="dark"] .grand-staff .ledger-line { stroke-width: 1.75; }
:root[data-theme="dark"] .grand-staff .staff-stem { stroke-width: 2.15; }
:root[data-theme="dark"] .grand-staff .staff-clef,
:root[data-theme="dark"] .grand-staff .staff-notehead,
:root[data-theme="dark"] .grand-staff .staff-accidental { stroke: none; paint-order: fill; }
:root[data-theme="dark"] .fretboard::before {
  background-color: #d3a45f;
  background-image:
    linear-gradient(90deg, rgba(66, 39, 14, .16), transparent 10%, rgba(255, 245, 220, .18) 50%, transparent 90%, rgba(66, 39, 14, .16)),
    linear-gradient(rgba(239, 202, 142, .34), rgba(239, 202, 142, .34)),
    url("./assets/maple-fretboard.webp");
  box-shadow:
    inset 9px 0 14px -12px rgba(48, 27, 8, .58),
    inset -9px 0 14px -12px rgba(48, 27, 8, .58),
    0 12px 34px rgba(0, 0, 0, .3);
}
:root[data-theme="dark"] .note-cell,
:root[data-theme="dark"] .missing-cell {
  border-top-color: rgba(255, 239, 207, .68);
  border-left-color: rgba(73, 45, 19, .42);
}
:root[data-theme="dark"] .neck-marker {
  background: #e2c58d;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, .5), 0 1px 3px rgba(56, 34, 13, .45);
}
:root[data-theme="dark"] .neck-marker.double {
  background: transparent;
  box-shadow: 0 -6px 0 #e2c58d, 0 6px 0 #e2c58d;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #dce7ec; }

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: #fff;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 160'%3E%3Cpath fill='%23cf202f' d='M0 0 139 80 0 160Z'/%3E%3Cpath fill='white' d='m46 56 7 15 16 2-12 11 3 17-14-8-15 8 3-17-12-11 17-2Z'/%3E%3C/svg%3E") left center / auto 100% no-repeat,
    linear-gradient(to bottom, #1167a8 0 20%, #fff 20% 40%, #1167a8 40% 60%, #fff 60% 80%, #1167a8 80% 100%);
  content: "";
  opacity: .12;
  pointer-events: none;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.app-shell {
  position: relative;
  z-index: 1;
  height: 100vh;
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 10px clamp(14px, 2.2vw, 34px);
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(500px, 540px) minmax(430px, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 10px 14px;
  overflow: hidden;
}

.topbar {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  margin: 0;
}

.brand-block { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-mark { display: inline-flex; flex: 0 0 44px; width: 44px; height: 44px; border-radius: 11px; text-decoration: none; transform: none; }
.brand-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
:root[data-theme="dark"] .brand-mark img { content: url("./assets/chordmaj7-logo-reverse.png"); }
.brand-mark:hover { opacity: .88; }
.brand-mark:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 11px; }
.brand-block h1 { margin: 0; font-size: clamp(1.8rem, 2.2vw, 2.25rem); line-height: .94; letter-spacing: -.04em; white-space: nowrap; }
.brand-block h1 span { display: inline; }
html[lang="es"] .brand-block h1 { font-size: clamp(1.62rem, 1.92vw, 2rem); letter-spacing: -.035em; }

.primary-controls {
  display: grid;
  grid-template-columns: auto minmax(240px, 1fr);
  align-items: end;
  gap: 12px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 22px;
  background: rgba(255,255,255,.66);
  box-shadow: 0 10px 30px rgba(23,35,42,.09);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: clip;
  min-width: 190px;
  border: 1px solid #aebbc1;
  border-radius: 999px;
  background: #d8dfe2;
  padding: 3px;
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #536069;
  font-weight: 850;
}

.segmented button.active {
  background: var(--blue);
  color: white;
  box-shadow: 0 3px 10px rgba(20,124,173,.28);
}

.tuning-control { display: grid; gap: 5px; min-width: 0; }
.tuning-control span { margin-left: 10px; color: var(--muted); font-size: .78rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.tuning-control select {
  width: 100%; min-height: 40px; padding: 0 40px 0 15px;
  border: 1px solid #aebbc1; border-radius: 14px; background: white; color: var(--ink); font-weight: 800;
}

.neck-section {
  grid-column: 2;
  grid-row: 1 / 5;
  min-height: 0;
  display: block;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border: 0;
}

.neck-stage { height: 100%; min-height: 0; display: grid; grid-template-columns: 40px minmax(285px,310px) minmax(145px,1fr); align-items: center; gap: 10px; }

.replay-button, .move-controls button, .neck-scroll-controls button, .fret-replay-button {
  min-height: 34px; border: 0; border-radius: 999px; padding: 0 14px; background: var(--blue); color: white; font-weight: 900;
}
.replay-button:disabled, .move-controls button:disabled, .neck-scroll-controls button:disabled { cursor: default; background: #d4dbde; color: white; }
.move-controls button:disabled, .neck-scroll-controls button:disabled { color: #667780; }
.move-controls button:disabled { color: #2f4650; }
.move-controls .fret-replay-button:disabled { color: #147cad; }
.side-controls { display: grid; align-content: center; gap: 12px; align-self: stretch; padding: 0; }
.side-controls button { min-width: 0; width: 100%; border: 1px solid #9fb2bb; border-radius: 11px; padding: 0 3px; background: rgba(255,255,255,.88); color: var(--blue-dark); }
.move-controls button { min-height: 54px; font-size: .72rem; }
.move-controls { align-content: center; gap: 8px; }
.move-controls .fret-replay-button { min-height: 54px; margin-top: 54px; font-size: 1.35rem; }
.fret-replay-button > span { display: inline-block; transform: translateX(1px); }
.neck-scroll-controls button { min-height: 132px; font-size: .78rem; }

.neck-viewport {
  --cell: 43px;
  --drone-cell: 31px;
  --label: 29px;
  position: relative;
  width: min(350px, 100%);
  max-height: none;
  min-height: 0;
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  padding: 39px 0 0;
  border-radius: 0;
}
.neck-viewport::-webkit-scrollbar { display: none; }

.finger-strip {
  position: absolute;
  z-index: 9;
  top: 8px;
  left: var(--label);
  display: grid;
  width: calc(100% - var(--label));
  height: 29px;
  color: var(--blue);
  font-size: clamp(1.3rem, 2.5vh, 1.58rem);
  font-weight: 650;
  line-height: 1;
  pointer-events: none;
}
.finger-label { display: grid; place-items: end center; }
.finger-label.short { visibility: hidden; }

.fretboard {
  --cell: 43px;
  --drone-cell: 31px;
  --label: 29px;
  display: grid;
  grid-template-columns: var(--label) repeat(5, minmax(var(--cell), 1fr));
  grid-template-rows: minmax(0, 1.12fr) repeat(15, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: visible;
  background: transparent;
}
.fretboard::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0 0 0 var(--neck-left, var(--label));
  border: 1px solid #8c7046;
  border-radius: 10px;
  background-color: #e7bd79;
  background-image:
    linear-gradient(90deg, rgba(75,44,15,.22), transparent 10%, rgba(255,255,255,.12) 50%, transparent 90%, rgba(75,44,15,.22)),
    linear-gradient(rgba(231,189,121,.2),rgba(231,189,121,.2)),
    url("./assets/maple-fretboard.webp");
  background-size: auto, auto, cover;
  box-shadow:
    inset 9px 0 14px -12px rgba(48,27,8,.72),
    inset -9px 0 14px -12px rgba(48,27,8,.72),
    0 12px 34px rgba(20,24,27,.18);
  pointer-events: none;
}
.corner, .fret-number, .string-label, .note-cell, .missing-cell { position: relative; display: grid; place-items: center; }
.corner, .string-label { position: sticky; top: 0; }
.corner, .fret-number { background: transparent; color: var(--ink); font-size: .68rem; font-weight: 900; }
.corner { z-index: 8; align-items: center; justify-items: end; padding-right: 6px; }
.fret-number { z-index: 2; border: 0; justify-items: end; padding-right: 6px; }

.string-label {
  z-index: 7;
  place-items: end center;
  padding: 0 1px clamp(2px, .38vh, 4px);
  background: rgba(255,245,222,.18);
  border-left: 1px solid #a58b63;
  border-bottom: 4px solid rgba(18,25,31,.82);
  color: var(--muted); font-size: .72rem; font-weight: 800;
}
.string-label::before { content: ""; position: absolute; z-index: 0; inset: 0 auto 0 50%; width: var(--string-width, 2px); transform: translateX(-50%); background: linear-gradient(90deg,#f8f8f8,#60676a,#fff); box-shadow: 1px 0 1px rgba(0,0,0,.35); }
.string-label > * { position: relative; z-index: 2; }
.string-label.short { padding: 0; border: 0; background: transparent; }
.note-button {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(26px, 4.4vh, 38px);
  height: clamp(26px, 4.4vh, 38px);
  padding: 0;
  border: 1.5px solid #1d2a31;
  border-radius: 50%;
  background: #fffefa;
  color: #162027;
  font-size: clamp(.66rem, 1.45vh, .8rem);
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
}
.note-button.accidental {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .04em;
  white-space: nowrap;
  background: #d8e0e4;
  font-size: clamp(.66rem, 1.45vh, .8rem);
}
.accidental-glyph {
  display: inline-block;
  margin: 0;
  font-family: "Segoe UI Symbol", "Bravura", sans-serif;
  font-size: .84em;
  font-weight: 800;
  line-height: 1;
  transform: translateY(-.02em);
}
.mute-button.active { border-color: transparent; background: transparent; color: #5c6870; box-shadow: none; font-size: clamp(.72rem, 1.55vh, .88rem); font-weight: 900; }
.string-label .note-button.selected { border-color: var(--blue-dark); background: var(--blue); color: white; box-shadow: 0 0 0 4px rgba(20,124,173,.2); }
.note-button:hover { transform: scale(1.08); border-color: var(--blue); }

.note-cell, .missing-cell { border-top: 2px solid rgba(111,86,52,.44); border-left: 1px solid rgba(75,54,29,.22); }
.note-cell::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: var(--string-width, 2px); transform: translateX(-50%); background: linear-gradient(90deg,#f8f8f8,#60676a,#fff); box-shadow: 1px 0 1px rgba(0,0,0,.35); }
.note-cell button { box-shadow: 0 2px 4px rgba(35,27,16,.18); }
.note-cell button.selected { background: var(--blue); border-color: var(--blue-dark); color: white; box-shadow: 0 0 0 6px rgba(20,124,173,.2); }
.course-dimmed { background-color: rgba(18,25,31,.17); }
.course-dimmed > .note-button,
.course-dimmed > .drone-toggle { opacity: .5; filter: saturate(.62); }
.course-dimmed-label { opacity: .5; }
:root[data-theme="dark"] .course-dimmed { background-color: rgba(0,0,0,.22); }
:root[data-theme="dark"] .course-dimmed > .note-button,
:root[data-theme="dark"] .course-dimmed > .drone-toggle { opacity: .62; filter: saturate(.72); }
.neck-marker { position: absolute; z-index: 1; top: 50%; left: calc(25% - 5px); width: 8px; height: 8px; transform: translate(-50%,-50%); border-radius: 50%; background: #8b795a; box-shadow: inset 0 1px 2px rgba(255,255,255,.35), 0 1px 2px rgba(65,43,20,.25); pointer-events: none; }
.neck-marker.double { background: transparent; box-shadow: 0 -6px 0 #8b795a, 0 6px 0 #8b795a; }
.finger-number { position: absolute; z-index: 3; right: -6px; top: -6px; display: grid !important; place-items: center; width: 17px; height: 17px; margin: 0 !important; border: 1px solid white; border-radius: 50%; background: #17232a; color: white !important; font-size: .58rem !important; font-weight: 900; }
.missing-cell { background: rgba(222,233,237,.88); }
.missing-cell::after { display: none; }
.drone-absent { border: 0; background: transparent; }
.drone-start, .drone-tail { background: linear-gradient(90deg,#e5bd7b,#efcf96); }
.drone-start { overflow: visible; border-top-color: #147cad; }
.drone-start::before { content: ""; position: absolute; z-index: 1; left: 50%; right: -3px; top: 50%; height: 2px; background: linear-gradient(#fff,#626a6e,#fff); box-shadow: 0 1px 1px rgba(0,0,0,.3); }
.drone-start::after, .drone-tail::after { content: ""; display: block; position: absolute; left: 50%; width: 1.55px; transform: translateX(-50%); background: linear-gradient(90deg,#f8f8f8,#60676a,#fff); box-shadow: 1px 0 1px rgba(0,0,0,.35); }
.drone-start::after { top: 50%; bottom: 0; }
.drone-tail::after { top: 0; bottom: 0; }
.drone-toggle { position: relative; z-index: 3; display: grid; place-items: center; width: clamp(25px, 3vh, 34px); height: clamp(25px, 3vh, 34px); padding: 0; border-radius: 50%; font-size: clamp(.65rem, 1.28vh, .82rem); font-weight: 900; box-shadow: 0 2px 5px rgba(20,31,37,.2); }
.drone-toggle.open { border: 2px solid var(--blue-dark); background: white; color: var(--blue-dark); }
.drone-toggle.muted { border: 1px solid #95a3aa; background: #dce5e9; color: #65747b; }

/* All 15 frets fit at once, so keep the right rail balanced but unobtrusive. */
.neck-scroll-controls { visibility: hidden; }

.notation-panel { align-self: stretch; display: grid; grid-template-rows: minmax(70px,auto) 250px; place-content: center; min-width: 0; padding: 0 2px; color: var(--blue-dark); text-align: center; }
.staff-chord-name { display: grid; align-content: end; justify-items: center; min-height: 70px; max-width: 100%; color: var(--blue-dark); font-size: clamp(1.55rem,2.3vw,2.5rem); font-weight: 600; line-height: 1.05; overflow-wrap: normal; }
.staff-chord-symbol, .staff-chord-omissions { display: block; max-width: 100%; white-space: nowrap; }
.staff-chord-omissions { margin-top: 5px; font-size: .42em; font-weight: 600; }
.grand-staff { width: 100%; max-width: 175px; height: 250px; overflow: visible; }
.grand-staff .staff-line, .grand-staff .ledger-line { stroke: currentColor; stroke-width: 2.35; }
.grand-staff .staff-clef { fill: currentColor; font-family: "Bravura", serif; font-size: 48px; }
.grand-staff .staff-notehead { fill: var(--blue-dark); font-family: "Bravura", serif; font-size: 44px; text-anchor: middle; dominant-baseline: central; }
.grand-staff .staff-stem { stroke: var(--blue-dark); stroke-width: 2.7; }
.grand-staff .staff-accidental { fill: currentColor; font-family: "Bravura", serif; font-size: 38px; }

.work-area { display: contents; }
.chord-card, .utility-card, .results-card { border: 1px solid rgba(255,255,255,.9); border-radius: 22px; background: var(--panel); box-shadow: 0 12px 32px rgba(23,35,42,.1); }
.chord-card { container-type: inline-size; grid-column: 1; grid-row: 2; align-self: start; min-width: 0; padding: 16px; }
.utility-card { grid-column: 1; grid-row: 3; align-self: end; display: grid; gap: 8px; padding: 10px; }
.settings-controls { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.setup-summary { display: block; width: 100%; margin: 0 0 10px; padding: 2px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: .83rem; line-height: 1.45; text-align: center; }
.setup-summary:hover, .setup-summary:focus-visible { background: var(--blue-pale); color: var(--blue-dark); }
.utility-card .replay-button, .clear-button, .utility-button { width: 100%; min-height: 42px; border-radius: 12px; padding-inline: 6px; }
.clear-button { border: 1px solid #9fb2bb; background: white; color: var(--blue-dark); font-weight: 850; }
.clear-button:disabled { cursor: default; color: #8c999f; background: #eef2f3; }
.utility-button { display: grid; grid-template-rows: 30px auto; place-items: center; align-content: center; gap: 3px; min-width: 0; border: 1px solid #9fb2bb; background: white; color: var(--blue-dark); font-size: clamp(.65rem,.8vw,.78rem); font-weight: 850; line-height: 1.05; }
.utility-icon { display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--blue); border-radius: 50%; color: var(--blue-dark); font-size: 1rem; line-height: 1; }
.utility-icon-text { font-size: 1.08rem; font-weight: 950; }
.utility-icon .favorite-star-icon { width: 18px; height: 18px; }
.utility-label { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 2px; max-width: 100%; overflow-wrap: anywhere; text-align: center; }
.favorite-count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; margin-left: 3px; border-radius: 999px; background: var(--blue-pale); color: var(--blue-dark); font-size: .67rem; }
.instrument-note { padding: 13px 14px; border-left: 4px solid var(--blue); background: var(--blue-pale); color: #36515f; font-size: .82rem; line-height: 1.45; }

.results-card { position: relative; grid-column: 3; grid-row: 1 / 4; min-height: 0; padding: 13px; overflow: hidden; display: flex; flex-direction: column; }
.chord-picker, .status, .interpretation-list, .playability-filters { flex: 0 0 auto; }
.chord-picker { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
.fretboard-sticky {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  width: min(285px, calc(100% - 48px));
  min-height: 210px;
  place-content: center;
  gap: 16px;
  padding: 30px 28px;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  border: 1px solid #e2c94f;
  background: linear-gradient(145deg, #fff59a, #ffe979);
  box-shadow: 0 18px 28px rgba(64, 54, 10, .24), inset 0 -18px 28px rgba(222, 188, 37, .12);
  color: #40370b;
  text-align: center;
}
.fretboard-sticky::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 50%;
  width: 94px;
  height: 24px;
  transform: translateX(-50%) rotate(1deg);
  background: rgba(255, 248, 209, .72);
  box-shadow: 0 1px 3px rgba(80, 63, 4, .12);
}
.fretboard-sticky strong { font-size: 1.75rem; line-height: 1; }
.fretboard-sticky span { font-size: 1rem; font-weight: 750; line-height: 1.45; }
.fretboard-sticky[hidden] { display: none; }
.picker-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.picker-group legend { display: block; margin: 0 0 5px 3px; color: var(--muted); font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.root-buttons { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px; }
.type-picker-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 3px -3px; }
.type-picker-heading > span { color: var(--muted); font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .07em; }
.type-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 7px; }
.type-family-column { display: grid; align-content: start; gap: 7px; min-width: 0; }
.type-family { min-width: 0; padding: 6px; border: 1px solid #d3dde1; border-radius: 10px; background: rgba(255,255,255,.48); }
.type-family-label { display: block; margin: 0 0 5px 2px; color: var(--muted); font-size: .6rem; font-weight: 900; letter-spacing: .055em; text-transform: uppercase; }
.type-family-buttons { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.chord-naming-link { display: inline-block; color: var(--blue-dark); font-size: .72rem; font-weight: 850; text-underline-offset: 3px; white-space: nowrap; }
.chord-naming-link:hover { color: var(--blue); }
.type-family-column > .omission-picker { min-width: 0; padding: 6px; border: 1px solid #d3dde1; border-radius: 10px; background: rgba(255,255,255,.48); }
.type-family-column > .omission-picker legend { margin-left: 2px; padding: 0 3px; }
.omission-buttons, .bass-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.bass-buttons { grid-template-columns: repeat(auto-fit,36px); justify-content: start; gap: 5px; }
.omission-buttons button, .bass-buttons button { min-height: 30px; border: 1px solid #aebbc1; border-radius: 8px; background: white; color: var(--ink); font-size: .68rem; font-weight: 900; }
.bass-buttons button { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
.omission-buttons button.active, .bass-buttons button.active { border-color: var(--blue-dark); background: var(--blue-pale); color: var(--blue-dark); box-shadow: inset 0 0 0 1px var(--blue); }
.omission-buttons button:disabled { cursor: default; opacity: .38; }
.root-buttons button, .type-buttons button { min-width: 0; min-height: 30px; padding: 0 3px; overflow: hidden; border: 1px solid #aebbc1; border-radius: 7px; background: white; color: var(--ink); font-size: .68rem; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.root-buttons button { min-height: 34px; padding-inline: 1px; font-size: .66rem; }
.type-buttons button:hover, .root-buttons button:hover { border-color: var(--blue); color: var(--blue-dark); }
.type-buttons button.active, .root-buttons button.active { border-color: var(--blue-dark); background: var(--blue); color: white; box-shadow: inset 0 0 0 1px var(--blue-dark); }
.picker-footer { display: grid; grid-template-columns: minmax(0, 1fr) 39px minmax(0, 1fr); gap: 7px; align-items: center; }
.picker-footer .clear-button { min-height: 39px; }
.selected-chord-name { display: block; width: 100%; min-height: 39px; padding: 7px 12px; border: 1px solid #90c7de; border-radius: 11px; background: #eef8fc; color: var(--blue-dark); font-size: 1.16rem; font-weight: 950; }
.current-favorite-toggle { display: grid; place-items: center; width: 39px; height: 39px; padding: 0; border: 1px solid #adc0c9; border-radius: 999px; background: rgba(255,255,255,.9); color: #86949b; font-size: 1.65rem; line-height: 1; }
.current-favorite-toggle .favorite-star-icon { width: 28px; height: 28px; }
.current-favorite-toggle.saved { border-color: var(--blue-dark); background: var(--blue); color: white; }
.current-favorite-toggle:disabled { opacity: .38; cursor: default; }

@container (max-width: 410px) {
  .type-family-buttons { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
  .type-family-buttons button { min-height: 27px; padding-inline: 1px; font-size: .59rem; letter-spacing: -.025em; text-overflow: clip; }
  .omission-buttons { gap: 3px; }
  .omission-buttons button { min-height: 27px; padding-inline: 2px; font-size: .59rem; letter-spacing: -.025em; }
}
.feedback-submit { border: 0; border-radius: 13px; padding: 0 20px; background: var(--blue); color: white; font-weight: 900; }
.status { min-height: 27px; color: #33444d; font-weight: 850; }
.status.warning { padding: 10px 12px; border: 1px solid #90c7de; border-radius: 10px; background: #eef8fc; }
.status:empty { min-height: 0; padding: 0; border: 0; background: transparent; }
.result-control-group { display: grid; gap: 5px; margin: 4px 0 8px; padding: 8px 9px; border: 1px solid rgba(117,137,147,.22); border-radius: 13px; background: rgba(238,245,248,.54); }
.result-control-group:has(> [hidden]) { display: none; }
.result-control-label { color: var(--muted); font-size: .62rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
html[lang="es"] .label-en, html[lang="en"] .label-es { display: none; }
.interpretation-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.interpretation-list[hidden] { display: none; }
.interpretation-list button { min-height: 34px; padding: 5px 11px; border: 1px solid #9fb2bb; border-radius: 999px; background: white; color: var(--ink); font-size: .75rem; font-weight: 850; }
.interpretation-list button span { display: block; color: var(--muted); font-size: .62rem; font-weight: 700; }
.interpretation-list button.active { border-color: var(--blue); background: var(--blue-pale); color: var(--blue-dark); }
.playability-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; overflow-x: visible; }
.playability-filters[hidden] { display: none; }
.playability-filter { flex: 0 0 auto; min-height: 29px; padding: 4px 10px; border: 1px solid #b7c2c7; border-radius: 999px; background: white; color: var(--ink); font-size: .72rem; font-weight: 850; }
.playability-filter.active { border-color: #17232a; background: #17232a; color: white; }
.playability-filter:disabled { opacity: .42; cursor: default; }
.result-list { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 7px; max-height: none; margin: 0; padding: 0 5px 0 0; list-style: none; overflow-y: auto; }
.result-item { position: relative; min-width: 0; }
.result-list button[data-index] { position: relative; width: 100%; min-height: 154px; padding: 9px 42px 8px 10px; text-align: left; border: 1px solid #d6d7d4; border-radius: 12px; background: #fffdf8; color: var(--ink); }
.result-list button[data-index].active { border-color: var(--blue-dark); background: var(--blue-pale); box-shadow: inset 0 0 0 2px var(--blue); }
.result-list .favorite-toggle { position: absolute; z-index: 2; right: 8px; top: 8px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid #adc0c9; border-radius: 999px; background: rgba(255,255,255,.9); color: #86949b; font-size: 1.25rem; line-height: 1; text-align: center; }
.favorite-star-icon { display: block; width: 20px; height: 20px; overflow: visible; fill: currentColor; }
.result-list .favorite-toggle.saved { border-color: var(--blue-dark); background: var(--blue); color: white; }
.voicing-card-header { display: flex !important; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; margin: 0 0 5px !important; padding-right: 0; }
.result-list .voicing-position { display: block; min-width: 0; margin: 0; color: var(--ink); font-size: .84rem; font-weight: 900; line-height: 1.15; letter-spacing: 0; }
.result-list .playability-badge { position: static; flex: 0 0 auto; display: inline-block; padding: 3px 7px; border-radius: 999px; background: #e8eef1; color: #33424a; font-size: .62rem; font-style: normal; font-weight: 850; }
.result-list .playability-badge.playable { background: #ddf2e5; color: #25603b; }
.result-list .playability-badge.stretch { background: #fff0c9; color: #76530d; }
.result-list .playability-badge.study { background: #ece7f4; color: #5a4276; }
.voicing-table { width: 100%; table-layout: fixed; border-collapse: collapse; color: var(--ink); font-size: .7rem; line-height: 1.15; }
.voicing-table th, .voicing-table td { padding: 3px 2px; text-align: center; border-top: 1px solid rgba(117,137,147,.24); }
.voicing-table thead th { padding-top: 2px; color: #68767d; font-size: .6rem; font-weight: 900; border-top: 0; }
.voicing-table th:first-child { width: 34%; text-align: left; color: #31576a; font-weight: 900; }
.voicing-table td { font-weight: 850; }
.voicing-card-footer { display: flex !important; justify-content: flex-end; min-height: 13px; margin: 3px 0 0 !important; }
.result-list .voicing-category { position: static; color: #3d8e68; font-size: .6rem; font-weight: 900; }
.result-list .voicing-category.rootless { color: #d26071; }
.result-list .voicing-category.shell { color: #8b68ad; }

:root[data-theme="dark"] .string-label .note-button.selected { background: #147cad; border-color: #0d5f88; color: #fff; box-shadow: 0 0 0 4px rgba(20,124,173,.28); }
:root[data-theme="dark"] .note-cell button.selected { background: #147cad; border-color: #0d5f88; color: #fff; box-shadow: 0 0 0 6px rgba(20,124,173,.28); }
:root[data-theme="dark"] .voicing-table thead th { color: #c0d0d7; }
:root[data-theme="dark"] .voicing-table th:first-child { color: #b9ddef; }
:root[data-theme="dark"] .result-control-group { border-color: #3b5663; background: rgba(11,28,37,.42); }

.footer-bar { grid-column: 1 / -1; grid-row: 4; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; padding: 0 12px 0 4px; }
.feedback-dock { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .72rem; font-weight: 800; }
.feedback-dock button { border: 1px solid var(--blue); border-radius: 999px; padding: 8px 16px; background: transparent; color: var(--blue-dark); font-weight: 850; }
.volume-control { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; color: var(--blue-dark); font-size: .78rem; font-weight: 900; }
.volume-control input { width: 100%; accent-color: var(--blue); }
.night-mode-control { display: flex !important; align-items: center; justify-content: space-between; gap: 18px; }
.night-mode-control input { width: 42px; height: 23px; accent-color: var(--blue); }
.banjo-switch { width: 100%; cursor: grab; touch-action: pan-y; user-select: none; }
.banjo-switch.dragging { cursor: grabbing; }
:root[data-theme="dark"] .banjo-switch { border-color: #607682; background: #263944; }
:root[data-theme="dark"] .banjo-switch button { color: #c4d0d6; }
:root[data-theme="dark"] .banjo-switch button.active { background: #147cad; color: #fff; box-shadow: 0 3px 10px rgba(20,124,173,.38); }
.accidental-select { display: block; }
.accidental-select select { width: 100%; min-height: 42px; padding: 7px 38px 7px 13px; border: 1px solid #aebbc1; border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-weight: 850; cursor: pointer; }
.accidental-select select:focus-visible { outline: 3px solid rgba(23,124,173,.22); border-color: var(--blue); }
.copyright { max-width: 100%; justify-self: end; padding-right: 2px; color: var(--muted); font-size: .72rem; line-height: 1.4; text-align: right; }
.copyright a { color: inherit; font-weight: 800; }

.feedback-dialog, .app-dialog { width: min(480px, calc(100% - 32px)); border: 0; border-radius: 20px; padding: 0; box-shadow: 0 24px 80px rgba(0,0,0,.3); }
.feedback-dialog::backdrop, .app-dialog::backdrop { background: rgba(12,24,30,.55); backdrop-filter: blur(3px); }
.feedback-dialog form { display: grid; gap: 14px; padding: 22px; }
.dialog-heading { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.dialog-heading strong, .dialog-heading span { display: block; }
.dialog-heading strong { font-size: 1.25rem; }
.dialog-heading span { color: var(--muted); font-size: .75rem; margin-top: 3px; }
.dialog-close { border: 0; background: transparent; font-size: 1.7rem; line-height: 1; }
.feedback-dialog label { display: grid; gap: 5px; font-weight: 800; font-size: .85rem; }
.feedback-dialog label span { color: var(--muted); font-weight: 600; }
.feedback-dialog textarea, .feedback-dialog input { width: 100%; border: 1px solid #b7c0c4; border-radius: 10px; padding: 10px; }
.feedback-dialog textarea { min-height: 130px; resize: vertical; }
.feedback-submit { min-height: 44px; }
.feedback-status { min-height: 18px; color: var(--blue-dark); font-size: .8rem; font-weight: 800; }
.honeypot { position: absolute !important; left: -10000px !important; opacity: 0 !important; }

.app-dialog form, .help-content { display: grid; gap: 15px; padding: 22px; }
.dialog-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.dialog-fieldset legend, .app-dialog label > span { display: block; margin: 0 0 6px; color: var(--muted); font-size: .76rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.config-dialog .segmented { width: 100%; }
.config-dialog .tuning-control { display: grid; gap: 0; }
.config-dialog .volume-control { display: grid; gap: 5px; font-weight: 900; }
.config-dialog .volume-control input { width: 100%; accent-color: var(--blue); }
.config-dialog .language-toggle button { width: auto; min-height: 40px; font-size: .9rem; font-weight: 850; }
.config-dialog .language-toggle button:focus-visible { outline: 0; background: transparent; box-shadow: inset 0 -3px 0 #d2a82f; }
.config-dialog .language-toggle button.active:focus-visible { background: var(--blue); color: white; box-shadow: inset 0 -3px 0 #f4d56a; }
:root[data-theme="dark"] .config-dialog .language-toggle button.active:focus-visible { background: #147cad; color: white; }
.favorites-dialog { width: min(1040px, calc(100% - 32px)); }
.favorites-content { display: grid; gap: 10px; max-height: min(760px, calc(100vh - 48px)); padding: 18px; }
.favorites-empty { margin: 8px 0; color: var(--muted); text-align: center; }
.favorites-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.favorites-toolbar button { min-height: 34px; padding: 5px 12px; border: 1px solid #aebbc1; border-radius: 999px; background: white; color: var(--blue-dark); font-size: .76rem; font-weight: 850; }
:root[data-theme="dark"] .favorites-toolbar button,
:root[data-theme="dark"] .dialog-cancel { border-color: #5f7480; background: #fff; color: #0d5f88; }
:root[data-theme="dark"] .dialog-done { background: #147cad; color: #fff; }
:root[data-theme="dark"] .favorite-card-heading strong,
:root[data-theme="dark"] .favorite-remove { color: #0d5f88; }
:root[data-theme="dark"] .favorite-select input { accent-color: #147cad; }
.favorites-toolbar button:disabled { cursor: default; opacity: .42; }
.favorites-list { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; min-height: 0; max-height: 54vh; margin: 0; padding: 0 3px 0 0; overflow-y: auto; list-style: none; }
.favorite-entry { position: relative; min-width: 0; padding: 8px 30px 7px; border: 1px solid #d3dde1; border-radius: 12px; background: #fffdf8; color: var(--ink); }
.favorite-select { position: absolute; top: 7px; left: 7px; display: grid; place-items: center; min-height: 28px; }
.favorite-select input { width: 20px; height: 20px; accent-color: var(--blue); }
.favorite-card-heading { display: grid; justify-items: center; min-height: 27px; margin-bottom: 0; text-align: center; }
.favorite-card-heading strong { color: var(--blue-dark); font-size: 1.2rem; line-height: 1.1; }
.favorite-card table, .print-sheet table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .74rem; }
.favorite-card th, .favorite-card td, .print-sheet th, .print-sheet td { padding: 4px 6px; border-top: 1px solid #e0e6e8; text-align: center; }
.favorite-card th, .print-sheet th { width: 82px; color: var(--muted); text-align: left; font-size: .66rem; text-transform: uppercase; }
.favorite-remove { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 1.25rem; line-height: 1; }
.favorite-remove:hover { background: #fee8e8; color: #a83232; }
.favorites-actions { margin-top: 2px; }
.favorites-actions button:disabled { cursor: default; opacity: .42; }
.favorite-card .print-chord-diagram { width: min(150px,100%); margin: 0 auto; }
.print-chord-diagram svg { display: block; width: 100%; height: auto; overflow: visible; }
.diagram-open-marker, .diagram-finger, .diagram-position { font-family: "Segoe UI", Arial, sans-serif; text-anchor: middle; dominant-baseline: middle; font-weight: 800; fill: #18242b; }
.diagram-open-marker { font-size: 19px; }
.diagram-open-circle { fill: white; stroke: #18242b; stroke-width: 2; }
.diagram-fret-dot { fill: #147cad; stroke: #0d5f88; stroke-width: 1.5; }
.diagram-finger { fill: white; font-size: 14px; }
.diagram-position { font-size: 14px; }
.diagram-note-row { display: grid; grid-template-columns: repeat(3,1fr); margin: -1px 13px 0; border-top: 1px solid #cbd4d8; padding-top: 3px; color: #18242b; font-size: .78rem; font-weight: 800; text-align: center; }
.print-sheet { display: none; }

@media print {
  @page { margin: .35in; }
  body::before, .app-shell, dialog { display: none !important; }
  body { overflow: visible; background: white; color: #111; }
  .print-sheet { display: block; color: #111; font-family: "Segoe UI", Arial, sans-serif; }
  .print-sheet header { margin-bottom: 12px; border-bottom: 2px solid #147cad; padding-bottom: 8px; }
  .print-sheet h1 { margin: 0; color: #0d5f88; font-size: 18pt; }
  .print-sheet header p, .print-sheet header small { margin: 4px 0 0; color: #4e5b62; }
  .print-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 5px; }
  .print-sheet article { break-inside: avoid; border: 0; border-radius: 0; background: transparent; padding: 3px 1px; }
  .print-sheet h2 { margin: 0 0 1px; color: #0d5f88; font-size: 11pt; text-align: center; }
  .print-chord-diagram { width: 108px; max-width: 100%; margin: 0 auto; }
  .print-chord-diagram svg { display: block; width: 100%; height: auto; overflow: visible; }
  .diagram-open-marker, .diagram-finger, .diagram-position { font-family: "Segoe UI", Arial, sans-serif; text-anchor: middle; dominant-baseline: middle; font-weight: 800; fill: #18242b; }
  .diagram-open-marker { font-size: 18px; }
  .diagram-open-circle { fill: white; stroke: #18242b; stroke-width: 2; }
  .diagram-fret-dot { fill: #147cad; stroke: #0d5f88; stroke-width: 1.5; }
  .diagram-finger { fill: white; font-size: 13px; }
  .diagram-position { font-size: 13px; }
  .diagram-note-row { display: grid; grid-template-columns: repeat(3,1fr); margin: -1px 13px 0; border-top: 1px solid #cbd4d8; padding-top: 4px; color: #18242b; font-size: 8pt; font-weight: 800; text-align: center; }
  .print-sheet footer { margin-top: 20px; border-top: 1px solid #cbd4d8; padding-top: 8px; color: #5d6a72; font-size: 8pt; }
}
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-cancel { min-height: 44px; border: 1px solid rgba(20,124,173,.55); border-radius: 13px; background: white; color: var(--blue-dark); font-weight: 900; }
.dialog-done { min-height: 44px; border: 0; border-radius: 13px; background: var(--blue); color: white; font-weight: 900; }
.confirm-dialog { width: min(430px, calc(100% - 32px)); }
.confirm-content { display: grid; gap: 12px; padding: 24px; }
.confirm-content > strong { color: var(--ink); font-size: 1.25rem; }
.confirm-content p { margin: 0 0 6px; color: var(--muted); line-height: 1.45; }
.dialog-danger { min-height: 44px; border: 0; border-radius: 13px; background: #c63d36; color: white; font-weight: 900; }
.dialog-danger:hover { background: #a92f29; }
.help-dialog p { margin: 0; color: #3d4b53; font-size: .88rem; line-height: 1.5; white-space: pre-line; }
.help-dialog .fingering-caveat { padding-top: 12px; border-top: 1px solid #d3dde1; color: var(--muted); font-size: .8rem; }

@media (max-width: 1400px) and (min-width: 1121px) {
  html[lang="es"] .brand-block h1 { max-width: 230px; font-size: 1.55rem; line-height: 1; white-space: normal; }
  html[lang="es"] .brand-block h1 span { display: block; }
}

@media (max-height: 880px) and (min-width: 1121px) {
  body { overflow: auto; }
  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto auto auto;
    overflow: visible;
  }
}

@media (max-width: 1120px) {
  body { overflow: auto; }
  .app-shell { display: block; height: auto; min-height: 100vh; overflow: visible; padding: 18px 16px 22px; }
  .topbar { grid-template-columns: 1fr; gap: 18px; }
  .brand-block h1 { white-space: normal; }
  .neck-section { margin-top: 16px; }
  .work-area { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
  .chord-card, .utility-card, .results-card { grid-column: auto; grid-row: auto; }
  .utility-card { grid-template-columns: 1fr; }
  .results-card { min-height: 360px; }
  .result-list { grid-template-columns: minmax(0, 1fr); }
  .footer-bar { grid-template-columns: 1fr 1fr; margin-top: 16px; }
  .copyright { justify-self: start; }
}

@media (max-width: 900px) {
  .favorites-list { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 620px) {
  .app-shell { padding: 14px 10px 20px; }
  .brand-block { align-items: center; flex-direction: row; gap: 10px; }
  .neck-stage { grid-template-columns: 32px minmax(0,1fr) 36px; }
  .notation-panel { display: none; }
  .move-controls button { min-height: 46px; }
  .neck-scroll-controls button { min-height: 96px; }
  .type-buttons { grid-template-columns: 1fr; }
  .fretboard { --cell: 44px; --label: 29px; }
  .result-list { grid-template-columns: 1fr; }
  .favorites-list { grid-template-columns: 1fr; }
  .footer-bar { grid-template-columns: 1fr; }
  .copyright { order: 4; padding-right: 0; text-align: left; }
}
