:root {
  --bg: #FFFFFF;
  --card: #F6F5F1;
  --card-2: #ECEAE4;
  --line: #DEDBD3;
  --ink: #141414;
  --ink-2: #5F5F58;
  --accent: #FFD400;
  --accent-hi: #FFE14D;
  --on-accent: #141414;
  --accent-text: #7A5C00;   /* жёлтый для текста: на белом обычный жёлтый не читается */
  --bad: #C7281C;
  --display: 'Unbounded', 'Onest', system-ui, sans-serif;
  --text: 'Onest', system-ui, sans-serif;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --r: 22px;
  --side: 248px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-color: #C9C5BB var(--bg); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.5 var(--text); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, p, ul, ol, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
kbd { font: 600 .75rem/1 var(--text); }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
[hidden] { display: none !important; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -80px; z-index: 60; padding: 12px 18px; border-radius: 12px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.skip:focus { top: 16px; }
em { font-style: normal; color: var(--accent-text); }

/* Каркас */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 26px 16px 22px; border-right: 1px solid var(--line); background: #FAFAF7; }
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 0 10px; font: 700 1rem/1.1 var(--display); letter-spacing: -.02em; }
.brand b { color: var(--accent-text); font-weight: 700; }
.brand__mark { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--accent); box-shadow: inset 0 0 0 5px var(--bg), inset 0 0 0 9px var(--accent); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; border-radius: 14px; font-weight: 600; font-size: .9375rem; color: var(--ink-2); transition: background-color .2s, color .2s; }
.nav a svg { width: 22px; height: 22px; }
.nav a:hover { background: var(--card-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.side__note { margin-top: auto; padding: 0 10px; font-size: .8125rem; line-height: 1.45; color: var(--ink-2); }
.main { min-width: 0; padding: clamp(20px, 3.4vw, 44px) clamp(16px, 4vw, 56px) 72px; background: radial-gradient(760px 420px at 100% -80px, rgba(255, 212, 0, .11), transparent 70%) no-repeat; }
.main:focus { outline: none; }
.view { max-width: 1160px; margin-inline: auto; animation: rise .5s var(--ease) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* Текст и кнопки */
h1 { font: 700 clamp(1.5rem, 3vw, 2.5rem)/1.12 var(--display); letter-spacing: -.03em; text-wrap: balance; }
.h2 { margin: clamp(36px, 5vw, 60px) 0 18px; font: 700 clamp(1.125rem, 1.8vw, 1.5rem)/1.15 var(--display); letter-spacing: -.02em; }
.lead { max-width: 54ch; font-size: clamp(1rem, 1.3vw, 1.125rem); color: var(--ink-2); }
.head { display: flex; flex-direction: column; gap: 10px; margin-bottom: clamp(20px, 3vw, 32px); }
.head p { max-width: 68ch; color: var(--ink-2); }
.row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 20px; border-radius: 16px; font-weight: 700; font-size: .9375rem; transition: translate .35s var(--ease), background-color .2s, border-color .2s, color .2s; }
.btn svg { width: 18px; height: 18px; }
.btn:hover { translate: 0 -2px; }
.btn:active { translate: 0; }
.btn--accent { background: var(--accent); color: var(--on-accent); box-shadow: 0 14px 30px -14px rgba(255, 212, 0, .7); }
.btn--accent:hover { background: var(--accent-hi); }
.btn--accent svg { fill: currentColor; stroke: none; }
.btn--accent svg use[href="#i-arrow"], .btn--accent svg:has(use[href="#i-arrow"]), .btn--accent svg:has(use[href="#i-mic"]) { fill: none; stroke: currentColor; }
.btn--ghost { border: 1px solid var(--line); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-text); }
.btn--ghost[aria-pressed="true"] { background: rgba(255, 212, 0, .14); border-color: var(--accent); color: var(--accent-text); }
.btn--l { min-height: 60px; padding: 0 28px; font-size: 1rem; }
.chip { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 36px; padding: 0 14px; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); font-size: .875rem; font-weight: 600; }
.chip svg { width: 16px; height: 16px; color: var(--accent-text); }
.hint { margin-top: 14px; max-width: 80ch; font-size: .8125rem; line-height: 1.5; color: var(--ink-2); }
.status { min-height: 1.5em; font-weight: 500; color: var(--ink); }

/* Главная */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px clamp(24px, 5vw, 64px); padding: clamp(22px, 3.6vw, 48px); border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.hero__copy { display: flex; flex-direction: column; gap: clamp(14px, 1.8vw, 22px); }
.hero__stat { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: var(--ink-2); font-size: .9375rem; }
.hero__stat b { color: var(--ink); }
.ring { position: relative; width: clamp(140px, 16vw, 200px); aspect-ratio: 1; }
.ring svg { width: 100%; height: 100%; rotate: -90deg; stroke-width: 9; stroke: var(--card-2); }
.ring__v { stroke: var(--accent); transition: stroke-dashoffset 1s var(--ease); }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 clamp(1.5rem, 3vw, 2.25rem)/1 var(--display); letter-spacing: -.03em; }
.tracks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.track { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 210px; padding: 20px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); transition: translate .4s var(--ease), border-color .25s; }
.track:hover { translate: 0 -6px; border-color: var(--accent); }
.track svg { width: 34px; height: 34px; margin-bottom: auto; color: var(--accent-text); stroke-width: 1.5; }
.track b { font: 700 1.0625rem/1.2 var(--display); letter-spacing: -.02em; }
.track > span { font-size: .875rem; color: var(--ink-2); }
.track__bar, .meter__bar { display: block; height: 6px; margin-top: 6px; border-radius: 6px; background: var(--card-2); overflow: hidden; }
.track__bar i, .meter__bar i { display: block; height: 100%; border-radius: 6px; background: var(--accent); transition: width .5s var(--ease); }
.track small { font-size: .8125rem; color: var(--ink-2); }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; counter-reset: s; }
.steps li { counter-increment: s; display: flex; flex-direction: column; gap: 8px; padding: 20px; border-radius: var(--r); border: 1px solid var(--line); }
.steps li::before { content: counter(s); width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: var(--card-2); font: 700 .875rem/1 var(--display); color: var(--accent-text); }
.steps b { font-weight: 700; }
.steps span { font-size: .875rem; color: var(--ink-2); }

/* Урок: список слева, сцена справа */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
.lessons { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 6px; }
.lessons button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); text-align: left; font-weight: 600; font-size: .9375rem; line-height: 1.25; transition: border-color .2s, background-color .2s; }
.lessons button:hover { border-color: #A8A59C; }
.lessons .num { flex: none; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--card-2); font: 700 .8125rem/1 var(--display); color: var(--ink-2); }
.lessons .num svg { width: 16px; height: 16px; stroke-width: 2.6; }
.lessons .is-done .num { background: rgba(255, 212, 0, .16); color: var(--accent-text); }
.lessons button[aria-current="true"] { border-color: var(--accent); background: rgba(255, 212, 0, .08); }
.stage { min-width: 0; }
.stage--wide { max-width: 900px; }
.panel { display: flex; flex-direction: column; gap: 18px; padding: clamp(18px, 2.6vw, 30px); border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.panel__top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px 24px; }
.panel__top > div { flex: 1 1 280px; display: flex; flex-direction: column; gap: 6px; }
.panel h2 { font: 700 clamp(1.125rem, 1.8vw, 1.5rem)/1.15 var(--display); letter-spacing: -.02em; }
.panel__top p { color: var(--ink-2); max-width: 60ch; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 150px; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.field b { color: var(--accent-text); font-variant-numeric: tabular-nums; }
.field select { min-height: 46px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font-weight: 600; }
.field select:focus { outline: none; border-color: var(--accent); }
input[type="range"] { width: 100%; min-height: 28px; accent-color: var(--accent); }
.seq { display: flex; flex-wrap: wrap; gap: 6px; }
.seq li { min-width: 46px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); text-align: center; font-weight: 600; font-size: .875rem; color: var(--ink-2); transition: background-color .2s, color .2s, border-color .2s; }
.seq .is-done { background: rgba(255, 212, 0, .14); border-color: transparent; color: var(--accent-text); }
.seq .is-now { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 212, 0, .18); }
.seq .is-play { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.seq--bols li { min-width: 62px; padding: 12px 10px; font: 700 1rem/1 var(--display); }
.seq .is-rest { border-style: dashed; opacity: .5; }

/* Клавиатура гармониума */
.keys-wrap { margin-top: 16px; padding: 14px 12px 12px; border-radius: var(--r); background: #ECEAE4; border: 1px solid var(--line); overflow-x: auto; overscroll-behavior-x: contain; }
.keys { display: flex; gap: 3px; min-width: 620px; height: clamp(170px, 24vw, 250px); touch-action: none; user-select: none; -webkit-user-select: none; }
.key { position: relative; border-radius: 0 0 10px 10px; transition: background-color .08s, translate .08s; }
.key--white { box-shadow: inset 0 0 0 1px #CFCBC1; flex: 1 1 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px; background: #FFFFFF; color: #1A1A1A; font-weight: 700; font-size: .8125rem; }
.key--white.is-sa { background: #FFF3B0; }
.key--black { position: absolute; z-index: 2; top: 0; right: calc(-32% - 1.5px); width: 64%; height: 60%; background: #161616; border: 1px solid #333; border-top: 0; border-radius: 0 0 8px 8px; }
.key.is-down { translate: 0 3px; background: var(--accent); }
.key--black.is-down { background: #B89600; }
.key.is-next { background: var(--accent); box-shadow: 0 0 0 3px rgba(255, 212, 0, .35), 0 0 30px rgba(255, 212, 0, .5); }
.key--black.is-next { background: var(--accent); border-color: var(--accent); }
.key span { pointer-events: none; }
.key--black > span { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; font-size: .625rem; font-weight: 700; color: #F5F5F0; }
.key--black.is-next > span, .key--black.is-down > span { color: #0A0A0A; }

/* Караталы */
.beats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.beats li { padding: 18px 8px; border-radius: 16px; border: 1px solid var(--line); text-align: center; font: 700 clamp(.9375rem, 1.6vw, 1.25rem)/1 var(--display); color: var(--ink-2); transition: background-color .08s, color .08s, scale .15s var(--ease); }
.beats .is-long { letter-spacing: .12em; }
.beats .is-rest { border-style: dashed; }
.beats .is-now { background: var(--accent); border-color: var(--accent); color: var(--on-accent); scale: 1.04; }
.beats .is-rest.is-now { background: var(--card-2); border-color: var(--line); color: var(--ink-2); scale: 1; }
.tap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: clamp(150px, 22vw, 220px); margin-top: 16px; border-radius: var(--r); background: var(--card); border: 2px solid var(--line); touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: border-color .2s; }
.tap b { font: 700 clamp(1.5rem, 3vw, 2.25rem)/1 var(--display); letter-spacing: -.02em; }
.tap span { font-size: .875rem; color: var(--ink-2); }
.tap:hover { border-color: #A8A59C; }
.tap.is-hit { animation: hit .35s var(--ease); }
.tap.is-miss { animation: miss .35s var(--ease); }
@keyframes hit { 0% { background: var(--accent); border-color: var(--accent); scale: .985; } }
@keyframes miss { 0% { background: rgba(255, 90, 77, .3); border-color: var(--bad); } }
.meter { margin-top: 14px; }
.meter .meter__bar { height: 10px; }
.meter p { margin-top: 10px; color: var(--ink-2); }

/* Мриданга */
.pads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.pad { position: relative; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 4px; min-height: clamp(130px, 18vw, 190px); padding: 16px; border-radius: var(--r); background: var(--card); border: 2px solid var(--line); text-align: left; touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: border-color .2s; }
.pad b { font: 700 clamp(1.25rem, 2.4vw, 1.875rem)/1 var(--display); letter-spacing: -.02em; }
.pad span { font-size: .8125rem; color: var(--ink-2); }
.pad kbd { position: absolute; right: 14px; top: 14px; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink-2); }
.pad--accent b { color: var(--accent-text); }
.pad.is-next { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 212, 0, .16); }
.pad.is-down { animation: hit .3s var(--ease); }

/* Вокал */
.tuner { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 24px; align-items: center; padding: 18px; border-radius: 18px; background: var(--bg); border: 1px solid var(--line); }
.tuner__now { display: flex; flex-direction: column; gap: 6px; min-width: 110px; }
.tuner small { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.tuner__now b { font: 700 clamp(1.75rem, 4vw, 2.75rem)/1 var(--display); letter-spacing: -.02em; color: var(--accent-text); }
.tuner__scale { position: relative; display: flex; justify-content: space-between; align-items: flex-end; height: 56px; padding: 0 4px 4px; border-radius: 12px; font-size: .75rem; color: var(--ink-2); background: linear-gradient(90deg, transparent calc(50% - 20% - 1px), rgba(255, 212, 0, .16) calc(50% - 20%), rgba(255, 212, 0, .16) calc(50% + 20%), transparent calc(50% + 20% + 1px)), var(--card-2); }
.tuner__scale i { position: absolute; top: 6px; left: 50%; width: 4px; height: 30px; margin-left: -2px; border-radius: 4px; background: var(--bad); opacity: .25; transition: left .12s linear, background-color .15s; }
.tuner__scale i.is-ok { background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.tuner__hold { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.tuner__hold .meter__bar { height: 10px; margin: 0; }
.tuner__hold .meter__bar i { transition: width .1s linear; }

/* Киртан */
.mantra { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mantra li { padding: clamp(12px, 2vw, 20px) 6px; border-radius: 14px; border: 1px solid var(--line); text-align: center; font: 700 clamp(.8125rem, 1.7vw, 1.25rem)/1.1 var(--display); letter-spacing: -.02em; color: var(--ink-2); transition: background-color .12s, color .12s, scale .2s var(--ease); }
.mantra .is-now { background: var(--accent); border-color: var(--accent); color: var(--on-accent); scale: 1.04; }
.mix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.toggles { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.toggles legend { margin-bottom: 8px; font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.toggles label { position: relative; cursor: pointer; }
.toggles input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.toggles span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-size: .875rem; color: var(--ink-2); transition: background-color .2s, color .2s, border-color .2s; }
.toggles input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.toggles input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.toast { position: fixed; z-index: 80; left: 50%; bottom: 28px; translate: -50% 0; padding: 14px 22px; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: 0 20px 50px -18px rgba(255, 212, 0, .8); animation: rise .4s var(--ease); }

@media (max-width: 1100px) {
  .tracks, .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { grid-template-columns: 1fr; }
  .lessons { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
  .lessons li { flex: none; }
  .lessons button { width: auto; white-space: nowrap; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: rgba(14, 14, 14, .96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .brand, .side__note { display: none; }
  .nav { flex: 1; flex-direction: row; gap: 2px; }
  .nav a { flex: 1 1 0; flex-direction: column; justify-content: center; gap: 4px; min-height: 56px; padding: 4px 2px; font-size: .625rem; text-align: center; }
  .main { padding-bottom: 110px; }
  .hero { grid-template-columns: 1fr; }
  .hero__stat { flex-direction: row; text-align: left; }
  .ring { width: 96px; }
  .toast { bottom: 96px; width: max-content; max-width: calc(100vw - 32px); }
}
@media (max-width: 560px) {
  .tracks, .steps { grid-template-columns: 1fr; }
  .track { min-height: 0; }
  .track svg { margin-bottom: 6px; }
  .pads { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pad kbd { display: none; }
  .mix { grid-template-columns: 1fr; }
  .row .btn { flex: 1 1 auto; }
  .tuner { grid-template-columns: 1fr; }
  .keys { min-width: 760px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* Мриданга: шесть пэдов и длинные рисунки с делением на группы */
.pads { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pad { min-height: clamp(120px, 13vw, 170px); }
.seq--bols li.is-bar { margin-left: 14px; }
.seq--bols.is-long li { min-width: 48px; padding: 10px 6px; font-size: .875rem; }
@media (max-width: 1100px) { .pads { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .pads { grid-template-columns: repeat(2, minmax(0, 1fr)); } .seq--bols.is-long li { min-width: 40px; } .seq--bols li.is-bar { margin-left: 8px; } }
/* Длинные рисунки раскладываются по строкам: одна строка — одна группа долей */
.seq--bols.is-long { display: grid; grid-template-columns: repeat(var(--g, 8), minmax(0, 1fr)); gap: 6px; max-width: calc(var(--g, 8) * 76px); }
.seq--bols.is-long li { min-width: 0; padding: 10px 2px; }
.seq--bols.is-long li.is-bar { margin-left: 0; }
