:root { --ink: #3b2540; --pink: #ff5fae; --pink2: #ff9ad0; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #120a2e; color: #fff; font-family: Rubik, system-ui, sans-serif; }
#stage { position: fixed; inset: 0; cursor: pointer; user-select: none; -webkit-user-select: none; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#fx { pointer-events: none; }

#girl { position: absolute; transform-origin: 50% 60%; transition: opacity .2s; }
#girl svg { width: 100%; height: 100%; display: block; }
#girl.hidden { opacity: 0; pointer-events: none; transition: none; }
#girl.silhouette { filter: brightness(0) invert(1) drop-shadow(0 0 18px #fff) drop-shadow(0 0 40px #ff9ad0); }
#girl.shown { animation: land .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes land { from { transform: scale(1.12); } to { transform: none; } }

#cat { position: absolute; cursor: pointer; }
#cat svg { width: 100%; height: 100%; display: block; overflow: visible; }

#spell { position: absolute; left: 0; right: 0; top: 34%; text-align: center; padding: 0 16px; pointer-events: none;
  font: 800 clamp(26px, 6.4vw, 64px)/1.1 Rubik, sans-serif; letter-spacing: .01em; }
#spell b { display: inline-block; white-space: nowrap; font-weight: inherit; }
#spell span { display: inline-block; opacity: 0; color: #fff;
  text-shadow: 0 0 10px #ff9ad0, 0 0 26px #ff5fae, 0 3px 0 #7a2c8f; }
#spell.on span { animation: letter 2.1s both; animation-delay: calc(var(--i) * 28ms); }
@keyframes letter {
  0% { opacity: 0; transform: translateY(30px) scale(.3) rotate(-20deg); }
  18% { opacity: 1; transform: translateY(0) scale(1.25) rotate(4deg); }
  30% { transform: scale(1) rotate(0); }
  78% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: translateY(-40px) scale(1.4); filter: blur(4px); }
}

#bubble, #catbubble { position: absolute; background: #fff; color: var(--ink); border: 3px solid var(--ink);
  border-radius: 22px; font: 700 clamp(17px, 2.3vw, 24px)/1.35 Comfortaa, Rubik, sans-serif; padding: 14px 20px;
  box-shadow: 0 6px 0 rgba(59, 37, 64, .35); opacity: 0; transform: scale(.8); transition: opacity .15s, transform .2s cubic-bezier(.2, 1.6, .4, 1);
  pointer-events: none; }
#bubble { top: max(14px, env(safe-area-inset-top)); translate: -50% 0; width: max-content; text-align: center; }
#catbubble { max-width: min(300px, 70vw); font-size: clamp(15px, 1.8vw, 19px); transform-origin: 85% 100%; }
#bubble.on, #catbubble.on { opacity: 1; transform: none; }
#bubble::after, #catbubble::after { content: ''; position: absolute; width: 18px; height: 18px; background: #fff;
  border: solid var(--ink); border-width: 0 3px 3px 0; }
#bubble::after { left: 50%; bottom: -11px; transform: translateX(-50%) rotate(45deg); }
#catbubble::after { right: 38px; bottom: -11px; transform: rotate(45deg); }
.rest { opacity: 0; }

#mute { position: absolute; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 78px); left: 10px; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; display: grid; place-items: center; z-index: 3; }
#mute .x { display: none; } #mute.off .x { display: inline; } #mute.off .w { display: none; }

#controls { position: absolute; left: 0; right: 0; bottom: max(16px, env(safe-area-inset-bottom)); display: flex; gap: 10px;
  justify-content: center; align-items: center; flex-wrap: nowrap; padding: 0 12px; z-index: 2; }
#go { display: flex; align-items: center; gap: 10px; border: 3px solid #fff; border-radius: 999px; padding: 14px 26px;
  font: 800 clamp(17px, 2.4vw, 22px)/1 Rubik, sans-serif; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, #ff8fcf, #e2489e 60%, #b8307f); box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px var(--ink), 0 0 30px rgba(255, 120, 200, .6);
  text-shadow: 0 2px 0 rgba(90, 20, 70, .5); transition: transform .1s; }
#go:active { transform: translateY(4px); box-shadow: 0 0 0 3px var(--ink), 0 2px 0 3px var(--ink); }
#go:disabled { filter: saturate(.4) brightness(.8); cursor: default; }
#go:not(:disabled) { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--ink), 0 6px 0 3px var(--ink), 0 0 46px rgba(255, 150, 220, .95); } }
#poster { display: flex; align-items: center; gap: 8px; flex: none; border: 3px solid var(--ink); border-radius: 999px; padding: 12px 18px; font: 600 16px/1 Rubik, sans-serif; cursor: pointer;
  background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
#poster[hidden] { display: none; }
#poster:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

#sheet { position: fixed; inset: 0; background: rgba(10, 5, 25, .93); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; z-index: 10; padding: 16px; }
#sheet[hidden] { display: none; }
#sheet .pair { display: flex; gap: 14px; align-items: flex-start; justify-content: center; width: min(900px, 100%); min-height: 0; }
#sheet figure { margin: 0; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
#sheet img { width: 100%; max-height: calc(100vh - 170px); object-fit: contain; border-radius: 6px; box-shadow: 0 10px 40px #000; }
#sheet .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#sheet .row > *, #close { border: 3px solid var(--ink); border-radius: 999px; padding: 10px 16px; font: 600 15px/1 Rubik, sans-serif;
  background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
#sheet .save { background: var(--pink); color: #fff; }
#sheet .share[hidden] { display: none; }
@media (max-width: 600px) {
  #sheet .pair { gap: 8px; }
  #sheet .row { flex-direction: column; align-items: stretch; gap: 6px; }
  #sheet .row > * { padding: 9px 8px; font-size: 13px; text-align: center; }
}

.vote { display: flex; gap: 8px; justify-content: center; margin-top: 12px; pointer-events: auto; flex-wrap: wrap; }
.vote button { border: 2px solid var(--ink); border-radius: 999px; padding: 7px 13px; font: 700 14px/1 Rubik, sans-serif;
  background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.vote button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.vote button[data-v="1"].on { background: #ffd84a; }
.vote button[data-v="-1"].on { background: #8a5a32; color: #fff; }
.vote.voted button:not(.on) { opacity: .7; }
.vote b { font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  #go:not(:disabled) { animation: none; }
}

@media (max-width: 600px) {
  #go { font-size: clamp(14px, 4vw, 18px); padding: 13px 18px; min-width: 0; }
  #go .moon { display: none; }
  #poster { width: 52px; height: 52px; padding: 0; justify-content: center; }
  #poster span { display: none; }
}
#bubble:not(.on) .vote { pointer-events: none; }
