@font-face { font-family: "Rizzy Pixel"; font-weight: 400; font-display: swap; src: url(assets/fonts/rizzy-pixel-400.woff2) format("woff2"); }
@font-face { font-family: "Rizzy Pixel"; font-weight: 500; font-display: swap; src: url(assets/fonts/rizzy-pixel-500.woff2) format("woff2"); }
@font-face { font-family: "Rizzy Pixel"; font-weight: 600; font-display: swap; src: url(assets/fonts/rizzy-pixel-600.woff2) format("woff2"); }
@font-face { font-family: "Rizzy Pixel"; font-weight: 700; font-display: swap; src: url(assets/fonts/rizzy-pixel-700.woff2) format("woff2"); }
@font-face { font-family: "Silkscreen"; font-weight: 400; font-display: swap; src: url(assets/fonts/silkscreen-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Silkscreen"; font-weight: 700; font-display: swap; src: url(assets/fonts/silkscreen-latin-700-normal.woff2) format("woff2"); }
/* MAKE UP: warm-dusk pixel UI. Palette pulled from art/palette.json. */
:root {
  --ink: #1b1120;      /* page */
  --ink2: #2a1a2e;     /* panels */
  --ink3: #3d2540;     /* borders, empty hearts */
  --plum: #5a2f4f;
  --cream: #f3e3cf;
  --sand: #d9b99a;
  --muted: #a88a8f;
  --rose: #e0465a;
  --rose-hi: #ff7a86;
  --gold: #e9b04a;
  --best: #5fb85a;
  --ok: #e9b04a;
  --bad: #d8434f;
  --px: 3px;           /* UI pixel unit for borders */
  --pixel: "Silkscreen", ui-monospace, monospace;
  --read: "Rizzy Pixel", ui-monospace, monospace;  /* Pixelify Sans with a redrawn e and 5: tools/patch_font.py */
}
* { box-sizing: border-box; }
html, body { margin: 0; font-variant-ligatures: none; font-feature-settings: "liga" 0, "clig" 0; background: var(--ink); color: var(--cream); }
body {
  font-family: var(--read);
  -webkit-font-smoothing: none;
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% 0%, #2c1830 0%, var(--ink) 60%) fixed;
}
button { font: inherit; color: inherit; cursor: pointer; }
#app {
  max-width: 460px; margin: 0 auto; padding: 10px 12px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
}

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 10px; }
.logo { font-family: var(--pixel); font-weight: 700; font-size: 22px; letter-spacing: 1px; color: var(--cream); }
.logo span { color: var(--rose); }
.num { font-family: var(--pixel); font-size: 13px; color: var(--muted); padding-top: 4px; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.streak { font-family: var(--pixel); font-size: 14px; }
.icon-btn {
  width: 30px; height: 30px; background: var(--ink2); border: none;
  box-shadow: inset 0 0 0 var(--px) var(--ink3); font-family: var(--pixel); font-size: 14px;
}

/* ---------- mood ---------- */
.mood { display: flex; align-items: center; gap: 8px; position: relative; }
.mood-label { font-family: var(--pixel); font-size: 10px; color: var(--muted); letter-spacing: 1px; }
.hearts { display: flex; gap: 4px; }
.hearts svg { width: 27px; height: 24px; image-rendering: pixelated; }
.hearts .pop { animation: pop .48s step-end; }
.hearts .crack { animation: crack .4s step-end; }
.mood-val { font-family: var(--pixel); font-size: 13px; margin-left: auto; color: var(--sand); min-width: 3ch; text-align: right; }
@keyframes pop { 0% { transform: translateY(-3px); filter: brightness(2.2); } 25% { transform: translateY(-6px); filter: brightness(1.4); } 50% { transform: translateY(-3px); filter: none; } 75% { transform: translateY(0); } }
@keyframes crack { 0% { transform: translateX(-3px); filter: brightness(.55); } 25% { transform: translateX(3px); } 50% { transform: translateX(-3px); filter: none; } 75% { transform: translateX(0); } }

/* ---------- stage ---------- */
.stage {
  position: relative; align-self: center; overflow: hidden;
  width: var(--stage, 320px); height: var(--stage, 320px);
  box-shadow: 0 0 0 var(--px) var(--ink3), 0 0 0 calc(var(--px)*2) #0f0912;
  background: #0f0912;
}
.stage img { position: absolute; image-rendering: pixelated; image-rendering: crisp-edges; user-select: none; -webkit-user-drag: none; }
.bg { inset: 0; width: 100%; height: 100%; }
.her { bottom: 0; left: 50%; transform: translateX(-50%); transform-origin: 50% 100%; }
.her.hop { animation: hop .32s steps(4); }
.her.shake { animation: shake .45s steps(6); }
.her.bounce { animation: bounce .6s steps(6) 2; }
@keyframes hop { 50% { transform: translateX(-50%) translateY(calc(var(--s) * -3px)); } }
@keyframes shake { 20% { transform: translateX(calc(-50% - var(--s) * 2px)); } 40% { transform: translateX(calc(-50% + var(--s) * 2px)); } 60% { transform: translateX(calc(-50% - var(--s) * 1px)); } 80% { transform: translateX(calc(-50% + var(--s) * 1px)); } }
@keyframes bounce { 50% { transform: translateX(-50%) translateY(calc(var(--s) * -2px)); } }
.vignette { position: absolute; inset: 0; pointer-events: none; opacity: 0; box-shadow: inset 0 0 60px 10px rgba(216, 67, 79, .85); }
.vignette.flash { animation: flash .7s steps(4); }
.vignette.love { box-shadow: inset 0 0 60px 10px rgba(255, 122, 134, .6); animation: flash 1s steps(5); }
@keyframes flash { 30% { opacity: 1; } 100% { opacity: 0; } }
.fx { position: absolute; inset: 0; pointer-events: none; }
.fx .p { position: absolute; width: 14px; height: 12px; image-rendering: pixelated; animation: rise 1.4s steps(10) forwards; }
@keyframes rise { to { transform: translateY(-120px); opacity: 0; } }
.delta {
  position: absolute; top: 12%; left: 50%; transform: translateX(-50%);
  font-family: var(--pixel); font-weight: 700; font-size: 22px; opacity: 0; pointer-events: none;
  text-shadow: 2px 0 #0f0912, -2px 0 #0f0912, 0 2px #0f0912, 0 -2px #0f0912;
}
.delta.show { animation: delta 1.3s steps(8) forwards; }
@keyframes delta { 0% { opacity: 0; transform: translate(-50%, 10px); } 20% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -14px); } }

/* ---------- dialogue ---------- */
.talk { display: flex; flex-direction: column; gap: 8px; }
.box {
  position: relative; background: var(--ink2); padding: 16px 14px 12px; min-height: 76px;
  box-shadow: inset 0 0 0 var(--px) var(--ink3);
}
.name {
  position: absolute; top: -10px; left: 10px; background: var(--rose); color: #fff;
  font-family: var(--pixel); font-size: 11px; padding: 2px 8px; letter-spacing: 1px;
}
.name.you { background: var(--plum); }
.line { margin: 0; font-size: 19px; line-height: 1.25; min-height: 2.5em; }
.line .caret { display: inline-block; width: .5em; animation: blink .8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.options { display: flex; flex-direction: column; gap: 7px; }
.opt {
  position: relative; text-align: left; background: #241628; border: none; padding: 11px 12px 11px 38px;
  font-family: var(--read); font-size: 16px; line-height: 1.2; color: var(--cream);
  box-shadow: inset 0 0 0 var(--px) var(--ink3), 0 var(--px) 0 #0f0912;
  transition: transform .06s steps(1);
}
.opt::before {
  content: attr(data-k); position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  font-family: var(--pixel); font-size: 12px; color: var(--muted);
}
.opt:active { transform: translateY(var(--px)); box-shadow: inset 0 0 0 var(--px) var(--ink3); }
@media (hover: hover) { .opt:hover:not(:disabled) { box-shadow: inset 0 0 0 var(--px) var(--rose), 0 var(--px) 0 #0f0912; } }
.opt:disabled { cursor: default; opacity: .38; }
.opt.picked { opacity: 1; }
.opt.picked.best { box-shadow: inset 0 0 0 var(--px) var(--best); }
.opt.picked.ok { box-shadow: inset 0 0 0 var(--px) var(--ok); }
.opt.picked.bad { box-shadow: inset 0 0 0 var(--px) var(--bad); }
.chip { display: inline-block; margin-top: 6px; font-family: var(--pixel); font-size: 10px; padding: 2px 6px; color: #120b14; }
.chip.best { background: var(--best); } .chip.ok { background: var(--ok); } .chip.bad { background: var(--bad); color: #fff; }
.next-btn { align-self: stretch; }

.rounds { display: flex; gap: 6px; justify-content: center; }
.rounds i { width: 14px; height: 14px; background: var(--ink3); display: block; }
.rounds i.cur { box-shadow: 0 0 0 2px var(--cream); }
.rounds i.best { background: var(--best); } .rounds i.ok { background: var(--ok); } .rounds i.bad { background: var(--bad); }

/* ---------- buttons ---------- */
.btn {
  display: block; width: 100%; border: none; padding: 13px 14px; text-align: center; text-decoration: none;
  font-family: var(--pixel); font-size: 15px; letter-spacing: 1px; color: var(--cream);
  background: var(--ink3); box-shadow: 0 var(--px) 0 #0f0912;
}
.btn:active { transform: translateY(var(--px)); box-shadow: none; }
.btn.primary { background: #d33c51; color: #fff; box-shadow: 0 var(--px) 0 #7c1f2e; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--ink3); color: var(--muted); font-size: 12px; }
.btn.cta {
  background: linear-gradient(180deg, #ff7a86, #e0465a); color: #fff; box-shadow: 0 var(--px) 0 #7c1f2e;
  padding: 10px 12px; animation: nudge 2.4s steps(2) infinite;
}
.cta-top { display: block; font-family: var(--read); font-size: 13px; letter-spacing: 0; opacity: .9; }
.cta-main { display: block; font-size: 14px; margin-top: 2px; }
@keyframes nudge { 0%, 85% { transform: none; } 90% { transform: translateY(-2px); } }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(15, 9, 18, .72); padding: 12px; overflow-y: auto;
}
.overlay[hidden] { display: none; }
.card {
  width: 100%; max-width: 436px; background: var(--ink2); padding: 22px 18px 18px; margin: auto 0 0;
  box-shadow: inset 0 0 0 var(--px) var(--ink3), 0 0 0 var(--px) #0f0912;
  display: flex; flex-direction: column; gap: 12px; text-align: center;
  animation: up .25s steps(4);
}
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.card h1 { margin: 0; font-family: var(--pixel); font-weight: 700; font-size: 22px; line-height: 1.2; }
.kicker { font-family: var(--pixel); font-size: 11px; color: var(--rose-hi); letter-spacing: 2px; }
.big-icon { font-size: 42px; line-height: 1; }
.situation { margin: 0; font-size: 18px; line-height: 1.3; color: var(--cream); }
.rule { margin: 0; font-size: 14px; color: var(--muted); }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 16px; }
.legend span { margin-right: 6px; }

.results { gap: 10px; }
.verdict-emoji { font-size: 48px; line-height: 1; }
.grid { font-size: 28px; letter-spacing: 4px; }
.res-sub { margin: 0; color: var(--sand); font-size: 15px; }
.copied { font-size: 13px; color: var(--best); margin-top: -4px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 4px; }
.stats div { background: #241628; padding: 8px 2px; }
.stats b { display: block; font-family: var(--pixel); font-size: 18px; }
.stats span { font-size: 11px; color: var(--muted); }
.dist { display: grid; gap: 4px; text-align: left; }
.dist .row { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 6px; font-size: 13px; }
.dist .bar { height: 14px; background: var(--ink3); min-width: 14px; font-family: var(--pixel); font-size: 10px; padding: 0 4px; line-height: 14px; text-align: right; }
.dist .bar.me { background: var(--rose); }
.next { font-size: 14px; color: var(--muted); }
.next b { font-family: var(--pixel); color: var(--cream); }
.answers { text-align: left; font-size: 14px; background: #241628; padding: 8px 10px; }
.answers summary { cursor: pointer; font-family: var(--pixel); font-size: 11px; color: var(--sand); }
.answers ol { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; }
.answers li em { color: var(--muted); font-style: normal; display: block; font-size: 13px; }

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

/* ---------- typed reply (Rizzy) ---------- */
.reply { display: flex; gap: 6px; align-items: stretch; }
.reply textarea {
  flex: 1; resize: none; border: none; outline: none; padding: 10px 12px; min-height: 52px;
  background: #241628; color: var(--cream); font-family: var(--read); font-size: 17px; line-height: 1.25;
  box-shadow: inset 0 0 0 var(--px) var(--ink3);
}
.reply textarea:focus { box-shadow: inset 0 0 0 var(--px) var(--rose); }
.reply textarea::placeholder { color: #a08592; }
.reply .send { width: auto; padding: 0 14px; font-size: 13px; }
.reply :disabled { opacity: .5; }
.hint-btn { align-self: flex-start; background: none; border: none; color: var(--sand); font-family: var(--pixel); font-size: 11px; padding: 2px 0; letter-spacing: 1px; }
.chips { display: flex; flex-direction: column; gap: 6px; }
.chips[hidden] { display: none; }
.chip.big { align-self: center; font-size: 13px; padding: 6px 12px; }
.chip.disaster { background: #120b14; color: #ff6b77; box-shadow: inset 0 0 0 2px #ff6b77; }
.rounds i.disaster { background: #120b14; box-shadow: inset 0 0 0 2px #ff6b77; }
.why { margin: -2px 0 0; font-size: 14px; color: var(--sand); text-align: center; }
.why[hidden], .you-bubble[hidden] { display: none; }
.you-bubble {
  align-self: flex-end; max-width: 85%; background: var(--plum); color: #fff; padding: 8px 12px;
  font-size: 16px; line-height: 1.25; box-shadow: 0 var(--px) 0 #0f0912; margin-bottom: 4px;
}
.dots { display: inline-flex; gap: 5px; padding: 6px 0; }
.dots i { width: 7px; height: 7px; background: var(--sand); animation: dot 1s steps(2) infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 50% { opacity: .2; } }
.her-take { position: relative; display: block; padding: 10px 12px 10px 74px; min-height: 64px; overflow: hidden; text-align: left;
  background: var(--ink3); box-shadow: inset 0 0 0 2px #ff7a8655; }
.her-take .cta-top { font-family: var(--pixel, inherit); font-size: 11px; letter-spacing: 1px; color: #ff9aa4; }
.her-take .cta-main { font-family: var(--read); font-size: 15px; letter-spacing: 0; }
.cta-girl { position: absolute; left: 6px; bottom: 0; height: 62px; image-rendering: pixelated; }

/* ---------- 8-bit icons + location fx ---------- */
.px-icon { image-rendering: pixelated; vertical-align: -0.2em; display: inline-block; }
.px-icon.s1 { height: 16px; } .px-icon.s2 { height: 22px; } .px-icon.s4 { height: 56px; }
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.sq { display: inline-block; width: 26px; height: 26px; margin: 0 3px; vertical-align: middle; box-shadow: inset 0 0 0 3px rgba(0,0,0,.25); }
.legend .sq { width: 16px; height: 16px; margin: 0 8px 0 0; }
.sq.best { background: var(--best); } .sq.ok { background: var(--ok); } .sq.bad { background: var(--bad); }
.sq.disaster { background: #120b14; box-shadow: inset 0 0 0 3px #ff6b77; }
.grid { letter-spacing: 0; }
.delta img { vertical-align: -0.15em; }
.streak { display: inline-flex; align-items: center; gap: 3px; }
.her-motion { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); image-rendering: pixelated; }
.her-motion[hidden] { display: none; }
.her-motion.shake { animation: shake .45s steps(6); }

/* ---------- time of day ---------- */
.tod-canvas { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; mix-blend-mode: multiply; }
.her, .her-motion { transition: filter 0.9s steps(8); }
.stage[data-tod="1"] :is(.her, .her-motion) { filter: brightness(0.98) sepia(0.08); }
.stage[data-tod="2"] :is(.her, .her-motion) { filter: brightness(0.93) saturate(0.95) hue-rotate(-6deg); }
.stage[data-tod="3"] :is(.her, .her-motion) { filter: brightness(0.86) saturate(0.9) hue-rotate(-10deg); }
.later {
  position: absolute; top: 8px; left: 8px; font-family: var(--pixel); font-size: 11px; letter-spacing: 1px; color: #fff;
  background: rgba(15, 9, 18, .75); padding: 3px 7px; opacity: 0; pointer-events: none;
}
.later.show { animation: later 2.6s steps(10) forwards; }
@keyframes later { 0% { opacity: 0; } 15%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- girl portrait + card ---------- */
.girl-btn { width: 40px; height: 40px; padding: 0; border: none; background: var(--ink3); box-shadow: inset 0 0 0 2px var(--rose), 0 3px 0 #0f0912; cursor: pointer; flex: none; position: relative; }
.girl-btn img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.girl-btn::after { content: "+"; position: absolute; right: -5px; bottom: -5px; width: 14px; height: 14px; background: var(--rose); color: #fff; font: 700 11px/14px var(--pixel); text-align: center; }
.girl-card { text-align: left; gap: 12px; }
.gc-head { display: flex; gap: 14px; align-items: center; }
.gc-portrait { width: 96px; height: 96px; image-rendering: pixelated; box-shadow: 0 0 0 3px var(--rose); flex: none; }
.gc-head h1 { font-size: 20px; }
.gc-vibe { color: var(--sand); font-size: 15px; margin-top: 4px; }
.gc-meter { color: var(--muted); font-size: 13px; margin-top: 2px; }
.gc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gc-grid h3 { margin: 0 0 4px; font: 700 11px var(--pixel); letter-spacing: 1px; color: var(--rose-hi); display: flex; gap: 6px; align-items: center; }
.gc-grid ul { margin: 0; padding-left: 16px; font-size: 15px; line-height: 1.3; display: grid; gap: 3px; }
.gc-flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { font-size: 13px; padding: 4px 8px; background: #241628; }
.flag.green { box-shadow: inset 0 0 0 2px var(--best); } .flag.ick { box-shadow: inset 0 0 0 2px var(--bad); }
.flag:empty { display: none; }
.gc-tip { margin: 0; font-size: 15px; color: var(--cream); background: #241628; padding: 8px 10px; }
.gc-chat { padding-left: 14px !important; text-align: center !important; min-height: 0 !important; }

/* ---------- gentle 8-bit icon motion (stepped, pixel-game style) ---------- */
.icon-wrap { display: inline-block; position: relative; line-height: 0; vertical-align: -0.2em; }
.icon-wrap .px-icon { vertical-align: 0; }
.ani-float  { animation: i-float 1.6s steps(4) infinite; }
.ani-bob    { animation: i-float 2.2s steps(4) infinite; }
.ani-shake  { animation: i-shake 2.4s steps(1) infinite; }
.ani-rattle { animation: i-shake 1.8s steps(1) infinite; }
.ani-fire   { animation: i-fire .5s steps(2) infinite; transform-origin: 50% 100%; }
.ani-glow   { animation: i-glow 1.4s steps(3) infinite; }
.ani-glint  { animation: i-glint 2.4s steps(4) infinite; }
.ani-blink  { animation: i-blink 3s steps(1) infinite; }
.ani-spin   { animation: i-spin 3s steps(8) infinite; }
.ani-twinkle{ animation: i-twinkle 1.2s steps(3) infinite; }
.ani-sway   { animation: i-sway 2.4s steps(4) infinite; transform-origin: 50% 100%; }
.ani-lift   { animation: i-lift 1.4s steps(3) infinite; }
.ani-zap    { animation: i-zap 1.6s steps(1) infinite; }
.ani-buzz   { animation: i-buzz 2.5s steps(1) infinite; }
/* steam / candle: a couple of pixels animated above the icon */
.ani-steam::after, .ani-candle::after {
  content: ""; position: absolute; left: 50%; top: -6px; width: 3px; height: 3px; background: #f6eee4;
  box-shadow: 3px -3px 0 #f6eee4, -1px -7px 0 rgba(246,238,228,.6); animation: i-steam 1.4s steps(4) infinite;
}
.ani-candle::after { top: -2px; left: 46%; width: 2px; height: 3px; background: #ffcf4a; box-shadow: 0 -2px 0 #ff8a3a; animation: i-flame .35s steps(2) infinite; }
@keyframes i-float { 50% { transform: translateY(-2px); } }
@keyframes i-shake { 0%, 88% { transform: none; } 90% { transform: translateX(-1px); } 94% { transform: translateX(1px); } 97% { transform: translateX(-1px); } }
@keyframes i-fire { 50% { transform: scaleY(1.12) scaleX(0.94); filter: brightness(1.15); } }
@keyframes i-glow { 50% { filter: brightness(1.35) drop-shadow(0 0 3px #ffe08a); } }
@keyframes i-glint { 0%, 70% { filter: none; } 80% { filter: brightness(1.5); } 90% { filter: brightness(1.15); } }
@keyframes i-blink { 0%, 92% { transform: none; } 94% { transform: scaleY(0.85); } }
@keyframes i-spin { to { transform: rotate(360deg); } }
@keyframes i-twinkle { 50% { transform: scale(0.8); filter: brightness(1.4); } }
@keyframes i-sway { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes i-lift { 50% { transform: translateY(-3px); } }
@keyframes i-zap { 0%, 80% { filter: none; } 82% { filter: brightness(2); } 86% { filter: none; } 88% { filter: brightness(1.8); } }
@keyframes i-buzz { 0%, 85% { transform: none; } 87% { transform: rotate(-6deg); } 90% { transform: rotate(6deg); } 93% { transform: rotate(-4deg); } }
@keyframes i-steam { 0% { transform: translateY(2px); opacity: .9; } 100% { transform: translateY(-5px); opacity: 0; } }
@keyframes i-flame { 50% { transform: scaleY(1.4) translateY(-1px); } }
.gc-chat[hidden] { display: none !important; }

/* ---------- reply timer ---------- */
.timer { position: relative; height: 14px; background: #241628; box-shadow: inset 0 0 0 2px var(--ink3); }
.timer i { position: absolute; left: 2px; top: 2px; bottom: 2px; width: calc(100% - 4px); background: var(--best); box-shadow: inset 0 -3px 0 rgba(0,0,0,.18), inset 0 3px 0 rgba(255,255,255,.18); }
.timer.hot i { background: var(--ok); }
.timer.panic i { background: var(--bad); }
.timer b { position: absolute; right: 6px; top: -1px; font: 700 10px/16px var(--pixel); color: #fff; text-shadow: 1px 1px 0 #0f0912; }
@keyframes tpanic { 50% { opacity: .55; } }
.timer b.beat { animation: tbeat .3s step-end; }
@keyframes tbeat { 0% { transform: translateY(-3px); color: #ffe08a; } 66% { transform: none; } }
.chip.timeout, .rounds i.timeout, .sq.timeout { background: #3a2a10; color: #ffcf6a; box-shadow: inset 0 0 0 2px #ffcf6a; }
.icon-btn.off { color: var(--muted); }
/* meter hearts: gentle staggered heartbeat (only hearts with fill) */
.hearts span { display: inline-block; position: relative; animation: hbeat 2.4s step-end infinite; }
.hearts span:nth-child(2) { animation-delay: .15s; } .hearts span:nth-child(3) { animation-delay: .3s; }
.hearts span:nth-child(4) { animation-delay: .45s; } .hearts span:nth-child(5) { animation-delay: .6s; }
.hearts span.empty { animation: none; }
@keyframes hbeat { 0%, 76%, 100% { transform: none; } 80% { transform: translateY(-3px); } }

.legal { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.legal a { color: var(--muted); }

/* ---------- icon centring pass (every pixel icon sits on the optical centre of its text line) ---------- */
.icon-wrap { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; line-height: 0; }
.icon-wrap .px-icon, .px-icon { vertical-align: middle; }
.big-icon, .verdict-emoji { display: flex; justify-content: center; align-items: center; }
.hint-btn, .chip, .delta, .streak, .gc-grid h3, .gc-tip, .dist .row > span { display: inline-flex; align-items: center; gap: 6px; }
.delta { white-space: nowrap; }
.chip.big { justify-content: center; }
.gc-tip { display: flex; }
.legend { width: max-content; margin: 0 auto; text-align: left; }
.legend li { display: flex; align-items: center; }
.legend .sq { flex: none; }
.situation .px-icon { vertical-align: -0.15em; }

/* girl portrait button: true sprite pixels, and the + badge is never painted over by the stage */
.girl-btn { z-index: 3; overflow: visible; }
.girl-btn::after { right: -4px; bottom: -4px; width: 13px; height: 13px; font: 700 11px/13px var(--pixel); z-index: 1; }
.gc-portrait { width: 80px; height: 80px; }
.overlay.dismissable { cursor: pointer; }
.overlay.dismissable .card { cursor: auto; }
.dist .row { grid-template-columns: 132px 1fr; }
.dist .row > span { white-space: nowrap; }

/* ---------- first-run onboarding (3 cards) ---------- */
.ob { gap: 10px; }
.ob-step { display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; min-height: 318px; animation: obin .2s steps(3); }
.ob-step[hidden] { display: none; }
@keyframes obin { from { transform: translateX(24px); opacity: 0; } }
.ob-scene { position: relative; width: 200px; height: 200px; box-shadow: 0 0 0 var(--px) var(--ink3); overflow: hidden; }
.ob-scene img { position: absolute; image-rendering: pixelated; }
#obBg { inset: 0; width: 100%; height: 100%; }
#obHer { bottom: 0; left: 50%; height: 100%; transform: translateX(-50%); }
.ob-mock { width: 100%; display: grid; gap: 8px; text-align: left; }
.ob-she { background: #241628; box-shadow: inset 0 0 0 2px var(--ink3); padding: 8px 10px; font-size: 15px; }
.ob-she b { display: block; font: 400 10px var(--pixel); letter-spacing: 2px; color: var(--rose-hi); margin-bottom: 2px; }
.ob-type { background: #1f1424; box-shadow: inset 0 0 0 var(--px) var(--rose); padding: 10px; font-size: 15px; min-height: 44px; }
.ob-caret { display: inline-block; width: 8px; height: 15px; margin-left: 2px; vertical-align: -2px; background: var(--cream); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.ob-hint { display: inline-flex; align-items: center; gap: 6px; color: var(--sand); font: 400 11px var(--pixel); letter-spacing: 1px; }
.ob-dots { display: flex; justify-content: center; gap: 8px; }
.ob-dots i { width: 10px; height: 10px; background: var(--ink3); }
.ob-dots i.on { background: var(--rose); }
.ob-skip { background: none; border: none; color: var(--muted); font: 400 11px var(--pixel); letter-spacing: 2px; padding: 4px; cursor: pointer; }

/* ---------- accessibility ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.timer.off i { background: var(--ink3); width: 100% !important; animation: none; }
.setting { display: flex; justify-content: center; }
.setting .btn { width: auto; padding: 8px 14px; }
.btn.arming { opacity: .55; }

/* heart gained: 4 pixel sparks fly out in 3px (1 art px) steps */
.hearts span.burst::after { content: ""; position: absolute; left: 12px; top: 10px; width: 3px; height: 3px; background: transparent; pointer-events: none; animation: spark .48s step-end forwards; }
@keyframes spark {
  0% { box-shadow: -9px -9px #ffe08a, 9px -9px #ffe08a, -9px 9px #ff9aa4, 9px 9px #ff9aa4; }
  33% { box-shadow: -15px -12px #ffe08a, 15px -12px #ffe08a, -15px 12px #ff9aa4, 15px 12px #ff9aa4; }
  66% { box-shadow: -18px -15px #fff3, 18px -15px #fff3, -18px 15px #fff3, 18px 15px #fff3; }
  100% { box-shadow: none; }
}
/* "read my card" speech bubble under her picture, tail points up at it */
.card-tip { position: absolute; left: 0; top: 52px; z-index: 6; padding: 7px 10px; background: var(--cream); color: var(--ink); border: none;
  font: 700 11px/1 var(--pixel); letter-spacing: .5px; white-space: nowrap; cursor: pointer;
  box-shadow: 0 0 0 3px var(--ink), 0 6px 0 0 #0f0912; animation: tipbob 1.2s step-end infinite; }
.card-tip::before { content: ""; position: absolute; left: 12px; top: -9px; width: 15px; height: 9px; background: var(--cream);
  clip-path: polygon(6px 0, 9px 0, 9px 3px, 12px 3px, 12px 6px, 15px 6px, 15px 9px, 0 9px, 0 6px, 3px 6px, 3px 3px, 6px 3px); }
@keyframes tipbob { 0% { transform: none; } 50% { transform: translateY(-3px); } }

.link-btn { background: none; border: none; color: var(--sand); font: 700 11px/1 var(--pixel); letter-spacing: .5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px; margin-top: -4px; }

/* phone keyboard up: the stage folds to a head-and-shoulders strip (top 40%) and the header steps away, so the reply box
   sits high on screen without any scrolling (Agam 12-02: keep her visible, don't hide the scene) */
body.typing .top { display: none; }
body.typing .stage { clip-path: inset(-8px -8px 60% -8px); margin-bottom: calc(var(--stage) * -0.6 + 6px); }

/* risky rizz: a bold flirt that landed (+40) */
.chip.bold, .rounds i.bold, .sq.bold { background: #9b5cf0; color: #fff; }

/* ---------- readability (Agam 12-02: "text hard to read") ---------- */
.line, .situation, .why, .you-bubble, .reply textarea, .gc-grid ul, .gc-tip, .her-take .cta-main, .ob-she, .ob-type, .answers, .res-sub, .legend {
  -webkit-font-smoothing: antialiased; letter-spacing: .2px;
}
.line { font-size: 20px; line-height: 1.35; }
.why { font-size: 15px; line-height: 1.35; color: #e6cdb3; }
.situation { font-size: 18px; line-height: 1.4; }
.rule, .next, .answers li em, .gc-meter { font-size: 15px; color: #c3a7ab; }
.you-bubble { font-size: 17px; line-height: 1.35; }
.name, .kicker, .chip, .card-tip { font-size: 12px; }
:root { --muted: #c3a7ab; }

/* ---------- desktop: scene left, conversation right (Agam 12-02) ---------- */
@media (min-width: 900px) and (min-height: 560px) {
  #app {
    max-width: 1120px; padding-top: 28px; column-gap: 32px; row-gap: 14px;
    display: grid; grid-template-columns: auto minmax(380px, 440px); justify-content: center; align-items: start;
    grid-template-areas: "top top" "stage mood" "stage talk"; grid-template-rows: auto auto 1fr;
  }
  .top { grid-area: top; } .mood { grid-area: mood; } .stage { grid-area: stage; align-self: start; } .talk { grid-area: talk; }
  .logo { font-size: 28px; }
  .line { font-size: 22px; }
  .reply textarea { font-size: 18px; }
  .card-tip { font-size: 13px; }
  body:has(#cardTip:not([hidden])) .talk { margin-top: 40px; }
  .overlay { align-items: center; }
  .card { margin: auto; max-width: 480px; }   /* room for the bubble, it must not cover her line */
}
.btn.intro-card-btn { color: var(--cream); font-size: 13px; box-shadow: inset 0 0 0 2px var(--rose-hi); }
