/* COOKIEBASE — desktop only. Safe-area coordinate space is 1536x864. */

@font-face {
  font-family: 'Luckiest Guy';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/fonts/luckiest-guy-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('assets/fonts/space-mono-700-latin.woff2') format('woff2');
}

:root {
  --fur: #039cd8;
  --navy: #1a3f9c;
  --ink: #0c0c0c;
  --tan: #d7a464;
  --paper: #ffffff;
  --scale: 1;
  --hs: 1;
  --display: 'Luckiest Guy', Impact, 'Arial Black', sans-serif;
  --mono: 'Space Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #e4eff8;
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }

/* ---------- preload gate ---------- */
#viewport { transition: opacity 250ms linear; }
body.preload #viewport { opacity: 0; }
body.preload #cta { pointer-events: none; }
#loader {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: transparent;
  z-index: 10;
}
body.preload #loader { display: flex; }
.ld-cookie {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--tan);
  border: 3px solid var(--ink);
  animation: ldspin 900ms linear infinite;
}
.ld-dot {
  position: absolute;
  left: 50%;
  top: 32%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: var(--navy);
}
@keyframes ldspin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.ld-text { font-family: var(--mono); font-size: 14px; letter-spacing: 1.5px; color: #33415a; }

/* ---------- background plate (cover, bottom-aligned) ---------- */
#viewport {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
#bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 10px;
  height: 10px;
  background: url('assets/L0_bleed_plate.jpg') 0 0 / 100% 100% no-repeat;
}

/* ---------- safe area (contain, never cropped) ---------- */
#safe {
  position: absolute;
  left: 0;
  top: 0;
  width: 1536px;
  height: 864px;
  transform-origin: 0 0;
  will-change: transform;
}

#stage {
  position: absolute;
  inset: 0;
  will-change: transform;
  pointer-events: none;
}

.layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 1536px;
  height: auto;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* body + pupils */
#body {
  position: absolute;
  inset: 0;
  transform-origin: 50% 100%;
  z-index: 1;
}
#bodyImg { position: absolute; left: 0; top: 0; width: 1536px; }

.pupil {
  position: absolute;
  width: 47.2px;
  height: 47.2px;
  margin: -23.6px 0 0 -23.6px;
  border-radius: 50%;
  background: var(--ink);
  will-change: transform;
  pointer-events: none;
}

/* cookie */
#cookieRig { position: absolute; inset: 0; will-change: transform; z-index: 2; }
#cookieWig { position: absolute; inset: 0; transform-origin: 648.2px 509.1px; }
#cookieSvg { position: absolute; left: 0; top: 0; width: 1536px; height: 864px; display: block; }
#cookieHit { cursor: pointer; pointer-events: auto; }
#cookieWig.hover { animation: wiggle .32s ease-in-out infinite alternate; }
@keyframes wiggle { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }

#lip { display: none; z-index: 3; }
#lip.on { display: block; }

#handRig { position: absolute; inset: 0; will-change: transform; z-index: 4; }

#fx { position: absolute; left: 0; top: 0; width: 1536px; height: 864px; pointer-events: none; z-index: 5; }

#nom {
  position: absolute;
  left: 700px;
  top: 300px;
  font-family: var(--display);
  font-size: 104px;
  line-height: 1;
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 6px 6px 0 var(--ink);
  transform-origin: 50% 50%;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}

/* ---------- UI panel ---------- */
#ui {
  position: absolute;
  left: 1064px;
  top: 0;
  width: 400px;
  height: 864px;
  font-family: var(--mono);
}

.tag {
  position: absolute;
  left: 160px;
  top: 252px;
  font-size: 12px;
  letter-spacing: .2px;
  background: #fff6c8;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  padding: 3px 8px;
  transform: rotate(-4deg);
  box-shadow: 1px 1px 0 rgba(12, 12, 12, .35);
  white-space: nowrap;
}

.console {
  position: absolute;
  top: 318px;
  left: 0;
  width: 400px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 14px 18px 16px;
  box-shadow: 5px 5px 0 var(--ink);
}
.console .lbl {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  letter-spacing: .3px;
}
.console .lbl b { font-size: 14px; }
.bar { display: flex; gap: 6px; margin: 9px 0 2px; }
.bar i {
  flex: 1;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  background: var(--tan);
  transition: background-color 140ms linear;
}
.bar i.off { background: #ececec; }
.bar i.tick { animation: segshake 200ms ease-out; }
@keyframes segshake {
  0%,100% { transform: translateY(0); }
  30% { transform: translateY(-2px) rotate(-2deg); }
  60% { transform: translateY(1px) rotate(2deg); }
}
.console .st { font-size: 13px; color: #33415a; margin-top: 6px; min-height: 18px; }

#cta {
  position: absolute;
  top: 448px;
  left: 0;
  width: 400px;
  height: 112px;
  font-family: var(--display);
  font-size: 54px;
  line-height: 1;
  letter-spacing: .5px;
  color: #fff;
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
  background: var(--fur);
  border: 4px solid var(--ink);
  border-radius: 60px;
  box-shadow: 0 8px 0 var(--ink);
  cursor: pointer;
  transition: transform 90ms ease, box-shadow 90ms ease, background-color 120ms linear;
}
#cta:hover { transform: translateY(-2px); box-shadow: 0 10px 0 var(--ink); }
#cta:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--ink); }
#cta:focus-visible { outline: 4px solid #1a3f9c; outline-offset: 4px; }
#cta.small { font-size: 40px; }
#cta.locked { opacity: .6; pointer-events: none; }
@keyframes ctapop { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }
#cta.fadein { animation: ctapop 280ms ease-out backwards; }
#cta.wiggle { animation: ctawiggle 420ms ease-in-out; }
@keyframes ctawiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-2.6deg); }
  75% { transform: rotate(2.6deg); }
}

.hint {
  position: absolute;
  top: 578px;
  left: 0;
  width: 400px;
  text-align: center;
  font-size: 13px;
  letter-spacing: .2px;
  color: #33415a;
}

.crumbs {
  position: absolute;
  top: 620px;
  left: 0;
  width: 400px;
  display: flex;
  gap: 12px;
  justify-content: center;
  visibility: hidden;
}
.crumbs.on { visibility: visible; }
.crumbbtn {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  background: var(--tan);
  border: 3px solid var(--ink);
  padding: 11px 15px;
  border-radius: 46% 54% 42% 58% / 55% 45% 55% 45%;
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  transform-origin: 50% 50%;
}
.crumbbtn:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.crumbbtn[aria-disabled="true"] {
  background: rgba(215, 164, 100, .55);
  border-color: rgba(12, 12, 12, .55);
  color: rgba(12, 12, 12, .78);
  box-shadow: 2px 2px 0 rgba(12, 12, 12, .45);
  cursor: default;
}

.eaten {
  position: absolute;
  top: 706px;
  left: 0;
  width: 400px;
  text-align: center;
  font-size: 12px;
  letter-spacing: .3px;
  color: #33415a;
}

/* ---------- header (viewport anchored) ---------- */
#header {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(20px * var(--hs)) calc(26px * var(--hs));
  pointer-events: none;
  z-index: 20;
}
#header > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: calc(12px * var(--hs)); }
.brand .mini {
  width: calc(40px * var(--hs));
  height: calc(40px * var(--hs));
  display: block;
  filter: drop-shadow(2px 2px 0 rgba(12,12,12,.9));
}
.word {
  font-family: var(--display);
  font-size: calc(42px * var(--hs));
  line-height: 1;
  letter-spacing: 1px;
  color: #fff;
  -webkit-text-stroke: calc(2px * var(--hs)) var(--ink);
  text-shadow: calc(3px * var(--hs)) calc(3px * var(--hs)) 0 var(--ink);
}
.chip {
  font-family: var(--mono);
  font-size: calc(14px * var(--hs));
  color: var(--ink);
  background: #fff;
  border: calc(2px * var(--hs)) solid var(--ink);
  border-radius: 999px;
  padding: calc(5px * var(--hs)) calc(13px * var(--hs));
  box-shadow: calc(3px * var(--hs)) calc(3px * var(--hs)) 0 var(--ink);
  white-space: nowrap;
}
.hlinks { display: flex; align-items: center; gap: calc(12px * var(--hs)); }
.pill, #mute {
  font-family: var(--mono);
  font-size: calc(14px * var(--hs));
  color: var(--ink);
  background: #fff;
  border: calc(2px * var(--hs)) solid var(--ink);
  border-radius: 999px;
  padding: calc(7px * var(--hs)) calc(15px * var(--hs));
  box-shadow: calc(3px * var(--hs)) calc(3px * var(--hs)) 0 var(--ink);
  text-decoration: none;
  cursor: pointer;
}
#mute {
  width: calc(42px * var(--hs));
  height: calc(42px * var(--hs));
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#mute svg.ic { display: block; width: calc(24px * var(--hs)); height: calc(24px * var(--hs)); }
#mute svg.ic-off { display: none; }
#mute.muted svg.ic-on { display: none; }
#mute.muted svg.ic-off { display: block; }
.pill:focus-visible, #mute:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.pill[aria-disabled="true"] { opacity: .5; cursor: default; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #cta, .bar i, .crumbbtn { transition: none !important; animation: none !important; }
  #cookieWig.hover { animation: none !important; }
  #body.breathe, #body.chew, #body.chew-slow { animation: none !important; }
  #lip.bobbing, #lip.bobbing-slow { animation: none !important; }
  .ld-cookie { animation: none !important; }
}

/* ---------- helpers ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* idle life loops */
#body.breathe { animation: breathe 3s ease-in-out infinite; }
@keyframes breathe {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.996); }
}
#body.chew { animation: chew 454ms ease-in-out infinite; }
#body.chew-slow { animation: chew 833ms ease-in-out infinite; }
#lip.bobbing { transform-origin: 50% 100%; animation: chew 454ms ease-in-out infinite; }
#lip.bobbing-slow { transform-origin: 50% 100%; animation: chew 833ms ease-in-out infinite; }
@keyframes chew {
  0%, 100% { transform: scaleX(1.025) scaleY(0.97); }
  50% { transform: scaleX(0.985) scaleY(1.0); }
}

/* ---------- social card mode (?state=final&social=1) ---------- */
body.social #header,
body.social #ui { display: none !important; }

#socialMark {
  position: absolute;
  right: 18px;
  top: 300px;
  text-align: right;
  display: none;
}
body.social #socialMark { display: block; }
#socialMark .sm-word {
  font-family: var(--display);
  font-size: 110px;
  line-height: .95;
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 6px 6px 0 var(--ink);
  white-space: nowrap;
}
#socialMark .sm-chip {
  font-family: var(--display);
  font-size: 64px;
  line-height: 1;
  margin-top: 10px;
  color: #fff;
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 4px 4px 0 var(--ink);
  white-space: nowrap;
}
