/* V-Pop! — the track editor (js/tracks.js, docs/v-pop-round5.md §8). Owned by music-editor.
   Every class starts with `tk-`. Builds on the tokens from css/vpop.css, and every var() has a fallback so the
   file also stands on its own. Phone first: the editor fits 358 px (390 px minus the modal's padding) and never
   scrolls the page sideways; the arrangement strip, the bar tabs and the piano roll scroll inside their own box.
   Studio hosts it under its sticky tabs; set --tk-top on the host to move the sticky play bar. */

.tk {
  --tk-ink: var(--ink, #14101f);
  --tk-card: var(--card, #1e1830);
  --tk-card2: var(--card2, #2a2242);
  --tk-card3: var(--ink-4, #362c55);
  --tk-text: var(--text, #f7f2ff);
  --tk-muted: var(--muted, #b8aed3);
  --tk-dim: var(--dim, #8379a3);
  --tk-pink: var(--pink, #ff4f9a);
  --tk-violet: var(--violet, #8b5cff);
  --tk-cyan: var(--cyan, #22d3ee);
  --tk-amber: var(--amber, #ffb020);
  --tk-green: var(--green, #2ee6a0);
  --tk-red: var(--red, #ff5d73);
  --tk-grad: linear-gradient(135deg, var(--tk-pink), var(--tk-violet) 55%, var(--tk-cyan));
  --tk-line: var(--line, rgba(255, 255, 255, .08));
  --tk-display: var(--font-display, "Baloo 2", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif);
  color: var(--tk-text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  font-size: 14px;
}
.tk *, .tk *::before, .tk *::after { box-sizing: border-box; }
:where(.tk) button { font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.tk button:disabled { opacity: .38; cursor: not-allowed; }
.tk button:focus-visible, .tk input:focus-visible { outline: 2px solid var(--tk-cyan); outline-offset: 2px; }

/* ---------- shared bits ---------- */
.tk-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 2px 0 0; }
.tk-h b { font-family: var(--tk-display); font-size: 17px; font-weight: 800; }
.tk-h small { color: var(--tk-muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.tk-h small b { font-family: inherit; font-size: 11px; font-weight: 900; padding: 0 4px; border-radius: 4px; background: var(--tk-card2); }
.tk-h small .tk-key-m { color: var(--tk-amber); }
.tk-h small .tk-key-s { color: var(--tk-green); }
.tk-lbl { color: var(--tk-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; flex: none; }
.tk-lbl2 { color: var(--tk-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin: 4px 2px 0; }
.tk-note { margin: 0; color: var(--tk-muted); font-size: 12.5px; line-height: 1.4; }
.tk-note.warn { color: var(--tk-amber); font-size: 14px; }
.tk-size { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--tk-muted); }
.tk-size i { position: relative; flex: 1; height: 8px; border-radius: 4px; background: var(--tk-card2); overflow: hidden; }
.tk-size i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); border-radius: 4px; background: var(--tk-cyan); }
.tk-size.warn i::after { background: var(--tk-amber); }
.tk-size.warn b { color: var(--tk-amber); }
.tk-warn { margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(255, 176, 32, .14); color: var(--tk-amber); font-size: 13px; font-weight: 600; }
.tk-val { min-width: 34px; text-align: center; font-family: var(--tk-display); font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }

.tk-ic {
  flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 14px;
  background: var(--tk-card2); font-size: 19px; line-height: 1; display: inline-grid; place-items: center;
  transition: transform .1s, background .15s;
}
.tk-ic:active:not(:disabled) { transform: scale(.92); }
.tk-ic.on { background: var(--tk-cyan); color: var(--tk-ink); box-shadow: 0 0 14px rgba(34, 211, 238, .45); }
.tk-ic.sm { font-size: 17px; }

.tk-btn {
  border: 0; border-radius: 999px; min-height: 44px; padding: 0 16px; font-weight: 700; background: var(--tk-card2);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; transition: transform .1s;
}
.tk-btn:active:not(:disabled) { transform: scale(.96); }
.tk-btn.primary { background: var(--tk-grad); color: #fff; box-shadow: 0 4px 14px rgba(255, 79, 154, .35); }
.tk-btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--tk-card2); }
.tk-btn.small { padding: 0 12px; font-size: 13.5px; }
.tk-btn.grow { flex: 1 1 auto; }
.tk-btn.big { width: 100%; min-height: 56px; font-size: 18px; }

.tk-chip {
  flex: none; border: 0; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--tk-card2);
  font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap;
}
.tk-chip.sm { padding: 0 10px; font-size: 13px; }
.tk-chip.on { background: var(--tk-grad); color: #fff; box-shadow: 0 3px 10px rgba(139, 92, 255, .35); }
.tk-chip small { font-weight: 500; opacity: .8; font-size: 11px; }
.tk-chip.dice { background: rgba(255, 176, 32, .16); color: var(--tk-amber); }
.tk-chiprow { display: flex; flex-wrap: wrap; gap: 6px; }

.tk-range { flex: 1 1 auto; min-width: 0; width: 100%; height: 44px; margin: 0; accent-color: var(--tk-pink); background: transparent; }
.tk-inp {
  flex: 1 1 120px; min-width: 0; min-height: 44px; border-radius: 12px; border: 2px solid var(--tk-card2);
  background: var(--tk-ink); color: var(--tk-text); padding: 0 12px; font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
}
.tk-inp:focus { border-color: var(--tk-violet); outline: none; }
.tk-stepper { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.tk-stepper > span { color: var(--tk-muted); font-size: 12px; font-weight: 700; margin-right: 2px; }
.tk-row2 { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.tk-row2.wrap { flex-wrap: wrap; justify-content: stretch; }
.tk-row2.wrap .tk-btn { flex: 1 1 140px; }

/* ---------- empty state ---------- */
.tk-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 14px 12px; border-radius: 16px; background: var(--grad-soft, linear-gradient(120deg, rgba(255, 79, 154, .22), rgba(139, 92, 255, .22) 55%, rgba(34, 211, 238, .18)));
}
.tk-empty p { margin: 0; font-weight: 700; font-size: 15px; }

/* ---------- 1. transport ---------- */
.tk-tp-main {
  position: sticky; top: var(--tk-top, 58px); z-index: 4;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; margin: 0 -2px;
  border-radius: 18px; background: rgba(20, 16, 31, .92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), inset 0 0 0 1px var(--tk-line);
}
.tk-play {
  flex: none; min-width: 100px; min-height: 48px; border: 0; border-radius: 999px; padding: 0 16px;
  background: var(--tk-grad); color: #fff; font-weight: 800; font-size: 16px; box-shadow: 0 4px 14px rgba(255, 79, 154, .4);
}
.tk-play.on { background: var(--tk-cyan); color: var(--tk-ink); box-shadow: 0 0 18px rgba(34, 211, 238, .55); animation: tk-throb .8s ease-in-out infinite; }
@keyframes tk-throb { 50% { filter: brightness(1.18); } }
.tk-time { flex: 1 1 auto; min-width: 0; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; color: var(--tk-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tk-tp { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px; border-radius: 16px; background: var(--tk-card2); }
.tk-tp-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tk-tp-row .tk-ic { background: var(--tk-card3); }
.tk-keyb {
  flex: none; min-height: 44px; border: 0; border-radius: 12px; padding: 0 12px; background: var(--tk-card3);
  font-size: 14px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.tk-swing { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 6px; }
.tk-swing > span { flex: none; color: var(--tk-muted); font-size: 12px; font-weight: 700; }
.tk-swing > span b { color: var(--tk-text); font-variant-numeric: tabular-nums; }

/* ---------- 2. arrangement ---------- */
.tk-arr { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tk-strip {
  display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 4px 2px 8px; margin: 0 -2px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; touch-action: pan-x pan-y;
}
.tk-part {
  --sc: #8b5cff;
  flex: none; scroll-snap-align: start; min-width: 78px; max-width: 120px; height: 60px; padding: 6px 10px 5px;
  border: 0; border-radius: 14px; background: var(--tk-card2); box-shadow: inset 0 4px 0 var(--sc);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; text-align: left;
  position: relative; transition: transform .12s;
}
.tk-part-e { position: absolute; right: 7px; top: 8px; font-size: 15px; }
.tk-part b { font-size: 13.5px; line-height: 1.2; max-width: 100%; padding-right: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-part small { color: var(--tk-muted); font-size: 11px; white-space: nowrap; }
.tk-part.on { background: linear-gradient(160deg, var(--sc), var(--tk-card2) 150%); color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .35), inset 0 0 0 2px rgba(255, 255, 255, .5); }
.tk-part.on small { color: rgba(255, 255, 255, .85); }
.tk-part.now::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 3px; height: 3px; border-radius: 3px; background: var(--tk-cyan); box-shadow: 0 0 8px var(--tk-cyan); }
.tk-strip.moving .tk-part { touch-action: none; }
.tk-part.lift { transform: translateY(-3px) scale(1.04); animation: tk-wiggle .5s ease-in-out infinite; }
@keyframes tk-wiggle { 25% { rotate: -2deg; } 75% { rotate: 2deg; } }
.tk-arr-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

/* ---------- 3. section bar ---------- */
.tk-secbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border-radius: 16px; background: var(--tk-card2); }
.tk-sectype { --sc: #8b5cff; background: var(--tk-card3); box-shadow: inset 4px 0 0 var(--sc); }
.tk-secbar .tk-ic { background: var(--tk-card3); }
.tk-secbar .tk-btn.ghost { box-shadow: inset 0 0 0 2px var(--tk-card3); }

/* ---------- 4. tracks (the mixer) ---------- */
.tk-tracks { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tk-trk { --tc: #ff4f9a; border-radius: 16px; background: var(--tk-card); box-shadow: inset 4px 0 0 var(--tc), inset 0 0 0 1px var(--tk-line); padding: 0 6px 0 10px; min-width: 0; }
.tk-trk.open { background: linear-gradient(180deg, var(--tk-card2), var(--tk-card) 90px); box-shadow: inset 4px 0 0 var(--tc), inset 0 0 0 1px rgba(255, 255, 255, .14), 0 6px 18px rgba(0, 0, 0, .3); }
.tk-trk.silent .tk-trk-n { opacity: .5; }
.tk-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 44px 44px; gap: 6px; align-items: center; min-height: 48px; }
.tk-trk-n { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 48px; padding: 0; border: 0; background: none; text-align: left; }
.tk-em { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; background: rgba(255, 255, 255, .07); }
.tk-trk.open .tk-em { background: var(--tc); box-shadow: 0 0 12px var(--tc); }
.tk-trk-t { display: flex; flex-direction: column; min-width: 0; }
.tk-trk-t b { font-size: 14.5px; line-height: 1.15; }
.tk-trk-t small { color: var(--tk-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-vol { accent-color: var(--tc); }
.tk-ms { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: var(--tk-card2); font-weight: 900; font-size: 15px; color: var(--tk-muted); }
.tk-ms.on { background: var(--tk-amber); color: var(--tk-ink); }
.tk-ms.s.on { background: var(--tk-green); color: var(--tk-ink); }
.tk-add { min-height: 48px; border: 2px dashed rgba(255, 255, 255, .2); border-radius: 16px; background: transparent; font-weight: 800; font-size: 15px; color: var(--tk-muted); }
.tk-add:active { background: var(--tk-card2); }

.tk-panel { display: flex; flex-direction: column; gap: 8px; padding: 4px 0 10px; margin-left: -6px; min-width: 0; }
.tk-ptools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tk-chip.inst { background: var(--tk-card3); max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.tk-pan { flex: 1 1 110px; min-width: 0; display: flex; align-items: center; gap: 4px; color: var(--tk-muted); font-size: 12px; font-weight: 800; }
.tk-pan .tk-range { accent-color: var(--tc); }
.tk-ic.dice { background: rgba(255, 176, 32, .16); }
.tk-ptools .tk-ic:not(.dice) { background: var(--tk-card3); }

/* ---------- 5a. drums ---------- */
.tk-dtools { display: flex; flex-wrap: wrap; gap: 6px; }
.tk-bars { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
.tk-bar { flex: none; min-width: 58px; min-height: 40px; border: 0; border-radius: 10px; background: var(--tk-card2); font-weight: 700; font-size: 13px; }
.tk-bar.on { background: var(--tc); color: var(--tk-ink); }
.tk-dgrid {
  display: grid; grid-template-columns: 40px repeat(16, minmax(0, 1fr)); grid-auto-rows: 32px; gap: 1px;
  padding: 3px; border-radius: 12px; background: var(--tk-ink); touch-action: manipulation;
}
.tk-dgrid.big { grid-template-columns: 44px repeat(8, minmax(0, 1fr)); grid-auto-rows: 40px; gap: 2px; }
.tk-dgrid.big .tk-lane { font-size: 12px; }
.tk-halves { display: inline-flex; gap: 4px; }
.tk-lane { min-width: 0; padding: 0 2px; border: 0; border-radius: 6px 3px 3px 6px; background: var(--tk-card2); font-size: 10.5px; font-weight: 800; color: var(--tk-muted); overflow: hidden; white-space: nowrap; text-overflow: clip; }
.tk-cell { min-width: 0; padding: 0; border: 0; border-radius: 4px; background: rgba(255, 255, 255, .07); transition: transform .08s, background .12s; }
.tk-cell.odd { background: rgba(255, 255, 255, .12); }
.tk-cell.beat { box-shadow: inset 2px 0 0 rgba(255, 255, 255, .16); }
.tk-cell.x { background: var(--tc); box-shadow: 0 0 8px var(--tc), inset 0 -3px 0 rgba(0, 0, 0, .2); }
.tk-cell.o { background: var(--tc); opacity: .5; }
.tk-cell.now { outline: 2px solid var(--tk-cyan); outline-offset: -2px; }
.tk-cell.x.now { transform: scale(1.12); filter: brightness(1.3); opacity: 1; }
.tk-cell:active { transform: scale(.88); }

/* ---------- 5b. piano roll ---------- */
.tk-rtools { display: flex; flex-direction: column; gap: 6px; }
.tk-lens { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.tk-lens .tk-chip { padding: 0 2px; font-size: 12px; min-width: 0; }
.tk-rtools2 { display: flex; gap: 6px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tk-zoom { display: inline-flex; gap: 4px; }
.tk-zoom .tk-ic { width: 52px; font-size: 13px; background: var(--tk-card3); }
.tk-nsel { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px 6px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
.tk-nsel > b { min-width: 38px; font-family: var(--tk-display); font-size: 16px; color: var(--tc); text-align: center; }
.tk-nsel .tk-ic { background: var(--tk-card3); }

.tk-roll {
  position: relative; height: 280px; overflow: auto; border-radius: 14px; background: var(--tk-ink);
  touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  box-shadow: inset 0 0 0 1px var(--tk-line);
}
.tk-rin { position: relative; min-width: 100%; }
.tk-ruler { position: sticky; top: 0; z-index: 4; display: flex; height: 18px; background: #191327; }
.tk-corner { position: sticky; left: 0; z-index: 5; flex: none; width: 36px; background: #191327; color: var(--tk-dim); font-size: 9px; text-transform: uppercase; display: grid; place-items: center; }
.tk-ticks { position: relative; flex: none; }
.tk-ticks span { position: absolute; top: 0; height: 18px; padding-left: 4px; border-left: 1px solid rgba(255, 255, 255, .25); font-size: 10px; font-weight: 800; color: var(--tk-muted); line-height: 18px; }
.tk-rbody { display: flex; position: relative; }
.tk-keys { position: sticky; left: 0; z-index: 3; flex: none; width: 36px; background: #191327; box-shadow: 1px 0 0 rgba(255, 255, 255, .1); }
.tk-key { height: var(--rh, 20px); line-height: var(--rh, 20px); font-size: 9.5px; font-weight: 700; padding-left: 4px; color: var(--tk-dim); border-bottom: 1px solid rgba(0, 0, 0, .3); white-space: nowrap; }
.tk-key.in { color: var(--tk-muted); background: rgba(255, 255, 255, .03); }
.tk-key.root { color: #fff; background: rgba(255, 79, 154, .28); }
.tk-lanes { position: relative; flex: none; }
.tk-lrow { position: absolute; left: 0; right: 0; height: var(--rh, 20px); border-bottom: 1px solid rgba(0, 0, 0, .35); pointer-events: none; }
.tk-lrow.in { background: rgba(255, 255, 255, .045); }
.tk-lrow.root { background: rgba(255, 79, 154, .12); }
.tk-lrow.out { background: rgba(0, 0, 0, .28); }
.tk-grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(90deg, rgba(255, 255, 255, .26) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px);
  background-size: calc(var(--w, 18px) * 16) 100%, calc(var(--w, 18px) * 4) 100%;
}
/* piano-roll note blocks: .tk-rnote (not .tk-note, which is the hint text — R5-REV-1) */
.tk-rnote {
  position: absolute; height: calc(var(--rh, 20px) - 2px); border-radius: 5px; background: var(--tc); touch-action: none; cursor: grab;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25), 0 0 8px color-mix(in srgb, var(--tc) 55%, transparent);
  z-index: 1;
}
.tk-rnote.v1 { opacity: .55; }
.tk-rnote.v3 { box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25), inset 0 0 0 2px rgba(255, 255, 255, .7); }
.tk-rnote.on { outline: 2px solid #fff; outline-offset: 1px; z-index: 2; }
.tk-rnote.drag { opacity: .85; z-index: 3; cursor: grabbing; }
.tk-nedge { position: absolute; top: -2px; bottom: -2px; left: max(calc(100% - 8px), 55%); width: 24px; cursor: ew-resize; touch-action: none; }
.tk-nedge::after { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: rgba(255, 255, 255, .7); }
.tk-ph { display: none; position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--tk-cyan); box-shadow: 0 0 8px var(--tk-cyan); pointer-events: none; z-index: 4; }

/* ---------- 5c. chords ---------- */
.tk-ccells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tk-cc { min-width: 0; min-height: 62px; border: 0; border-radius: 14px; background: var(--tk-card2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; box-shadow: inset 0 3px 0 var(--tc); }
.tk-cc b { font-family: var(--tk-display); font-size: 20px; line-height: 1.1; }
.tk-cc small { color: var(--tk-muted); font-size: 10.5px; white-space: nowrap; }
.tk-cc.none b { color: var(--tk-dim); }
.tk-cc.now { background: color-mix(in srgb, var(--tc) 40%, var(--tk-card2)); box-shadow: 0 0 14px var(--tc); }

/* ---------- 6. vocals ---------- */
.tk-vox { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 18px; background: linear-gradient(160deg, rgba(255, 93, 115, .14), var(--tk-card) 70%); box-shadow: inset 0 0 0 1px var(--tk-line); }
.tk-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; padding: 0 12px;
  border: 0; border-radius: 14px; background: var(--tk-card2); font-weight: 700; text-align: left;
}
.tk-switch i { flex: none; position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--tk-card3); transition: background .15s; }
.tk-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.tk-switch.on i { background: var(--tk-green); }
.tk-switch.on i::after { transform: translateX(20px); }
.tk-tip { margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(255, 176, 32, .12); color: #ffd98a; font-size: 13px; line-height: 1.35; }
.tk-recbox { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.tk-from { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tk-rec {
  min-height: 64px; border: 0; border-radius: 999px; font-size: 20px; font-weight: 900; color: #fff;
  background: radial-gradient(circle at 30% 30%, #ff7a8e, #e0244a 70%); box-shadow: 0 6px 22px rgba(224, 36, 74, .5);
}
.tk-rec:active:not(:disabled) { transform: scale(.97); }
.tk-recbox.live { align-items: center; padding: 12px; border-radius: 16px; background: rgba(224, 36, 74, .14); box-shadow: inset 0 0 0 2px rgba(255, 93, 115, .5); }
.tk-count { font-family: var(--tk-display); font-size: 56px; line-height: 1; font-weight: 900; color: #fff; text-shadow: 0 0 20px rgba(255, 93, 115, .8); }
.tk-count.rec { font-size: 26px; color: #ff6b81; animation: tk-throb 1s ease-in-out infinite; }
.tk-meter { width: 100%; height: 14px; border-radius: 999px; background: var(--tk-ink); overflow: hidden; }
.tk-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--tk-green), var(--tk-amber) 70%, var(--tk-red)); transition: width .08s linear; }
.tk-rtime { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--tk-muted); }
.tk-btn.stop { background: #fff; color: #c81d45; }
.tk-upl { position: relative; overflow: hidden; align-self: center; }
.tk-file { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; font-size: 16px; cursor: pointer; }
.tk-takes { display: flex; flex-direction: column; gap: 4px; }
.tk-take { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px 44px 44px; gap: 4px; align-items: center; min-height: 48px; padding: 2px; border-radius: 14px; background: var(--tk-card2); }
.tk-take.on { box-shadow: inset 0 0 0 2px var(--tk-amber); background: linear-gradient(160deg, rgba(255, 176, 32, .18), var(--tk-card2) 70%); }
.tk-take .tk-ic { background: transparent; }
.tk-take .tk-ic.star.on { background: transparent; box-shadow: none; }
.tk-take .tk-ic.on:not(.star) { background: var(--tk-cyan); }
.tk-take-n { display: flex; flex-direction: column; min-width: 0; }
.tk-take-n b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-take-n small { color: var(--tk-muted); font-size: 11.5px; }
.tk-takeed { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 14px; background: var(--tk-card2); }
.tk-sl { display: flex; flex-direction: column; min-width: 0; }
.tk-sl > span { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; color: var(--tk-muted); padding-top: 4px; }
.tk-sl > span b { color: var(--tk-text); font-variant-numeric: tabular-nums; }
.tk-sl .tk-range { height: 36px; accent-color: var(--tk-amber); }
.tk-lineup { display: flex; align-items: flex-end; gap: 8px; }
.tk-lineup .tk-sl { flex: 1 1 auto; }
.tk-lineup .tk-btn { flex: none; margin-bottom: 0; }

/* ---------- sheets (dom.openModal) ---------- */
.tk-sheet { gap: 10px; }
.tk-sheet h3 { margin: 0; padding-right: 48px; font-family: var(--tk-display); font-size: 20px; }
.tk-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.tk-pick {
  min-width: 0; min-height: 56px; border: 0; border-radius: 14px; background: var(--tk-card2); padding: 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.tk-pick b { font-family: var(--tk-display); font-size: 18px; line-height: 1.1; }
.tk-pick small { color: var(--tk-muted); font-size: 11px; }
.tk-pick.on { background: var(--tk-grad); color: #fff; box-shadow: 0 3px 12px rgba(255, 79, 154, .4); }
.tk-pick.on small { color: rgba(255, 255, 255, .85); }
.tk-keys12 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tk-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tk-seg .tk-chip { min-height: 52px; }
.tk-types { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tk-type {
  --sc: #8b5cff; min-width: 0; min-height: 56px; border: 0; border-radius: 14px; background: var(--tk-card2);
  box-shadow: inset 4px 0 0 var(--sc); display: flex; align-items: center; gap: 8px; padding: 0 12px; text-align: left;
}
.tk-type span { font-size: 22px; }
.tk-type b { font-size: 15px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-type small { color: var(--tk-muted); font-size: 11px; }
.tk-type.on { background: linear-gradient(160deg, var(--sc), var(--tk-card2) 150%); color: #fff; }
.tk-insts { display: flex; flex-direction: column; gap: 4px; }
.tk-inst { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 4px; align-items: center; border-radius: 14px; background: var(--tk-card2); padding: 2px; }
.tk-inst.on { box-shadow: inset 0 0 0 2px var(--tk-pink); }
.tk-inst-n { min-height: 48px; border: 0; background: none; display: flex; align-items: center; gap: 10px; padding: 0 10px; text-align: left; }
.tk-inst-n span { font-size: 22px; }
.tk-inst-n b { font-size: 15px; }
.tk-inst .tk-ic { background: var(--tk-card3); }

/* ---------- round 6: length, fit, the four parts, lyrics (docs/v-pop-round6.md §8.3) ---------- */
.tk-kara { flex: 1 0 100%; min-width: 0; display: flex; justify-content: center; }
.tk-kara .ly-kara { --ly-size: 16px; padding: 2px 8px 4px; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.tk-lenrow { flex-wrap: wrap; padding: 4px 0 2px; }
.tk-lenb {
  flex: 1 1 150px; min-width: 0; min-height: 44px; border: 0; border-radius: 12px; padding: 0 12px; background: var(--tk-card3);
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap;
}
.tk-lenb b { font-family: var(--tk-display); font-size: 18px; font-variant-numeric: tabular-nums; }
.tk-lenb small { color: var(--tk-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.tk-fit { flex: 1 1 140px; background: rgba(34, 211, 238, .16); color: var(--tk-cyan); }
.tk-lenpicks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tk-lenpicks .tk-pick { min-height: 48px; }

.tk-kinds { display: flex; flex-direction: column; gap: 6px; }
.tk-kinds-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.tk-kind {
  --sc: #8b5cff; position: relative; min-width: 0; min-height: 58px; padding: 6px 4px 5px; border: 0; border-radius: 14px;
  background: var(--tk-card2); box-shadow: inset 0 0 0 2px rgba(255, 176, 32, .55); color: var(--tk-text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-align: center;
  transition: transform .1s;
}
.tk-kind:active { transform: scale(.95); }
.tk-kind b { font-size: 12px; line-height: 1.15; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-kind-e { font-size: 19px; line-height: 1.1; }
.tk-kind i {
  position: absolute; top: -5px; right: -3px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px;
  font-style: normal; font-size: 12px; font-weight: 900; line-height: 20px; background: var(--tk-amber); color: var(--tk-ink);
}
.tk-kind.ok { box-shadow: inset 0 3px 0 var(--sc); background: linear-gradient(170deg, color-mix(in srgb, var(--sc) 26%, var(--tk-card2)), var(--tk-card2) 80%); }
.tk-kind.ok i { background: var(--tk-green); }
.tk-kinds .tk-note { color: var(--tk-amber); text-align: center; }

.tk-ly { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 18px; background: linear-gradient(160deg, rgba(139, 92, 255, .18), var(--tk-card) 70%); box-shadow: inset 0 0 0 1px var(--tk-line); }
.tk-ly .tk-tip { background: rgba(255, 79, 154, .12); color: #ffc2dc; }
.tk-lynav { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 6px; align-items: center; }
.tk-lypart {
  --sc: #8b5cff; min-width: 0; min-height: 48px; padding: 4px 10px; border-radius: 14px; background: var(--tk-card2);
  box-shadow: inset 4px 0 0 var(--sc); display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px;
}
.tk-lypart b { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-lypart small { flex: 1 0 100%; color: var(--tk-muted); font-size: 11.5px; }
.tk-lylines { display: flex; flex-direction: column; gap: 6px; counter-reset: none; }
.tk-lyl { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 6px; align-items: center; min-width: 0; }
.tk-lyl > span { color: var(--tk-muted); font-size: 11.5px; font-weight: 800; text-align: center; line-height: 1.1; }
.tk-lyin { width: 100%; }
.tk-lyin::placeholder { color: var(--tk-dim); }
.tk-lylines.same .tk-lyin { opacity: .72; border-style: dashed; }
.tk-lykara { display: flex; justify-content: center; min-width: 0; }
.tk-lykara .ly-kara { --ly-size: 20px; width: 100%; }
.tk-lyprev { width: 100%; }
.tk-lyprev.on { background: var(--tk-cyan); color: var(--tk-ink); }

/* ---------- karaoke (lyrics.mountKaraoke): every host (the studio, the act page, the player bar, the MV) ----------
   Hosts tune it with --ly-size, --ly-fill (sung), --ly-off (still to sing) and --ly-bg; `.ly-one` is the one-line
   strip. The sung part fills left to right through --ly-u (0–1), set every frame without any layout work. */
.ly-kara {
  --ly-fill: #ffd36e;
  --ly-off: rgba(255, 255, 255, .5);
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; max-width: 100%;
  padding: 6px 14px 7px; border-radius: 16px; background: var(--ly-bg, rgba(14, 9, 26, .62));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  text-align: center; pointer-events: none; box-sizing: border-box;
}
.ly-hide { display: none; }
.ly-now {
  margin: 0; max-width: 100%; font-family: var(--font-display, "Baloo 2", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif);
  font-size: var(--ly-size, 18px); font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ly-t {
  background-image: linear-gradient(90deg, var(--ly-fill) 0, var(--ly-fill) calc(var(--ly-u, 0) * 100%), #fff calc(var(--ly-u, 0) * 100%), #fff 100%);
  -webkit-box-decoration-break: slice; box-decoration-break: slice;
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, .55));
}
.ly-next {
  margin: 0; max-width: 100%; font-size: calc(var(--ly-size, 18px) * .72); font-weight: 600; line-height: 1.3;
  color: var(--ly-off); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ly-next:empty { display: none; }
.ly-rest .ly-t { letter-spacing: .35em; opacity: .75; }
.ly-still .ly-t { background: none; color: var(--ly-fill); -webkit-text-fill-color: currentColor; }
.ly-one { flex-direction: row; padding: 3px 10px; }
.ly-one .ly-now { -webkit-line-clamp: 1; }
.ly-one .ly-next { display: none; }

@media (prefers-reduced-motion: reduce) {
  .tk-play.on, .tk-part.lift, .tk-count.rec { animation: none; }
  .ly-t { background: none; color: var(--ly-fill, #ffd36e); -webkit-text-fill-color: currentColor; }
}
