/* ===== Haa: a friendship in 38,311 messages ===== */
:root {
  --v: #5aa9ff;          /* Viswanth colour */
  --s: #ff8fa3;          /* SND colour */
  --gold: #ffd36e;
  --ink: #0d0b1a;
  --glass: rgba(14, 12, 32, 0.78);
  --font: "Zen Maru Gothic", "Nunito", "Segoe UI", system-ui, sans-serif;
  --hand: "Caveat", "Comic Sans MS", cursive;
  --display: "Bungee", "Zen Maru Gothic", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #000; overflow: hidden; font-family: var(--font); color: #fff; }
button { font-family: inherit; cursor: pointer; border: 0; }

/* The stage is a fixed 1280x720 canvas scaled to the window */
#viewport { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 50%, #1a1433, #000 70%); }
#stage {
  position: relative; width: 1280px; height: 720px; overflow: hidden;
  transform-origin: center center; background: #000; border-radius: 6px;
  box-shadow: 0 0 80px rgba(120, 90, 255, 0.25);
}
.screen { position: absolute; inset: 0; display: none; }
.screen.active { display: block; }

/* ---------- Title screen ---------- */
#title-screen { background: linear-gradient(#0b0a24, #2a1850 55%, #ff9a8b 100%); }
#title-screen .logo {
  position: absolute; left: 0; right: 0; top: 120px; text-align: center;
  font-family: var(--display); font-size: 150px; letter-spacing: 6px;
  background: linear-gradient(180deg, #fff 30%, #ffd36e 60%, #ff8fa3);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 0 #3b1d6e) drop-shadow(0 0 30px rgba(255, 180, 220, .6));
  animation: logoFloat 4s ease-in-out infinite;
}
#title-screen .logo small { display: block; font-family: var(--font); font-size: 26px; letter-spacing: 3px; color: #fff; -webkit-text-fill-color: #fff; filter: none; margin-top: 4px; opacity: .9; }
@keyframes logoFloat { 50% { transform: translateY(-8px) rotate(-1deg); } }
#title-screen .tagline { position: absolute; top: 360px; width: 100%; text-align: center; font-family: var(--hand); font-size: 34px; color: #ffe4ef; text-shadow: 0 2px 8px #000; }
#title-screen .duo { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); display: flex; gap: 0; }
#title-screen .duo .char-wrap { position: relative; width: 240px; height: 312px; }
.press-start {
  position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%); z-index: 5;
  padding: 16px 44px; border-radius: 40px; font-size: 26px; font-weight: 800; letter-spacing: 2px;
  color: #2a1850; background: linear-gradient(#fff, #ffd36e); box-shadow: 0 6px 0 #c1802a, 0 0 30px rgba(255, 211, 110, .7);
  animation: pulse 1.6s ease-in-out infinite;
}
.press-start:active { transform: translateX(-50%) translateY(4px); box-shadow: 0 2px 0 #c1802a; }
@keyframes pulse { 50% { filter: brightness(1.15); transform: translateX(-50%) scale(1.05); } }
#title-screen .continue-hint { position: absolute; bottom: 30px; width: 100%; text-align: center; font-size: 15px; opacity: .7; }

/* ---------- Map ---------- */
#map-screen { background: linear-gradient(#bfe6ff, #ffe9c7); }
#map-screen svg.map-bg { position: absolute; inset: 0; }
.map-header { position: absolute; top: 18px; left: 24px; right: 24px; display: flex; align-items: center; justify-content: space-between; z-index: 3; }
.map-header h2 { font-family: var(--display); color: #2a1850; font-size: 34px; text-shadow: 0 3px 0 #fff; }
.map-node {
  position: absolute; width: 96px; height: 96px; border-radius: 50%; transform: translate(-50%, -50%);
  display: grid; place-items: center; font-size: 40px; background: #fff; z-index: 2;
  box-shadow: 0 6px 0 #a06cd5, 0 10px 24px rgba(60, 20, 120, .3); transition: transform .2s;
}
.map-node:hover:not(.locked) { transform: translate(-50%, -50%) scale(1.12) rotate(-4deg); }
.map-node.locked { background: #d9d4e4; filter: grayscale(1); cursor: not-allowed; box-shadow: 0 6px 0 #9a94a8; }
.map-node.current { animation: nodeBounce 1.2s ease-in-out infinite; box-shadow: 0 6px 0 #ff8fa3, 0 0 0 8px rgba(255, 143, 163, .35), 0 0 40px #ffd36e; }
@keyframes nodeBounce { 50% { transform: translate(-50%, -58%); } }
.map-node .label {
  position: absolute; top: 102px; width: 190px; left: 50%; transform: translateX(-50%); text-align: center;
  font-size: 14px; font-weight: 800; color: #2a1850; background: rgba(255, 255, 255, .85); padding: 4px 8px; border-radius: 10px;
}
.map-node .label small { display: block; font-weight: 600; opacity: .7; font-size: 12px; }
.map-node .stars { position: absolute; top: -18px; font-size: 16px; letter-spacing: -2px; }
.map-node .lock { position: absolute; font-size: 28px; }
.map-tokens { position: absolute; z-index: 4; transition: left 1s cubic-bezier(.5,1.6,.4,1), top 1s cubic-bezier(.5,1.6,.4,1); transform: translate(-50%, -125%); display: flex; gap: 2px; pointer-events: none; }
.token { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; background: #fff; border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.3); animation: hop .9s ease-in-out infinite; }
.token:nth-child(2) { animation-delay: .45s; }
.token svg { width: 100%; height: 100%; }
@keyframes hop { 50% { transform: translateY(-6px); } }
.map-footer { position: absolute; bottom: 16px; left: 24px; right: 24px; display: flex; gap: 12px; justify-content: flex-end; z-index: 3; }

.pill-btn { padding: 10px 18px; border-radius: 20px; font-weight: 800; font-size: 15px; background: #2a1850; color: #fff; box-shadow: 0 4px 0 #120a26; }
.pill-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #120a26; }
.pill-btn.light { background: #fff; color: #2a1850; box-shadow: 0 4px 0 #b9a8d8; }

/* ---------- HUD ---------- */
.hud { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; align-items: center; gap: 12px; z-index: 40; pointer-events: none; }
.hud > * { pointer-events: auto; }
.bond { display: flex; align-items: center; gap: 8px; background: var(--glass); padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 800; }
.bond .bar { width: 150px; height: 10px; border-radius: 6px; background: #2c2650; overflow: hidden; }
.bond .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--v), var(--s), var(--gold)); transition: width .6s; }
.haa-counter { background: var(--glass); padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 800; position: relative; }
.haa-counter b { color: var(--gold); }
.haa-counter.pop { animation: haaPop .5s; }
@keyframes haaPop { 40% { transform: scale(1.35) rotate(-6deg); background: #ff8fa3; } }
.hud .spacer { flex: 1; }
.hud .chapter-tag { background: var(--glass); padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 700; opacity: .9; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--glass); color: #fff; font-size: 16px; display: grid; place-items: center; }
.icon-btn.off { opacity: .45; }

/* ---------- Scene ---------- */
#scene-screen { background: #000; }
.camera { position: absolute; inset: 0; transition: transform 1.6s cubic-bezier(.3,.7,.2,1), filter .6s; transform-origin: 50% 60%; }
.camera.shake { animation: shake .45s; }
@keyframes shake { 20%{transform:translate(-10px,4px)} 40%{transform:translate(9px,-6px)} 60%{transform:translate(-6px,5px)} 80%{transform:translate(5px,-3px)} }
.bg-holder { position: absolute; inset: -30px; transition: opacity 1s; }
.bg-holder .layer { position: absolute; inset: 0; transition: transform .25s ease-out; }
.bg-holder svg { width: 100%; height: 100%; display: block; }
.split { position: absolute; inset: 0; }
.split .half { position: absolute; top: 0; bottom: 0; overflow: hidden; }
.split .half.left { left: 0; width: 100%; clip-path: polygon(0 0, 54% 0, 46% 100%, 0 100%); }
.split .half.right { left: 0; width: 100%; clip-path: polygon(54% 0, 100% 0, 100% 100%, 46% 100%); }
.split .divider { position: absolute; inset: 0; pointer-events: none; }
.split .place-tag { position: absolute; top: 60px; padding: 4px 12px; border-radius: 12px; background: rgba(0,0,0,.55); font-size: 14px; font-weight: 800; letter-spacing: 1px; }
.split .place-tag.l { left: 30px; color: var(--s); } .split .place-tag.r { right: 30px; color: var(--v); }
.split .distance { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) rotate(-8deg); background: #fff; color: #2a1850; font-weight: 900; padding: 6px 14px; border-radius: 14px; font-size: 15px; box-shadow: 0 4px 0 #a06cd5; z-index: 3; }

#fx { position: absolute; inset: 0; pointer-events: none; z-index: 12; }

/* characters */
.chars { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.char-wrap { position: absolute; bottom: -20px; width: 420px; height: 546px; transition: left .9s cubic-bezier(.3,.8,.3,1), opacity .7s, filter .4s, transform .5s; }
.char-wrap svg { width: 100%; height: 100%; overflow: visible; }
.char-wrap.dim { filter: brightness(.55) saturate(.8); }
.char-wrap.hidden { opacity: 0; }
.char-wrap .body { animation: breathe 3.2s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
@keyframes breathe { 50% { transform: scaleY(1.012) translateY(-2px); } }
.char-wrap .eyes-open { animation: blink 4.6s infinite; transform-origin: 50% 172px; transform-box: view-box; }
.char-wrap.s .eyes-open { animation-duration: 5.3s; animation-delay: 1.3s; }
@keyframes blink { 0%, 95%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }
.char-wrap .m-open { opacity: 0; }
.char-wrap.talking .m-open { animation: talkA .26s steps(1) infinite; }
.char-wrap.talking .m-closed { animation: talkB .26s steps(1) infinite; }
@keyframes talkA { 0% { opacity: 1; } 50% { opacity: 0; } }
@keyframes talkB { 0% { opacity: 0; } 50% { opacity: 1; } }
.char-wrap.jump { animation: jump .5s; }
@keyframes jump { 40% { transform: translateY(-40px); } }
.char-wrap.chibi-shake { animation: tinyShake .25s 3; }
@keyframes tinyShake { 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.char-wrap.flip svg { transform: scaleX(-1); }

/* anime emote bubbles */
.emote { position: absolute; z-index: 15; font-size: 54px; pointer-events: none; animation: emotePop 1.8s ease-out forwards; filter: drop-shadow(0 3px 0 rgba(0,0,0,.4)); }
@keyframes emotePop { 0% { transform: scale(0) rotate(-20deg); opacity: 0; } 15% { transform: scale(1.3) rotate(8deg); opacity: 1; } 25% { transform: scale(1) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px); } }

/* speed lines + comedy overlays */
.speedlines { position: absolute; inset: 0; z-index: 11; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255,255,255,.0) 0deg 4deg, rgba(255,255,255,.55) 4deg 5deg);
  -webkit-mask: radial-gradient(circle, transparent 28%, #000 62%); mask: radial-gradient(circle, transparent 28%, #000 62%); }
.speedlines.on { opacity: 1; animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) scale(1.2); } }
.freeze { position: absolute; inset: 0; z-index: 30; pointer-events: none; display: none; }
.freeze.on { display: block; animation: freezeIn .35s; background: rgba(255, 240, 200, .18); backdrop-filter: sepia(.6) saturate(1.4); }
.freeze .freeze-label { position: absolute; top: 90px; left: 50%; transform: translateX(-50%) rotate(-3deg); background: #ffd36e; color: #2a1850; font-family: var(--display); font-size: 28px; padding: 8px 22px; border: 4px solid #2a1850; box-shadow: 6px 6px 0 #2a1850; }
@keyframes freezeIn { 0% { background: #fff; } }

/* letterbox */
.letterbox { position: absolute; left: 0; right: 0; height: 0; background: #000; z-index: 25; transition: height .8s cubic-bezier(.5,0,.2,1); }
.letterbox.top { top: 0; } .letterbox.bottom { bottom: 0; }
.cinematic .letterbox { height: 72px; }

/* dialogue box */
.dialogue {
  position: absolute; left: 60px; right: 60px; bottom: 26px; min-height: 160px; z-index: 35;
  background: linear-gradient(180deg, rgba(20,16,44,.86), rgba(10,8,26,.94)); border-radius: 22px;
  border: 2px solid rgba(255,255,255,.18); box-shadow: 0 10px 40px rgba(0,0,0,.6), inset 0 0 30px rgba(140,110,255,.12);
  padding: 30px 40px 22px; cursor: pointer; transition: opacity .3s, transform .3s; backdrop-filter: blur(4px);
}
.dialogue.hidden { opacity: 0; transform: translateY(30px); pointer-events: none; }
.dialogue .name {
  position: absolute; top: -22px; left: 30px; padding: 6px 22px; border-radius: 14px; font-weight: 900; font-size: 20px; letter-spacing: 1px;
  background: #444; color: #fff; box-shadow: 0 4px 0 rgba(0,0,0,.35); transform: rotate(-2deg);
}
.dialogue .name.v { background: linear-gradient(#7fc0ff, #3d7fd6); }
.dialogue .name.s { background: linear-gradient(#ffb0c0, #e2607e); }
.dialogue .name.n { background: linear-gradient(#ffe39a, #e5a93b); color: #2a1850; }
.dialogue .name.r { background: linear-gradient(#ff6b6b, #b5179e); }
.dialogue .text { font-size: 27px; line-height: 1.38; font-weight: 700; min-height: 40px; }
.dialogue .text.narr { font-style: italic; color: #ffe9b8; font-weight: 600; }
.dialogue .en { margin-top: 8px; font-size: 18px; color: #b9b2e6; font-style: italic; min-height: 24px; }
.dialogue .meta { position: absolute; right: 26px; top: 12px; font-size: 12px; opacity: .55; letter-spacing: 1px; }
.dialogue .next { position: absolute; right: 24px; bottom: 14px; font-size: 20px; animation: nextBob .8s ease-in-out infinite; opacity: 0; }
.dialogue.done .next { opacity: 1; }
@keyframes nextBob { 50% { transform: translateY(5px); } }
.subs-off .dialogue .en { display: none; }

/* title card */
.title-card { position: absolute; inset: 0; z-index: 50; display: none; place-items: center; background: #07060f; overflow: hidden; }
.title-card.on { display: grid; }
.title-card .tc-inner { text-align: center; }
.title-card .tc-chapter { font-size: 18px; letter-spacing: 10px; color: var(--gold); opacity: 0; animation: tcIn .8s .2s forwards; }
.title-card .tc-title { font-family: var(--display); font-size: 76px; margin: 14px 0; opacity: 0; animation: tcSlash .9s .5s forwards; text-shadow: 0 0 30px rgba(255, 143, 163, .6); }
.title-card .tc-sub { font-family: var(--hand); font-size: 32px; color: #cfc6ff; opacity: 0; animation: tcIn .8s 1.1s forwards; }
.title-card .tc-brush { position: absolute; left: -10%; width: 120%; height: 160px; top: calc(50% - 80px); background: linear-gradient(90deg, transparent, rgba(255, 143, 163, .25), rgba(90, 169, 255, .25), transparent); transform: skewY(-4deg) scaleX(0); animation: brush 1s .3s forwards; }
@keyframes tcIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes tcSlash { 0% { opacity: 0; letter-spacing: 40px; filter: blur(10px); } 100% { opacity: 1; letter-spacing: 2px; filter: none; } }
@keyframes brush { to { transform: skewY(-4deg) scaleX(1); } }
.title-card .tc-hint { position: absolute; bottom: 30px; width: 100%; text-align: center; font-size: 14px; opacity: .5; }

/* fades */
.fader { position: absolute; inset: 0; background: #000; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .7s; }
.fader.on { opacity: 1; }
.fader.white { background: #fff; }

/* phone chat overlay */
.phone {
  position: absolute; left: 50%; top: 50%; width: 360px; height: 640px; transform: translate(-50%, -50%) scale(.98); z-index: 20;
  border-radius: 44px; background: #111; padding: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 0 3px #333, 0 0 60px rgba(90,169,255,.25);
  display: none; animation: phoneIn .6s cubic-bezier(.3,1.4,.4,1);
}
.phone.on { display: block; }
@keyframes phoneIn { from { transform: translate(-50%, 30%) rotate(8deg); opacity: 0; } }
.phone .screen-in { position: relative; height: 100%; border-radius: 32px; overflow: hidden; background: #ece5dd url("") ; background: linear-gradient(#1f2c34, #0b141a); display: flex; flex-direction: column; }
.phone .ph-head { display: flex; align-items: center; gap: 10px; padding: 34px 14px 10px; background: #202c33; font-weight: 800; font-size: 16px; }
.phone .ph-head .avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #fff; }
.phone .ph-head small { display: block; font-weight: 500; opacity: .6; font-size: 11px; }
.phone .ph-body { flex: 1; overflow: hidden; padding: 12px 10px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.phone .ph-date { align-self: center; background: #182229; color: #8696a0; font-size: 11px; padding: 4px 10px; border-radius: 8px; margin: 6px 0; }
.bubble { max-width: 82%; padding: 7px 10px 16px; border-radius: 10px; font-size: 15px; position: relative; line-height: 1.3; animation: bubbleIn .35s cubic-bezier(.3,1.5,.5,1); }
.bubble.me { align-self: flex-end; background: #005c4b; border-top-right-radius: 2px; }
.bubble.them { align-self: flex-start; background: #202c33; border-top-left-radius: 2px; }
.bubble .tm { position: absolute; right: 8px; bottom: 3px; font-size: 10px; opacity: .6; }
.bubble .tr { display: block; font-size: 11px; opacity: .65; font-style: italic; margin-top: 3px; }
.subs-off .bubble .tr { display: none; }
@keyframes bubbleIn { from { transform: scale(.4) translateY(20px); opacity: 0; } }
.typing { align-self: flex-start; background: #202c33; border-radius: 10px; padding: 10px 14px; display: flex; gap: 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: dots 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 50% { transform: translateY(-5px); opacity: .5; } }
.phone-caption { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 21; font-family: var(--hand); font-size: 28px; color: #ffe9b8; text-shadow: 0 2px 6px #000; display: none; white-space: nowrap; }
.phone-caption.on { display: block; }
.tap-hint { position: absolute; right: 30px; bottom: 30px; z-index: 22; font-size: 13px; opacity: .6; display: none; }
.tap-hint.on { display: block; }

/* choices */
.choices { position: absolute; inset: 0; z-index: 45; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: rgba(8, 6, 20, .55); }
.choices.on { display: flex; }
.choices .prompt { font-size: 26px; font-weight: 900; margin-bottom: 10px; text-shadow: 0 3px 0 #000; text-align: center; max-width: 900px; }
.choice-btn {
  min-width: 460px; padding: 16px 28px; border-radius: 16px; font-size: 21px; font-weight: 800; color: #2a1850;
  background: linear-gradient(#fff, #e9e1ff); box-shadow: 0 6px 0 #8b73c9; transition: transform .15s; animation: choiceIn .4s backwards;
}
.choice-btn:nth-child(3) { animation-delay: .08s; } .choice-btn:nth-child(4) { animation-delay: .16s; } .choice-btn:nth-child(5) { animation-delay: .24s; }
.choice-btn:hover { transform: scale(1.04) rotate(-1deg); background: linear-gradient(#fff, #ffe1ea); }
@keyframes choiceIn { from { opacity: 0; transform: translateY(20px); } }

/* roast card */
.roast {
  position: absolute; z-index: 46; left: 50%; top: 46%; width: 620px; transform: translate(-50%, -50%) rotate(-2deg);
  background: #fff8e1; color: #2a1850; border: 5px solid #2a1850; border-radius: 18px; padding: 26px 30px; box-shadow: 10px 10px 0 #2a1850;
  display: none; animation: roastIn .5s cubic-bezier(.3,1.6,.5,1);
}
.roast.on { display: block; }
.roast .r-title { font-family: var(--display); font-size: 26px; color: #e2607e; }
.roast .r-target { font-size: 14px; font-weight: 800; letter-spacing: 2px; opacity: .7; margin: 2px 0 12px; }
.roast .r-body { font-size: 22px; font-weight: 700; line-height: 1.4; }
.roast .r-stamp { position: absolute; right: -20px; top: -24px; background: #e2607e; color: #fff; font-family: var(--display); font-size: 18px; padding: 8px 14px; transform: rotate(12deg); border-radius: 8px; box-shadow: 4px 4px 0 #2a1850; }
.roast .r-meter { margin-top: 14px; font-size: 14px; font-weight: 800; }
.roast .r-meter span { color: #ff6b00; letter-spacing: 2px; }
@keyframes roastIn { from { transform: translate(-50%, -50%) rotate(-25deg) scale(.2); opacity: 0; } }

/* memory card */
.memory { position: absolute; inset: 0; z-index: 55; display: none; place-items: center; background: radial-gradient(circle, rgba(60,30,110,.85), rgba(5,3,15,.95)); }
.memory.on { display: grid; }
.memory .card {
  width: 430px; padding: 26px; border-radius: 22px; text-align: center; color: #2a1850; position: relative;
  background: linear-gradient(160deg, #fff, #ffeef3 60%, #e8f2ff); box-shadow: 0 0 0 6px #ffd36e, 0 0 60px rgba(255, 211, 110, .7);
  animation: cardFlip 1s cubic-bezier(.3,1.3,.5,1);
}
@keyframes cardFlip { from { transform: rotateY(180deg) scale(.4); opacity: 0; } }
.memory .card .unlocked { font-size: 13px; letter-spacing: 4px; font-weight: 900; color: #e2607e; }
.memory .card h3 { font-family: var(--display); font-size: 30px; margin: 6px 0 12px; }
.memory .card .art { height: 150px; border-radius: 14px; overflow: hidden; margin-bottom: 14px; position: relative; }
.memory .card .art svg { width: 100%; height: 100%; }
.memory .card blockquote { font-family: var(--hand); font-size: 30px; line-height: 1.1; }
.memory .card .q-en { font-size: 14px; opacity: .7; font-style: italic; margin-top: 6px; }
.memory .card .stat { margin-top: 14px; font-size: 14px; font-weight: 800; background: #2a1850; color: #ffd36e; border-radius: 10px; padding: 8px; }
.memory .card .xp { margin-top: 12px; font-weight: 900; color: #3d7fd6; }
.memory .shine { position: absolute; inset: 0; border-radius: 22px; background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.8) 50%, transparent 60%); background-size: 250% 100%; animation: shine 2.5s infinite; pointer-events: none; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }

/* toasts */
#toasts { position: absolute; top: 60px; right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; background: linear-gradient(90deg, #2a1850, #3b2370); border: 2px solid var(--gold); border-radius: 14px; padding: 10px 16px; min-width: 300px; animation: toastIn .5s cubic-bezier(.3,1.5,.5,1), toastOut .5s 3.6s forwards; box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.toast .ti { font-size: 30px; }
.toast b { display: block; color: var(--gold); font-size: 12px; letter-spacing: 2px; }
.toast span { font-size: 15px; font-weight: 800; }
.toast small { display: block; font-size: 12px; opacity: .75; }
@keyframes toastIn { from { transform: translateX(120%); } }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }
.float-xp { position: absolute; z-index: 70; font-weight: 900; color: var(--gold); font-size: 22px; pointer-events: none; animation: floatUp 1.2s forwards; text-shadow: 0 2px 0 #000; }
@keyframes floatUp { to { transform: translateY(-60px); opacity: 0; } }

/* ---------- Mini games ---------- */
.game { position: absolute; inset: 0; z-index: 48; display: none; }
.game.on { display: block; }
.game canvas { position: absolute; inset: 0; }
.game .g-hud { position: absolute; top: 60px; left: 0; right: 0; text-align: center; z-index: 2; pointer-events: none; }
.game .g-title { font-family: var(--display); font-size: 34px; text-shadow: 0 4px 0 #2a1850; }
.game .g-sub { font-size: 17px; font-weight: 700; opacity: .9; margin-top: 4px; text-shadow: 0 2px 4px #000; }
.game .g-score { font-size: 24px; font-weight: 900; color: var(--gold); margin-top: 6px; }
.game .g-intro { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; background: rgba(8,6,20,.7); }
.game .g-intro .box { text-align: center; max-width: 640px; background: #fff; color: #2a1850; border-radius: 20px; padding: 28px 34px; box-shadow: 0 8px 0 #a06cd5; }
.game .g-intro h3 { font-family: var(--display); font-size: 32px; }
.game .g-intro p { font-size: 18px; margin: 10px 0 18px; font-weight: 600; line-height: 1.4; }
.game .g-intro kbd { background: #2a1850; color: #fff; padding: 2px 8px; border-radius: 6px; font-size: 15px; }

.hold-btn {
  position: absolute; left: 50%; bottom: 90px; transform: translateX(-50%); width: 260px; height: 64px; border-radius: 34px; z-index: 3;
  font-size: 20px; font-weight: 900; color: #fff; background: #3a3260; overflow: hidden; box-shadow: 0 5px 0 #191433; user-select: none; -webkit-user-select: none; touch-action: none;
}
.hold-btn i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--s), var(--gold)); }
.hold-btn span { position: relative; }

.app-grid { position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%); display: grid; grid-template-columns: repeat(4, 120px); gap: 22px; z-index: 3; }
.app-icon { width: 120px; height: 120px; border-radius: 28px; display: grid; place-items: center; font-size: 46px; color: #fff; font-weight: 900; position: relative; box-shadow: 0 6px 0 rgba(0,0,0,.35); transition: transform .15s; }
.app-icon:hover { transform: scale(1.07) rotate(-3deg); }
.app-icon small { position: absolute; bottom: -24px; font-size: 13px; color: #fff; text-shadow: 0 1px 3px #000; font-weight: 700; }
.app-icon.tried { filter: grayscale(.8) brightness(.7); }
.app-reply { position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); z-index: 4; background: #fff; color: #2a1850; padding: 12px 22px; border-radius: 16px; font-weight: 800; font-size: 19px; box-shadow: 0 5px 0 #a06cd5; max-width: 900px; text-align: center; }

/* letter + credits */
.letter-wrap { position: absolute; inset: 0; z-index: 47; display: none; place-items: center; }
.letter-wrap.on { display: grid; }
.letter { width: 760px; background: #fffaf0; color: #3a2a1a; border-radius: 6px; padding: 34px 44px; box-shadow: 0 20px 60px rgba(0,0,0,.6); transform: rotate(-1deg); position: relative;
  background-image: repeating-linear-gradient(transparent 0 33px, #e8dcc8 33px 34px); animation: letterIn 1s cubic-bezier(.3,1.2,.5,1); }
@keyframes letterIn { from { transform: translateY(100%) rotate(6deg); } }
.letter h3 { font-family: var(--hand); font-size: 40px; color: #b5179e; }
.letter .countdown { font-size: 14px; font-weight: 800; letter-spacing: 1px; color: #7a5a3a; margin-bottom: 8px; }
.letter label { display: block; font-weight: 800; font-size: 14px; margin-top: 12px; }
.letter textarea { width: 100%; height: 86px; border: 0; background: transparent; resize: none; font-family: var(--hand); font-size: 26px; line-height: 34px; color: #2a2a6a; outline: none; }
.letter .row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.credits { position: absolute; inset: 0; z-index: 49; overflow: hidden; display: none; background: radial-gradient(circle at 50% 30%, #2a1850, #05030f); }
.credits.on { display: block; }
.credits .roll { position: absolute; left: 0; right: 0; top: 100%; text-align: center; animation: roll 70s linear forwards; }
@keyframes roll { to { transform: translateY(-100%) translateY(-760px); } }
.credits h2 { font-family: var(--display); font-size: 64px; margin: 40px 0 10px; }
.credits h4 { color: var(--gold); letter-spacing: 6px; font-size: 15px; margin-top: 46px; }
.credits p { font-size: 22px; margin: 8px 0; }
.credits .big { font-family: var(--display); font-size: 44px; color: var(--s); }
.credits .small { font-size: 15px; opacity: .7; }
.credits .skip { position: absolute; bottom: 20px; right: 20px; z-index: 2; }

/* album */
.album { position: absolute; inset: 0; z-index: 70; background: rgba(10,6,25,.92); display: none; padding: 70px 60px; overflow: auto; }
.album.on { display: block; }
.album h2 { font-family: var(--display); font-size: 36px; margin-bottom: 20px; }
.album .grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.album .acard { background: #fff; color: #2a1850; border-radius: 14px; padding: 12px; min-height: 190px; font-size: 13px; }
.album .acard.locked { background: #2c2650; color: #6d659e; display: grid; place-items: center; font-size: 40px; }
.album .acard h5 { font-size: 15px; margin-bottom: 6px; }
.album .acard q { font-family: var(--hand); font-size: 21px; display: block; line-height: 1.05; }
.album .ach { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.album .ach div { background: #2c2650; border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 700; opacity: .4; }
.album .ach div.got { opacity: 1; background: linear-gradient(90deg, #3b2370, #5a2d6e); border: 1px solid var(--gold); }
.album .close { position: absolute; top: 20px; right: 24px; }

.rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 700px) {
  .rotate-hint { display: grid; position: fixed; inset: auto 0 0 0; padding: 10px; text-align: center; background: #2a1850; font-size: 13px; z-index: 999; }
}
