/* ---------- Concert chrome ---------- */
body.is-concert .concert { pointer-events: auto; }
/* the card on the left shows the track and closes the concert */
.concert__meta, .concert__close, .concert__title, .concert__hint { display: none; }

/* ---------- "Now playing" card, left of the lyrics ---------- */
/* everything inside is measured in --u, a hundredth of the card's width, so the whole card grows
   with the screen instead of stopping at a fixed size on a big monitor */
.concert { --np-w: max(300px, min(30vw, 46vh)); }
.np {
  --u: calc(var(--np-w) / 100);
  position: absolute;
  left: var(--gutter);
  top: 50%;
  z-index: 3;
  display: grid;
  grid-template-columns: calc(var(--u) * 42) minmax(0, 1fr);
  grid-template-areas: "cover meta" "seek seek" "times times" "controls controls" "foot foot";
  align-content: space-between;
  gap: calc(var(--u) * 2.6) calc(var(--u) * 4.4);
  width: var(--np-w);
  aspect-ratio: 1;
  padding: calc(var(--u) * 4.4) calc(var(--u) * 4.4) calc(var(--u) * 4);
  border: 1px solid rgba(242, 238, 233, .08);
  border-radius: calc(var(--u) * 6.8);
  background: linear-gradient(180deg, rgba(26, 21, 29, .82), rgba(9, 8, 12, .9));
  box-shadow: 0 50px 120px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .05);
  text-align: left;
  transform: translate(-24px, -50%);
  opacity: 0;
  transition: transform .8s var(--ease) .1s, opacity .6s ease .1s;
}
body.is-concert .np { transform: translate(0, -50%); opacity: 1; }
/* a red glow breathes behind the cover with the kick */
.np::before {
  content: "";
  position: absolute;
  left: 2%;
  width: 48%;
  top: 2%;
  height: 46%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--red-rgb), .55), transparent);
  filter: blur(26px);
  opacity: calc(.25 + var(--beat) * .6);
  will-change: opacity;
}
.np__cover {
  grid-area: cover;
  position: relative;
  aspect-ratio: 1;
  border-radius: calc(var(--u) * 4.4);
  overflow: hidden;
  background: #0d0b10;
  box-shadow: 0 26px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(242, 238, 233, .08);
  transform: scale(calc(1 + var(--beat) * .012));
  will-change: transform;
}
.np__cover canvas, .np__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.np__cover img { opacity: 0; transition: opacity .6s; }
.np__cover.has-art img { opacity: 1; }
.np.is-playing .np__cover:not(.has-art) canvas { animation: spin 6s linear infinite; }
.np__meta { grid-area: meta; align-self: center; display: grid; gap: calc(var(--u) * 1); min-width: 0; }
.np__meta::before { content: "сейчас играет"; color: var(--red); font-family: var(--f-mono); font-size: calc(var(--u) * 2.5); letter-spacing: .06em; }
.np__title { font-family: var(--f-body); font-weight: 800; font-size: calc(var(--u) * 6.2); line-height: 1.1; letter-spacing: -.02em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.np__artist { color: var(--muted); font-size: calc(var(--u) * 3.7); }

.np__seek { grid-area: seek; position: relative; height: calc(var(--u) * 4.4); margin: 2px 2px 0; cursor: pointer; touch-action: none; outline: none; }
.np__seek::before, .np__fill {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--u) * 1.6);
  height: calc(var(--u) * 1.2);
  border-radius: 99px;
  background: rgba(242, 238, 233, .16);
}
.np__fill { background: linear-gradient(90deg, var(--red), #ff5a50); transform-origin: 0 50%; transform: scaleX(0); }
.np__knob {
  position: absolute;
  top: calc(var(--u) * .6);
  left: 0;
  width: calc(var(--u) * 3.2);
  height: calc(var(--u) * 3.2);
  margin-left: calc(var(--u) * -1.6);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 calc(var(--u) * .8) rgba(var(--red-rgb), .25), 0 2px 8px rgba(0, 0, 0, .5);
  transform: scale(.85);
  transition: transform .2s;
}
.np__seek:hover .np__knob, .np__seek.is-held .np__knob, .np__seek:focus-visible .np__knob { transform: scale(1.15); }
.np__times { grid-area: times; display: flex; justify-content: space-between; margin: calc(var(--u) * -2) 2px 0; font-family: var(--f-mono); font-size: calc(var(--u) * 2.6); color: var(--muted); font-variant-numeric: tabular-nums; }

.np__controls { grid-area: controls; display: flex; align-items: center; justify-content: center; gap: calc(var(--u) * 8); }
.np__btn {
  display: grid;
  place-items: center;
  width: calc(var(--u) * 11.5);
  height: calc(var(--u) * 11.5);
  border-radius: 50%;
  color: var(--fg-2);
  transition: color .25s, background-color .25s, transform .25s var(--ease);
}
.np__btn svg { width: calc(var(--u) * 5.6); height: calc(var(--u) * 5.6); fill: currentColor; }
.np__btn:hover { color: #fff; background: rgba(242, 238, 233, .07); }
.np__btn:active { transform: scale(.92); }
.np__play {
  width: calc(var(--u) * 17.5);
  height: calc(var(--u) * 17.5);
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff5b67, var(--red) 55%, #b50f1d);
  box-shadow: 0 14px 34px rgba(var(--red-rgb), .45), 0 0 0 calc(var(--beat) * var(--u) * 1.8) rgba(var(--red-rgb), .16);
}
.np__play:hover { color: #fff; background: radial-gradient(circle at 35% 30%, #ff6f79, #ff3a4a 55%, #c3121f); transform: scale(1.05); }
.np__play svg { width: calc(var(--u) * 7.2); height: calc(var(--u) * 7.2); }
.np__play .icon-pause, .np.is-playing .np__play .icon-play { display: none; }
.np.is-playing .np__play .icon-pause { display: block; }

.np__foot { grid-area: foot; display: flex; align-items: center; gap: calc(var(--u) * 2.8); padding-top: calc(var(--u) * 2); border-top: 1px solid rgba(242, 238, 233, .07); }
.np__vol { display: flex; align-items: center; gap: calc(var(--u) * 1.2); flex: 1 1 auto; min-width: 0; color: var(--muted); }
.np__vol svg { flex: none; width: calc(var(--u) * 4.4); height: calc(var(--u) * 4.4); fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.np__vol svg .fill { fill: currentColor; stroke: none; }
.np__vol input { width: 100%; min-width: 50px; accent-color: var(--red); }
.np__sync { display: flex; align-items: center; gap: calc(var(--u) * .8); flex: none; color: var(--muted); font-family: var(--f-mono); font-size: calc(var(--u) * 2.4); white-space: nowrap; }
.np__sync button { width: calc(var(--u) * 6.4); height: calc(var(--u) * 7.2); border-radius: calc(var(--u) * 2); font-size: calc(var(--u) * 4.4); line-height: 1; color: var(--fg-2); }
.np__sync button:hover { background: rgba(242, 238, 233, .07); color: #fff; }
.np__exit { flex: none; width: calc(var(--u) * 9.2); height: calc(var(--u) * 9.2); }
.np__exit svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; width: calc(var(--u) * 4.4); height: calc(var(--u) * 4.4); }

/* lyrics sit in the space right of the card and grow with the screen as well */
@media (min-width: 1021px) {
  .concert .karaoke { left: calc(var(--gutter) + var(--np-w) + 4vw); }
  .concert .karaoke__lines { width: calc(100% - var(--gutter)); }
  .concert .concert__lyrics-cta { margin-left: calc(var(--np-w) + 4vw); }
  .concert .kl { font-size: clamp(30px, min(3.9vw, 6.4vh), 180px); }
}
.concert__close {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: var(--gutter);
  z-index: 3;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--fg-2);
  background: rgba(10, 9, 14, .7);
  transition: color .3s, border-color .3s;
}
.concert__close:hover { color: var(--red); border-color: rgba(var(--red-rgb), .6); }

.concert__lyrics-cta {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 440px;
  margin: 28px auto 0;
  padding: 0 16px;
  text-align: center;
}
.concert__lyrics-cta .mono { color: var(--red); font-size: 10px; }
.concert__lyrics-note { color: var(--muted); font-size: 13px; line-height: 1.55; }
.concert__lyrics-note b { color: var(--fg-2); font-weight: 600; }

/* ---------- Karaoke ---------- */
.karaoke {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 15%, #000 36%, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, transparent 15%, #000 36%, #000 80%, transparent 100%);
}
.concert.has-lyrics .karaoke { display: block; }
.concert.has-lyrics .concert__lyrics-cta,
.concert.has-lyrics .concert__hint { display: none; }
.concert.has-lyrics .concert__scope { opacity: .16; }
.concert.has-lyrics .concert__title {
  position: absolute;
  top: max(22px, env(safe-area-inset-top));
  left: var(--gutter);
  font-size: 30px;
  color: var(--red);
  -webkit-text-stroke: 0;
  text-shadow: none;
  transform: none;
}
.concert.has-lyrics .concert__meta {
  position: absolute;
  top: max(64px, calc(env(safe-area-inset-top) + 44px));
  left: var(--gutter);
  font-size: 10px;
}

.karaoke__lines {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  width: min(100% - var(--gutter) * 2, 1100px);
  margin: 0 auto;
  text-align: left;
  transform: translate3d(0, 40vh, 0);
  transition: transform .75s cubic-bezier(.22, .9, .25, 1);
  will-change: transform;
}

.kl {
  margin: 0 0 .42em;
  font-family: var(--f-body);
  font-weight: 800;
  font-size: clamp(28px, 3.5vw, 58px);
  line-height: 1.16;
  letter-spacing: -.025em;
  color: rgba(242, 238, 233, .9);
  opacity: .22;
  transform-origin: 0 50%;
  transform: scale(.94);
  transition: opacity .5s ease, transform .6s cubic-bezier(.22, .9, .25, 1);
  cursor: pointer;
}
.kl:hover { opacity: .6; }
.kl.is-past { opacity: .4; transform: scale(.94); }
.kl.is-next { opacity: .5; }
.kl.is-active { opacity: 1; transform: scale(calc(1 + var(--beat) * .018)); }

/* word fill: a two-tone gradient slid under clipped text */
.kw {
  --f: 0;
  background: linear-gradient(90deg, #fff 0 47%, rgba(242, 238, 233, .34) 53% 100%);
  background-size: 200% 100%;
  background-position: calc((1 - var(--f)) * 100%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.kl.is-past .kw { --f: 1; }
.kl.is-active .kw, .subs .kw { display: inline-block; transition: transform .25s cubic-bezier(.22, .9, .25, 1); }
.kl.is-active .kw.is-now, .subs .kw.is-now { transform: translateY(-.05em); }
.kl.is-active .kw { text-shadow: none; }
.kl.is-active {
  filter: drop-shadow(0 0 18px rgba(var(--red-rgb), calc(.15 + var(--beat) * .45)));
}

/* instrumental breaks */
.kl--gap { display: flex; gap: .32em; height: 1.16em; align-items: center; }
.kl--gap i {
  width: .3em;
  height: .3em;
  border-radius: 50%;
  background: #fff;
  opacity: .3;
  transform: scale(.7);
  transition: opacity .3s, transform .3s;
}
.kl--gap.is-active i:nth-child(1) { opacity: calc(.3 + min(1, var(--f, 0) * 3) * .7); transform: scale(calc(.7 + min(1, var(--f, 0) * 3) * .3 + var(--beat) * .25)); }
.kl--gap.is-active i:nth-child(2) { opacity: calc(.3 + max(0, min(1, var(--f, 0) * 3 - 1)) * .7); transform: scale(calc(.7 + max(0, min(1, var(--f, 0) * 3 - 1)) * .3 + var(--beat) * .25)); }
.kl--gap.is-active i:nth-child(3) { opacity: calc(.3 + max(0, min(1, var(--f, 0) * 3 - 2)) * .7); transform: scale(calc(.7 + max(0, min(1, var(--f, 0) * 3 - 2)) * .3 + var(--beat) * .25)); }

/* marker mode (.txt -> .lrc) */
.concert.is-recording .kl { cursor: default; }
.concert.is-recording .kl.is-next { opacity: 1; transform: scale(1); }
.concert.is-recording .kl.is-next::before { content: "пробел ▸ "; color: var(--red); font-size: .4em; vertical-align: middle; letter-spacing: .1em; }
.concert.is-recording .kl.is-past .kw,
.concert.is-recording .kl.is-active .kw { --f: 1; }

/* scratch feedback on the name */
body.is-scratching .hero__name { color: var(--amber); transition: color .2s; }

/* phones and narrow screens: the card becomes a strip at the top */
@media (max-width: 1020px) {
  .concert { --np-w: 440px; }
  .np {
    top: max(12px, env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    width: auto;
    aspect-ratio: auto;
    align-content: normal;
    grid-template-columns: 56px minmax(0, 1fr) auto auto;
    grid-template-areas: "cover meta play exit" "seek seek seek seek";
    align-items: center;
    gap: 8px 12px;
    padding: 10px 10px 8px;
    border-radius: 20px;
    transform: translateY(-16px);
  }
  body.is-concert .np { transform: none; }
  .np__cover { grid-area: cover; border-radius: 12px; }
  .np__meta { grid-area: meta; padding: 0; gap: 2px; }
  .np__meta::before { display: none; }
  .np__title { font-size: 16px; -webkit-line-clamp: 1; }
  .np__artist { font-size: 12px; }
  .np__controls { grid-area: play; gap: 0; }
  .np__controls [data-np="back"], .np__controls [data-np="fwd"] { display: none; }
  .np__play { width: 46px; height: 46px; }
  .np__play svg { width: 20px; height: 20px; }
  .np__foot { grid-area: exit; padding: 0; border: 0; }
  .np__exit { width: 40px; height: 40px; }
  .np__exit svg { width: 18px; height: 18px; }
  .np__vol, .np__sync { display: none; }
  .np__seek { grid-area: seek; height: 18px; margin: 0 4px; }
  .np__seek::before, .np__fill { top: 7px; height: 4px; }
  .np__knob { top: 3px; width: 12px; height: 12px; margin-left: -6px; }
  .np__times { display: none; }
  .karaoke { -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 17%, #000 32%, #000 82%, transparent 100%); mask-image: linear-gradient(to bottom, transparent 0, transparent 17%, #000 32%, #000 82%, transparent 100%); }
}
@media (max-width: 720px) {
  .kl { font-size: clamp(26px, 7.4vw, 40px); }
}

@media (prefers-reduced-motion: reduce) {
  .karaoke__lines, .kl { transition: none; }
}
