/* ==========================================================================
   JM Rankify Motion — HOME STAGE (the cinematic intro film)
   Every entrance is a CSS animation so the whole film can pause.
   ========================================================================== */

.jm-stage {
	--sp: var(--jm-accent);
	position: relative;
	height: 100svh;
	min-height: 620px;
	max-height: 1100px;
	overflow: hidden;
	isolation: isolate;
	background:
		radial-gradient(ellipse 60% 50% at 50% 45%, color-mix(in srgb, var(--jm-accent) 5%, transparent), transparent 70%),
		var(--jm-bg);
	border-bottom: 1px solid var(--jm-line);
	user-select: none;
}
.jm-stage.is-paused *, .jm-stage.is-paused *::before, .jm-stage.is-paused *::after { animation-play-state: paused !important; }

.jm-orb { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.jm-stage-grid {
	position: absolute; inset: -64px; z-index: 0; pointer-events: none; opacity: .5;
	background-image: linear-gradient(var(--jm-line) 1px, transparent 1px), linear-gradient(90deg, var(--jm-line) 1px, transparent 1px);
	background-size: 64px 64px;
	mask-image: radial-gradient(ellipse 65% 60% at 50% 50%, #000 10%, transparent 75%);
	-webkit-mask-image: radial-gradient(ellipse 65% 60% at 50% 50%, #000 10%, transparent 75%);
	animation: st-grid 14s linear infinite;
}
@keyframes st-grid { to { transform: translate(64px, 64px); } }
.jm-stage-vignette { position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.65)); }
.jm-stage::after { /* film grain */
	content: ""; position: absolute; inset: -50%; z-index: 4; pointer-events: none; opacity: .06;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	animation: st-grain .8s steps(4) infinite;
}
@keyframes st-grain { 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } }

/* HUD corners */
.jm-stage .hud { position: absolute; z-index: 6; color: var(--jm-muted); font-size: .64rem; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.jm-stage .hud b { color: var(--jm-accent); font-weight: 500; }
.jm-stage .hud.tl { top: calc(var(--top) + 18px); left: 28px; }
.jm-stage .hud.tr { top: calc(var(--top) + 18px); right: 28px; font-variant-numeric: tabular-nums; }
.jm-stage .hud.bl { bottom: 92px; left: 28px; }
.jm-stage .hud.br { bottom: 92px; right: 28px; }

/* ---------- scenes ---------- */
.sc {
	position: absolute; z-index: 5;
	inset: calc(var(--top) + 30px) 5vw 158px;
	display: flex; flex-direction: column; align-items: center; justify-content: center;
	opacity: 0; visibility: hidden; pointer-events: none;
}
/* every scene's flow content sits in .sc-fit; JS scales it down (never up) when the
   screen is short, so nothing overlaps or hides behind something else on laptops */
.sc-fit { width: 100%; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; transform: scale(var(--k, 1)); transform-origin: 50% 50%; }
.sc.is-on { opacity: 1; visibility: visible; pointer-events: auto; }
.sc.is-out { visibility: visible; animation: sc-out .6s var(--ease-snap) forwards; }
@keyframes sc-out { from { opacity: 1; } to { opacity: 0; transform: scale(1.06); filter: blur(10px); } }
.sc mark { background: none; color: var(--jm-accent); padding: 0; }
.sc * { animation-fill-mode: both; }

/* reusable keyframes */
@keyframes k-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes k-up { from { opacity: 0; transform: translateY(26px); } }
@keyframes k-down { from { opacity: 0; transform: translateY(-20px); } }
@keyframes k-left { from { opacity: 0; transform: translateX(-40px); } }
@keyframes k-pop { 0% { opacity: 0; transform: scale(.6); } 60% { transform: scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes k-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* ===== Scene 1 — kinetic intro ===== */
.sc1 { justify-content: center; }
/* kicker sits in the flow above the big words, so it can never overlap them */
.sc-kicker { position: relative; align-self: flex-start; margin: 0 0 clamp(16px, 3.2vh, 30px) 2%; font-size: .82rem; z-index: 2; }
.sweep {
	display: inline-block; padding: 6px 10px; color: var(--jm-text);
	background: linear-gradient(var(--jm-accent), var(--jm-accent)) no-repeat 0 0 / 0% 100%;
}
.is-on .sweep { animation: k-fade .3s .2s both, sweep .7s .6s var(--ease-snap) forwards; }
@keyframes sweep { to { background-size: 100% 100%; color: var(--jm-ink); } }

.sc1-graph { position: absolute; left: 0; right: 0; top: 4%; height: 82%; width: 100%; overflow: visible; }
.sc1-graph .ax { stroke: var(--jm-line-2); stroke-width: 1; stroke-dasharray: 1; stroke-dashoffset: 1; vector-effect: non-scaling-stroke; }
.sc1-graph .tick { fill: var(--jm-muted); font: 10px var(--jm-mono); opacity: 0; }
.sc1-graph .curve { fill: none; stroke: var(--jm-accent); stroke-width: 2.5; stroke-dasharray: 1; stroke-dashoffset: 1; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 8px var(--jm-accent)); }
.sc1-graph .dot { fill: var(--jm-accent); filter: drop-shadow(0 0 10px var(--jm-accent)); opacity: 0; }
.is-on .sc1-graph .ax { animation: k-draw 1.1s .1s var(--ease) forwards; }
.is-on .sc1-graph .ax-y { animation-delay: .35s; }
.is-on .sc1-graph .tick { animation: k-fade .4s .8s forwards; }
.is-on .sc1-graph .curve { animation: k-draw 2.2s .9s var(--ease) forwards; }
.is-on .sc1-graph .dot { animation: k-fade .3s .9s forwards; }

.sc1-words {
	position: relative; z-index: 2; margin: 0; text-align: center;
	font: 900 clamp(3.6rem, 14vw, 13.5rem)/.84 var(--jm-display); font-stretch: 125%;
	letter-spacing: -.02em; text-transform: uppercase;
}
.sc1-words .w { display: block; overflow: hidden; padding: .04em .06em; }
.sc1-words .w.is-accent { color: var(--jm-accent); text-shadow: 0 0 40px color-mix(in srgb, var(--jm-accent) 45%, transparent); }
.sc1-words .ch { display: inline-block; transform-origin: 50% 100%; }
.is-on .sc1-words .ch { animation: ch-in .8s calc(1.0s + var(--i) * .45s + var(--c) * .045s) cubic-bezier(.2, 1.4, .3, 1) both; }
@keyframes ch-in { from { opacity: 0; transform: translateY(105%) scaleY(1.6) rotate(6deg); filter: blur(6px); } }
.sc1-sub { position: relative; z-index: 2; margin: 22px 0 0; font: 600 clamp(1rem, 2vw, 1.4rem)/1.3 var(--jm-body); color: var(--jm-text); letter-spacing: .02em; }
.is-on .sc1-sub { animation: k-up .8s 2.4s var(--ease) both; }

/* ===== Scene 2 — network graph ===== */
.sc-title { margin: 0 0 3vh; font: 900 clamp(1.6rem, 4vw, 3.2rem)/1 var(--jm-display); font-stretch: 125%; text-transform: uppercase; text-align: center; }
.is-on .sc-title { animation: k-down .7s .1s var(--ease) both; }
.sc2-graph { width: min(1100px, 100%); height: auto; overflow: visible; }
.sc2-graph .ln { fill: none; stroke: var(--jm-line-2); stroke-width: 1.5; stroke-dasharray: 1; stroke-dashoffset: 1; }
.sc2-graph .ln2 { stroke: color-mix(in srgb, var(--jm-accent) 55%, transparent); }
.is-on .sc2-graph .ln { animation: k-draw .7s calc(.7s + var(--d) * .14s) var(--ease) forwards; }
.is-on .sc2-graph .ln2 { animation: k-draw .6s calc(2.5s + var(--d) * .1s) var(--ease) forwards; }
.sc2-graph .node rect { fill: color-mix(in srgb, var(--jm-bg) 85%, #fff 3%); stroke: var(--jm-line-2); stroke-width: 1.2; }
.sc2-graph .node text { fill: var(--jm-text); font: 600 14px var(--jm-mono); letter-spacing: .08em; text-anchor: middle; }
.sc2-graph .n-center rect { stroke: var(--jm-accent); stroke-width: 2; fill: color-mix(in srgb, var(--jm-accent) 10%, var(--jm-bg)); filter: drop-shadow(0 0 18px color-mix(in srgb, var(--jm-accent) 40%, transparent)); }
.sc2-graph .n-center text { fill: var(--jm-accent); font: 900 20px var(--jm-display); font-stretch: 125%; letter-spacing: .02em; }
.sc2-graph .n-niche rect:first-child { stroke: color-mix(in srgb, var(--jm-accent) 45%, transparent); }
.sc2-graph .n-niche .chk { fill: transparent; stroke: var(--jm-accent); stroke-width: 1.2; }
.sc2-graph .n-niche .chk-mark { fill: none; stroke: var(--jm-ink); stroke-width: 2.4; stroke-dasharray: 1; stroke-dashoffset: 1; }
.sc2-graph .n-niche text { font-size: 13px; text-anchor: start; }
.sc2-graph .n-right rect { fill: var(--jm-accent); stroke: var(--jm-accent); }
.sc2-graph .n-right text { fill: var(--jm-ink); font-weight: 800; }
.sc2-graph .node { transform-box: fill-box; transform-origin: center; }
.is-on .sc2-graph .n-left { animation: k-left .6s .3s var(--ease) both; }
.is-on .sc2-graph .n-center { animation: k-pop .7s .6s var(--ease) both; }
.is-on .sc2-graph .n-niche { animation: k-left .5s calc(1.0s + var(--d) * .14s) var(--ease) both; }
.is-on .sc2-graph .n-niche .chk { animation: chk-fill .25s calc(1.7s + var(--d) * .14s) forwards; }
.is-on .sc2-graph .n-niche .chk-mark { animation: k-draw .3s calc(1.8s + var(--d) * .14s) forwards; }
.is-on .sc2-graph .n-right { animation: k-pop .6s 3.1s var(--ease) both, glow 1.6s 3.7s ease-in-out infinite; }
@keyframes chk-fill { to { fill: var(--jm-accent); } }
@keyframes glow { 50% { filter: drop-shadow(0 0 16px var(--jm-accent)); } }
.sc2-graph .pulse { fill: var(--jm-accent); opacity: 0; filter: drop-shadow(0 0 8px var(--jm-accent)); }
.is-on .sc2-graph .pulse { animation: pulse-run 1.4s 1.2s linear infinite; }
@keyframes pulse-run { 0% { opacity: 0; transform: translateX(0); } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(160px); } }

/* ===== Scene 3 — the brief ===== */
.sc3-aa { position: absolute; left: -2vw; top: 42%; font: 900 clamp(5rem, 15vw, 14rem)/1 var(--jm-display); font-stretch: 125%; color: var(--jm-text); opacity: .9; }
.is-on .sc3-aa { animation: aa 9s var(--ease) both; }
@keyframes aa { 0% { transform: translateX(-100%); opacity: 0; } 12% { transform: translateX(0); opacity: .9; } 40% { opacity: .9; transform: translateX(-18%); } 55%, 100% { transform: translateX(-120%); opacity: 0; } }
.sc3-in { position: relative; width: min(880px, 100%); }
.sc3-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.sc3-title { margin: 0; font: 900 clamp(1.8rem, 4.4vw, 3.4rem)/1 var(--jm-display); font-stretch: 125%; color: color-mix(in srgb, var(--jm-text) 92%, var(--jm-accent)); }
.is-on .sc3-title { animation: k-left .6s .2s var(--ease) both; }
.sc3-tl { display: flex; align-items: center; gap: 10px; font-size: .62rem; color: var(--jm-muted); }
.sc3-tl i { position: relative; width: 140px; height: 1px; background: var(--jm-line-2); }
.sc3-tl b { position: absolute; top: -4px; left: 0; width: 1px; height: 9px; background: var(--jm-accent); box-shadow: 0 0 8px var(--jm-accent); }
.is-on .sc3-tl { animation: k-fade .5s .4s both; }
.is-on .sc3-tl b { animation: tl-run 9s linear forwards; }
@keyframes tl-run { to { left: 100%; } }
.sc3-box {
	position: relative; padding: 16px 22px 14px; min-height: 170px;
	border: 1px solid var(--jm-line-2);
	background: color-mix(in srgb, var(--jm-bg) 70%, transparent);
	backdrop-filter: blur(4px);
	clip-path: polygon(0 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%);
}
.sc3-box::before, .sc3-box::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--jm-accent); }
.sc3-box::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.sc3-box::after { bottom: 6px; right: 6px; border-left: 0; border-top: 0; transform: rotate(45deg) scale(.6); opacity: .0; }
.is-on .sc3-box { animation: k-up .6s .35s var(--ease) both; }
.sc3-box-h { display: flex; justify-content: space-between; font-size: .6rem; color: var(--jm-muted); padding-bottom: 12px; border-bottom: 1px solid var(--jm-line); }
.sc3-box-h .dot { display: inline-block; width: 6px; height: 6px; background: var(--jm-accent); margin-right: 8px; vertical-align: middle; }
.sc3-type { min-height: 3.4em; margin: 16px 0 10px; font: 500 clamp(.95rem, 1.8vw, 1.25rem)/1.75 var(--jm-mono); color: var(--jm-text); text-transform: none; letter-spacing: 0; }
.sc3-type mark { background: var(--jm-accent); color: var(--jm-ink); padding: 1px 4px; animation: mk .25s var(--ease) both; }
@keyframes mk { from { background-size: 0; opacity: .3; } }
.sc3-box-f { color: var(--jm-muted); display: flex; align-items: center; gap: 6px; }
.caret { display: inline-block; width: 9px; height: 1.1em; background: var(--jm-accent); animation: jm-blink 1s steps(2) infinite !important; }
.sc3-type::after { content: ""; display: inline-block; width: .55em; height: 1.1em; margin-left: 2px; vertical-align: -2px; background: var(--jm-accent); animation: jm-blink .9s steps(2) infinite; }

.sc3-results { margin-top: 16px; opacity: 0; }
.sc3.is-res .sc3-results { opacity: 1; animation: k-up .5s var(--ease) both; }
.sc3-rh { margin: 0 0 10px; color: var(--jm-muted); font-size: .66rem; }
.sc3-rh .ok { color: var(--jm-accent); }
.sc3-rh b { color: var(--jm-accent); font-weight: 600; }
.sc3-results ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.sc3-results li {
	display: grid; grid-template-columns: 1.8fr .5fr .9fr .6fr .7fr 28px; align-items: center; gap: 12px;
	padding: 10px 14px; border: 1px solid var(--jm-line); background: color-mix(in srgb, var(--jm-bg) 75%, transparent);
	font: 500 .78rem/1 var(--jm-mono); animation: row-in .5s var(--ease) both;
}
.sc3-results li .site { color: var(--jm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc3-results li .cty { color: var(--jm-ink); background: var(--jm-text); padding: 3px 5px; justify-self: start; font-weight: 700; font-size: .66rem; }
.sc3-results li .nch, .sc3-results li .trf { color: var(--jm-muted); }
.sc3-results li .da { color: var(--jm-accent); }
.sc3-results li .ok { width: 18px; height: 18px; display: grid; place-items: center; background: var(--jm-accent); color: var(--jm-ink); }
.sc3-results li .ok svg { width: 12px; height: 12px; }
@keyframes row-in { from { opacity: 0; transform: translateX(30px); clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }

/* ===== Scene 4 — workflow ===== */
.sc4-title { margin: 0 0 4vh; font: 900 clamp(1.6rem, 4vw, 3rem)/1 var(--jm-display); font-stretch: 125%; text-transform: uppercase; }
.is-on .sc4-title { animation: k-down .6s .1s var(--ease) both; }
.sc4-body { position: relative; width: min(1040px, 100%); display: grid; grid-template-columns: 1fr 260px; align-items: center; gap: 40px; }
.sc4-bars, .sc4-pipe { grid-area: 1 / 1; }
.sc4-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; gap: 8px; transition: none; }
.sc4-bars li {
	position: relative; display: flex; align-items: center; gap: 14px;
	padding: 12px 18px 12px 14px;
	border: 1.5px solid var(--jm-hot);
	background: color-mix(in srgb, var(--jm-hot) 6%, var(--jm-bg));
	clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
	animation: bar-in .55s var(--ease) both;
}
.sc4-bars li .n { color: color-mix(in srgb, var(--jm-hot) 70%, var(--jm-text)); font-size: .6rem; }
.sc4-bars li b { font: 900 clamp(1rem, 2.2vw, 1.5rem)/1 var(--jm-display); font-stretch: 125%; text-transform: uppercase; }
.sc4-bars li em { margin-left: auto; font: 600 .8rem var(--jm-mono); font-style: normal; color: var(--jm-hot); }
.sc4-bars li::after { content: ""; position: absolute; left: 12px; right: 12px; top: 50%; height: 2px; background: var(--jm-text); transform: scaleX(0); transform-origin: left; }
@keyframes bar-in { from { opacity: 0; transform: translateY(40px) scale(.96); } }
.sc4.p2 .sc4-bars { animation: bars-out .7s var(--ease-snap) .5s forwards; }
.sc4.p2 .sc4-bars li::after { animation: strike .4s var(--ease) forwards; animation-delay: calc(var(--i) * .07s); }
@keyframes strike { to { transform: scaleX(1); } }
@keyframes bars-out { to { opacity: 0; transform: scale(.9) translateY(-20px); filter: blur(6px); } }

.sc4-pipe { display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; }
.sc4.p2 .sc4-pipe { opacity: 1; }
.pipe-node {
	padding: 16px 20px; background: var(--jm-accent); color: var(--jm-ink);
	font: 900 clamp(.85rem, 1.6vw, 1.15rem)/1 var(--jm-display); font-stretch: 125%; text-transform: uppercase; white-space: nowrap;
	clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
	opacity: 0;
}
.pipe-node:first-child { background: transparent; color: var(--jm-accent); box-shadow: inset 0 0 0 2px var(--jm-accent); clip-path: none; }
.pipe-ln { width: clamp(24px, 5vw, 70px); height: 2px; background: var(--jm-accent); transform: scaleX(0); transform-origin: left; box-shadow: 0 0 10px var(--jm-accent); }
.sc4.p2 .pipe-node { animation: k-pop .5s calc(1.1s + var(--i) * .45s) var(--ease) forwards; }
.sc4.p2 .pipe-ln { animation: strike .35s calc(1.35s + var(--i) * .45s) var(--ease) forwards; }

.sc4-timer { text-align: left; }
.sc4-timer .lbl { display: flex; align-items: center; gap: 8px; color: var(--jm-muted); font-size: .62rem; margin-bottom: 6px; }
.sc4-timer .lbl i { width: 6px; height: 6px; background: var(--jm-hot); }
.sc4-timer strong { display: block; font: 900 clamp(3rem, 7vw, 5.6rem)/1 var(--jm-display); font-stretch: 125%; color: var(--jm-hot); text-shadow: 0 0 40px color-mix(in srgb, var(--jm-hot) 40%, transparent); font-variant-numeric: tabular-nums; transition: color .4s; white-space: nowrap; }
.sc4.p2 .sc4-timer strong { font-size: clamp(2.2rem, 4.6vw, 4rem); }
.is-on .sc4-timer { animation: k-fade .5s .5s both; }
.sc4.p2 .sc4-timer strong { color: var(--jm-accent); text-shadow: 0 0 40px color-mix(in srgb, var(--jm-accent) 45%, transparent); animation: k-pop .6s 1.6s var(--ease) both; }
.sc4.p2 .sc4-timer .lbl i { background: var(--jm-accent); }

/* ===== Scene 5 — proof ===== */
.sc5-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: min(1100px, 100%); border-top: 1px solid var(--jm-line-2); }
.sc5-stat { position: relative; padding: 26px 18px 10px; animation: k-up .7s calc(.2s + var(--i) * .2s) var(--ease) both; }
.sc5-stat + .sc5-stat { border-left: 1px solid var(--jm-line); }
.sc5-stat::before { content: ""; position: absolute; top: -1px; left: 0; height: 2px; width: 100%; background: var(--jm-accent); transform: scaleX(0); transform-origin: left; animation: strike .8s calc(.4s + var(--i) * .2s) var(--ease) forwards; }
.sc5-stat strong { display: block; font: 900 clamp(2.2rem, 5.6vw, 5.2rem)/1 var(--jm-display); font-stretch: 125%; color: var(--jm-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sc5-stat:nth-child(odd) strong { color: var(--jm-accent); }
.sc5-stat span { display: block; margin-top: 12px; font: 500 .7rem/1.4 var(--jm-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--jm-muted); }
.sc5-chips { list-style: none; padding: 0; margin: 5vh 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 980px; }
.sc5-chips li { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--jm-line-2); background: color-mix(in srgb, var(--jm-bg) 70%, transparent); font: 600 .74rem/1 var(--jm-mono); text-transform: uppercase; letter-spacing: .04em; }
.sc5-chips li svg { color: var(--jm-accent); width: 14px; height: 14px; }
.is-on .sc5-chips li { animation: k-pop .45s calc(1.6s + var(--i) * .16s) var(--ease) both; }

/* ===== Scene 6 — logo ===== */
.sc6 { text-align: center; }
.sc6-kicker { margin: 0 0 12px; font-size: .8rem; letter-spacing: .5em; color: var(--jm-text); }
.is-on .sc6-kicker { animation: k-fade .6s .2s both; }
.sc6-logo {
	position: relative; margin: 0; white-space: nowrap;
	font: 900 clamp(2.8rem, 11vw, 10.5rem)/.9 var(--jm-display); font-stretch: 125%; letter-spacing: -.01em; text-transform: uppercase;
	color: var(--jm-text);
	text-shadow: 0 0 1px var(--jm-accent), 0 0 24px color-mix(in srgb, var(--jm-accent) 35%, transparent);
}
.sc6-logo .b { color: var(--jm-accent); }
.is-on .sc6-logo { animation: logo-in 1.2s .4s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes logo-in { from { opacity: 0; letter-spacing: .5em; filter: blur(14px); transform: scale(1.1); } }
.sc6-slash { position: absolute; left: 10%; right: 10%; top: 50%; height: 3px; background: linear-gradient(90deg, transparent, var(--jm-accent), #fff, var(--jm-accent), transparent); transform: rotate(-9deg) scaleX(0); box-shadow: 0 0 20px var(--jm-accent); pointer-events: none; }
.is-on .sc6-slash { animation: slash 1.4s 1.3s var(--ease-snap) both; }
@keyframes slash { 0% { transform: rotate(-9deg) scaleX(0); transform-origin: left; opacity: 1; } 35% { transform: rotate(-9deg) scaleX(1); transform-origin: left; opacity: 1; } 100% { transform: rotate(-9deg) scaleX(1); opacity: .0; } }
.sc6-sub { margin: 26px 0 30px; font: 500 clamp(.72rem, 1.4vw, .9rem)/1.4 var(--jm-mono); text-transform: uppercase; letter-spacing: .14em; color: var(--jm-muted); }
.is-on .sc6-sub { animation: k-up .6s 1.9s var(--ease) both; }
.sc6-btns { justify-content: center; }
.is-on .sc6-btns { animation: k-up .6s 2.3s var(--ease) both; }

/* ---------- captions ---------- */
.jm-caption {
	position: absolute; z-index: 7; left: 50%; bottom: 96px; transform: translateX(-50%);
	width: min(92%, 900px); margin: 0; text-align: center;
	font: 900 clamp(1rem, 2.2vw, 1.55rem)/1.2 var(--jm-display); font-stretch: 112%; text-transform: uppercase;
	color: #fff; text-shadow: 0 2px 14px rgba(0,0,0,.9);
	pointer-events: none; min-height: 1.2em;
}
.jm-caption .cw { display: inline-block; animation: cap .28s var(--ease) both; animation-delay: calc(var(--k) * 40ms); }
.jm-caption .cw.hl { color: var(--jm-accent); }
@keyframes cap { from { opacity: 0; transform: translateY(8px) scale(.9); } }

/* ---------- controls ---------- */
.jm-stage-ctrl { position: absolute; z-index: 8; left: 28px; right: 28px; bottom: 24px; display: flex; align-items: center; gap: 10px; }
.jm-voice-btn {
	display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 0 16px;
	background: color-mix(in srgb, var(--jm-bg) 60%, transparent); color: var(--jm-text);
	border: 1px solid var(--jm-accent); border-radius: 0; cursor: pointer;
	font: 600 .7rem/1 var(--jm-mono); letter-spacing: .08em; text-transform: uppercase;
	backdrop-filter: blur(8px);
	animation: vb 2.4s ease-in-out infinite;
}
@keyframes vb { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--jm-accent) 15%, transparent); } }
.jm-voice-btn svg { width: 18px; height: 18px; color: var(--jm-accent); }
.jm-voice-btn .ico-on, .jm-voice-btn .t-on { display: none; }
.jm-voice-btn[aria-pressed="true"] { background: var(--jm-accent); color: var(--jm-ink); animation: none; }
.jm-voice-btn[aria-pressed="true"] svg { color: var(--jm-ink); }
.jm-voice-btn[aria-pressed="true"] .ico-on, .jm-voice-btn[aria-pressed="true"] .t-on { display: inline; }
.jm-voice-btn[aria-pressed="true"] .ico-off, .jm-voice-btn[aria-pressed="true"] .t-off { display: none; }
.jm-stage-ctrl .jm-icon-btn { background: color-mix(in srgb, var(--jm-bg) 60%, transparent); backdrop-filter: blur(8px); }
.jm-stage-ctrl .jm-icon-btn svg { width: 16px; height: 16px; }
.jm-stage-ctrl .i-play { display: none; }
.jm-stage.is-paused .jm-stage-ctrl .i-play { display: inline; }
.jm-stage.is-paused .jm-stage-ctrl .i-pause { display: none; }
.jm-prog { flex: 1; display: flex; gap: 6px; max-width: 420px; margin-left: 8px; }
.jm-prog button { flex: 1; height: 18px; padding: 0; border: 0; background: none; cursor: pointer; display: flex; align-items: center; }
.jm-prog i { position: relative; display: block; width: 100%; height: 3px; background: var(--jm-line-2); overflow: hidden; }
.jm-prog i::after { content: ""; position: absolute; inset: 0; background: var(--jm-accent); transform: scaleX(var(--p, 0)); transform-origin: left; }
.jm-prog button:hover i { background: var(--jm-muted); }

.jm-scroll { position: absolute; z-index: 8; right: 28px; bottom: 30px; display: flex; align-items: center; gap: 10px; color: var(--jm-muted); text-decoration: none; font-size: .64rem; }
.jm-scroll i { width: 1px; height: 30px; background: linear-gradient(var(--jm-accent), transparent); animation: sc-line 1.8s ease-in-out infinite; transform-origin: top; }
@keyframes sc-line { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1023px) {
	.jm-stage .hud.bl, .jm-stage .hud.br { display: none; }
	.sc { inset: calc(var(--top) + 30px) 18px 158px; }
	.sc4-body { grid-template-columns: 1fr; gap: 22px; }
	.sc4-timer { text-align: center; order: -1; }
	.sc4-timer .lbl { justify-content: center; }
	.sc5-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.sc5-stat:nth-child(3) { border-left: 0; }
	.sc3-results li { grid-template-columns: 1.6fr .5fr .8fr .6fr 24px; }
	.sc3-results li .trf { display: none; }
}
@media (max-width: 640px) {
	.jm-stage { min-height: 640px; }
	.jm-stage .hud.tl, .jm-stage .hud.tr { top: calc(var(--top) + 10px); left: 16px; right: 16px; }
	.jm-stage .hud.tr { left: auto; }
	.sc-kicker { margin-left: 0; font-size: .64rem; }
	.sc1-words { font-size: clamp(3rem, 19vw, 6rem); }
	.sc3-aa { display: none; }
	.sc3-tl { display: none; }
	.sc3-box { padding: 12px 14px; min-height: 150px; }
	.sc3-results li { grid-template-columns: 1.7fr .5fr .5fr 22px; font-size: .66rem; gap: 8px; padding: 8px 10px; }
	.sc3-results li .nch { display: none; }
	.sc3-results li:nth-child(n+4) { display: none; }
	.pipe-node { padding: 11px 10px; font-size: .68rem; }
	.pipe-ln { width: 14px; }
	.sc4-bars li { padding: 9px 12px; }
	.sc5-stat { padding: 18px 10px 8px; }
	.sc5-chips li:nth-child(n+5) { display: none; }
	.sc6-logo { font-size: clamp(2.2rem, 13vw, 4rem); }
	.jm-caption { bottom: 84px; font-size: .95rem; }
	.jm-stage-ctrl { left: 16px; right: 16px; bottom: 18px; gap: 8px; }
	.jm-voice-btn { padding: 0 12px; }
	.jm-prog { display: none; }
	.jm-scroll { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.jm-stage-grid, .jm-stage::after { animation: none !important; }
}

/* first visit: invite the first tap (browsers need it before any sound) */
.jm-voice-btn .t-first { display: none; }
.jm-stage.is-first .jm-voice-btn .t-off { display: none; }
.jm-stage.is-first .jm-voice-btn .t-first { display: inline; }
.jm-stage.is-first .jm-voice-btn { background: var(--jm-accent); color: var(--jm-ink); animation: vb-strong 1.6s ease-in-out infinite; }
.jm-stage.is-first .jm-voice-btn svg { color: var(--jm-ink); }
@keyframes vb-strong { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--jm-accent) 22%, transparent), 0 0 30px color-mix(in srgb, var(--jm-accent) 50%, transparent); } }

/* auto-fit needs the real available width */
.sc1-words, .sc6-logo, .sc-title, .sc4-title { align-self: stretch; max-width: 100%; text-align: center; }
.sc6-logo { padding: 0 .04em; }

/* never break a big word in the middle (auto-fit shrinks it instead) */
.sc1-words .w { white-space: nowrap; }

/* Scene 2 — phone layout: a vertical flow instead of the wide graph */
.sc2-mobile { display: none; }
@media (max-width: 640px) {
	.sc2-graph { display: none; }
	.sc2-mobile { display: flex; flex-direction: column; align-items: center; gap: 0; width: 100%; }
	.m-node { padding: 12px 18px; border: 1px solid var(--jm-line-2); background: color-mix(in srgb, var(--jm-bg) 85%, #fff 3%); font: 600 .72rem/1 var(--jm-mono); letter-spacing: .08em; text-transform: uppercase; }
	.m-center { border: 2px solid var(--jm-accent); color: var(--jm-accent); font: 900 1.05rem/1 var(--jm-display); font-stretch: var(--jm-display-stretch); box-shadow: 0 0 24px color-mix(in srgb, var(--jm-accent) 35%, transparent); }
	.m-right { background: var(--jm-accent); border-color: var(--jm-accent); color: var(--jm-ink); font-weight: 800; }
	.m-ln { width: 2px; height: 22px; background: var(--jm-line-2); transform: scaleY(0); transform-origin: top; }
	.m-ln2 { background: var(--jm-accent); }
	.m-niches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: min(100%, 320px); }
	.m-niches span { display: flex; align-items: center; gap: 8px; padding: 10px 10px; border: 1px solid color-mix(in srgb, var(--jm-accent) 45%, transparent); font: 600 .68rem/1 var(--jm-mono); letter-spacing: .06em; }
	.m-niches b { width: 12px; height: 12px; border: 1.5px solid var(--jm-accent); flex: none; }
	.is-on .m-left { animation: k-down .5s .2s var(--ease) both; }
	.is-on .m-ln { animation: strike-y .35s .6s var(--ease) forwards; }
	.is-on .m-center { animation: k-pop .6s .8s var(--ease) both; }
	.is-on .sc2-mobile .m-ln:nth-of-type(2) { animation-delay: 1.3s; }
	.is-on .m-niches span { animation: k-up .45s calc(1.5s + var(--d) * .12s) var(--ease) both; }
	.is-on .m-niches b { animation: chk-bg .25s calc(2.1s + var(--d) * .12s) forwards; }
	.is-on .m-ln2 { animation: strike-y .35s 2.9s var(--ease) forwards; }
	.is-on .m-right { animation: k-pop .5s 3.2s var(--ease) both, glow 1.6s 3.8s ease-in-out infinite; }
}
@keyframes strike-y { to { transform: scaleY(1); } }
@keyframes chk-bg { to { background: var(--jm-accent); } }
