/* Музыкант — экраны и компоненты приложения. Токены — tokens.css, базовые элементы — base.css. */

:root {
  --gutter: clamp(16px, 4vw, 64px);
  --content: 1440px;
  --bar-h: 76px;
}

html.no-scroll, html.no-scroll body { overflow: hidden; }

/* приложение проявляется, когда шрифты готовы: без прыжка подмены */
.app { position: relative; min-height: 100vh; min-height: 100dvh; opacity: 0; transition: opacity var(--t-slow) var(--ease); }
html.is-ready .app { opacity: 1; }
.noscript { padding: 48px var(--gutter); color: var(--ink-2); }

/* ---------- смена экранов ---------- */
.screen {
  min-height: 100vh;
  min-height: 100dvh;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.screen.is-entering { opacity: 0; transform: translateY(10px); }
.screen.is-leaving {
  position: absolute;
  inset: 0 0 auto 0;
  opacity: 0;
  transform: none;
  pointer-events: none;
  transition-duration: var(--t-fast);
}
[data-title]:focus, h1[tabindex='-1']:focus, h2[tabindex='-1']:focus { box-shadow: none; outline: none; }

/* ---------- верхняя строка и подвал ---------- */
.topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 28px var(--gutter);
}
.topline__nav { display: flex; gap: 28px; align-items: center; }

.site-foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 28px var(--gutter) 32px;
  color: var(--ink-3);
}
.site-foot__privacy { color: var(--ink-2); }
.site-foot .link { font-size: 14px; }

/* ---------- название ноты со знаком ---------- */
.note { white-space: nowrap; }
.note .acc {
  display: inline-block;
  height: 0.78em;
  margin-left: 0.06em;
  vertical-align: -0.04em;
  overflow: visible;
}

/* =================================================================
   Главная
   ================================================================= */
.home { display: flex; flex-direction: column; min-height: 100dvh; }
.home__main {
  flex: 1;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: clamp(16px, 4vh, 56px) var(--gutter) 0;
  display: flex;
  flex-direction: column;
  gap: clamp(36px, 6vh, 72px);
}
.home__hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 40px 64px;
  align-items: end;
}
.home__title { font-size: clamp(46px, 6.6vw, 104px); max-width: 9.5em; }
.home__intro { display: grid; gap: 18px; padding-bottom: 10px; }
.home__intro .lead { color: var(--ink-2); }
.home__note { font-family: var(--font-display); font-style: italic; font-size: clamp(21px, 1.7vw, 25px); line-height: 1.25; color: var(--ink); }
.home__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }

/* ряд из восьми жестов */
.demo { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 28px 0 22px; }
.demo__row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.demo__cell { display: grid; justify-items: center; gap: 6px; text-align: center; }
.demo__glyph { position: relative; display: block; width: 76px; height: 76px; }
.demo__glyph .hand-glyph { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity var(--t) var(--ease), transform var(--t) var(--ease); }
.demo__glyph .demo__gold { opacity: 0; }
.demo__cell.is-lit .demo__gold { opacity: 1; transform: translateY(-4px); }
.demo__cell.is-lit .demo__glyph .hand-glyph:not(.demo__gold) { opacity: 0; transform: translateY(-4px); }
.demo__name { margin-top: 8px; font-size: 13px; color: var(--ink-2); transition: color var(--t) var(--ease); }
.demo__cell.is-lit .demo__name { color: var(--ink); }
.demo__note {
  min-height: 24px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  line-height: 1.1;
  color: var(--ink-3);
  transition: color var(--t) var(--ease);
}
.demo__cell.is-lit .demo__note { color: var(--gold); }
.demo__num { font-size: 11px; letter-spacing: .14em; color: var(--ink-3); }
.demo__cap { display: flex; align-items: center; gap: 10px; margin-top: 18px; justify-content: center; }
.demo__cap-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

.home__steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; list-style: none; padding: 0; margin: 0; }
.hstep { display: grid; grid-template-columns: auto 1fr; column-gap: 18px; row-gap: 4px; align-items: baseline; }
.hstep__num { grid-row: span 2; font-family: var(--font-display); font-style: italic; font-size: 22px; color: var(--gold); }
.hstep__title { font-size: 17px; font-weight: 500; }
.hstep__sub { color: var(--ink-2); }

/* =================================================================
   Загрузка, вход для звука, пустые состояния
   ================================================================= */
.load, .gate { display: flex; flex-direction: column; min-height: 100dvh; }
.load__main, .gate__main { flex: 1; display: grid; place-items: center; padding: 24px var(--gutter) 15vh; }
.load__box, .gate__box { width: 100%; max-width: 460px; display: grid; justify-items: center; text-align: center; gap: 18px; }
.load__glyph, .gate__glyph { margin-bottom: 14px; }
.load__glyph .hand-glyph { animation: breathe 2.4s var(--ease) infinite; }
.load__glyph.is-error .hand-glyph { animation: none; }
@keyframes breathe { 50% { opacity: .55; } }
.load__caption { font-family: var(--font-display); font-size: 28px; line-height: 1.2; min-height: 1.2em; }
.load__bar { width: min(280px, 100%); margin: 6px 0 4px; }
.load__hint { color: var(--ink-3); max-width: 30em; }
.load__title, .gate__title { font-size: clamp(30px, 3.2vw, 40px); }
.load__text, .gate__text { color: var(--ink-2); max-width: 30em; }
.load__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 10px; }
.load__code { margin-top: 10px; }
.gate__box .btn { margin-top: 10px; }
.gate__home { margin-top: 6px; }

/* =================================================================
   Репертуар
   ================================================================= */
.library { display: flex; flex-direction: column; min-height: 100dvh; }
.library__main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: clamp(8px, 3vh, 40px) var(--gutter) 24px; }
.library__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px 40px; flex-wrap: wrap; padding-bottom: 28px; border-bottom: 1px solid var(--line-strong); }
.library__title { font-size: clamp(44px, 5.4vw, 80px); }

.songs { list-style: none; padding: 0; margin: 0; }
.song { border-bottom: 1px solid var(--line); }
.song__link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 168px 92px 24px;
  align-items: center;
  gap: 28px;
  padding: 22px 4px;
  color: inherit;
  text-decoration: none;
  transition: background-color var(--t-fast) var(--ease);
}
.song__link:focus-visible { border-radius: var(--radius-s); }
.song__main { display: grid; gap: 4px; min-width: 0; }
.song__title { font-family: var(--font-display); font-weight: 500; font-size: clamp(25px, 2.1vw, 32px); line-height: 1.08; transition: color var(--t-fast) var(--ease); }
.song__by { font-size: 14px; color: var(--ink-2); }
.song__work { color: var(--ink-3); }
.song__glyphs { display: flex; gap: 2px; opacity: .9; }
.song__side { display: grid; gap: 4px; justify-items: end; text-align: right; }
.song__meta { color: var(--ink-2); white-space: nowrap; }
.song__best { display: flex; justify-content: flex-end; }
.song__new { color: var(--ink-3); white-space: nowrap; font-size: 10px; }
.song__go { color: var(--ink-3); display: grid; place-items: center; transition: transform var(--t) var(--ease), color var(--t-fast) var(--ease); }
.song__link:hover .song__title { color: var(--gold-bright); }
.song__link:hover .song__go { color: var(--gold); transform: translateX(4px); }

.stars { display: inline-flex; gap: 4px; align-items: center; }
.star path { fill: none; stroke: var(--ink-3); stroke-width: 1.1; stroke-linejoin: round; }
.star.is-on path { fill: var(--gold); stroke: var(--gold); }

.free-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 24px;
  align-items: center;
  gap: 32px;
  margin-top: 40px;
  padding: 28px 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
.free-entry:hover { border-color: var(--gold-dim); background: rgba(201, 166, 107, .035); }
.free-entry:hover .song__go { color: var(--gold); transform: translateX(4px); }
.free-entry:focus-visible { border-radius: var(--radius); }
.free-entry__glyphs { display: flex; gap: 0; }
.free-entry__text { display: grid; gap: 4px; }
.free-entry__title { font-family: var(--font-display); font-size: clamp(26px, 2.2vw, 32px); line-height: 1.1; }
.free-entry__sub { color: var(--ink-2); font-size: 15px; }

/* =================================================================
   Верхняя строка игры
   ================================================================= */
.playbar {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, auto) minmax(120px, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: var(--bar-h);
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--line);
}
.playbar__title { display: grid; gap: 2px; min-width: 0; }
.playbar__name { font-family: var(--font-display); font-weight: 500; font-size: 24px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playbar__by { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playbar__mid { display: flex; align-items: center; gap: 16px; min-width: 0; padding: 0 8px; }
.playbar__progress { flex: 1; }
.playbar__count { min-width: 5.2em; text-align: right; }
.playbar__actions { display: flex; align-items: center; gap: 4px; }
.playbar__actions .btn--quiet { gap: 8px; }
.playbar__actions .settings-btn { margin-left: 8px; }
.playbar__loading {
  position: absolute;
  left: 50%;
  bottom: -30px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: nowrap;
  z-index: 5;
  animation: breathe 1.8s var(--ease) infinite;
}
.play.is-listening .playbar__listen { color: var(--gold-bright); }

/* =================================================================
   Экран игры
   ================================================================= */
.play { position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.play__main {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  min-height: 0;
}
.play__stand { min-width: 0; min-height: 0; display: flex; border-right: 1px solid var(--line); }
.play__mirror { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 28px var(--gutter) 28px clamp(24px, 3vw, 48px); }

/* ---------- пюпитр ---------- */
.stand {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(20px, 4vh, 48px) clamp(24px, 3.4vw, 64px) clamp(16px, 3vh, 36px) var(--gutter);
}
.stand__coach {
  max-width: 24em;
  min-height: 2.5em;
  margin-bottom: clamp(16px, 3vh, 32px);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(21px, 1.8vw, 27px);
  line-height: 1.25;
  color: var(--ink);
}
.now { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: clamp(24px, 3vw, 48px); }
.now__glyph { position: relative; width: clamp(150px, min(16vw, 29vh), 280px); aspect-ratio: 1; }
.now__glyph .hand-glyph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: opacity var(--t-fast) var(--ease), transform var(--t) var(--ease);
}
.now__glyph .hand-glyph.is-in { opacity: 0; transform: translateY(6px) scale(.97); }
.now__glyph .hand-glyph.is-out { opacity: 0; transform: translateY(-6px) scale(.97); }
.now__glyph.is-hit .hand-glyph:not(.is-out) { animation: hit 420ms var(--ease); }
@keyframes hit {
  0% { filter: brightness(1); }
  25% { filter: brightness(1.45); transform: scale(1.035); }
  100% { filter: brightness(1); transform: scale(1); }
}
.now__ring { position: absolute; inset: -9%; width: 118%; height: 118%; overflow: visible; pointer-events: none; transform: rotate(-90deg); }
.now__ring circle { fill: none; stroke-width: .7; vector-effect: non-scaling-stroke; }
.now__ring-track { stroke: transparent; transition: stroke var(--t) var(--ease); }
.now__ring-arc { stroke: var(--gold); stroke-dasharray: 100; stroke-dashoffset: 100; stroke-linecap: round; opacity: 0; transition: opacity var(--t-fast) var(--ease); }
.stand.is-repeat .now__ring-track { stroke: var(--line); }
.stand.is-repeat .now__ring-arc { opacity: 1; }
.now__ring circle { stroke-width: 1.2px; }

.now__text { display: grid; gap: 10px; min-width: 0; }
.now__head { display: flex; align-items: flex-start; gap: 14px; }
.now__name { font-family: var(--font-display); font-weight: 500; font-size: clamp(52px, 5.2vw, 84px); line-height: .95; letter-spacing: -0.01em; }
.now__key { margin-top: .5em; }
.now__note { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: clamp(26px, 2.2vw, 34px); line-height: 1; color: var(--gold); min-height: 1em; }
.stand__hint { min-height: 1.3em; margin-top: 14px; color: var(--ink-2); }

/* ---------- лента ---------- */
.ribbon {
  position: relative;
  height: clamp(180px, 30vh, 310px);
  margin-top: clamp(20px, 4vh, 48px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 84%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 84%, transparent 100%);
}
.ribbon__track { position: absolute; inset: 0; transition: transform var(--t-slow) var(--ease); will-change: transform; }
.ribbon__track.no-anim { transition: none; }
.ribbon__line { position: absolute; top: 0; left: 0; overflow: visible; max-width: none; }
.ribbon__line .seg { stroke: var(--line-strong); stroke-width: 1; transition: stroke var(--t) var(--ease); }
.ribbon__line .seg.is-past { stroke: var(--line); }
.ribbon__line .lig { fill: none; stroke: var(--gold-dim); stroke-width: 1.2; stroke-linecap: round; }
.ribbon__line .lig.is-past { stroke: var(--line); }
.ribbon__line .dot { fill: var(--ink-2); transition: fill var(--t) var(--ease); }
.ribbon__line .dot.is-past { fill: var(--ink-3); }
.ribbon__line .dot.is-now { fill: var(--gold); }
.rstep { position: absolute; width: 0; height: 0; transition: opacity var(--t) var(--ease); }
.rstep__glyph { position: absolute; left: 0; bottom: 12px; transform: translateX(-50%); transition: transform var(--t) var(--ease); }
.rstep__note {
  position: absolute;
  left: 0;
  top: 10px;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  line-height: 1;
  color: var(--ink-2);
  transition: color var(--t) var(--ease);
}
.rstep.is-now .rstep__note { color: var(--gold); }
.rstep.is-past { opacity: .5; }
.rstep.is-far { opacity: .22; }
.rstep.is-hit .rstep__glyph { animation: lift 420ms var(--ease); }
@keyframes lift { 30% { transform: translateX(-50%) translateY(-5px); } }

/* пауза и финальная реплика знакомства */
.stand__veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 9, 8, .96);
  z-index: 3;
  animation: fade-in var(--t) var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
.veil { display: grid; justify-items: center; gap: 16px; text-align: center; padding: 24px; max-width: 30em; }
.veil__title { font-family: var(--font-display); font-size: clamp(30px, 3vw, 44px); line-height: 1.12; }
.veil--outro .veil__title { font-style: italic; }
.veil__hint { display: flex; align-items: center; gap: 8px; }

/* ---------- зеркало ---------- */
.mirror { width: 100%; display: grid; gap: 12px; }
.mirror__frame {
  position: relative;
  width: min(100%, calc((100dvh - var(--bar-h) - 96px) * 4 / 3));
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  border-radius: var(--radius-l);
  border: 1px solid var(--line);
  background: var(--bg-raised);
  overflow: hidden;
  isolation: isolate;
  transition: border-color var(--t) var(--ease);
}
.mirror__frame.is-hit { border-color: var(--gold-dim); }
.mirror__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform: scaleX(-1);
  filter: grayscale(1) brightness(.46) contrast(1.08);
}
.mirror__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.mirror__caption {
  position: absolute;
  inset: auto 0 50% 0;
  transform: translateY(50%);
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(22px, 2vw, 28px);
  color: var(--ink);
  z-index: 2;
  pointer-events: none;
}
.mirror__live {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 12px 8px;
  border-radius: var(--radius);
  background: rgba(10, 9, 8, .78);
  border: 1px solid var(--line);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), border-color var(--t) var(--ease);
}
.mirror__live.is-on { opacity: 1; transform: none; }
.mirror__live.is-match { border-color: var(--gold-dim); }
.mirror__live .label { font-size: 10px; }
.mirror__live-glyph { width: 80px; height: 80px; }
.mirror__live.is-wrong .hg-diff { animation: blink 420ms ease-in-out 3; }
@keyframes blink { 50% { opacity: .25; } }
.mirror__status {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--bg-raised);
}
.mirror__status-text { font-family: var(--font-display); font-size: 24px; }
.mirror__status .progress { width: 200px; }
.mirror__debug {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-2);
  text-align: center;
  white-space: pre-wrap;
  font-variant-numeric: tabular-nums;
}
.mirror__fallback { display: grid; gap: 16px; width: 100%; }
.mirror__camline { text-align: center; color: var(--ink-2); }
.mirror__camline .link { font-size: inherit; }

/* ---------- плашки жестов ---------- */
.pads { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pad {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  padding: 18px 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  color: var(--ink);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.pad:hover { border-color: var(--line-strong); }
.pad:focus-visible { border-radius: var(--radius); }
.pad[disabled] { opacity: .42; cursor: default; }
.pad.is-expected { border-color: var(--gold-dim); }
.pad.is-down { background: rgba(201, 166, 107, .09); border-color: var(--gold); transform: translateY(1px); }
.pad.is-down .pad__name { color: var(--gold-bright); }
.pad__name { font-size: 13px; color: var(--ink-2); }
.pad__note { font-family: var(--font-display); font-style: italic; font-size: 20px; line-height: 1; color: var(--gold); }
.pad__key { position: absolute; top: 8px; right: 8px; }
.pad__glyph { display: block; }

/* =================================================================
   Итог
   ================================================================= */
.result {
  position: absolute;
  inset: var(--bar-h) 0 0 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 32px var(--gutter);
  background: var(--bg);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
  overflow: auto;
}
.result.is-on { opacity: 1; }
.result__inner { display: grid; justify-items: center; text-align: center; gap: 12px; max-width: 720px; }
.result__title { font-size: clamp(44px, 5.4vw, 80px); margin-top: 4px; }
.result__by { font-size: 15px; }
.result__stars { gap: 10px; margin: 22px 0 6px; }
.result__stars .star path { stroke-width: .9; }
.result__phrase { font-family: var(--font-display); font-style: italic; font-size: clamp(22px, 2vw, 28px); line-height: 1.25; max-width: 22em; }
.result__stats { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); margin: 30px 0 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); width: 100%; }
.result__stat { display: grid; gap: 8px; padding: 22px 12px; }
.result__stat + .result__stat { border-left: 1px solid var(--line); }
.result__value { font-family: var(--font-display); font-size: clamp(34px, 3vw, 44px); line-height: 1; }
.result__best { color: var(--gold); margin-top: 6px; }
.result__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }

/* =================================================================
   Настройки
   ================================================================= */
.settings-backdrop { position: fixed; inset: 0; z-index: 30; }
.settings {
  position: fixed;
  top: calc(var(--bar-h) - 6px);
  right: var(--gutter);
  z-index: 31;
  width: 340px;
  max-height: calc(100dvh - var(--bar-h) - 16px);
  overflow: auto;
  padding: 18px 20px 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.settings.is-open { opacity: 1; transform: none; }
.settings__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.settings__close { width: 36px; height: 36px; border-color: transparent; }
.settings__actions { display: none; gap: 10px; margin-bottom: 18px; }
.set-block { padding: 14px 0; border-top: 1px solid var(--line); }
.set-block__title { display: block; margin-bottom: 8px; }
.set-options { display: grid; }
.set-option {
  display: grid;
  grid-template-columns: 18px auto 1fr;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 8px;
  margin: 0 -8px;
  border-radius: var(--radius-s);
  text-align: left;
  font-size: 15px;
  color: var(--ink-2);
}
.set-option:hover { color: var(--ink); background: rgba(243, 238, 230, .03); }
.set-option[aria-checked='true'] { color: var(--ink); }
.set-option__mark { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; }
.set-option[aria-checked='true'] .set-option__mark { border-color: var(--gold); }
.set-option[aria-checked='true'] .set-option__mark::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.set-option__sub { justify-self: end; font-size: 13px; color: var(--ink-3); }
.set-block--rows { display: grid; gap: 16px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.set-row__text { display: grid; gap: 2px; cursor: pointer; }
.set-row__label { font-size: 15px; }
.set-row__hint { font-size: 12.5px; line-height: 1.4; color: var(--ink-2); }
.set-row--vol .range { width: 150px; }

.switch { position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px; border: 1px solid var(--line-strong); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.switch__knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.switch[aria-checked='true'] { background: var(--gold-dim); border-color: var(--gold); }
.switch[aria-checked='true'] .switch__knob { transform: translateX(16px); background: var(--gold-bright); }
.switch:focus-visible { border-radius: 999px; }

.range { --fill: .5; appearance: none; -webkit-appearance: none; height: 24px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 1px; background: linear-gradient(90deg, var(--gold) calc(var(--fill) * 100%), var(--line-strong) 0); }
.range::-moz-range-track { height: 1px; background: var(--line-strong); }
.range::-moz-range-progress { height: 1px; background: var(--gold); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6.5px; border-radius: 50%; background: var(--ink); border: 0; }
.range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 0; }
.range:focus-visible { box-shadow: none; }
.range:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus-ring); }

/* =================================================================
   О сервисе
   ================================================================= */
.about-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(10, 9, 8, .64); opacity: 0; transition: opacity var(--t) var(--ease); }
.about-backdrop.is-open { opacity: 1; }
.about {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 51;
  width: min(600px, 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-raised);
  border-left: 1px solid var(--line);
  padding: 64px clamp(20px, 4vw, 56px) 56px;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.about.is-open { opacity: 1; transform: none; }
.about__close { position: absolute; top: 18px; right: 18px; }
.about__body { display: grid; gap: 30px; }
.about__glyphs { display: flex; gap: 4px; }
.about__title { font-size: clamp(38px, 4vw, 54px); }
.about__sec { display: grid; gap: 12px; }
.about__sec p { color: var(--ink-2); font-size: 15.5px; }
.credits { display: grid; list-style: none; padding: 0; margin: 0; }
.credit { display: grid; gap: 3px; padding: 14px 0; border-top: 1px solid var(--line); }
.credit:last-child { border-bottom: 1px solid var(--line); }
.credit__what { font-size: 10px; }
.credit__name { font-family: var(--font-display); font-size: 22px; line-height: 1.15; }

/* ---------- всплывающая строка ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  font-size: 14px;
  color: var(--ink);
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* =================================================================
   Свободная игра
   ================================================================= */
.free { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100vh; height: 100dvh; overflow: hidden; }
.free__main {
  display: grid;
  grid-template-columns: minmax(260px, 430px) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 72px);
  align-items: center;
  min-height: 0;
  padding: 24px var(--gutter);
}
.free__controls { display: grid; gap: 28px; align-content: center; }
.free__group { display: grid; gap: 12px; }
.free__tip { max-width: 26em; }
.free__stage { min-height: 0; height: 100%; display: flex; align-items: center; }
.free__stage .mirror__frame { width: min(100%, calc((100dvh - var(--bar-h) - 260px) * 4 / 3)); }
.free-now {
  width: min(100%, calc((100dvh - var(--bar-h) - 300px) * 4 / 3));
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--bg-raised);
  text-align: center;
}
.free-now__glyph { margin-bottom: 10px; }
.free-now__name { font-family: var(--font-display); font-size: clamp(30px, 3vw, 46px); line-height: 1.05; }
.free-now__note { font-family: var(--font-display); font-style: italic; font-size: 24px; color: var(--ink-2); min-height: 1.2em; }
.free-now.is-on .free-now__note { color: var(--gold); }
.free__row { padding: 0 var(--gutter) 24px; }
.pads--free { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.pads--free .pad { padding: 16px 6px 12px; }

/* =================================================================
   Адаптив
   ================================================================= */
@media (max-width: 1100px) {
  .song__link { grid-template-columns: minmax(0, 1fr) 150px 84px 20px; gap: 20px; }
  .song__glyphs { display: none; }
}

@media (max-width: 860px) {
  :root { --bar-h: 64px; }
  .home__hero { grid-template-columns: 1fr; gap: 22px; }
  .home__steps { grid-template-columns: 1fr; gap: 16px; }
  .site-foot { flex-direction: column; gap: 10px; }

  /* игра: зеркало сверху, пюпитр снизу */
  .play__main { display: flex; flex-direction: column; }
  .play__mirror { order: -1; flex: none; height: 43dvh; padding: 12px var(--gutter) 10px; align-items: stretch; }
  .play__stand { flex: 1; border-right: 0; border-top: 1px solid var(--line); }
  .mirror { height: 100%; align-content: center; }
  .mirror__frame { width: 100%; height: 100%; aspect-ratio: auto; max-height: 100%; border-radius: var(--radius); }
  .play .mirror.has-video { grid-template-rows: minmax(0, 1fr) auto; }
  .play__mirror:not(:has(.mirror.has-video)) { height: auto; padding-top: 16px; padding-bottom: 16px; }
  .stand { justify-content: center; padding: 14px var(--gutter) 12px; }
  .stand__coach { font-size: 18px; min-height: 0; margin-bottom: 10px; }
  .now { gap: 18px; }
  .now__glyph { width: clamp(96px, 30vw, 136px); }
  .now__name { font-size: clamp(38px, 11vw, 52px); }
  .now__note { font-size: 24px; }
  .now__text { gap: 6px; }
  .stand__hint { margin-top: 6px; font-size: 10px; }
  .ribbon { flex: 1 1 auto; min-height: 140px; max-height: 230px; height: auto; margin-top: 14px; }
  .rstep__note { font-size: 15px; top: 8px; }
  .play--learn .now__glyph { width: clamp(76px, 22vw, 104px); }

  .playbar {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    grid-template-areas: 'back title actions' 'mid mid mid';
    gap: 6px 12px;
    padding: 10px var(--gutter) 10px;
  }
  .playbar .btn-icon { width: 40px; height: 40px; }
  .playbar__back { grid-area: back; }
  .playbar__title { grid-area: title; }
  .playbar__name { font-size: 20px; }
  .playbar__by { font-size: 12px; }
  .playbar__mid { grid-area: mid; padding: 0; gap: 12px; }
  .playbar__actions { grid-area: actions; }
  .playbar__actions > .btn--quiet { display: none; }
  .playbar--free { grid-template-areas: 'back title actions'; }
  .playbar--free .playbar__mid { display: none; }
  .playbar__loading { bottom: -26px; }

  .pads { gap: 8px; }
  .pad { padding: 10px 4px 8px; gap: 2px; }
  .pad__key { top: 5px; right: 5px; min-width: 18px; height: 18px; font-size: 10px; padding: 0 4px; }
  .pad__name { font-size: 11px; }
  .mirror__fallback { align-content: center; gap: 10px; }
  .mirror__camline { font-size: 12.5px; }
  .mirror__live { left: 10px; bottom: 10px; padding: 6px 8px 4px; }
  .mirror__live-glyph { width: 56px; height: 56px; }
  .mirror__live-glyph .hand-glyph { width: 56px; height: 56px; }
  .mirror__caption { font-size: 20px; }

  .result { padding: 24px var(--gutter); place-items: start center; }
  .result__inner { padding-top: 4vh; }
  .result__stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .result__stat { padding: 16px 6px; }
  .result__actions .btn { flex: 1 1 100%; }

  .settings-backdrop { background: rgba(10, 9, 8, .6); opacity: 0; transition: opacity var(--t-fast) var(--ease); }
  .settings-backdrop.is-open { opacity: 1; }
  .settings {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 86dvh;
    border-radius: var(--radius-l) var(--radius-l) 0 0;
    border-bottom: 0;
    padding: 18px var(--gutter) calc(22px + env(safe-area-inset-bottom));
    transform: translateY(16px);
  }
  .settings__actions { display: flex; }
  .settings__actions .btn { flex: 1; }

  /* свободная игра на телефоне прокручивается */
  .free { height: auto; min-height: 100dvh; overflow: visible; grid-template-rows: auto auto auto; }
  .free__main { grid-template-columns: 1fr; gap: 18px; padding: 16px var(--gutter); }
  .free__controls { gap: 16px; order: 2; }
  .free__stage { order: 1; height: auto; }
  .free__stage .mirror__frame, .free-now { width: 100%; aspect-ratio: 4 / 3; height: auto; }
  .free__tip { display: none; }
  .pads--free { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .free-now__glyph .hand-glyph { width: 104px; height: 104px; }
  .free-now__name { font-size: 28px; }
}

@media (max-width: 560px) {
  .topline { padding: 20px var(--gutter); }
  .home__main { gap: 32px; }
  .home__title { font-size: clamp(42px, 12vw, 60px); }
  .home__cta .btn { flex: 1 1 100%; }
  .demo { padding: 20px 0 16px; }
  .demo__row { gap: 2px; }
  .demo__glyph { width: 40px; height: 40px; }
  .demo__name { display: none; }
  .demo__note { font-size: 16px; min-height: 20px; }
  .demo__num { font-size: 10px; letter-spacing: .06em; }
  .demo__cap { font-size: 10px; text-align: center; }

  .library__head { padding-bottom: 20px; }
  .chips { gap: 6px; }
  .chip { min-height: 34px; padding: 0 13px; font-size: 13px; }
  .song__link {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'main go' 'side side';
    gap: 10px 12px;
    padding: 18px 0;
  }
  .song__main { grid-area: main; }
  .song__go { grid-area: go; }
  .song__side { grid-area: side; display: flex; align-items: center; gap: 14px; justify-items: start; text-align: left; }
  .song__best { grid-area: best; }
  .song__link { grid-template-areas: 'main go' 'side best'; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter); scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .song__link .song__side::after { content: none; }
  .song__by { font-size: 13px; }
  .song__work { display: none; }
  .free-entry { grid-template-columns: minmax(0, 1fr) 20px; gap: 14px; padding: 20px; }
  .free-entry__glyphs { grid-column: 1 / -1; }
  .free-entry__glyphs .hand-glyph { width: 26px; height: 26px; }

  .now__key { display: none; }
  .result__title { font-size: 40px; }
}

@media (min-width: 1800px) {
  :root { --content: 1680px; }
  .now__glyph { width: clamp(224px, 13vw, 300px); }
  .ribbon { height: clamp(240px, 26vh, 340px); }
  .playbar__name { font-size: 28px; }
  .play__mirror .mirror { max-width: 1040px; }
  .pads--play .pad { padding: 26px 10px 18px; }
  .pads--play .pad__glyph .hand-glyph { width: 72px; height: 72px; }
  .pad__name { font-size: 15px; }
}
