/* ============================================================
   FretLab — стили
   ============================================================ */

:root {
  --bg: #14110f;
  --bg-2: #1b1714;
  --panel: #221d19;
  --panel-2: #2a2320;
  --line: #3a302a;
  --line-soft: #2f2722;
  --text: #f0e6da;
  --muted: #a89a8c;
  --muted-2: #7d7166;

  --amber: #e8a33d;
  --amber-dim: #b97e26;
  --cream: #f7e9cf;

  --green: #5fbf7f;
  --green-dim: #2f7a4c;
  --red: #e2585c;
  --red-dim: #8e2f36;
  --blue: #6fa8dc;
  --violet: #b28ee0;

  --wood-1: #3b2a1d;
  --wood-2: #2b1e14;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 3px 10px rgba(0, 0, 0, .25);

  --font: 'Segoe UI', system-ui, -apple-system, 'Inter', Roboto, sans-serif;
  --mono: 'Cascadia Mono', 'Consolas', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1200px 600px at 12% -8%, #2a1f18 0%, transparent 60%),
    radial-gradient(900px 500px at 92% 4%, #241b2a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 22px;
  background: rgba(20, 17, 15, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 20px;
  background: linear-gradient(150deg, var(--amber), #a5651a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 4px 14px rgba(232, 163, 61, .22);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.brand-text strong { font-size: 17px; letter-spacing: .3px; }
.brand-text small { font-size: 11px; color: var(--muted-2); letter-spacing: .4px; }

.tabs {
  display: flex;
  gap: 4px;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, color .16s, border-color .16s;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.tab[aria-selected="true"] {
  color: var(--cream);
  background: linear-gradient(180deg, rgba(232, 163, 61, .2), rgba(232, 163, 61, .07));
  border-color: rgba(232, 163, 61, .38);
}

.topbar-tools { display: flex; gap: 6px; flex: 0 0 auto; align-items: center; }

.seg-compact { padding: 2px; }
.seg-compact button {
  padding: 6px 9px;
  font-size: 12px;
  border-radius: 7px;
}

.tool-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.tool-btn:hover { border-color: var(--amber-dim); background: var(--panel-2); }
.tool-btn:active { transform: scale(.94); }
.tool-btn[aria-pressed="false"] { color: var(--muted-2); }

/* ---------- основная область ---------- */

.main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 40px;
}

.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.view-head { margin-bottom: 22px; }
.view-head h1 {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: -.3px;
}
.view-head p { margin: 0; color: var(--muted); max-width: 68ch; }

/* ---------- общие блоки ---------- */

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--muted-2);
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--muted-2);
}

select, input[type="text"], input[type="number"] {
  appearance: none;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus {
  border-color: var(--amber-dim);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, .14);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a89a8c' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, border-color .15s, background .15s, color .15s;
  user-select: none;
}
.btn:hover { border-color: var(--amber-dim); }
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #f0b45c, var(--amber));
  border-color: #c98a2c;
  color: #241704;
  box-shadow: 0 4px 14px rgba(232, 163, 61, .22);
}
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost { background: transparent; }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 9px; }

/* ---------- гриф ---------- */

.fretboard-host {
  width: 100%;
  overflow-x: auto;
  padding: 4px 0 8px;
  scrollbar-width: thin;
}

svg.fretboard {
  display: block;
  user-select: none;
  touch-action: manipulation;
}

.fb-board { fill: url(#fb-wood); fill: var(--wood-1); }
.fb-fret {
  stroke: #8d8578;
  opacity: .55;
}
.fb-nut {
  stroke: #efe4d3;
  opacity: .92;
  stroke-linecap: round;
}
.fb-string {
  stroke: #cbbfae;
  stroke-linecap: round;
  opacity: .8;
}
.fb-inlay { fill: #d9cbb6; opacity: .5; }
.fb-fretnum {
  fill: var(--muted-2);
  font-size: 11px;
  font-family: var(--mono);
}
.fb-tuning {
  fill: var(--muted-2);
  font-size: 10.5px;
  font-family: var(--mono);
  font-weight: 600;
}
.fb-state-bg {
  fill: rgba(255, 255, 255, .03);
  stroke: var(--line);
  stroke-width: 1;
}
.fb-state.clickable { cursor: pointer; }
.fb-state.clickable:hover .fb-state-bg { fill: rgba(232, 163, 61, .16); stroke: var(--amber-dim); }

.fb-open-mark {
  fill: none;
  stroke: var(--green);
  stroke-width: 2;
}
.fb-mute-mark {
  fill: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.fb-cell { fill: transparent; cursor: pointer; }
.fb-cell:hover { fill: rgba(232, 163, 61, .1); }

.fb-placed-dot {
  fill: var(--amber);
  stroke: #2a1c08;
  stroke-width: 1.6;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
}
.fb-placed { cursor: default; }
.fb-placed.clickable { cursor: pointer; }
.fb-placed.clickable:hover .fb-placed-dot { fill: #ffc272; }
.fb-placed-label {
  fill: #2a1c08;
  font-size: 10.5px;
  font-weight: 800;
  pointer-events: none;
}

.fb-dot { fill: var(--blue); opacity: .85; }
.fb-dot-root { fill: var(--amber); opacity: .95; }
.fb-dot-label {
  fill: #10171d;
  font-size: 9.5px;
  font-weight: 800;
  pointer-events: none;
}
.fb-marker-note .fb-dot-label { fill: #0d1418; }

.fb-focus-ring {
  fill: none;
  stroke: var(--violet);
  stroke-width: 2.4;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: .35; stroke-width: 2; }
  50% { opacity: 1; stroke-width: 3.2; }
}

/* ---------- мини-диаграммы ---------- */

.mini-chord { display: block; width: 100%; height: auto; }
.mini-string { stroke: #9d9184; stroke-width: 1; opacity: .6; }
.mini-fret { stroke: #9d9184; stroke-width: 1; opacity: .6; }
.mini-nut { stroke: #efe4d3; stroke-width: 3; stroke-linecap: round; }
.mini-dot { fill: var(--amber); }
.mini-open { fill: none; stroke: var(--green); stroke-width: 1.8; }
.mini-mute { fill: var(--red); font-size: 8.5px; font-weight: 700; }
.mini-name { fill: var(--cream); font-size: 11px; font-weight: 700; }
.mini-base { fill: var(--muted-2); font-size: 9px; font-family: var(--mono); }

/* ---------- справочник аккордов ---------- */

.lookup-bar {
  display: grid;
  grid-template-columns: 1.2fr 1.6fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}
@media (max-width: 640px) {
  .lookup-bar { grid-template-columns: 1fr; }
}

.chord-hero {
  display: grid;
  grid-template-columns: minmax(170px, 210px) 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  .chord-hero { grid-template-columns: 1fr; }
}

.chord-hero-name {
  margin: 0;
  font-size: 38px;
  letter-spacing: -.8px;
  line-height: 1.05;
}
.chord-hero-sub { color: var(--muted); margin: 4px 0 14px; font-size: 14px; }

.pill-row { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.pill.root { border-color: rgba(232, 163, 61, .5); color: var(--amber); background: rgba(232, 163, 61, .1); }
.pill.third { border-color: rgba(111, 168, 220, .45); color: var(--blue); background: rgba(111, 168, 220, .1); }
.pill.fifth { border-color: rgba(95, 191, 127, .4); color: var(--green); background: rgba(95, 191, 127, .1); }
.pill.other { border-color: rgba(178, 142, 224, .4); color: var(--violet); background: rgba(178, 142, 224, .1); }

.voicing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.voicing {
  padding: 8px 6px 6px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, transform .1s;
}
.voicing:hover { border-color: var(--amber-dim); background: var(--panel); transform: translateY(-1px); }
.voicing[aria-pressed="true"] {
  border-color: var(--amber);
  background: rgba(232, 163, 61, .1);
  box-shadow: 0 0 0 1px rgba(232, 163, 61, .3) inset;
}
.voicing-label {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted-2);
  font-weight: 600;
}

.table-notes {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table-notes th, .table-notes td {
  padding: 7px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.table-notes th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted-2);
  font-weight: 700;
}
.table-notes tr:last-child td { border-bottom: none; }
.table-notes .dim { color: var(--muted-2); }
.table-notes .root-note { color: var(--amber); font-weight: 700; }

.chord-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
}
.chord-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 6px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .14s, background .14s;
}
.chord-chip:hover { border-color: var(--amber-dim); background: var(--panel); }
.chord-chip.active {
  border-color: var(--amber);
  background: rgba(232, 163, 61, .14);
  color: var(--cream);
}

/* ---------- конструктор ---------- */

.builder-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 940px) {
  .builder-grid { grid-template-columns: 1fr; }
}

.result-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(232, 163, 61, .09), transparent 65%), var(--bg-2);
  padding: 16px;
}

.result-name {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -.8px;
  line-height: 1.05;
  margin: 0 0 2px;
  color: var(--cream);
}
.result-name.unknown { color: var(--muted); font-size: 22px; }
.result-sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.result-notes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.alt-list { display: flex; flex-wrap: wrap; gap: 6px; }
.alt-btn {
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.alt-btn:hover { border-color: var(--amber-dim); color: var(--text); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row span { font-size: 13px; color: var(--muted); }

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .18s, border-color .18s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .18s, background .18s;
}
.switch[aria-checked="true"] { background: rgba(232, 163, 61, .28); border-color: var(--amber-dim); }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: var(--amber); }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.seg button {
  padding: 6px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.seg button[aria-pressed="true"] {
  background: rgba(232, 163, 61, .18);
  color: var(--cream);
  box-shadow: inset 0 0 0 1px rgba(232, 163, 61, .35);
}

.builder-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.boxes-overview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.box-card { padding: 12px; }
.box-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.box-card-head strong { font-size: 13.5px; }
.box-card-head span { font-size: 11.5px; color: var(--muted-2); font-family: var(--mono); }

.practice-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13.5px;
}
.practice-list li { margin-bottom: 7px; }
.practice-list li::marker { color: var(--amber); }

/* ---------- тренажёры ---------- */

.trainer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.score { display: flex; gap: 18px; }
.score-item { display: flex; flex-direction: column; gap: 1px; }
.score-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted-2);
  font-weight: 700;
}
.score-value { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }

.task-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(178, 142, 224, .28);
  background: linear-gradient(120deg, rgba(178, 142, 224, .12), transparent 60%), var(--bg-2);
  margin-bottom: 16px;
}
.task-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--muted-2);
  font-weight: 700;
  margin-bottom: 3px;
}
.task-value { font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.task-hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 7px;
}
.answer-btn {
  padding: 11px 6px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .13s, background .13s, transform .1s;
}
.answer-btn:hover:not(:disabled) { border-color: var(--amber-dim); background: var(--panel); }
.answer-btn:disabled { cursor: default; }
.answer-btn.correct {
  border-color: var(--green);
  background: rgba(95, 191, 127, .18);
  color: #c8f2d6;
}
.answer-btn.wrong {
  border-color: var(--red);
  background: rgba(226, 88, 92, .16);
  color: #ffd4d5;
}
.answer-btn.chosen { box-shadow: inset 0 0 0 1.5px currentColor; }

.feedback {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  display: none;
}
.feedback.show { display: block; }
.feedback.good {
  border-color: var(--green-dim);
  background: rgba(95, 191, 127, .12);
  color: #c8f2d6;
}
.feedback.bad {
  border-color: var(--red-dim);
  background: rgba(226, 88, 92, .11);
  color: #ffd0d1;
}

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.legend .dot-root { background: var(--amber); }
.legend .dot-note { background: var(--blue); }
.legend .dot-target { background: var(--violet); }

/* ---------- гаммы ---------- */

.box-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
}
.box-btn {
  padding: 8px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.box-btn:hover { border-color: var(--amber-dim); color: var(--text); }
.box-btn[aria-pressed="true"] {
  border-color: var(--amber);
  background: rgba(232, 163, 61, .16);
  color: var(--cream);
}

.scale-degrees {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.fret-range {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fret-range input[type="range"] { flex: 1; accent-color: var(--amber); }

/* ---------- обозначения аккордов ---------- */

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2px 24px;
}
.symbol-row {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}
.symbol-code {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--amber);
  background: rgba(232, 163, 61, .09);
  border: 1px solid rgba(232, 163, 61, .22);
  border-radius: 6px;
  padding: 3px 7px;
  text-align: center;
  white-space: nowrap;
}
.symbol-what { font-size: 13px; color: var(--muted); }

.group-lead {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 13.5px;
  max-width: 76ch;
}

.guide-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  align-items: start;
  gap: 10px;
}
@media (max-width: 560px) {
  .guide-items { grid-template-columns: 1fr; }
}

.guide-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  padding: 13px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.guide-item:hover { border-color: var(--amber-dim); background: var(--panel); }
.guide-item:focus-visible { outline: 2px solid var(--amber-dim); outline-offset: 2px; }
.guide-item.open {
  border-color: rgba(232, 163, 61, .45);
  background: linear-gradient(160deg, rgba(232, 163, 61, .07), transparent 70%), var(--bg-2);
}

.guide-item-head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
}
.guide-item-titles { min-width: 0; }
.guide-item-name {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--cream);
}
.guide-item-type {
  font-size: 11.5px;
  color: var(--muted-2);
  display: block;
  line-height: 1.35;
}
.guide-item-diagram { width: 52px; flex: 0 0 auto; opacity: .95; }
.guide-item-checksvg { display: none; }
.guide-item-chevron {
  font-size: 18px;
  font-weight: 400;
  color: var(--amber);
  width: 20px;
  text-align: center;
  line-height: 1;
}

.guide-item-plain {
  margin: 10px 0 6px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}
.guide-item-compare {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted-2);
}
.guide-item-compare strong { color: var(--muted); font-weight: 600; }

.guide-item-body {
  margin-top: 13px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  cursor: default;
}

.guide-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.guide-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* линейка полутонов */

.ruler { margin-top: 2px; }
.ruler-track {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 3px;
}
.ruler-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 1px 5px;
  border-radius: 7px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .015);
  min-width: 0;
}
.ruler-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
}
.ruler-label {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
  line-height: 1;
  white-space: nowrap;
}
.ruler-note {
  font-size: 10px;
  font-weight: 700;
  color: transparent;
  line-height: 1.1;
  white-space: nowrap;
}
.ruler-cell.active {
  border-color: rgba(111, 168, 220, .5);
  background: rgba(111, 168, 220, .13);
}
.ruler-cell.active .ruler-dot { background: var(--blue); box-shadow: 0 0 6px rgba(111, 168, 220, .7); }
.ruler-cell.active .ruler-label { color: var(--blue); }
.ruler-cell.active .ruler-note { color: var(--text); }
.ruler-cell.is-root {
  border-color: rgba(232, 163, 61, .65);
  background: rgba(232, 163, 61, .16);
}
.ruler-cell.is-root .ruler-dot { background: var(--amber); box-shadow: 0 0 7px rgba(232, 163, 61, .8); }
.ruler-cell.is-root .ruler-label { color: var(--amber); }

.ruler-legend {
  display: flex;
  gap: 14px;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--muted-2);
}
.ruler-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ruler-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
}
.ruler-swatch.active { background: rgba(232, 163, 61, .3); border-color: var(--amber-dim); }

/* пример чтения названия */

.read-example {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.read-part {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
}
.read-part small {
  font-family: var(--font);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted-2);
}
.read-part-0 { border-color: rgba(232, 163, 61, .5); color: var(--amber); background: rgba(232, 163, 61, .09); }
.read-part-1 { border-color: rgba(111, 168, 220, .45); color: var(--blue); background: rgba(111, 168, 220, .09); }
.read-part-2 { border-color: rgba(178, 142, 224, .45); color: var(--violet); background: rgba(178, 142, 224, .09); }

/* ---------- интервалы ---------- */

.interval-controls {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 12px;
  align-items: end;
}
@media (max-width: 720px) {
  .interval-controls { grid-template-columns: 1fr; }
}

.interval-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.interval-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(232, 163, 61, .45);
  background: rgba(232, 163, 61, .1);
}
.interval-badge strong {
  font-size: 20px;
  color: var(--amber);
  font-family: var(--mono);
  line-height: 1.1;
}
.interval-badge small {
  font-size: 10.5px;
  color: var(--muted-2);
  white-space: nowrap;
}
.interval-name { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.interval-sub { font-size: 13px; color: var(--muted); }

.interval-feel {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}

.interval-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.interval-meta > div { display: flex; flex-direction: column; gap: 2px; }
.interval-meta strong { font-size: 14px; }

.iv-consonant { color: var(--green); }
.iv-neutral { color: var(--blue); }
.iv-mid { color: var(--violet); }
.iv-dissonant { color: var(--red); }

.iv-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  border: 1px solid currentColor;
  opacity: .85;
  white-space: nowrap;
}

.interval-song {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.interval-song p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

/* расстояние между струнами */

.gap-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.gap-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 11px 6px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text);
  cursor: pointer;
  transition: border-color .14s, background .14s;
}
.gap-cell:hover { border-color: var(--amber-dim); background: var(--panel); }
.gap-cell.special {
  border-color: rgba(226, 88, 92, .5);
  background: rgba(226, 88, 92, .08);
}
.gap-strings { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.gap-semi { font-size: 18px; color: var(--cream); }
.gap-name { font-size: 10.5px; color: var(--muted-2); }

/* таблица интервалов */

.interval-table-wrap { overflow-x: auto; }
.interval-table { min-width: 620px; }
.interval-table tbody tr { cursor: pointer; }
.interval-table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.interval-table tr.active { background: rgba(232, 163, 61, .1); }
.interval-table tr.active td:first-child { box-shadow: inset 2px 0 0 var(--amber); }
.iv-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  width: 78px;
}
.iv-degree {
  font-family: var(--mono);
  color: var(--muted);
  width: 62px;
}

/* ---------- футер и тост ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  padding: 18px 22px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 16px);
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
  max-width: min(90vw, 460px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.good { border-color: var(--green-dim); }
.toast.bad { border-color: var(--red-dim); }

kbd {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 11.5px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
