/* The Agency — Moose Valley Pop Pulp */
:root {
  --gold: #F5C54F; --coral: #F47A57; --teal: #4BBCC5; --sage: #A7C78A;
  --lilac: #B494CB; --ink: #252329; --cream: #FFF1CD; --paper: #F6E3B4;
  --red: #D9443A; --navy: #23395B;
  --display: "Bangers", "Impact", system-ui, sans-serif;
  --body: "Archivo", system-ui, -apple-system, sans-serif;
  --line: 4px solid var(--ink);
  --shadow: 6px 6px 0 var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  background-image: radial-gradient(rgba(37,35,41,.10) 1px, transparent 1.4px);
  background-size: 7px 7px;
  color: var(--ink); font-family: var(--body); font-size: 18px; line-height: 1.45;
  min-height: 100vh;
}
h1, h2, h3, .display { font-family: var(--display); letter-spacing: .03em; font-weight: 400; margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--navy); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  font-family: var(--display); font-size: 1.5rem; letter-spacing: .05em;
  background: var(--gold); border: var(--line); box-shadow: var(--shadow);
  padding: .55em 1.1em; cursor: pointer; border-radius: 6px; text-transform: uppercase; text-decoration: none; display: inline-block;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:hover { transform: translate(-2px,-2px); box-shadow: 8px 8px 0 var(--ink); }
.btn:active { transform: translate(4px,4px); box-shadow: 2px 2px 0 var(--ink); }
.btn:focus-visible, .choice:focus-visible, input:focus-visible { outline: 4px solid var(--teal); outline-offset: 3px; }
.btn.coral { background: var(--coral); } .btn.teal { background: var(--teal); } .btn.cream { background: var(--cream); }
.btn.small { font-size: 1.05rem; padding: .35em .8em; box-shadow: 4px 4px 0 var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.panel { background: var(--cream); border: var(--line); box-shadow: var(--shadow); border-radius: 4px; }
.caption {
  background: var(--gold); border: 3px solid var(--ink); padding: .35em .7em;
  font-family: var(--display); font-size: 1.25rem; letter-spacing: .04em; display: inline-block;
}
.burst {
  font-family: var(--display); color: var(--cream); background: var(--red);
  -webkit-text-stroke: 1px var(--ink); padding: .2em .6em; border: var(--line);
  transform: rotate(-4deg); display: inline-block; box-shadow: var(--shadow);
}

/* --- story lines --- */
.lines { display: flex; flex-direction: column; gap: .6rem; }
.line-narr { background: var(--gold); border: 3px solid var(--ink); padding: .5rem .8rem; font-style: italic; }
.line-say { display: grid; grid-template-columns: 52px 1fr; gap: .6rem; align-items: start; }
.line-say .who { font-family: var(--display); font-size: 1rem; letter-spacing: .05em; display: block; color: var(--navy); }
.line-say .bubble { background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: .45rem .8rem; position: relative; }
.line-say .bubble::before {
  content: ""; position: absolute; left: -12px; top: 14px; border: 8px solid transparent;
  border-right-color: var(--ink); border-left: 0;
}
.face { width: 52px; height: 52px; border-radius: 50%; border: 3px solid var(--ink); background: var(--cream) center 8% / 180% no-repeat; }
.face.p { background-position: center; background-size: cover; }
.face.none { background: var(--lilac); display: grid; place-items: center; font-family: var(--display); font-size: 1.3rem; }

/* --- stats --- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem .9rem; }
.stat { font-size: .85rem; }
.stat .lbl { display: flex; justify-content: space-between; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.meter { height: 14px; border: 3px solid var(--ink); background: #fff; margin-top: 2px; }
.meter > i { display: block; height: 100%; background: var(--teal); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.stat[data-k="cash"] .meter > i { background: var(--gold); }
.stat[data-k="reputation"] .meter > i { background: var(--coral); }
.stat[data-k="morale"] .meter > i { background: var(--sage); }
.stat[data-k="client_trust"] .meter > i { background: var(--teal); }
.stat[data-k="ethics"] .meter > i { background: var(--lilac); }
.stat[data-k="chaos"] .meter > i { background: var(--red); }
.delta-up { color: #1d6b2f; font-weight: 800; } .delta-down { color: var(--red); font-weight: 800; }

/* --- choices --- */
.choices { display: flex; flex-direction: column; gap: .7rem; }
.choice {
  display: grid; grid-template-columns: 2.6rem 1fr; gap: .7rem; align-items: center; text-align: left;
  background: #fff; border: var(--line); box-shadow: 4px 4px 0 var(--ink); padding: .6rem .8rem; cursor: pointer;
  font-weight: 600; border-radius: 4px; width: 100%;
}
.choice .key {
  font-family: var(--display); font-size: 1.5rem; background: var(--teal); border: 3px solid var(--ink);
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%;
}
.choice:nth-child(2) .key { background: var(--coral); } .choice:nth-child(3) .key { background: var(--gold); } .choice:nth-child(4) .key { background: var(--lilac); }
.choice[aria-checked="true"] .key { background: #fff; }
.choice[aria-checked="true"] { background: var(--gold); transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.choice[aria-pressed="true"] { background: var(--gold); transform: translate(2px,2px); box-shadow: 2px 2px 0 var(--ink); }
.choice[disabled] { cursor: default; }
.choice.winner { background: var(--gold); }

.timer { height: 18px; border: var(--line); background: #fff; position: relative; overflow: hidden; }
.timer > i { position: absolute; inset: 0 auto 0 0; background: var(--coral); transition: width .25s linear; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--cream);
  padding: .6rem 1rem; border-radius: 6px; z-index: 99; max-width: 92vw; font-weight: 600;
}

@keyframes pop { 0% { transform: scale(.85); opacity: 0 } 70% { transform: scale(1.03); opacity: 1 } 100% { transform: none } }
@keyframes burstpop { 0% { transform: scale(.4) rotate(-14deg); opacity: 0 } 70% { transform: scale(1.12) rotate(-2deg); opacity: 1 } 100% { transform: rotate(-4deg) } }
.burst { animation: burstpop .5s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes kenburns { from { transform: scale(1.02) translate(0,0) } to { transform: scale(1.12) translate(-2%, -2%) } }
@keyframes slidein { from { transform: translateY(14px); opacity: 0 } to { transform: none; opacity: 1 } }
.pop { animation: pop .45s ease-out both; }
.slidein > * { animation: slidein .45s ease-out both; }
.slidein > *:nth-child(2) { animation-delay: .08s } .slidein > *:nth-child(3) { animation-delay: .16s }
.slidein > *:nth-child(4) { animation-delay: .24s } .slidein > *:nth-child(5) { animation-delay: .32s } .slidein > *:nth-child(6) { animation-delay: .40s }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
body.reduced *, body.reduced *::before, body.reduced *::after { animation: none !important; transition: none !important; }

/* voice track */
.speaking { outline: 4px solid var(--coral); outline-offset: 3px; }
.line-say.speaking { outline: none; } .line-say.speaking .bubble { outline: 4px solid var(--coral); outline-offset: 2px; }
.line-say.speaking .face { animation: yap .32s ease-in-out infinite alternate; border-color: var(--coral); }
@keyframes yap { from { transform: rotate(-6deg) scale(1.04) } to { transform: rotate(5deg) scale(1.12) translateY(-2px) } }
.voice-unlock { position: fixed; right: 18px; bottom: 18px; z-index: 50; }

[hidden] { display: none !important; }

/* --- endings --- */
.endfx { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow: hidden; cursor: pointer;
  background: radial-gradient(circle at 50% 45%, var(--gold) 0 18%, var(--coral) 18% 30%, var(--gold) 30% 44%, var(--coral) 44% 60%, var(--gold) 60%);
  animation: endin .35s ease-out both; }
.endfx.mood-bad { background: radial-gradient(circle at 50% 45%, #3a3640 0 18%, var(--ink) 18% 30%, #3a3640 30% 44%, var(--ink) 44% 60%, #3a3640 60%); }
.endfx.mood-weird { background: radial-gradient(circle at 50% 45%, var(--lilac) 0 18%, var(--teal) 18% 30%, var(--lilac) 30% 44%, var(--teal) 44% 60%, var(--lilac) 60%); }
.endfx::before { content: ""; position: absolute; inset: -50%; background: repeating-conic-gradient(rgba(255,255,255,.18) 0 10deg, transparent 10deg 20deg); animation: spin 14s linear infinite; }
.endfx.out { animation: endout .45s ease-in both; }
.endcard { position: relative; z-index: 2; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px 36px; max-width: min(92vw, 1100px);
  background: var(--cream); border: 6px solid var(--ink); box-shadow: 12px 12px 0 var(--ink); transform: rotate(-2deg);
  animation: slam .6s cubic-bezier(.2,1.6,.4,1) .1s both; }
.endcard .kicker { font-family: var(--display); font-size: clamp(1.1rem, 2.4vw, 2rem); letter-spacing: .25em; text-transform: uppercase; background: var(--ink); color: var(--gold); padding: .1em .7em; }
.endcard .mood { font-family: var(--display); font-size: clamp(1rem, 2vw, 1.6rem); letter-spacing: .08em; text-transform: uppercase; }
.endcard h1 { font-size: clamp(2.6rem, 8vw, 7rem); line-height: .95; color: var(--coral); -webkit-text-stroke: 2px var(--ink); text-shadow: 6px 6px 0 var(--ink); animation: wobble 1.6s ease-in-out .7s infinite alternate; }
.mood-bad .endcard h1 { color: var(--red); } .mood-weird .endcard h1 { color: var(--lilac); }
.endcard .found { font-weight: 800; }
.endcard .skip { font-size: .85rem; opacity: .65; }
.confetti { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.confetti i { position: absolute; top: -20px; display: block; image-rendering: pixelated; box-shadow: 2px 2px 0 rgba(37,35,41,.5); animation: fall linear both; }
.mood-bad .confetti i { animation-name: drip; }
body.endshake #app { animation: shake .5s ease-in-out .15s both; }
@keyframes endin { from { opacity: 0 } to { opacity: 1 } }
@keyframes endout { to { opacity: 0; transform: scale(1.06) } }
@keyframes slam { 0% { transform: scale(3) rotate(-14deg); opacity: 0 } 60% { transform: scale(.92) rotate(1deg); opacity: 1 } 100% { transform: rotate(-2deg) } }
@keyframes wobble { from { transform: rotate(-1.5deg) } to { transform: rotate(1.5deg) scale(1.03) } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes fall { 0% { transform: translate(0, 0) rotate(0) } 100% { transform: translate(var(--dx), 110vh) rotate(var(--rot)) } }
@keyframes drip { 0% { transform: translate(0, 0) } 100% { transform: translate(0, 110vh) } }
@keyframes shake { 0%,100% { transform: none } 20% { transform: translate(-8px, 4px) } 40% { transform: translate(7px, -5px) } 60% { transform: translate(-5px, 3px) } 80% { transform: translate(3px, -2px) } }

.moodbadge { font-family: var(--display); font-size: 1.3rem; letter-spacing: .08em; text-transform: uppercase; border: 3px solid var(--ink); padding: .15em .7em; display: inline-block; box-shadow: 4px 4px 0 var(--ink); background: var(--gold); }
.moodbadge.mood-bad { background: var(--ink); color: var(--cream); } .moodbadge.mood-weird { background: var(--lilac); }

.scards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.scard { position: relative; background: #fff; border: 3px solid var(--ink); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; opacity: .25; transform: translateY(8px); transition: opacity .35s, transform .35s; }
.scard.in { opacity: 1; transform: none; }
.scard .lbl { font-weight: 800; text-transform: uppercase; letter-spacing: .05em; font-size: .85rem; }
.scard .num { font-family: var(--display); font-size: clamp(2.2rem, 3.6vw, 3.4rem); line-height: 1; font-weight: 400; }
.scard .net { font-size: .85rem; }
.scard .meter > i { transition: width 1s cubic-bezier(.2,.8,.2,1); }
.scard .tag { position: absolute; right: -8px; top: -12px; font-family: var(--display); font-size: 1rem; letter-spacing: .06em; border: 3px solid var(--ink); padding: 0 .5em; transform: rotate(5deg); }
.scard .tag.best { background: var(--sage); } .scard .tag.worst { background: var(--coral); }

.board { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.brow { display: grid; grid-template-columns: 2rem 40px 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; background: #fff; border: 3px solid var(--ink); padding: 6px 10px; animation: slidein .45s ease-out var(--d, 0s) both; }
.brow:first-child { background: var(--gold); box-shadow: 4px 4px 0 var(--ink); }
.brow.me { outline: 4px solid var(--teal); outline-offset: 2px; }
.brow .rank { font-family: var(--display); font-size: 1.8rem; grid-row: span 2; }
.brow .face { width: 40px; height: 40px; grid-row: span 2; }
.brow .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brow .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brow .title { font-size: .85rem; font-weight: 700; }
.brow .score { text-align: right; line-height: 1; } .brow .score b { font-family: var(--display); font-size: 1.8rem; font-weight: 400; }
.brow .score small { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.brow .meter { grid-column: 3 / span 2; height: 10px; border-width: 2px; margin-top: 4px; }
.brow .meter > i { background: var(--teal); }
.history .backers { display: block; font-size: .85em; color: var(--navy); font-weight: 700; }
@media (max-width: 768px) { .scards { grid-template-columns: repeat(2, 1fr); } }
