/* =========================================================
   SPIDERVERSES DAILY: a puzzle page from the Daily Bugle of the multiverse.
   Newsprint, ink, caption boxes, glitch. Same family as track/rank.spiderverses.com.
   ========================================================= */
:root {
  --paper: #f3ecda; --paper2: #e9e0c8; --card: #fffaf0; --ink: #141210; --red: #e3262f; --cyan: #1fb7d6; --yellow: #ffe14d; --blue: #2b59c3; --mute: #6d6556;
  --good: #2fa84f; --near: #f2b51d; --bad: #c7c0ad;
  --display: 'Bangers', Impact, sans-serif; --marker: 'Permanent Marker', cursive; --mono: 'Space Mono', monospace; --body: 'Comic Neue', 'Comic Sans MS', sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); font: 700 16px/1.45 var(--body); background: radial-gradient(circle, #0000001c 1px, transparent 1.6px) 0 0 / 6px 6px, var(--paper); }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; color: inherit; }
.ic { width: 1em; height: 1em; vertical-align: -.14em; flex-shrink: 0; }

/* masthead */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--ink); color: var(--paper); border-bottom: 5px solid var(--red); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; }
.brand .mark { display: inline-flex; color: var(--red); filter: drop-shadow(2px 2px 0 #000); }
.brand .mark .ic { width: 34px; height: 34px; }
.brand span:last-child { font-family: var(--display); font-size: 30px; letter-spacing: .04em; line-height: 1; text-shadow: -2px 0 var(--cyan), 2px 0 var(--red); }
.brand b { font-family: var(--marker); font-weight: 400; font-size: 20px; color: var(--yellow); text-shadow: none; margin-left: 4px; rotate: -4deg; display: inline-block; }
.tools { margin-left: auto; display: flex; gap: 8px; }
.tool { width: 42px; height: 42px; display: grid; place-items: center; background: var(--paper); color: var(--ink); border: 3px solid var(--paper); box-shadow: 3px 3px 0 var(--red); }
.tool .ic { width: 22px; height: 22px; }
.tool:hover { background: var(--yellow); }

/* dateline strip */
.strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 22px; padding: 8px 16px; background: var(--paper2); border-bottom: 3px solid var(--ink);
  font: 700 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.strip span { display: inline-flex; align-items: center; gap: 6px; }
.strip b { color: var(--red); }
.strip a { color: inherit; text-decoration: none; border-bottom: 2px solid var(--red); }

main { max-width: 980px; margin: 0 auto; padding: 22px 18px 40px; }
.loading { font-family: var(--display); font-size: 26px; text-align: center; padding: 40px 0; }

/* the three game panels */
.games { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 6px 0 26px; }
.game { position: relative; display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; background: var(--card); border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); transition: translate .08s, box-shadow .08s; }
.game:nth-child(1) { rotate: -.8deg; } .game:nth-child(3) { rotate: .7deg; }
.game:hover { translate: -2px -2px; box-shadow: 8px 8px 0 var(--ink); }
.game.on { background: var(--yellow); box-shadow: 6px 6px 0 var(--ink), 6px 6px 0 3px var(--red); }
.game .gi { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; background: var(--ink); color: var(--yellow); }
.game .gi .ic { width: 26px; height: 26px; }
.game b { display: block; font: 400 26px/1 var(--display); letter-spacing: .05em; }
.game small { display: block; font: 700 11px var(--mono); color: var(--mute); margin-top: 3px; }
.game .st { position: absolute; top: -12px; right: -10px; display: inline-flex; align-items: center; gap: 4px; font: 400 15px var(--display); letter-spacing: .05em; padding: 3px 8px 1px; border: 3px solid var(--ink); rotate: 6deg; box-shadow: 2px 2px 0 var(--ink); }
.game .st.won { background: var(--good); color: #fff; } .game .st.lost { background: var(--ink); color: var(--paper); } .game .st.play { background: var(--card); }
.game .st .ic { width: 14px; height: 14px; }

/* stage header */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.head h1 { margin: 0; font: 400 clamp(38px, 7vw, 64px)/.9 var(--display); letter-spacing: .02em; text-shadow: -3px 0 var(--cyan), 3px 0 var(--red); }
.head .kicker { display: inline-block; font: 700 11px var(--mono); letter-spacing: .16em; background: var(--yellow); border: 3px solid var(--ink); padding: 4px 10px 3px; box-shadow: 3px 3px 0 var(--ink); rotate: -2deg; margin-bottom: 10px; }
.tries { display: flex; gap: 6px; }
.tries i { width: 16px; height: 16px; border: 3px solid var(--ink); background: var(--card); transform: rotate(45deg); }
.tries i.miss { background: var(--red); } .tries i.hit { background: var(--good); }

/* FRAME: zoomed + glitched still */
.view { position: relative; overflow: hidden; border: 5px solid var(--ink); box-shadow: 9px 9px 0 var(--ink); background: #000; }
.frame { aspect-ratio: 16 / 9; }
.zoom { position: absolute; inset: 0; transition: transform .6s steps(6), filter .6s steps(6); }
.zoom img, .zoom .sl { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* tear bands: slices of the frame, channel-split and shoved sideways, jumping on 12fps steps */
.zoom .sl { pointer-events: none; opacity: var(--g); }
.zoom .sl.r { filter: url(#red) brightness(1.4); mix-blend-mode: screen; animation: bandR .5s steps(3) infinite; }
.zoom .sl.c { filter: url(#cyan) brightness(1.3); mix-blend-mode: screen; animation: bandC .42s steps(3) infinite; }
.zoom .sl.r2 { filter: saturate(1.6) contrast(1.2); animation: bandS .58s steps(3) infinite; }
@keyframes bandR { 0% { clip-path: inset(14% 0 70% 0); translate: calc(var(--g) * -22px) 0; } 33% { clip-path: inset(52% 0 33% 0); translate: calc(var(--g) * 16px) 0; } 66% { clip-path: inset(76% 0 10% 0); translate: calc(var(--g) * -10px) 0; } }
@keyframes bandC { 0% { clip-path: inset(30% 0 58% 0); translate: calc(var(--g) * 18px) 0; } 33% { clip-path: inset(6% 0 84% 0); translate: calc(var(--g) * -14px) 0; } 66% { clip-path: inset(62% 0 24% 0); translate: calc(var(--g) * 12px) 0; } }
@keyframes bandS { 0% { clip-path: inset(44% 0 47% 0); translate: calc(var(--g) * 30px) 0; } 33% { clip-path: inset(86% 0 4% 0); translate: calc(var(--g) * -26px) 0; } 66% { clip-path: inset(22% 0 72% 0); translate: calc(var(--g) * 20px) 0; } }
@keyframes jit { 0% { translate: calc(var(--g) * -14px) 0; } 33% { translate: calc(var(--g) * 9px) 0; } 66% { translate: calc(var(--g) * -5px) 0; } }
.bands { position: absolute; inset: 0; pointer-events: none; opacity: var(--g); background: repeating-linear-gradient(0deg, transparent 0 14px, #00000055 14px 16px); animation: scan .25s steps(2) infinite; }
@keyframes scan { 50% { translate: 0 6px; } }
.halftone { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle, #0000002e 1px, transparent 1.6px) 0 0 / 5px 5px; }
.lvl { position: absolute; left: 10px; top: 10px; z-index: 3; font: 700 11px var(--mono); letter-spacing: .14em; background: var(--ink); color: var(--yellow); padding: 4px 8px; }

/* POSTER: pixelated */
.posterwrap { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 22px; align-items: start; }
.poster { aspect-ratio: 2 / 3; }
.poster canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.side { display: flex; flex-direction: column; gap: 14px; }

/* guess box */
.guess { position: relative; display: flex; gap: 10px; margin: 22px 0 6px; }
.guess .in { flex: 1; position: relative; display: flex; align-items: center; background: #fff; border: 4px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.guess .in .ic { width: 22px; height: 22px; margin: 0 4px 0 12px; color: var(--mute); }
.guess input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 12px 10px; font: 700 18px var(--body); color: var(--ink); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 3px solid var(--ink); background: var(--card); color: var(--ink);
  font: 400 21px/1 var(--display); letter-spacing: .05em; padding: .5em .9em .38em; text-decoration: none; box-shadow: 4px 4px 0 var(--ink); transition: translate .08s, box-shadow .08s; }
.btn:hover { translate: -2px -2px; box-shadow: 6px 6px 0 var(--ink); }
.btn:active { translate: 2px 2px; box-shadow: 1px 1px 0 var(--ink); }
.btn.red { background: var(--red); color: #fff; } .btn.ink { background: var(--ink); color: #fff; } .btn.yel { background: var(--yellow); }
.btn:disabled { opacity: .5; cursor: not-allowed; translate: none; box-shadow: 4px 4px 0 var(--ink); }
.btn .ic { width: .95em; height: .95em; }
.list { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; max-height: 330px; overflow: auto; background: var(--card); border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); display: none; }
.list.open { display: block; }
.opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border: 0; border-bottom: 2px dashed #14121022; background: none; text-align: left; font: 700 15px var(--body); }
.opt img { width: 34px; height: 50px; object-fit: cover; border: 2px solid var(--ink); flex-shrink: 0; background: #222; }
.opt.wide img { width: 72px; height: 42px; }
.opt small { display: block; font: 700 11px var(--mono); color: var(--mute); }
.opt.act, .opt:hover { background: var(--yellow); }
.opt.used { opacity: .4; pointer-events: none; }
.hint-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font: 700 12px var(--mono); color: var(--mute); }

/* past guesses (title games) */
.hist { display: grid; gap: 10px; margin-top: 16px; }
.h { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 12px; align-items: center; background: var(--card); border: 3px solid var(--ink); padding: 7px 10px; box-shadow: 3px 3px 0 var(--ink); animation: pop .3s steps(3); }
.h.skip { grid-template-columns: 1fr; font: 400 18px var(--display); letter-spacing: .05em; color: var(--mute); }
.h img { width: 40px; height: 58px; object-fit: cover; border: 2px solid var(--ink); }
.h b { font: 400 19px/1.05 var(--display); letter-spacing: .03em; }
.chip { display: inline-flex; align-items: center; gap: 5px; font: 700 12px var(--mono); letter-spacing: .06em; padding: 4px 8px; border: 2px solid var(--ink); white-space: nowrap; }
.chip.g { background: var(--good); color: #fff; } .chip.n { background: var(--near); } .chip.b { background: var(--bad); }
.chip .ic { width: 13px; height: 13px; }
@keyframes pop { 0% { scale: .85; } 60% { scale: 1.04; } 100% { scale: 1; } }
.shake { animation: shake .35s steps(4); }
@keyframes shake { 25% { translate: -8px 0; } 50% { translate: 7px 0; } 75% { translate: -4px 0; } }

/* SPIDER: the dossier + clue table */
.dossier { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: stretch; }
.mystery { position: relative; aspect-ratio: 16 / 10; border: 5px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); background: radial-gradient(circle, #ffffff12 1px, transparent 1.6px) 0 0 / 6px 6px, radial-gradient(ellipse at 50% 40%, #3a0b12, #141210 70%); overflow: hidden; display: grid; place-items: center; }
.mystery .ic.emb { width: 48%; height: 48%; color: var(--red); opacity: .9; filter: drop-shadow(-4px 0 var(--cyan)) drop-shadow(4px 0 #000); animation: jit 1.2s steps(2) infinite; --g: .4; }
.mystery img { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; filter: blur(5px) saturate(1.4) contrast(1.1); animation: jit 1.1s steps(2) infinite; --g: .5; }
.mystery .q { position: absolute; bottom: 8px; left: 8px; font: 700 10px var(--mono); letter-spacing: .14em; background: var(--yellow); border: 2px solid var(--ink); padding: 3px 6px; }
.clues { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.clue { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--card); border: 3px dashed var(--ink); font-size: 15px; }
.clue.on { border-style: solid; background: var(--yellow); }
.clue .ic { width: 20px; height: 20px; }
.table { margin-top: 16px; overflow-x: auto; }
.trow { display: grid; grid-template-columns: minmax(170px, 1.5fr) repeat(5, minmax(88px, 1fr)); gap: 6px; margin-bottom: 6px; min-width: 700px; }
.trow.th div { font: 700 10px var(--mono); letter-spacing: .14em; color: var(--mute); padding: 0 4px; }
.cell { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 64px; padding: 6px 8px; border: 3px solid var(--ink); font: 700 13px/1.2 var(--body); animation: flip .45s steps(4) both; }
.cell small { font: 700 9px var(--mono); letter-spacing: .1em; opacity: .8; }
.cell.g { background: var(--good); color: #fff; } .cell.n { background: var(--near); } .cell.b { background: var(--bad); }
.cell.who { flex-direction: row; align-items: center; gap: 8px; background: var(--card); }
.cell.who img { width: 54px; height: 36px; object-fit: cover; border: 2px solid var(--ink); flex-shrink: 0; }
.cell.who b { font: 400 16px/1 var(--display); letter-spacing: .03em; }
.cell.yr { flex-direction: row; align-items: center; justify-content: center; gap: 6px; font: 400 22px var(--display); }
.cell.yr .ic { width: 20px; height: 20px; }
.trow .cell:nth-child(2) { animation-delay: .08s; } .trow .cell:nth-child(3) { animation-delay: .16s; } .trow .cell:nth-child(4) { animation-delay: .24s; } .trow .cell:nth-child(5) { animation-delay: .32s; } .trow .cell:nth-child(6) { animation-delay: .4s; }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }

/* result panel */
.result { position: relative; margin-top: 24px; display: grid; grid-template-columns: 260px 1fr; gap: 20px; padding: 20px; background: var(--card); border: 5px solid var(--ink); box-shadow: 10px 10px 0 var(--ink); }
.result .art { border: 4px solid var(--ink); overflow: hidden; background: #000; box-shadow: 5px 5px 0 var(--red); }
.result .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result .art.tall { aspect-ratio: 2 / 3; } .result .art.wide { aspect-ratio: 16 / 10; align-self: start; }
.burst { position: absolute; top: -26px; right: 18px; font: 400 44px/1 var(--display); letter-spacing: .04em; color: #fff; background: var(--red); border: 4px solid var(--ink); padding: 8px 18px 2px;
  clip-path: polygon(0% 18%, 10% 0%, 22% 14%, 36% 2%, 50% 16%, 64% 0%, 78% 14%, 92% 2%, 100% 22%, 94% 50%, 100% 80%, 88% 100%, 72% 86%, 56% 100%, 40% 86%, 24% 100%, 10% 84%, 0% 92%, 6% 52%);
  rotate: 4deg; animation: pop .35s steps(3); }
.burst.lose { background: var(--ink); }
.result h2 { margin: 6px 0 4px; font: 400 clamp(30px, 5vw, 46px)/.95 var(--display); letter-spacing: .02em; }
.result .meta { font: 700 12px var(--mono); color: var(--mute); }
.result .next { display: flex; align-items: center; gap: 8px; margin: 16px 0; font: 700 13px var(--mono); }
.result .next b { font: 400 30px var(--display); letter-spacing: .06em; color: var(--red); }
.result .acts { display: flex; flex-wrap: wrap; gap: 10px; }

/* dialogs */
dialog { padding: 0; border: 5px solid var(--ink); background: var(--paper); color: var(--ink); width: min(620px, 94vw); max-height: 92vh; box-shadow: 14px 14px 0 #000a; }
dialog::backdrop { background: #141210d9; }
.close { position: absolute; top: 12px; right: 12px; z-index: 3; width: 42px; height: 42px; display: grid; place-items: center; border: 3px solid var(--ink); background: var(--paper); box-shadow: 3px 3px 0 var(--ink); }
.close .ic { width: 20px; height: 20px; }
.dl { padding: 22px; }
.dl h3 { margin: 0 0 12px; display: inline-block; font: 400 34px/1 var(--display); letter-spacing: .04em; background: var(--yellow); border: 3px solid var(--ink); padding: 6px 14px 2px; box-shadow: 4px 4px 0 var(--ink); rotate: -1deg; }
.dl h4 { display: flex; align-items: center; gap: 8px; margin: 18px 0 6px; font: 400 24px var(--display); letter-spacing: .04em; }
.dl p { margin: 4px 0; font-size: 15px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.sgrid div { text-align: center; background: var(--card); border: 3px solid var(--ink); padding: 8px 4px; }
.sgrid b { display: block; font: 400 34px/1 var(--display); color: var(--red); }
.sgrid small { font: 700 9px var(--mono); letter-spacing: .12em; }
.dist { display: grid; gap: 4px; }
.dist div { display: grid; grid-template-columns: 20px 1fr; gap: 6px; align-items: center; font: 700 12px var(--mono); }
.dist i { display: block; min-width: 26px; background: var(--ink); color: var(--paper); font-style: normal; text-align: right; padding: 2px 6px; }
.dist i.now { background: var(--red); }
.sharebox { width: 100%; min-height: 120px; margin: 10px 0; font: 700 15px var(--mono); color: var(--ink); background: var(--card); border: 3px solid var(--ink); padding: 10px; }

#toast { position: fixed; left: 50%; top: 92px; translate: -50% 0; z-index: 120; display: none; font: 400 20px var(--display); letter-spacing: .04em; background: var(--yellow); border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); padding: 8px 16px 5px; }
.foot { max-width: 980px; margin: 10px auto 0; padding: 18px 18px 34px; border-top: 4px solid var(--ink); font-size: 13px; font-weight: 400; }
.foot p { margin: 6px 0; } .more { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; } .more b { font: 400 18px var(--display); letter-spacing: .04em; }
.foot .tmdb { color: var(--mute); }

@media (max-width: 760px) {
  .top { padding: 8px 12px; } .brand span:last-child { font-size: 24px; } .brand b { font-size: 16px; }
  main { padding: 16px 12px 30px; }
  .games { gap: 10px; } .game { flex-direction: column; text-align: center; padding: 10px 6px; gap: 6px; } .game .gi { width: 36px; height: 36px; } .game b { font-size: 20px; } .game small { display: none; }
  .posterwrap, .dossier, .result { grid-template-columns: 1fr; }
  .poster { max-width: 280px; margin: 0 auto; width: 100%; }
  .mystery { max-width: 360px; width: 100%; margin: 0 auto; }
  .result .art { max-width: 300px; }
  .h { grid-template-columns: 34px 1fr; } .h .chip { grid-column: 2; justify-self: start; }
  .burst { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* phone fixes */
.hint-row { display: block; } .hint-row .ic { margin-right: 6px; vertical-align: -3px; }
html, body { overflow-x: clip; }
@media (max-width: 760px) {
  .guess { flex-wrap: wrap; } .guess .in { flex: 1 1 100%; } .guess .btn { flex: 1; }
  .head h1 { font-size: 38px; } .tries i { width: 13px; height: 13px; border-width: 2px; }
  .strip { font-size: 11px; gap: 4px 14px; }
}

.dossier { grid-template-columns: 260px minmax(0, 1fr); }
.mystery { width: 100%; min-width: 0; contain: layout paint; isolation: isolate; }
@media (max-width: 760px) { .dossier { grid-template-columns: 1fr; } }
