/* Motion layer for the discovery pages: trailer player, tiles, reveal.
   Loaded after seo.css. Flat fills with one hard edge, no gradients or blur,
   same palette as the app. All demo content is decorative; the real copy is
   in the page HTML. */
.scroll-progress { position: fixed; top: 0; left: 0; height: 0.2rem; width: 0; background: var(--green); z-index: 50; }
.js .reveal { opacity: 0; transform: translateY(1.2rem); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }

.trailer { margin: 1.75rem 0 2.25rem; }
.tr-stage {
  position: relative; container-type: inline-size; aspect-ratio: 1 / 1; overflow: hidden;
  background: var(--card); border-radius: 1rem; box-shadow: 0 5px 0 #0c0f12;
}
@media (min-width: 40rem) { .tr-stage { aspect-ratio: 16 / 10; } }
.tr-scene {
  position: absolute; inset: 0 0 6rem 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2.5cqw; padding: 3cqw; animation: sceneIn .45s ease both;
}
.tr-cap { position: absolute; left: 0; right: 0; bottom: 0; height: 6rem; padding: 0.8rem 1.1rem; background: #0c0f12; }
.tr-cap b { display: block; color: var(--text); font-size: 1rem; animation: sceneIn .4s ease both; }
.tr-cap span { display: block; color: var(--muted); font-size: 0.85rem; line-height: 1.45; animation: sceneIn .4s .05s ease both; }
.tr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.tr-btn, .tr-chip {
  font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; border: 0; color: var(--text);
  background: var(--face); border-radius: 0.6rem; padding: 0.45rem 0.8rem; box-shadow: 0 3px 0 #14181c;
}
.tr-btn { display: inline-flex; align-items: center; gap: 0.4rem; }
.tr-btn svg { width: 0.8rem; height: 0.8rem; }
.tr-btn:active, .tr-chip:active { transform: translateY(3px); box-shadow: none; }
.tr-chip[aria-current="true"] { background: var(--green); color: var(--on-green); box-shadow: 0 3px 0 var(--green-edge); }
.tr-prog { height: 0.3rem; background: var(--face); border-radius: 1rem; margin-top: 0.8rem; overflow: hidden; }
.tr-prog i { display: block; height: 100%; width: 0; background: var(--green); transition: width .15s linear; }
.trailer.paused *, .trailer.paused *::before { animation-play-state: paused !important; }

/* tiles + boards */
.board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6cqw; width: 100%; }
.tile {
  aspect-ratio: 1; display: grid; place-items: center; font-weight: 800; border-radius: 0.2rem;
  font-size: clamp(0.5rem, 2.6cqw, 1.1rem); color: var(--text); box-shadow: inset 0 0 0 2px #2a3138;
}
.tile.filled { box-shadow: inset 0 0 0 2px #5b656c; animation: pop .15s ease; }
.tile.flip { animation: flip .5s ease; }
.tile.t-g { background: var(--green); color: #fff; box-shadow: 0 2px 0 var(--green-edge); }
.tile.t-y { background: #f0b429; color: #3a2a00; box-shadow: 0 2px 0 #b77e14; }
.tile.t-x { background: #33404a; box-shadow: 0 2px 0 #1d262c; }

.boards3, .boards4 { display: flex; gap: 3cqw; width: 100%; justify-content: center; align-items: flex-start; }
.bcol { width: 26cqw; position: relative; animation: sceneIn .4s ease both; }
.boards4 .bcol { width: 19cqw; }
.bname { font-size: clamp(0.6rem, 2.4cqw, 0.85rem); font-weight: 700; margin-bottom: 0.4rem; color: var(--text); white-space: nowrap; }
.bcol .board { gap: 0.5cqw; }
.solved { position: absolute; right: 0; top: -0.2rem; background: var(--green); color: var(--on-green); font-size: clamp(0.5rem, 2cqw, 0.7rem); font-weight: 800; padding: 0.1rem 0.4rem; border-radius: 0.4rem; animation: pop .4s ease; }
.timer { width: 70%; height: 0.5rem; background: var(--face); border-radius: 1rem; overflow: hidden; }
.timer i { display: block; height: 100%; background: #f0b429; animation: drain linear forwards; }

.pl-row { display: flex; gap: 2cqw; flex-wrap: wrap; justify-content: center; }
.pl { display: flex; align-items: center; gap: 0.5rem; background: var(--face); border-radius: 0.7rem; padding: 0.45rem 0.75rem; box-shadow: 0 3px 0 #14181c; font-size: clamp(0.7rem, 2.6cqw, 0.9rem); font-weight: 700; animation: pop .45s ease both; }
.pl .rdy { background: var(--green); color: var(--on-green); font-size: 0.7rem; padding: 0.05rem 0.4rem; border-radius: 0.4rem; animation: pop .35s ease; }
.pl .wait { color: var(--muted); font-weight: 600; font-size: 0.7rem; }
.pl-col { display: flex; flex-direction: column; gap: 0.5rem; width: min(22rem, 90%); }
.pl-col .pl { justify-content: space-between; animation: slideIn .45s ease both; }
.count { font-size: 22cqw; font-weight: 900; color: var(--text); line-height: 1; }
.count.pop { animation: pop .65s ease; }
.count.go { color: var(--green); }
.keybtn { display: inline-block; background: var(--green); color: var(--on-green); font-weight: 800; border-radius: 0.7rem; padding: 0.55rem 1.2rem; box-shadow: 0 4px 0 var(--green-edge); font-size: clamp(0.75rem, 2.8cqw, 1rem); }
.keybtn.pressed { transform: translateY(3px); box-shadow: 0 1px 0 var(--green-edge); }
.codes { display: flex; gap: 1.2cqw; }
.codes .tile { width: 9cqw; font-size: clamp(0.9rem, 5cqw, 2rem); }
.codes .tile.t-y { animation: pop .3s ease; }
.toast { background: var(--face); border-radius: 0.7rem; padding: 0.5rem 0.9rem; font-size: clamp(0.65rem, 2.5cqw, 0.85rem); font-weight: 700; box-shadow: 0 3px 0 #14181c; animation: slideIn .4s ease both; }
.bubble { background: var(--green); color: var(--on-green); border-radius: 1rem; padding: 0.55rem 0.9rem; font-weight: 700; font-size: clamp(0.65rem, 2.5cqw, 0.85rem); animation: pop .4s ease; }
.chipr { display: flex; gap: 0.5rem; }
.chipr .pill { background: var(--face); border-radius: 2rem; padding: 0.25rem 0.7rem; font-size: clamp(0.6rem, 2.2cqw, 0.8rem); font-weight: 700; color: var(--muted); transition: background .2s, color .2s; }
.chipr .pill.on { background: var(--green); color: var(--on-green); }

.srow { display: grid; grid-template-columns: 4.5rem 1fr 3.5rem; align-items: center; gap: 0.6rem; width: min(26rem, 92%); font-size: clamp(0.65rem, 2.5cqw, 0.85rem); font-weight: 700; animation: slideIn .4s ease both; }
.srow .trk { height: 1.1rem; background: var(--face); border-radius: 0.4rem; overflow: hidden; }
.srow .trk i { display: block; height: 100%; width: 0; background: var(--green); border-radius: 0.4rem; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.srow small { display: block; color: var(--muted); font-weight: 600; }
.srow .num { text-align: right; }
.podium { display: flex; align-items: flex-end; gap: 2cqw; height: 65%; position: relative; }
.pcol { width: 18cqw; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; font-weight: 800; font-size: clamp(0.6rem, 2.4cqw, 0.85rem); }
.pcol .blk { width: 100%; border-radius: 0.5rem 0.5rem 0 0; background: var(--face); box-shadow: 0 3px 0 #14181c; display: grid; place-items: center; height: 0; transition: height .8s cubic-bezier(.2,.8,.2,1); font-size: clamp(0.9rem, 4cqw, 1.5rem); }
.pcol.first .blk { background: #f0b429; color: #3a2a00; box-shadow: 0 3px 0 #b77e14; }
.crown { font-size: clamp(1rem, 5cqw, 2rem); animation: bob 1s ease-in-out infinite; }
.conf { position: absolute; width: 0.55rem; height: 0.55rem; top: -10%; animation: fall 2.2s linear forwards; }

.cgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2cqw; width: min(24rem, 90%); }
.cw { background: var(--face); border-radius: 0.5rem; padding: 0.55rem 0.2rem; text-align: center; font-weight: 800; font-size: clamp(0.55rem, 2.4cqw, 0.85rem); box-shadow: 0 3px 0 #14181c; transition: transform .5s cubic-bezier(.2,.8,.2,1), background .3s; }
.cw.sel { transform: translateY(-3px); background: #5b656c; }
.cw.k-g { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-edge); }
.cw.k-y { background: #f0b429; color: #3a2a00; box-shadow: 0 3px 0 #b77e14; }
.cw.k-r { background: #e5484d; color: #fff; box-shadow: 0 3px 0 #a93038; }
.cw.k-k { background: #96a0a6; color: #111417; box-shadow: 0 3px 0 #5b656c; }
.rank { display: grid; grid-template-columns: 4rem 1fr 3rem; gap: 0.6rem; align-items: center; width: min(26rem, 92%); font-size: clamp(0.65rem, 2.5cqw, 0.85rem); font-weight: 700; animation: slideIn .4s ease both; }
.rank .trk { height: 0.9rem; background: var(--face); border-radius: 0.4rem; overflow: hidden; }
.rank .trk i { display: block; height: 100%; width: 0; background: #f0b429; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.rank .num { text-align: right; color: var(--muted); }
.big { font-size: clamp(1.4rem, 8cqw, 3rem); font-weight: 900; }
.mut { color: var(--muted); font-size: clamp(0.6rem, 2.3cqw, 0.8rem); font-weight: 600; }
.legend { display: flex; gap: 1.5cqw; flex-wrap: wrap; justify-content: center; }
.legend .lg { display: flex; align-items: center; gap: 0.4rem; font-size: clamp(0.55rem, 2.1cqw, 0.75rem); font-weight: 700; color: var(--muted); background: var(--face); padding: 0.25rem 0.55rem; border-radius: 0.5rem; transition: transform .2s, color .2s; }
.legend .lg.hot { color: var(--text); transform: scale(1.08); }
.legend .sw { width: 0.8rem; height: 0.8rem; border-radius: 0.2rem; }
.sline { display: flex; justify-content: space-between; width: min(22rem, 90%); font-weight: 700; font-size: clamp(0.7rem, 2.8cqw, 1rem); animation: slideIn .4s ease both; }
.segbar { display: flex; width: min(22rem, 90%); height: 1.1rem; border-radius: 0.4rem; overflow: hidden; background: var(--face); }
.segbar i { display: block; height: 100%; width: 0; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.modes3 { display: flex; gap: 3cqw; width: 100%; justify-content: center; }
.mcol { background: var(--face); border-radius: 0.8rem; padding: 0.7rem; width: 28cqw; text-align: center; animation: pop .45s ease both; box-shadow: 0 3px 0 #14181c; }
.mcol b { display: block; font-size: clamp(0.65rem, 2.6cqw, 0.9rem); margin-bottom: 0.5rem; }
.pips { display: flex; flex-wrap: wrap; gap: 0.25rem; justify-content: center; }
.pip { width: 1.1cqw; min-width: 0.4rem; height: 1.1cqw; min-height: 0.4rem; border-radius: 50%; background: #33404a; transition: background .2s, transform .2s; }
.pip.on { background: var(--green); transform: scale(1.3); }
.avs { display: flex; flex-wrap: wrap; gap: 0.2rem; justify-content: center; font-size: clamp(0.8rem, 3cqw, 1.3rem); }
.avs span { transition: opacity .4s, transform .4s, filter .4s; }
.avs span.out { opacity: .25; transform: scale(.6) rotate(-20deg); filter: grayscale(1); }

.calc { background: var(--card); border-radius: 1rem; padding: 1.25rem; box-shadow: 0 5px 0 #0c0f12; margin: 1.25rem 0; }
.calc label { display: flex; justify-content: space-between; font-weight: 700; font-size: 0.9rem; margin-top: 0.8rem; }
.calc input[type=range] { width: 100%; accent-color: var(--green); margin-top: 0.3rem; }
.calc .total { font-size: 2.6rem; font-weight: 900; margin: 0.8rem 0 0.3rem; color: var(--text); }
.calc .seg { display: flex; height: 1.1rem; border-radius: 0.4rem; overflow: hidden; background: var(--face); }
.calc .seg i { display: block; height: 100%; transition: width .35s ease; }
.calc .parts { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.7rem; margin: 1.5rem 0; }
@media (min-width: 40rem) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--card); border-radius: 0.9rem; padding: 0.9rem; text-align: center; box-shadow: 0 4px 0 #0c0f12; }
.stat b { display: block; font-size: 1.8rem; color: var(--green); }
.stat span { font-size: 0.8rem; color: var(--muted); }
tr.hl th, tr.hl td { background: #242a30; color: var(--text); transition: background .3s; }

@keyframes sceneIn { from { opacity: 0; transform: translateY(0.6rem); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-1rem); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes drain { from { width: 100%; } to { width: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.3rem); } }
@keyframes fall { to { transform: translateY(26rem) rotate(300deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .tile.flip, .tile.filled, .conf, .crown { animation: none; }
}

@media (min-width: 62rem) { .hero .tr-stage { aspect-ratio: 4 / 3; } }
