/* The Clara Job. Board A: 1960s caper title paper cut-outs. Board C (blueprint) only for the HUD map.
   One accent: tomato. Motion: paper pieces drop in with a short overshoot (cut card landing), never fade-up-stagger. */
:root {
  --ink: #1b1f3a; --ink2: #262b52; --mustard: #e3a72f; --tomato: #d9472b; --teal: #2f8f8a; --cream: #f3e6c8; --blush: #e8a3a0;
  --blue: #1f4f8f; --chalk: #eef3ff; --red: #e2362c;
  --display: "Bowlby One SC", Impact, "Arial Black", sans-serif;
  --body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --hand: "Gochi Hand", "Comic Sans MS", cursive;
  --land: cubic-bezier(.3, 1.6, .5, 1);   /* card landing: quick, small overshoot */
  --slide: cubic-bezier(.6, 0, .25, 1);   /* paper pulled on a string */
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --gut: max(14px, env(safe-area-inset-left, 0px));
  color-scheme: dark;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--cream); font-family: var(--body); overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.grain { position: fixed; inset: 0; pointer-events: none; background: url(/tex/grain.webp) 0 0 / 512px; mix-blend-mode: multiply; opacity: .28; z-index: 1; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#ui .chips, #ui .mute, #ui button, #ui .pad, #ui .log { pointer-events: auto; }
#over { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#over > * { pointer-events: auto; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; }

/* ---------- earpiece ---------- */
.ear { position: absolute; top: calc(10px + var(--safe-t)); left: var(--gut); right: 92px; max-width: 420px; display: flex; gap: 10px; align-items: flex-start;
  background: var(--cream); color: var(--ink); padding: 8px 12px 9px 8px; transform: rotate(-1.2deg) translateY(-140%); box-shadow: 4px 4px 0 var(--ink2), 4px 4px 0 1px #0004;
  font-size: 15px; line-height: 1.32; transition: transform .45s var(--land); pointer-events: none; clip-path: polygon(0 2%, 3% 0, 97% 1%, 100% 4%, 99% 96%, 96% 100%, 2% 99%, 0 95%); }
.ear.on { transform: rotate(-1.2deg) translateY(0); }
.ear-face { width: 44px; height: 58px; object-fit: cover; object-position: 50% 18%; flex: none; background: var(--blush); border: 2px solid var(--ink); }
.ear b { display: block; font-family: var(--display); font-weight: 400; font-size: 10.5px; letter-spacing: .12em; color: var(--tomato); margin: 1px 0 2px; }
.log, .bp { display: none; }

/* ---------- top right: route dots + mute ---------- */
.route { position: absolute; top: calc(18px + var(--safe-t)); right: calc(var(--gut) + 46px); display: flex; gap: 5px; pointer-events: none; }
.route i { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--cream); opacity: .7; }
.route i.done { background: var(--mustard); border-color: var(--mustard); opacity: 1; }
.route i.cur { opacity: 1; box-shadow: 0 0 0 3px #e3a72f55; }
.mute { position: absolute; top: calc(8px + var(--safe-t)); right: var(--gut); width: 38px; height: 38px; border: 2px solid var(--cream); background: var(--ink2); border-radius: 50%; font-size: 17px; cursor: pointer; }
.mute.off { text-decoration: line-through; opacity: .6; }
.timer { position: absolute; top: calc(52px + var(--safe-t)); right: var(--gut); font-family: var(--display); font-size: 20px; color: var(--cream); background: var(--tomato); padding: 2px 8px; transform: rotate(2deg); font-variant-numeric: tabular-nums; box-shadow: 3px 3px 0 var(--ink); pointer-events: none; }

/* ---------- plaque, hint, chips (bottom, inside the thumb zone) ---------- */
.plaque { position: absolute; left: 50%; bottom: calc(126px + var(--safe-b)); width: min(92vw, 420px); translate: -50% 0; background: var(--mustard); color: var(--ink);
  padding: 8px 14px 10px; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink2); text-align: left; transform: rotate(-.8deg); pointer-events: none; }
.plaque small { display: block; font-family: var(--display); font-size: 10.5px; letter-spacing: .14em; opacity: .75; }
.plaque span { display: block; font-family: var(--display); font-size: clamp(17px, 4.9vw, 22px); line-height: 1.08; }
.plaque.in { animation: drop .5s var(--land) both; }
@keyframes drop { from { transform: rotate(-6deg) translateY(-30px); opacity: 0; } to { transform: rotate(-.8deg); opacity: 1; } }
.hint { position: absolute; left: 50%; bottom: calc(98px + var(--safe-b)); translate: -50% 0; font-family: var(--display); font-size: 11.5px; letter-spacing: .1em; color: var(--cream); background: var(--ink); border: 2px solid var(--cream); padding: 5px 10px 4px; white-space: nowrap; max-width: calc(100vw - 28px); overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .3s; pointer-events: none; box-shadow: 3px 3px 0 #0008; transform: rotate(.6deg); }
.hint.on { opacity: 1; }
.chips { position: absolute; left: 50%; translate: -50% 0; bottom: calc(14px + var(--safe-b)); width: min(94vw, 520px); display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.chips.locked { pointer-events: none; opacity: .5; }
.chip { font: 600 13.5px var(--body); background: var(--ink2); color: var(--cream); border: 2px solid var(--cream); padding: 8px 12px; border-radius: 3px; cursor: pointer; box-shadow: 2px 2px 0 #0006; transition: transform .12s, background .15s; min-height: 38px; }
.chip:hover { background: var(--teal); }
.chip:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 #0006; }
.chip[disabled] { opacity: .35; text-decoration: line-through; cursor: default; }

/* ---------- anchored paper tags ---------- */
.anchors { position: absolute; inset: 0; pointer-events: none; }
.anchors > * { position: absolute; left: 0; top: 0; will-change: transform; }
.lbl > div { background: var(--cream); color: var(--ink); font: 800 13px/1.1 var(--body); padding: 6px 9px 7px; max-width: 118px; text-align: center; border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 #0007; transform: rotate(var(--r, -2deg)); transition: transform .3s var(--land), background .2s, opacity .3s; position: relative; }
.lbl > div::before { content: ""; position: absolute; top: -9px; left: 50%; width: 34px; height: 13px; translate: -50% 0; background: #e6d3a3cc; transform: rotate(4deg); }
.rugtag > div { max-width: 92px; font-size: 12px; padding: 4px 7px 5px; }
.rugtag > div::before { display: none; }
.lbl.hot > div { background: var(--mustard); transform: rotate(0) scale(1.1); }
.lbl.dead > div::after { content: "NOPE"; position: absolute; right: -8px; top: -10px; font: 400 11px var(--display); color: var(--cream); background: var(--tomato); padding: 2px 5px; transform: rotate(10deg); text-decoration: none; }
.lbl.dead > div { opacity: .6; text-decoration: line-through; text-decoration-color: var(--tomato); text-decoration-thickness: 3px; }
.btag > div { background: var(--cream); color: var(--ink); padding: 5px 9px 6px 16px; border: 2px solid var(--ink); box-shadow: 3px 3px 0 #0008; width: 124px; position: relative;
  transform-origin: 50% 0; transform: perspective(300px) rotateX(-95deg); opacity: 0; clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%); }
.btag > div::before { content: ""; position: absolute; left: 6px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--ink); }
.btag b { display: block; font: 800 13.5px/1.1 var(--body); text-transform: uppercase; letter-spacing: .02em; }
.btag i { display: block; font: 17px/1 var(--hand); color: var(--tomato); font-style: normal; margin-top: 1px; }
.btag.big b { font: 30px/1 var(--hand); text-transform: none; color: var(--tomato); }
.btag.up > div { animation: tagUp .55s var(--land) both; }
.btag.away > div { opacity: 1; transform: none; animation: none; transition: opacity .5s, transform .5s var(--slide); opacity: 0 !important; transform: translateY(-14px) rotate(6deg) !important; }
@keyframes tagUp { 0% { transform: perspective(300px) rotateX(-95deg); opacity: 0; } 30% { opacity: 1; } 100% { transform: perspective(300px) rotateX(0) rotate(var(--r, -3deg)); opacity: 1; } }

/* ---------- gate + overlays ---------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 70% 15%, #2f3466 0, var(--ink) 60%); z-index: 6; padding: 0 var(--gut); }
.gate .card { width: min(100%, 420px); background: var(--cream); color: var(--ink); padding: 22px 22px 24px; transform: rotate(-1.5deg); box-shadow: 8px 8px 0 var(--tomato), 8px 8px 0 2px var(--ink); position: relative; }
.gate .card::after { content: ""; position: absolute; top: -12px; right: 30px; width: 70px; height: 22px; background: #e6d3a3d0; transform: rotate(8deg); }
.gate small { font-family: var(--display); font-size: 11px; letter-spacing: .16em; color: var(--tomato); }
.gate h1 { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 12vw, 64px); line-height: .9; margin: 6px 0 12px; }
.gate p { margin: 0 0 18px; line-height: 1.45; font-size: 16px; }
.btn { font: 800 15px var(--body); letter-spacing: .07em; text-transform: uppercase; background: var(--tomato); color: var(--cream); border: 3px solid var(--ink); padding: 13px 22px; cursor: pointer; box-shadow: 4px 4px 0 var(--ink); transition: transform .1s; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.quiet { background: transparent; color: var(--ink); box-shadow: none; border-width: 2px; font-size: 12.5px; padding: 10px 14px; }

.note { position: fixed; left: 50%; top: 50%; width: min(92vw, 430px); max-height: calc(100% - 40px - var(--safe-t) - var(--safe-b)); overflow: auto; translate: -50% -50%; background: var(--cream); color: var(--ink);
  padding: 22px 22px 18px; box-shadow: 8px 8px 0 var(--ink2), 8px 8px 0 2px #0006; transform: rotate(-1deg); animation: noteIn .8s var(--land) both;
  background-image: repeating-linear-gradient(transparent 0 31px, #2f8f8a33 31px 32px); background-position: 0 14px; }
@keyframes noteIn { from { transform: translateY(60vh) rotate(8deg); } to { transform: rotate(-1deg); } }
.note p { font: 23px/32px var(--hand); margin: 0 0 0; }
.note .sig { text-align: right; color: var(--tomato); font: 26px/32px var(--hand); }
.note .next { margin-top: 14px; border-top: 2px dashed var(--ink); padding-top: 12px; font: 800 14px var(--body); }
.note .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

@media (min-width: 1000px) {
  .bp { display: block; position: absolute; left: 28px; top: 50%; translate: 0 -50%; height: min(72vh, 600px, calc((50vw - 300px) * 1.5)); aspect-ratio: 2 / 3; transform: rotate(-1.5deg); box-shadow: 7px 7px 0 #0009; pointer-events: none; }
  .bp img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .bp svg { position: absolute; inset: 0; width: 100%; height: 100%; }
  .bp path { fill: none; stroke: var(--red); stroke-width: 1.2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.4s ease-in-out; }
  .bp i { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2.5px solid var(--red); border-radius: 50%; background: #1f4f8f; color: var(--chalk); font: 400 13px/21px var(--display); text-align: center; font-style: normal; }
  .bp i.done { background: var(--red); }
  .bp i.cur { animation: pulse 1.2s ease-in-out infinite; }
  @keyframes pulse { 50% { transform: scale(1.25); } }
  .bp b { position: absolute; left: 10px; bottom: 10px; font: 400 12px var(--display); letter-spacing: .14em; color: var(--chalk); background: var(--red); padding: 3px 8px; }
  .route { display: none; }
  .ear { left: auto; right: 32px; top: 80px; width: 340px; transform: rotate(1deg) translateX(140%); }
  .ear.on { transform: rotate(1deg); }
  .log { display: block; position: absolute; right: 32px; top: 230px; width: 340px; bottom: 260px; overflow: hidden; pointer-events: none;
    mask-image: linear-gradient(#000 60%, transparent); }
  .log h3 { font: 400 11px var(--display); letter-spacing: .16em; color: var(--mustard); margin: 0 0 8px; }
  .log ol { list-style: none; margin: 0; padding: 0; }
  .log li { font-size: 14px; line-height: 1.35; padding: 6px 0; border-bottom: 1px solid #f3e6c822; opacity: .8; }
  .log li:first-child { opacity: 1; }
  /* question, hint and answers stay centred under the building, as on the phone (tester-2: answers drifted off to the right) */
  .plaque { width: 480px; bottom: calc(24px + max(var(--chips-h, 0px), 44px) + 54px); }
  .chips { width: min(840px, 92vw); bottom: 24px; gap: 9px; }
  .chip { font-size: 15px; padding: 10px 16px; }
  .hint { bottom: calc(24px + max(var(--chips-h, 0px), 44px) + 14px); font-size: 13px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .plaque { left: auto; right: var(--gut); translate: 0; width: 300px; bottom: auto; top: 60px; }
  .chips { left: auto; right: var(--gut); translate: 0; width: 300px; bottom: 10px; }
  .hint { bottom: 8px; left: 30%; }
  .ear { right: auto; width: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .btag > div { transform: none; opacity: 1; }
}

/* ---------- intro: lines in the dark, then the paper-strip title ---------- */
.curtain { position: fixed; inset: 0; background: #0c0e1e; display: grid; align-items: center; padding: 0 calc(var(--gut) + 6vw); transition: transform .9s var(--slide); z-index: 6; }
.curtain.up { transform: translateY(-104%); }
.curtain::after { content: ""; position: absolute; left: 0; right: 0; bottom: -14px; height: 16px; background: #0c0e1e; clip-path: polygon(0 0, 100% 0, 100% 40%, 92% 90%, 80% 30%, 66% 100%, 50% 40%, 34% 80%, 18% 30%, 6% 90%, 0 50%); }
.seq { font-family: var(--display); font-size: clamp(30px, 8.5vw, 64px); line-height: .98; margin: 0; max-width: 12ch; color: var(--cream); opacity: 0; }
.seq.on { animation: seqIn .5s var(--land) both; }
@keyframes seqIn { from { opacity: 0; transform: translateX(-18px) rotate(-2deg); } to { opacity: 1; transform: none; } }
.skip { position: absolute; right: var(--gut); bottom: calc(18px + var(--safe-b)); background: none; border: 0; color: var(--cream); opacity: 0; font: 600 14px var(--body); letter-spacing: .08em; cursor: pointer; padding: 10px; transition: opacity .4s; }
.skip.on { opacity: .6; }
.title { position: fixed; left: 0; right: 0; top: 22%; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; z-index: 4; }
.title span { font-family: var(--display); font-size: clamp(38px, 12vw, 92px); line-height: 1; padding: 6px 22px 2px 26px; color: var(--ink); background: var(--cream);
  box-shadow: 5px 5px 0 #0007; transform: translateX(110%) rotate(-1.5deg); animation: strip .7s var(--land) calc(var(--i) * .16s + .2s) forwards; clip-path: polygon(0 4%, 100% 0, 100% 100%, 2% 96%); }
.title span:nth-child(2) { background: var(--tomato); color: var(--cream); margin-right: 22px; }
.title span:nth-child(3) { background: var(--mustard); }
.title.out span { animation: stripOut .5s var(--slide) forwards; }
@keyframes strip { to { transform: translateX(0) rotate(-1.5deg); } }
@keyframes stripOut { from { transform: translateX(0) rotate(-1.5deg); } to { transform: translateX(115%) rotate(2deg); } }

/* ---------- briefing: blueprint map + dossier cards ---------- */
.brief { position: fixed; inset: 0; z-index: 4; display: grid; grid-template-rows: 1fr auto auto; padding: calc(12px + var(--safe-t)) var(--gut) calc(14px + var(--safe-b)); background: #1b1f3acc; animation: fadeIn .4s both; }
.brief.out { animation: briefOut .5s var(--slide) forwards; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes briefOut { to { opacity: 0; transform: translateY(30px); } }
.map { position: relative; justify-self: center; height: min(52vh, 560px); aspect-ratio: 2 / 3; transform: rotate(1.5deg); box-shadow: 6px 6px 0 #0008; animation: drop .6s var(--land) both; }
.map img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map path { fill: none; stroke: var(--red); stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 2.2s .4s ease-in-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.map i { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2.5px solid var(--red); border-radius: 50%; background: #1f4f8fee; color: var(--chalk); font: 400 13px/21px var(--display); text-align: center; font-style: normal; transform: scale(0); animation: pop .35s var(--land) var(--d) forwards; }
@keyframes pop { to { transform: scale(1); } }
.map .target { position: absolute; left: 8px; bottom: 8px; font: 400 12px var(--display); letter-spacing: .12em; color: var(--chalk); background: var(--red); padding: 3px 7px; }
.deck { position: relative; height: 128px; margin-top: 14px; justify-self: center; width: min(100%, 400px); }
.dcard { position: absolute; inset: 0; background: #d9b77a; color: var(--ink); padding: 12px 16px; box-shadow: 4px 4px 0 #0008; transform: rotate(calc(var(--i) * 2deg - 2deg)); transition: transform .45s var(--slide), opacity .45s; touch-action: none;
  background-image: linear-gradient(#f3e6c8, #f3e6c8); background-size: calc(100% - 20px) calc(100% - 34px); background-position: 10px 24px; background-repeat: no-repeat; }
.dcard small { font: 400 11px var(--display); letter-spacing: .14em; color: var(--tomato); }
.dcard p { margin: 10px 4px 0; font: 600 16.5px/1.35 var(--body); }
.dcard.gone { transform: translateX(var(--dx)) rotate(20deg); opacity: 0; pointer-events: none; }
.brow { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; width: min(100%, 400px); justify-self: center; }
.bh { font: 400 11.5px var(--display); letter-spacing: .12em; color: var(--mustard); }

/* ---------- roof pad, floaty button, lift floor indicator ---------- */
.pad { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; z-index: 1; }
.floaty { z-index: 3; position: absolute; left: 50%; translate: -50% 0; bottom: calc(24px + var(--safe-b)); background: var(--cream); }
/* the hint pill sits low on desktop and in landscape, so the button must not land on it */
@media (max-height: 500px) and (orientation: landscape) { .floaty { left: auto; right: var(--gut); translate: 0; bottom: 10px; color: var(--cream); border-color: var(--cream); } }
.floor-ind { position: absolute; left: 50%; top: calc(16% + var(--safe-t)); translate: -50% 0; font: 400 44px var(--display); color: var(--mustard); background: var(--ink); border: 3px solid var(--mustard); width: 70px; height: 70px; border-radius: 50%; text-align: center; line-height: 66px; box-shadow: 4px 4px 0 #0008; pointer-events: none; }
.floor-ind.flip { animation: flip .4s var(--land); }
@keyframes flip { from { transform: rotateX(90deg); } }

/* ---------- WANTED poster ---------- */
.poster-wrap { position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 14px; padding: calc(12px + var(--safe-t)) var(--gut) calc(12px + var(--safe-b)); background: #1b1f3add; overflow: auto; }
.poster { width: min(86vw, 360px, 56vh); background: var(--cream); color: var(--ink); border: 10px solid var(--tomato); outline: 3px solid var(--cream); padding: 12px 16px 14px; text-align: center; transform: rotate(-1.2deg);
  box-shadow: 8px 8px 0 #0009; position: relative; animation: drop .6s var(--land) both; background-image: url(/tex/grain.webp); background-blend-mode: multiply; }
.poster h2 { font: 400 clamp(40px, 12vw, 64px)/0.9 var(--display); margin: 2px 0 8px; letter-spacing: .02em; }
.mug { background: var(--teal); height: min(34vh, 230px); position: relative; overflow: hidden; border: 3px solid var(--ink); }
.mug img { height: 100%; display: block; margin: 0 auto; }
.mug .board { position: absolute; left: 50%; bottom: 14%; translate: -50% 0; font: 400 20px var(--display); color: var(--ink); }
.charge { font: 800 14px/1.3 var(--body); margin: 10px 0 6px; text-transform: none; }
.rank { margin: 0 0 4px; font-size: 16px; line-height: 1.3; } .rank b { color: var(--tomato); }
.poster small { font-size: 11.5px; opacity: .75; }
.stamp { position: absolute; right: 6px; top: 66%; font: 400 20px var(--display); color: var(--tomato); border: 3px solid var(--tomato); padding: 3px 8px; transform: rotate(-14deg); opacity: 0; animation: stamp .35s cubic-bezier(.2, 2, .4, 1) .55s forwards; mix-blend-mode: multiply; font-style: normal; }
@keyframes stamp { from { transform: rotate(-14deg) scale(2.2); opacity: 0; } to { transform: rotate(-14deg) scale(1); opacity: .9; } }
.poster-wrap .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.btn.quiet.light { color: var(--cream); border-color: var(--cream); }
