/* =========================================================================
   Harmony Lab — оформление
   ========================================================================= */

:root {
  --bg: #08090c;
  --panel: rgba(255, 255, 255, 0.038);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #efece5;
  --muted: #9c968c;
  --dim: #6d6962;
  --gold: #d9a95a;
  --gold-soft: rgba(217, 169, 90, 0.12);
  --teal: #8fc4b6;
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection { background: rgba(217, 169, 90, 0.28); color: #fff; }

/* ------------------------------- фон ---------------------------------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 620px at 10% -12%, rgba(217, 169, 90, 0.14), transparent 62%),
    radial-gradient(760px 520px at 94% 4%, rgba(96, 138, 168, 0.11), transparent 66%),
    radial-gradient(1100px 760px at 50% 118%, rgba(217, 169, 90, 0.055), transparent 62%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.topbar,
.layout,
.footer { position: relative; z-index: 2; }

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

.topbar {
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 32px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  width: 38px;
  height: 38px;
  padding: 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.01));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.brand-mark span {
  flex: 1;
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(180deg, #f6f1e5, #b7b0a2);
}
.brand-mark span:nth-child(2),
.brand-mark span:nth-child(4) { height: 60%; background: linear-gradient(180deg, #cfc8ba, #8f887b); }

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

.brand-kicker {
  margin: 0;
  font-size: 9.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #f7f3ea;
}

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

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: 500 12.5px var(--font-ui);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.toggle:hover { color: var(--text); border-color: var(--line-strong); }

.toggle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #47433d;
  transition: background 0.18s, box-shadow 0.18s;
}

.toggle[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(217, 169, 90, 0.38);
  background: rgba(217, 169, 90, 0.09);
}

.toggle[aria-pressed="true"] .toggle-dot {
  background: var(--gold);
  box-shadow: 0 0 9px rgba(217, 169, 90, 0.85);
}

.toggle:focus-visible,
.ghost-btn:focus-visible,
.mini:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ------------------------------ каркас -------------------------------- */

.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stage { display: flex; flex-direction: column; gap: 14px; }

/* --------------------------- сейчас играет ---------------------------- */

.now-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr 0.85fr;
  align-items: stretch;
  padding: 22px 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.016));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 70px -50px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}

.now-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 8%;
  right: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(217, 169, 90, 0.6), transparent);
}

.now-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 0 26px;
  min-width: 0;
}
.now-cell:first-child { padding-left: 0; }
.now-cell:not(:first-child) { border-left: 1px solid var(--line); }

.now-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3b3833;
  transition: background 0.2s, box-shadow 0.2s;
}
.live-dot.is-live {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(217, 169, 90, 0.9);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.now-big {
  font-family: var(--font-display);
  font-size: clamp(38px, 4.6vw, 58px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fcf8ef;
  min-height: 58px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.25s;
}

.now-mid {
  font-family: var(--font-display);
  font-size: clamp(23px, 2.6vw, 33px);
  line-height: 1.15;
  min-height: 38px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.25s;
}

.now-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
  min-height: 18px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.now-panel.is-idle .now-big { color: #cfc7b8; }
.now-panel.is-idle .now-mid { color: #a9a294; }

.now-panel.is-empty .now-big,
.now-panel.is-empty .now-mid { color: #57534c; }

/* ------------------------------ рояль --------------------------------- */

.piano-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 16px 6px;
  background: linear-gradient(180deg, #16171c 0%, #101116 55%, #0b0c10 100%);
  box-shadow: 0 30px 70px -40px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.piano-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 6px;
  scrollbar-width: thin;
  scrollbar-color: #37383f transparent;
}
.piano-scroll::-webkit-scrollbar { height: 8px; }
.piano-scroll::-webkit-scrollbar-track { background: transparent; }
.piano-scroll::-webkit-scrollbar-thumb { background: #33343b; border-radius: 99px; }
.piano-scroll::-webkit-scrollbar-thumb:hover { background: #45464e; }

.piano {
  position: relative;
  height: clamp(172px, 23vh, 238px);
  min-width: 1080px;
  touch-action: pan-x;
  user-select: none;
  -webkit-user-select: none;
}

.piano::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 34px;
  z-index: 3;
  pointer-events: none;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
}

.key {
  position: absolute;
  top: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.08s ease, box-shadow 0.12s ease, transform 0.08s ease;
}

.key:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -3px;
  z-index: 8;
}

.key--white {
  height: 100%;
  z-index: 1;
  border-radius: 0 0 7px 7px;
  background: linear-gradient(180deg, #fdfbf6 0%, #f4f0e6 62%, #e3ded1 100%);
  box-shadow:
    inset 0 -10px 14px -6px rgba(0, 0, 0, 0.2),
    inset -1px 0 0 rgba(0, 0, 0, 0.16),
    1px 0 0 rgba(255, 255, 255, 0.45);
}
.key--white:hover { background: linear-gradient(180deg, #fffdf8, #f7f3e9 62%, #e9e4d7); }
.key--white.is-active {
  background: linear-gradient(180deg, #ffe8b6 0%, #f2c983 55%, #ddab60 100%);
  box-shadow:
    inset 0 -8px 16px -6px rgba(150, 95, 10, 0.5),
    0 0 26px rgba(217, 169, 90, 0.35);
  transform: translateY(1px);
}

.key--black {
  height: 62%;
  z-index: 2;
  border-radius: 0 0 5px 5px;
  background: linear-gradient(180deg, #3b3d44 0%, #191a1f 55%, #07080b 100%);
  box-shadow:
    0 5px 9px rgba(0, 0, 0, 0.55),
    inset 0 -3px 0 rgba(255, 255, 255, 0.05),
    inset 1px 0 0 rgba(255, 255, 255, 0.07);
}
.key--black:hover { background: linear-gradient(180deg, #44474f, #1d1f25 55%, #0a0b0e); }
.key--black.is-active {
  background: linear-gradient(180deg, #e9c17e 0%, #a97e35 60%, #7a5820 100%);
  box-shadow: 0 0 24px rgba(217, 169, 90, 0.45), inset 0 -2px 0 rgba(255, 255, 255, 0.16);
}

.key-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: #8c8677;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
body.show-labels .key-note { opacity: 1; }
.key.is-c .key-note { opacity: 1; font-weight: 700; color: #5b5547; }

.key-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 27px;
  font-size: 10px;
  font-weight: 600;
  color: #b4ae9f;
  text-align: center;
  pointer-events: none;
  opacity: 0.8;
}
.key--black .key-hint { bottom: 7px; color: #c6c1b5; opacity: 0.7; }

.key--white.is-active .key-note,
.key--white.is-active .key-hint { color: #5a4417; }
.key--black.is-active .key-hint { color: #2a1d06; }

/* ---------------------------- панель под роялем ----------------------- */

.piano-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 6px 8px;
  font-size: 12px;
  color: var(--muted);
}

.octave-ctl { display: flex; align-items: center; gap: 8px; }

.bar-label {
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-right: 2px;
}

.mini {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.mini:hover { border-color: rgba(217, 169, 90, 0.45); color: var(--gold); }

.octave-value {
  min-width: 82px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
}

.hint {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0;
  color: var(--dim);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-width: 2px;
  background: rgba(255, 255, 255, 0.05);
  font: 600 10px/1 var(--font-ui);
  color: #c7c1b4;
}

.hint-sep { opacity: 0.4; margin: 0 3px; }

.ghost-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font: 500 12px var(--font-ui);
  cursor: pointer;
  transition: color 0.18s, border-color 0.18s;
  white-space: nowrap;
}
.ghost-btn:hover { color: var(--text); border-color: var(--line-strong); }

/* ------------------------------- карточки ------------------------------ */

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 252px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.042), rgba(255, 255, 255, 0.011));
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.card-index {
  font: 600 10px/1 var(--font-ui);
  letter-spacing: 0.1em;
  color: var(--gold);
  opacity: 0.75;
}

.card h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-tag {
  margin-left: auto;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-transform: lowercase;
  text-align: right;
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.card--chord { grid-column: span 5; }
.card--key { grid-column: span 4; }
.card--func { grid-column: span 3; }
.card--intervals,
.card--structure,
.card--tension { grid-column: span 4; }
.card--history { grid-column: span 7; }
.card--next { grid-column: span 5; }

/* ------------------------------ аккорд -------------------------------- */

.chord-hero { display: flex; flex-direction: column; gap: 6px; }

.chord-symbol {
  font-family: var(--font-display);
  font-size: clamp(38px, 4.2vw, 54px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fdf9f0;
  overflow-wrap: anywhere;
}

.chord-quality { font-size: 12.5px; color: var(--muted); line-height: 1.4; }

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

.tone-chip {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(217, 169, 90, 0.28);
  background: rgba(217, 169, 90, 0.08);
}
.tone-chip b { font-size: 15px; font-weight: 600; color: #f6ead3; }
.tone-chip i { font-style: normal; font-size: 10.5px; color: var(--gold); letter-spacing: 0.04em; }
.tone-chip.is-missing {
  opacity: 0.4;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.16);
  background: transparent;
}

.spec { margin: 0; display: grid; gap: 10px; }
.spec--2 { grid-template-columns: 1fr 1fr; }

.spec-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spec-item dt {
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--dim);
}
.spec-item dd {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.35;
}

/* ---------------------------- тональность ------------------------------ */

.key-hero { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.key-name { font-family: var(--font-display); font-size: 30px; line-height: 1; color: #fbf7ee; }
.key-prob { font-size: 12px; color: var(--gold); font-variant-numeric: tabular-nums; }
.key-flag {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.9;
  text-align: right;
  max-width: 140px;
  line-height: 1.35;
}

.prob-list { display: flex; flex-direction: column; gap: 7px; }

.prob-row {
  display: grid;
  grid-template-columns: 54px 1fr 38px;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.prob-row.is-top { color: var(--text); }

.prob-row.is-context .prob-name { color: var(--gold); }
.prob-row.is-context .prob-fill { background: linear-gradient(90deg, rgba(217, 169, 90, 0.5), var(--gold)); }
.prob-row.is-context .prob-track { box-shadow: 0 0 0 1px rgba(217, 169, 90, 0.4); }

.prob-list.is-alt .prob-fill { background: rgba(255, 255, 255, 0.3); }
.prob-list.is-alt .prob-val { color: var(--dim); }
.prob-list.is-alt .prob-row.is-top .prob-val { color: var(--muted); }

.prob-track { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }

.prob-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, rgba(217, 169, 90, 0.5), var(--gold));
  transition: width 0.35s ease;
}
.prob-row:not(.is-top) .prob-fill { background: rgba(255, 255, 255, 0.22); }

.prob-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--dim);
}
.prob-row.is-top .prob-val { color: var(--gold); }

.scale-label,
.sub-label {
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
}

.scale-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }

.scale-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 7px 2px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
}
.scale-note b { font-size: 12.5px; font-weight: 600; color: #e9e4d8; }
.scale-note i { font-style: normal; font-size: 9px; color: var(--dim); }
.scale-note.is-tonic { border-color: rgba(217, 169, 90, 0.4); background: rgba(217, 169, 90, 0.1); }
.scale-note.is-tonic b { color: var(--gold); }

/* ------------------------------ функция -------------------------------- */

.func-hero { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.func-numeral { font-family: var(--font-display); font-size: 44px; line-height: 1; color: #fdf9f0; }
.func-name { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }

.pill {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  font-size: 10.5px;
  color: var(--muted);
}
.pill--warn {
  border-color: rgba(217, 140, 90, 0.35);
  color: #e2ab80;
  background: rgba(217, 140, 90, 0.08);
}

.note-line { margin: 0; font-size: 11.5px; color: var(--dim); line-height: 1.5; }

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

.iv-table { display: flex; flex-direction: column; }

.iv-row {
  display: grid;
  grid-template-columns: 38px 1fr 46px 28px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12.5px;
}
.iv-row:last-child { border-bottom: 0; }

.iv-note { font-weight: 600; color: #f2ecdf; }
.iv-name { color: var(--muted); font-size: 12px; }
.iv-short { color: var(--gold); font-size: 11px; text-align: right; }
.iv-sem { text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; font-size: 11px; }

.iv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.root-iv { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }

.iv-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--muted);
}
.iv-chip b { color: var(--gold); font-weight: 600; font-size: 10.5px; }
.iv-chip.is-missing { opacity: 0.35; }

/* ------------------------------ строение ------------------------------- */

.set-block {
  margin-top: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.set-line { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); }
.set-line b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }

/* ----------------------------- напряжение ------------------------------ */

.tension-head { display: flex; align-items: baseline; gap: 6px; }
.tension-value { font-family: var(--font-display); font-size: 44px; line-height: 1; color: #fdf9f0; }
.tension-max { font-size: 12px; color: var(--dim); }

.meter { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }

.meter-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #86bfae, var(--gold) 55%, #d97a5a);
  transition: width 0.3s ease;
}

.tension-label { font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }

.parts { display: flex; flex-direction: column; gap: 2px; }

.part-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
  color: var(--dim);
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
}
.part-row:last-child { border-bottom: 0; }
.part-row b { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }

/* ------------------------------- история ------------------------------- */

.hist-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.hist-strip::-webkit-scrollbar { display: none; }

.hist-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 9px 13px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
  color: var(--text);
  font-family: inherit;
}
.hist-chip b { font-family: var(--font-display); font-size: 17px; font-weight: 400; line-height: 1; }
.hist-chip i { font-style: normal; font-size: 10px; color: var(--dim); letter-spacing: 0.04em; }
.hist-chip:hover { border-color: rgba(217, 169, 90, 0.4); background: rgba(217, 169, 90, 0.07); transform: translateY(-1px); }
.hist-chip.is-current { border-color: rgba(217, 169, 90, 0.5); background: rgba(217, 169, 90, 0.1); }
.hist-chip.is-current i { color: var(--gold); }

.cadence-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.prog-line {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.cadence-badge {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 8px;
  background: rgba(143, 196, 182, 0.1);
  border: 1px solid rgba(143, 196, 182, 0.3);
  color: #a9d5c8;
  font-size: 12px;
}
.cadence-empty { font-size: 11.5px; color: var(--dim); }

.hist-key { margin: 0; font-size: 11.5px; color: var(--dim); }
.hist-key b { color: var(--muted); font-weight: 600; }

/* ------------------------------- дальше -------------------------------- */

.next-list { display: flex; flex-direction: column; gap: 8px; }

.next-row {
  display: grid;
  grid-template-columns: 58px 46px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}
.next-row:hover {
  border-color: rgba(217, 169, 90, 0.4);
  background: rgba(217, 169, 90, 0.07);
  transform: translateY(-1px);
}
.next-sym { font-family: var(--font-display); font-size: 19px; }
.next-roman { font-size: 12px; color: var(--gold); }
.next-reason { font-size: 11px; color: var(--dim); text-align: right; }

/* -------------------------------- пусто -------------------------------- */

.empty {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  text-align: center;
  padding: 18px 6px;
}
.empty span { font-family: var(--font-display); font-size: 30px; opacity: 0.35; line-height: 1; }
.empty p { margin: 0; font-size: 11.5px; max-width: 240px; line-height: 1.5; }

/* -------------------------------- подвал ------------------------------- */

.footer {
  max-width: 1440px;
  margin: 0 auto;
  padding: 6px 32px 48px;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.65;
}
.footer p { margin: 0; max-width: 780px; }

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  padding: 14px 18px;
  border-radius: 12px;
  background: #2a1c12;
  color: #f0d9bd;
  font-size: 13px;
  z-index: 10;
}

/* ------------------------------ адаптив -------------------------------- */

@media (max-width: 1200px) {
  .card--chord { grid-column: span 6; }
  .card--key { grid-column: span 6; }
  .card--func { grid-column: span 6; }
  .card--intervals,
  .card--structure,
  .card--tension { grid-column: span 6; }
  .card--history,
  .card--next { grid-column: span 12; }
}

@media (max-width: 900px) {
  .topbar { padding: 22px 18px 14px; flex-wrap: wrap; }
  .layout { padding: 0 18px 32px; }
  .footer { padding: 6px 18px 40px; }

  .now-panel { grid-template-columns: 1fr; gap: 16px; padding: 20px; }
  .now-cell { padding: 0; }
  .now-cell:not(:first-child) { border-left: 0; border-top: 1px solid var(--line); padding-top: 14px; }
  .now-big { min-height: auto; font-size: 42px; }
  .now-mid { min-height: auto; }

  .card { min-height: 0; }
  .hint { display: none; }
  .piano { min-width: 900px; height: 180px; }
}

@media (max-width: 640px) {
  .card--key,
  .card--func,
  .card--intervals,
  .card--structure,
  .card--tension { grid-column: span 12; }
  .now-big { font-size: 36px; }
  .now-mid { font-size: 24px; }
  .card { padding: 16px 16px 18px; }
  .chord-symbol { font-size: 38px; }
  .piano-bar { gap: 10px; }
  .bar-label { display: none; }
  .ghost-btn { padding: 7px 11px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
