:root{
  --text:#333;
  --btn:#ff7f50;
  --btn2:#ff6347;
  --shadow: rgba(0,0,0,0.20);
}

body {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: 'Comic Sans MS', cursive, sans-serif;
  color: var(--text);
  overflow: hidden;
  background: linear-gradient(-45deg, #ffe6f0, #e6f7ff, #e6ffe6, #fff5e6);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Hide cursor only on "fine" pointer devices (desktop mouse) */
@media (pointer:fine) {
  body { cursor: none; }
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 0 0 0.35em 0;
  animation: bounce 2s infinite;
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: center;
  padding: 0 16px;
}

.eyes {
  display: flex;
  gap: 10px;
  transform: translateY(3px);
}

.eye {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  border: 2px solid var(--text);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.pupil {
  width: 16px;
  height: 16px;
  background: black;
  border-radius: 50%;
  position: absolute;
  transition: transform 0.05s linear;
}

p.subtitle {
  font-size: 1.2em;
  margin: 0 0 1.3em 0;
  text-align: center;
  padding: 0 16px;
}

.hint {
  font-size: 0.95em;
  opacity: 0.75;
  margin-top: 0.5em;
}

#runaway {
  position: absolute;
  padding: 0.85em 1.6em;
  font-size: 1em;
  background-color: var(--btn);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: background-color 0.25s, transform 0.15s;
  box-shadow: 0 10px 16px var(--shadow);
  will-change: left, top, transform;
  touch-action: none;
}

#runaway:hover { background-color: var(--btn2); }

#runaway:active { transform: translate(0,0) scale(0.98); }

#runaway:focus-visible{
  outline: 3px dashed rgba(0,0,0,0.35);
  outline-offset: 6px;
}

/* Win banner (hidden by default) */
.win {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(0,0,0,0.1);
  backdrop-filter: blur(8px);
  padding: 10px 14px;
  border-radius: 14px;
  box-shadow: 0 10px 18px rgba(0,0,0,0.12);
  display: none;
  align-items: center;
  gap: 10px;
  z-index: 20;
}

.win a{
  color: #0a66c2;
  text-decoration: none;
  font-weight: 700;
}
.win a:hover{ text-decoration: underline; }

/* Canvas for emoji trail & confetti */
#trailCanvas{
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* Animations */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-20px); }
  60% { transform: translateY(-8px); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Reduced motion: disable animations, show cursor */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  body { cursor: auto !important; }
}
