:root {
  --blk: #0e0b09;
  --ink: #1a1512;
  --cream: #f3e6d0;
  --latte: #d9b48a;
  --caramel: #b9814d;
  --neon: #ffcf8a;
  --wa: #25d366;
  --pix: "Press Start 2P", monospace;
  --body: "Outfit", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--blk); color: var(--cream); font-family: var(--body); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.vignette { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(6, 4, 3, .75) 100%); }

/* ---------- speech bubble ---------- */
.bubble {
  position: absolute; left: 0; top: 0; z-index: 5;
  width: min(330px, 78vw);
  padding: 14px 16px 15px;
  background: #fffaf1; color: #1a1210;
  border-radius: 20px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45), 0 0 0 3px #1a1210, 0 0 30px rgba(255, 200, 130, .35);
  transform: translate(-50%, -100%) scale(.6); opacity: 0;
  transition: opacity .45s ease, transform .55s cubic-bezier(.3, 1.6, .5, 1);
  pointer-events: none;
}
.bubble.show { opacity: 1; transform: translate(-50%, calc(-100% + var(--bob, 0px))) scale(1); }
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -15px; width: 26px; height: 26px;
  background: #fffaf1; transform: translateX(-50%) rotate(45deg);
  box-shadow: 3px 3px 0 0 #1a1210; border-radius: 0 0 5px 0;
}
.b-who { font-family: var(--pix); font-size: 9px; letter-spacing: .06em; color: #b9814d; margin-bottom: 8px; }
.b-who span { color: #4a9a68; font-family: var(--body); font-size: 11px; letter-spacing: 0; font-weight: 600; }
.bubble p { font-size: 17px; line-height: 1.38; font-weight: 600; min-height: 1.4em; position: relative; z-index: 1; }
.bubble p b { font-weight: 800; color: #6b3e1c; background: linear-gradient(transparent 60%, #ffe2b0 60%); padding: 0 2px; }
.bubble p .caret { display: inline-block; width: 2px; height: 1em; background: #1a1210; margin-left: 2px; vertical-align: -2px; animation: caret .8s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0 } }
.b-typing { display: none; gap: 5px; padding: 4px 2px; }
.b-typing.on { display: flex; }
.b-typing i { width: 8px; height: 8px; border-radius: 50%; background: #b9814d; animation: dot 1s infinite ease-in-out; }
.b-typing i:nth-child(2) { animation-delay: .15s } .b-typing i:nth-child(3) { animation-delay: .3s }
@keyframes dot { 0%, 100% { transform: translateY(0); opacity: .4 } 50% { transform: translateY(-5px); opacity: 1 } }

.cloud { position: absolute; left: 0; top: 0; z-index: 4; font-size: 46px; pointer-events: none; opacity: 0;
  transform: translate(-50%, -100%); transition: opacity .6s; filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); }
.cloud.show { opacity: 1; animation: drizzle 1.4s ease-in-out infinite; }
@keyframes drizzle { 50% { margin-top: -6px } }

/* ---------- HUD ---------- */
.hud { position: absolute; top: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: space-between; align-items: flex-start;
  gap: 10px; padding: max(14px, env(safe-area-inset-top)) 16px 0; pointer-events: none; }
.chip { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 9px 13px; border-radius: 14px;
  background: rgba(14, 11, 9, .72); border: 1px solid rgba(243, 230, 208, .18); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .35); }
.chip img { height: 38px; width: auto; }
.chip b { display: block; white-space: nowrap; font-family: "Oswald", Impact, sans-serif; font-weight: 700; letter-spacing: .06em; font-size: 15px; color: var(--cream); }
.chip small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: var(--latte); opacity: .9; }
.chip.wait { flex-direction: column; align-items: flex-end; gap: 4px; }
.chip.wait small { font-family: var(--pix); font-size: 8px; letter-spacing: .08em; color: var(--neon); }
.chip.wait b { font-family: var(--pix); font-size: 15px; font-weight: 400; color: var(--cream); text-shadow: 0 0 12px rgba(255, 200, 120, .6); }

/* ---------- bottom dock ---------- */
.dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 0 16px max(18px, env(safe-area-inset-bottom)); pointer-events: none; }
.dock > * { pointer-events: auto; }
.tag { font-family: var(--pix); font-size: 10px; letter-spacing: .14em; color: rgba(243, 230, 208, .55); pointer-events: none; }
.tag span { color: var(--neon); animation: blink 1.6s steps(1) infinite; }
@keyframes blink { 50% { opacity: .35 } }
.btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; transition: opacity .4s, transform .4s; }
.btns.hide { opacity: 0; transform: translateY(14px); pointer-events: none; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 13px 20px; border-radius: 999px; font-weight: 800; font-size: 15.5px;
  text-decoration: none; transition: transform .18s, box-shadow .18s, background .18s; -webkit-tap-highlight-color: transparent; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.yes { background: var(--neon); color: #1a1210; box-shadow: 0 0 0 3px #1a1210, 0 8px 0 #7a4f2c, 0 0 28px rgba(255, 200, 120, .55); }
.btn.no { background: rgba(26, 21, 18, .85); color: var(--cream); box-shadow: 0 0 0 2px rgba(243, 230, 208, .4), 0 8px 0 #000; }
.btn.wa { display: none; background: var(--wa); color: #06210f; box-shadow: 0 0 0 3px #06210f, 0 8px 0 #0f6b33, 0 0 30px rgba(37, 211, 102, .5); }
.btn.wa.show { display: inline-flex; animation: pop .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.5); opacity: 0 } }

.left-card { position: absolute; left: 50%; top: 50%; z-index: 8; width: min(340px, calc(100vw - 32px)); padding: 22px 20px 20px; text-align: center;
  background: rgba(14, 11, 9, .9); border: 1px solid rgba(243, 230, 208, .25); border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 40px rgba(255, 200, 120, .15);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transform: translate(-50%, -40%) scale(.9); transition: opacity .4s, transform .5s cubic-bezier(.3, 1.5, .5, 1), visibility 0s .4s; }
.left-card.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); transition: opacity .4s, transform .5s cubic-bezier(.3, 1.5, .5, 1); }
.left-card .lc-emoji { font-size: 40px; margin-bottom: 6px; }
.left-card b { display: block; font-family: var(--pix); font-size: 14px; color: var(--neon); margin-bottom: 10px; letter-spacing: .06em; }
.left-card p { font-size: 15.5px; color: var(--cream); margin-bottom: 16px; }

#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 7; }

.loader { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--blk); transition: opacity .8s, visibility 0s .8s; }
.loader img { height: 110px; animation: breathe 1.6s ease-in-out infinite; }
.loader span { font-family: var(--pix); font-size: 10px; letter-spacing: .1em; color: var(--latte); }
.loader.done { opacity: 0; visibility: hidden; }
@keyframes breathe { 50% { transform: scale(1.06); filter: drop-shadow(0 0 18px rgba(255, 200, 120, .6)); } }

@media (max-width: 640px) {
  .chip { padding: 7px 10px; gap: 8px; }
  .chip img { height: 30px; }
  .chip b { font-size: 12.5px; }
  .chip small { font-size: 10px; }
  .chip.wait b { font-size: 10px; }
  .chip.loc small { max-width: 130px; }
  .chip.wait small { font-size: 7px; }
  .bubble p { font-size: 15px; }
  .btn { padding: 12px 16px; font-size: 14.5px; }
  .tag { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .bubble, .btn, .btns { transition: none; }
  .cloud.show, .loader img, .tag span { animation: none; }
}
