/* v05 Stories: the frame, the story chrome (segment bars + header), slides, stickers, buttons. */
:root {
  --bg: #0b0614;
  --ink: #fff;
  --mute: rgba(255, 255, 255, .72);
  --ring: conic-gradient(from 210deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5, #feda75);
  --ring-lin: linear-gradient(45deg, #feda75, #fa7e1e 25%, #d62976 50%, #962fbf 75%, #4f5bd5);
  --ok: #27e07a;
  --no: #ff4d6d;
  --a: #7b2ff7;
  --b: #f107a3;
  --c: #ff8a00;
  --disp: Impact, 'Haettenschweiler', 'Avenir Next Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif-condensed, sans-serif;
  --ui: system-ui, -apple-system, 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
  --hand: 'Marker Felt', 'Bradley Hand', 'Chalkboard SE', 'Comic Sans MS', cursive;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .9, .25, 1);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font: 500 16px/1.4 var(--ui); -webkit-font-smoothing: antialiased; }
body { overflow: hidden; overscroll-behavior: none; }
body[data-phase="results"] { overflow-x: hidden; overflow-y: auto; height: auto; min-height: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- the app and the 9:16 story frame ---------- */
.app { position: fixed; inset: 0; overflow: hidden; }
.backdrop { position: absolute; inset: 0; background: #07040d; }
.bd-glow { position: absolute; inset: -20%; background: radial-gradient(40% 40% at 30% 30%, var(--a), transparent 70%), radial-gradient(45% 45% at 75% 70%, var(--b), transparent 70%); opacity: .35; filter: blur(40px); transition: background .8s; }
.bd-img { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(38px) saturate(1.3) brightness(.45); opacity: .9; transition: opacity .6s; }
.frame { position: absolute; inset: 0; overflow: hidden; background: #05030a; isolation: isolate; }
.art { position: absolute; inset: 0; background: linear-gradient(165deg, var(--a), var(--b) 60%, var(--c)); }
.art svg { width: 100%; height: 100%; display: block; opacity: .9; }
.stage { position: absolute; inset: 0; opacity: 0; transition: opacity .8s; }
.stage.is-on { opacity: 1; }
.stage.is-off { visibility: hidden; }
.vig { position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .3s;
  background: radial-gradient(120% 80% at 50% 55%, transparent 45%, rgba(255, 0, 40, .75) 100%); }
.layer { position: absolute; inset: 0; z-index: 3; perspective: 1300px; pointer-events: none; }
.layer > .slide { pointer-events: auto; }
.layer > .slide.leaving, .layer > .slide--hud { pointer-events: none; }
.chrome { position: absolute; left: 0; right: 0; top: 0; z-index: 6; padding: calc(8px + var(--safe-t)) 10px 0; pointer-events: none;
  background: linear-gradient(rgba(0, 0, 0, .45), rgba(0, 0, 0, 0)); }
.peek { display: none; }
@media (max-width: 759px), (max-height: 559px) { .backdrop .bd-img, .bd-glow { display: none; } }

@media (min-width: 760px) and (min-height: 560px) {
  .frame { inset: auto; left: 50%; top: 50%; height: min(calc(100vh - 40px), 900px); width: calc(min(calc(100vh - 40px), 900px) * 9 / 16);
    transform: translate(-50%, -50%); border-radius: 18px; box-shadow: 0 30px 90px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06); }
  .peek { display: grid; position: absolute; top: 50%; width: calc(min(calc(100vh - 40px), 900px) * 9 / 16 * .52); aspect-ratio: 9 / 16; transform: translateY(-50%);
    border-radius: 12px; overflow: hidden; opacity: .5; background: #120b1f center / cover no-repeat; align-content: center; justify-items: center; gap: 10px;
    text-align: center; padding: 16px; transition: opacity .5s, background-image .5s; }
  .peek::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(10, 6, 20, .35), rgba(10, 6, 20, .85)); }
  .peek > * { position: relative; }
  .peek--l { right: calc(50% + min(calc(100vh - 40px), 900px) * 9 / 32 + 40px); }
  .peek--r { left: calc(50% + min(calc(100vh - 40px), 900px) * 9 / 32 + 40px); }
  .peek:empty { opacity: 0; }
  .peek b { font: 800 15px/1.2 var(--ui); }
  .peek small { font: 600 12px/1.2 var(--ui); color: var(--mute); }
  .peek .av { width: 62px; height: 62px; }
}

/* ---------- story chrome: segment bars + header ---------- */
.bars { display: flex; gap: 4px; height: 3px; }
.seg { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.seg > i { display: block; height: 100%; width: 100%; background: #fff; transform-origin: left center; transform: scaleX(var(--f, 0)); border-radius: inherit; }
.seg.is-done > i { transform: scaleX(1); }
.seg.is-wait > i { animation: segwait 1.4s ease-in-out infinite; transform: scaleX(.18); }
.seg.is-hot > i { background: #ff3b5c; }
@keyframes segwait { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.head { display: flex; align-items: center; gap: 9px; margin-top: 9px; min-height: 40px; }
.who { display: grid; min-width: 0; line-height: 1.15; flex: 1; }
.who b { font: 700 14.5px/1.15 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.who small { font: 500 12px/1.2 var(--ui); color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.badge { font: 800 10px/1 var(--ui); letter-spacing: .06em; padding: 3px 6px; border-radius: 5px; background: rgba(255, 255, 255, .22); }
.badge--live { background: #ff2d55; }
.badge--pov { background: #fff; color: #111; }
.slot { display: flex; align-items: center; gap: 6px; }
.mute { pointer-events: auto; width: 44px; height: 44px; border: 0; background: none; border-radius: 50%; display: grid; place-items: center; cursor: pointer; margin-right: -6px; }
.mute svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.mute:active { transform: scale(.88); }

/* story ring avatar */
.av { position: relative; width: 38px; height: 38px; flex: none; border-radius: 50%; padding: 2px; background: var(--ring); display: grid; }
.av > span { border-radius: 50%; border: 2px solid #0b0614; background: #2a1d3d center / cover no-repeat; display: grid; place-items: center; font: 800 13px/1 var(--ui); overflow: hidden; }
.av.is-seen { background: rgba(255, 255, 255, .45); }
.av.is-lock > span::after { content: '🔒'; font-size: 15px; }
.av.is-spin { animation: spin 1.6s linear infinite; }
.av.is-spin > span { animation: spin 1.6s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- slides ---------- */
.slide { position: absolute; inset: 0; display: flex; flex-direction: column; padding: calc(78px + var(--safe-t)) 20px calc(22px + var(--safe-b)); overflow: hidden;
  backface-visibility: hidden; isolation: isolate; }
.slide.leaving { pointer-events: none; }
.slide--tint::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(170deg, color-mix(in srgb, var(--a) 72%, transparent), color-mix(in srgb, var(--b) 82%, transparent) 70%, color-mix(in srgb, var(--b) 92%, #000)); }
.slide--solid { background: linear-gradient(165deg, var(--a), var(--b)); }
.slide--dark::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(rgba(5, 3, 10, .2), rgba(5, 3, 10, .05) 35%, rgba(5, 3, 10, .82) 78%); }
.slide .grow { flex: 1; }
.cube-in { animation: cubeIn .62s var(--ease) both; transform-origin: 0 50%; }
.cube-out { animation: cubeOut .62s var(--ease) both; transform-origin: 100% 50%; }
@keyframes cubeIn { from { transform: translateX(100%) rotateY(90deg); filter: brightness(.5); } to { transform: none; filter: none; } }
@keyframes cubeOut { from { transform: none; filter: none; } to { transform: translateX(-100%) rotateY(-90deg); filter: brightness(.4); } }
.rise { animation: rise .55s var(--ease) both; animation-delay: var(--d, 0ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.popin { animation: popin .5s var(--pop) both; animation-delay: var(--d, 0ms); }
@keyframes popin { from { opacity: 0; transform: scale(.6) rotate(var(--r, 0deg)); } to { opacity: 1; transform: scale(1) rotate(var(--r, 0deg)); } }
@media (prefers-reduced-motion: reduce) {
  .cube-in, .cube-out, .rise, .popin { animation: none !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; }
}

/* ---------- story text (the "text with background" style) ---------- */
.kicker { align-self: flex-start; font: 800 12px/1 var(--ui); letter-spacing: .08em; text-transform: uppercase; padding: 8px 11px; border-radius: 99px; background: rgba(0, 0, 0, .35); }
.htext { margin: 0; font: 400 clamp(46px, 13.5vw, 62px)/1.06 var(--disp); text-transform: uppercase; letter-spacing: .005em; }
.htext > span { display: inline; padding: 0 .16em; background: #fff; color: #111; box-decoration-break: clone; -webkit-box-decoration-break: clone; border-radius: .12em; }
.htext > span.alt { background: #111; color: #fff; }
.lede { margin: 0; font: 600 18px/1.35 var(--ui); text-shadow: 0 1px 8px rgba(0, 0, 0, .35); max-width: 30ch; }
.small { font: 500 14px/1.4 var(--ui); color: var(--mute); margin: 0; }
.hand { font: 700 26px/1.05 var(--hand); }

/* ---------- stickers + the forward button (a "link sticker") ---------- */
.sticker { background: #fff; color: #111; border-radius: 18px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
.cta { appearance: none; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; padding: 14px 22px;
  border-radius: 16px; background: #fff; color: #111; font: 800 18px/1 var(--ui); box-shadow: 0 10px 28px rgba(0, 0, 0, .3); transition: transform .15s var(--pop), opacity .2s;
  -webkit-tap-highlight-color: transparent; }
.cta:active { transform: scale(.95); }
.cta:disabled { cursor: default; opacity: .85; }
.cta.is-arming:disabled { opacity: 1; }
.cta:focus-visible, .mute:focus-visible, .es-stop:focus-visible, .pt-mk:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px rgba(0, 0, 0, .45); }
.cta .ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ring-lin); color: #fff; flex: none; }
.cta .ic svg { width: 12px; height: 12px; }
.cta--grad { background: var(--ring-lin); color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.cta--grad .ic { background: #fff; color: #d62976; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(0, 0, 0, .15); border-top-color: #d62976; animation: spin .8s linear infinite; }
.tapnote { text-align: center; font: 600 12px/1 var(--ui); color: var(--mute); margin: 10px 0 0; letter-spacing: .02em; }

/* row of pro story rings */
.rings { display: flex; gap: 10px; flex-wrap: nowrap; }
.ringp { display: grid; justify-items: center; gap: 5px; width: 54px; }
.ringp .av { width: 52px; height: 52px; }
.ringp small { font: 600 11px/1.1 var(--ui); white-space: nowrap; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }

/* ---------- landing ---------- */
.land .htext { margin-top: 14px; }
.land .lede { margin-top: 16px; }
.land .rings { margin-top: 22px; justify-content: space-between; gap: 4px; }
.land .ringp { flex: 1 1 0; min-width: 0; width: auto; }
.land .ringp .av { width: min(52px, 12vw); height: min(52px, 12vw); }
.land .ringp small { font-size: 10.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.land .cta { margin-top: 24px; }
.err-note { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, .45); font: 600 14px/1.35 var(--ui); }

/* ---------- level intro ---------- */
.lvnum { font: 400 120px/0.85 var(--disp); color: transparent; -webkit-text-stroke: 2px rgba(255, 255, 255, .85); margin: 10px 0 16px; }
.demo { position: relative; height: 112px; margin: 14px 0 4px; }
.demo .ring { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: var(--ring); padding: 4px; animation: breathe 1.6s ease-in-out infinite; }
.demo .ring::after { content: 'A'; display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: #fff; color: #111; font: 900 22px/1 var(--ui); }
.demo .ring:nth-child(2) { left: 22%; animation-delay: .3s; } .demo .ring:nth-child(2)::after { content: 'B'; }
.demo .ring:nth-child(3) { left: 78%; animation-delay: .6s; } .demo .ring:nth-child(3)::after { content: 'C'; }
.demo .finger { position: absolute; left: 50%; top: 50%; font-size: 34px; animation: tapfinger 1.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, .5); } 50% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); } }
@keyframes tapfinger { 0%, 100% { transform: translate(6px, 16px) scale(1); } 45% { transform: translate(2px, 4px) scale(.88); } 55% { transform: translate(2px, 4px) scale(.88); } }
.facts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.fact { font: 700 14px/1 var(--ui); padding: 10px 12px; border-radius: 12px; background: rgba(0, 0, 0, .3); }
.youare { margin-top: 18px; display: flex; align-items: center; gap: 12px; }
.youare .rings { gap: 6px; }

/* ---------- the emoji slider sticker (self-rating) ---------- */
.es { padding: 20px 18px 16px; text-align: center; }
.es-q { margin: 0; font: 800 21px/1.2 var(--ui); }
.es-sub { margin: 6px 0 0; font: 500 14px/1.3 var(--ui); color: #555; }
.es-track { position: relative; height: 74px; margin: 18px 0 4px; touch-action: none; }
.es-rail { position: absolute; left: 28px; right: 28px; top: 50%; height: 10px; margin-top: -5px; border-radius: 9px; background: #ececf1; overflow: hidden; }
.es-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ring-lin); border-radius: inherit; transition: width .35s var(--ease); }
.es-stops { position: absolute; inset: 0; display: flex; justify-content: space-between; }
.es-stop { width: 56px; height: 74px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; font-size: 30px; opacity: .8; transition: opacity .2s, transform .2s var(--pop); -webkit-tap-highlight-color: transparent; }
.es-stop:active { transform: scale(.85); }
.es-thumb { position: absolute; top: 50%; left: 28px; width: 54px; height: 54px; margin: -27px 0 0 -27px; font-size: 40px; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: left .35s var(--ease), opacity .2s; }
.es-thumb.is-on { opacity: 1; animation: thumbpop .5s var(--pop); }
.es-val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font: 900 15px/1 var(--ui); background: #111; color: #fff; padding: 6px 8px; border-radius: 9px; white-space: nowrap; margin-bottom: 2px; }
@keyframes thumbpop { 0% { transform: scale(.4); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
.es-ends { display: flex; justify-content: space-between; font: 700 12px/1 var(--ui); color: #888; padding: 0 12px; }
.es-done { margin: 12px 0 0; font: 800 15px/1.2 var(--ui); color: #d62976; min-height: 18px; }
.es.is-locked .es-stop { pointer-events: none; }

/* ---------- between: recap ---------- */
.bigstat { font: 400 clamp(150px, 46vw, 210px)/.82 var(--disp); letter-spacing: -.01em; margin: 6px 0 22px; text-shadow: 0 8px 40px rgba(0, 0, 0, .25); }
.bigstat small { font-size: .34em; opacity: .75; }
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.minic { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 5; background: #000 center / cover no-repeat; display: flex; flex-direction: column; justify-content: flex-end; padding: 10px; }
.minic::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0, 0, 0, .05), rgba(0, 0, 0, .82)); }
.minic > * { position: relative; }
.minic .tag { align-self: flex-start; font: 800 12px/1 var(--ui); padding: 6px 8px; border-radius: 8px; background: #fff; color: #111; }
.minic .tag.ok { background: var(--ok); color: #04210f; }
.minic b { font: 800 15px/1.15 var(--ui); margin-top: 8px; }
.minic small { font: 600 12px/1.25 var(--ui); color: var(--mute); }
.tray { display: flex; justify-content: space-between; gap: 6px; margin: 18px 0 6px; }
.tray .ringp { width: 72px; }
.tray .av { width: 62px; height: 62px; }
.tray .av.is-now { animation: breathe 1.6s ease-in-out infinite; }
.tray small { font-size: 12px; }
.prog { margin-top: 14px; }
.prog-bar { height: 10px; border-radius: 9px; background: rgba(0, 0, 0, .3); overflow: hidden; }
.prog-bar > i { display: block; height: 100%; width: var(--w, 10%); background: #fff; border-radius: inherit; transition: width 1.1s var(--ease); }
.prog p { margin: 8px 0 0; font: 700 14px/1.2 var(--ui); }
