/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream:   #faf8f4;
  --warm:    #f2ede4;
  --sand:    #d9cfc2;
  --brown:   #8b6f57;
  --dark:    #2e2118;
  --accent:  #c94f3a;
  --score:   #5a8a4a;
  --warn:    #e8a020;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--cream);
  font-family: 'Georgia', 'Times New Roman', serif;
  color: var(--dark);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#screen-game { cursor: none; }

/* ===== CUSTOM CURSOR ===== */
#cursor {
  position: fixed;
  width: 52px; height: 52px;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%) rotate(0deg);
  background-image: url('hairbrush.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.12s ease;
}
/* #cursor.cursor-hidden { display: none; } */

/* ===== SCREENS ===== */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ===== START SCREEN ===== */
#screen-start {
  background: var(--cream);
  background-image:
    radial-gradient(ellipse 60% 40% at 70% 80%, #e8ddd088 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 20% 20%, #f0e8de88 0%, transparent 50%);
}

.start-content {
  text-align: center;
  padding: 2rem;
}

.title {
  font-size: clamp(2.2rem, 7vw, 4rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--dark);
  margin-bottom: 0.5rem;
}
.title .subtitle {
  font-size: 0.65em;
  color: var(--brown);
  font-style: italic;
}

.tagline {
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: var(--brown);
  margin: 1.2rem 0 2rem;
  line-height: 1.6;
}

.btn-main {
  display: inline-block;
  padding: 0.85rem 2.4rem;
  background: var(--dark);
  color: var(--cream);
  border: none;
  border-radius: 3px;
  font-family: inherit;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-main:hover { background: var(--brown); }
.btn-main:active { transform: scale(0.97); }

.hint {
  margin-top: 1.5rem;
  font-size: 0.78rem;
  color: var(--sand);
  letter-spacing: 0.02em;
}

/* ===== GAME SCREEN ===== */
#screen-game {
  background: var(--cream);
  cursor: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0;
}

.hud {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 0.4rem 1rem;
  z-index: 100;
  pointer-events: none;
  margin-bottom: 0.3rem;
}

.score-box {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--score);
  letter-spacing: 0.04em;
}

.warning-box {
  font-size: 1rem;
  font-weight: bold;
  color: var(--warn);
  background: #fff8e8;
  border: 2px solid var(--warn);
  border-radius: 4px;
  padding: 0.3rem 0.8rem;
  opacity: 0;
  transition: opacity 0.2s;
  letter-spacing: 0.02em;
}
.warning-box.visible { opacity: 1; }

/* ===== CAT STAGE ===== */
.cat-stage {
  position: relative;
  display: inline-block;
  width: min(88vw, 78vh);
  max-width: 860px;
}

#cat-body {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  -webkit-user-drag: none;
}

.cat-face {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: auto;
  pointer-events: none;
  opacity: 0;
  -webkit-user-drag: none;
}
#cat-face1 { opacity: 1; }

/* shake + grow animation when caught */
.cat-stage.caught {
  animation: shake 0.7s ease forwards;
  transform-origin: center bottom;
}
@keyframes shake {
  0%   { transform: translateX(0)    scale(1); }
  10%  { transform: translateX(-8px) scale(1.04) rotate(-2deg); }
  22%  { transform: translateX(8px)  scale(1.09) rotate(2deg); }
  34%  { transform: translateX(-7px) scale(1.14) rotate(-2deg); }
  46%  { transform: translateX(7px)  scale(1.19) rotate(2deg); }
  58%  { transform: translateX(-4px) scale(1.22) rotate(-1deg); }
  70%  { transform: translateX(4px)  scale(1.24) rotate(1deg); }
  84%  { transform: translateX(-2px) scale(1.25); }
  100% { transform: translateX(0)    scale(1.25); }
}

/* ===== HAIR CANVAS ===== */
#hair-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

#debug-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0.45;
  display: none;
}

/* ===== GAME OVER ===== */
#screen-gameover {
  background: var(--cream);
}

.gameover-content {
  text-align: center;
  padding: 2rem;
  animation: fadeUp 0.5s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bite-emoji {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.gameover-content h2 {
  font-size: clamp(2rem, 6vw, 3rem);
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.gameover-sub {
  font-size: 1rem;
  color: var(--brown);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.final-score {
  font-size: 1.6rem;
  font-weight: bold;
  color: var(--score);
  margin-bottom: 1.8rem;
}

/* ===== MOBILE: restore default cursor ===== */
@media (hover: none) and (pointer: coarse) {
  #cursor { display: none !important; }
  .hint { display: none; }
  /* #touch-brush { display: block; } */
  /* cat smaller on mobile to leave room */
  .cat-stage { width: min(96vw, 60vh); }
}

#touch-brush {
  position: fixed;
  width: 64px;
  height: 64px;
  pointer-events: none;
  z-index: 9999;

  left: 0;
  top: 0;

  transform: translate(-50%, -50%) rotate(0deg);

  background-image: url('hairbrush.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.15s,
    transform 0.12s ease;
}

#touch-brush.visible {
  opacity: 1;
  visibility: visible;
}