:root {
  --bg: #f3f4f6;
  --accent: #e11d48;
  --bg-pattern: url('../images/ui/paws-pattern.png');
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  cursor: none;
}

@media (hover: none) and (pointer: coarse) {
  html, body { cursor: auto; }
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.4rem, 2vh, 1.2rem);
  height: 100dvh;
  box-sizing: border-box;
  padding: 0.8rem;
  font-family: 'Patrick Hand', 'Comic Neue', cursive;
  color: #1e293b;
  background-color: var(--bg);
  background-image: var(--bg-pattern);
  background-repeat: repeat;
  background-blend-mode: multiply;
  background-size: 100px;
  transition: background-color 0.4s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

h1 {
  font-size: clamp(1.4rem, 4.5vh, 3rem);
  margin: 0;
  text-align: center;
  line-height: 1.1;
  z-index: 10;
  pointer-events: none;
  padding: 0 1rem;
  flex: 0 0 auto;
}

/* ---------- Laser pointer toy ---------- */

.laser-dot {
  position: fixed;
  top: 0; left: 0;
  width: 14px; height: 14px;
  background-color: rgba(255, 0, 0, 0.9);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  opacity: 0;
  box-shadow: 0 0 4px 1px red, 0 0 15px 4px rgba(255, 0, 0, 0.5);
  will-change: transform;
  transition: width 0.15s ease, height 0.15s ease;
}
.laser-dot.clicking {
  background-color: #fff;
  box-shadow: 0 0 25px 10px rgba(255, 50, 50, 0.95);
  width: 20px; height: 20px;
}

.laser-beam {
  position: fixed;
  top: 0; left: 0;
  width: 3px;
  height: 0;
  transform-origin: center bottom;
  background: linear-gradient(to top, rgba(255,0,0,0.85), rgba(255,60,60,0.15));
  box-shadow: 0 0 6px 1px rgba(255,0,0,0.6);
  pointer-events: none;
  z-index: 99998;
  opacity: 0;
  will-change: transform, height;
}

.laser-holder {
  position: fixed;
  top: 0; left: 0;
  width: 40px;
  height: 230px;
  pointer-events: none;
  z-index: 99997;
  opacity: 0;
  will-change: transform;
  transform-origin: 50% 3.04%;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.35));
}
.laser-holder img {
  width: 100%;
  height: 100%;
  display: block;
}
.laser-active .laser-dot,
.laser-active .laser-beam,
.laser-active .laser-holder {
  opacity: 1;
}

/* ---------- Game layout ---------- */

.game-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 5;
  flex: 1 1 auto;
  min-height: 0;
}

.card {
  background: #fff;
  padding: 0.8rem 0.8rem 0.5rem 0.8rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  border-radius: 2px;
  transform: rotate(-3deg) scale(var(--scale, 1));
  transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  cursor: none;
  will-change: transform;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  max-height: 100%;
}

.card.wiggle { animation: shake-card 0.2s; }

@keyframes shake-card {
  0% { transform: scale(var(--scale, 1)) rotate(-3deg); }
  25% { transform: scale(var(--scale, 1)) rotate(-6deg); }
  75% { transform: scale(var(--scale, 1)) rotate(0deg); }
  100% { transform: scale(var(--scale, 1)) rotate(-3deg); }
}

.stage {
  height: min(52vh, 60vmin, 460px);
  width: auto;
  max-width: 88vw;
  aspect-ratio: 4 / 5;
  background: #f5ede3;
  overflow: hidden;
  position: relative;
  flex: 0 1 auto;
}

.cat {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  position: absolute;
  top: 0; left: 0;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.cat.visible { opacity: 1; }

.zzz {
  position: absolute;
  top: 8%;
  right: 8%;
  font-size: 1.6rem;
  color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.3);
  pointer-events: none;
  z-index: 15;
  opacity: 0;
}
.zzz.visible { animation: zzz-float 2.2s ease-in-out infinite; }

@keyframes zzz-float {
  0% { opacity: 0; transform: translateY(0) scale(0.8); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-40px) scale(1.3); }
}

.speech-bubble {
  position: absolute;
  top: 6%;
  left: 50%;
  transform: translateX(-50%) scale(0.8);
  background: #fff;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-size: 1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  white-space: nowrap;
  z-index: 16;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  max-width: 90vw;
  text-overflow: ellipsis;
  overflow: hidden;
}
.speech-bubble.visible { opacity: 1; transform: translateX(-50%) scale(1); }

.particle {
  position: absolute;
  pointer-events: none;
  font-size: 28px;
  line-height: 1;
  z-index: 20;
}

/* ---------- Action buttons ---------- */

.actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  z-index: 30;
  flex: 0 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  background: #fff;
  border: none;
  border-radius: 22px;
  width: clamp(52px, 9vh, 70px);
  height: clamp(52px, 9vh, 70px);
  box-shadow: 0 6px 0 rgba(0,0,0,0.15), 0 8px 16px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, opacity 0.3s;
  padding: 0.25rem;
}
.action-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.1);
}
.action-btn img {
  width: clamp(22px, 4vh, 32px);
  height: clamp(22px, 4vh, 32px);
  object-fit: contain;
  pointer-events: none;
}
.action-btn.psps-btn { font-size: clamp(1rem, 2.2vh, 1.4rem); }
.action-btn .label {
  font-size: clamp(0.6rem, 1.4vh, 0.75rem);
  color: #475569;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1;
}
.action-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.action-btn.bump { animation: btn-bump 0.25s ease; }
@keyframes btn-bump {
  0% { transform: scale(1); }
  40% { transform: scale(0.85); }
  100% { transform: scale(1); }
}

@media (hover: none) and (pointer: coarse) {
  .action-btn { cursor: pointer; }
}

/* ---------- Footer ---------- */

footer {
  font-size: clamp(0.8rem, 2vh, 1rem);
  z-index: 10;
  padding: 0.6rem 1.2rem;
  background: rgba(255,255,255,0.9);
  border-radius: 50px;
  transform: rotate(1deg);
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
  text-align: center;
  max-width: 90%;
  flex: 0 0 auto;
}
footer a { color: var(--accent); text-decoration: none; font-weight: bold; cursor: pointer; }
#guiltModal a { cursor: pointer; }

.hint {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  padding: 0.5rem 1.1rem;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-size: 0.95rem;
  color: var(--accent);
  white-space: nowrap;
  pointer-events: none;
  z-index: 17;
  animation: hint-pulse 1.8s ease-in-out infinite;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.hint.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px) scale(0.9);
}
@keyframes hint-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

.shake-screen { animation: screen-shake 0.1s infinite; }
@keyframes screen-shake {
  0% { transform: translate(1px, 1px); }
  50% { transform: translate(-1px, -1px); }
  100% { transform: translate(1px, -1px); }
}

#guiltModal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: #e11d48;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  cursor: auto;
}
#guiltModal.visible { opacity: 1; pointer-events: auto; }

#guiltModal h2 { font-size: clamp(2rem, 8vw, 4rem); margin: 0 0 1rem 0; line-height: 1.1; padding: 0 1rem; }
#guiltModal p { font-size: 1.2rem; max-width: 500px; margin: 0 0 2rem 0; padding: 0 2rem;}

.match-btn {
  background: white;
  color: #e11d48;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 1rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  box-shadow: 0 8px 0 rgba(0,0,0,0.2);
  transition: transform 0.1s, box-shadow 0.1s;
  cursor: pointer;
  display: inline-block;
}
.match-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 rgba(0,0,0,0.2); }

.modal-instagram {
  margin-top: 1.5rem;
  color: white;
  text-decoration: underline;
  font-size: 1rem;
  cursor: pointer;
}

#guiltModal .modal-emoji {
  font-size: clamp(3rem, 10vw, 5rem);
  margin-bottom: 0.5rem;
  animation: bounce-emoji 0.8s ease infinite alternate;
}
@keyframes bounce-emoji {
  from { transform: translateY(0); }
  to { transform: translateY(-10px); }
}
