/* ---------- VARIABLES + PAGE ---------- */
:root {
  --bg: radial-gradient(circle at 25% 15%, #3b4f9a 0%, #1c2550 55%, #0e1430 100%);
  --feather: #8d6e63;  /* face */
  --dark: #5d4037;     /* ear tufts, eye rings, talons */
  --wing: #6d4c41;     /* wings (the "arms" and "paws") */
  --disc: #f3e5c8;     /* pale discs around the eyes */
  --beak: #ff8f00;     /* beak and feet */
  --accent: #f9a825;   /* button and focus ring */
  --px: 0px;           /* pupil x, set by JavaScript */
  --py: 0px;           /* pupil y */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px 56px;
  background: var(--bg);
  font-family: 'Poppins', sans-serif;
  overflow-x: hidden;
}
/* ---------- END PAGE ---------- */

/* ---------- NIGHT SKY ---------- */
/* Eight tiny radial gradients = eight stars, all on one pseudo-element */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 12% 20%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 78% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 60% 30%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 30% 70%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 60%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 8% 88%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 45% 90%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 92% 85%, #fff 50%, transparent 51%);
  animation: twinkle 3s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .4; } }
/* ---------- END NIGHT SKY ---------- */

/* ---------- SCENE ---------- */
.scene {
  position: relative;
  width: 340px;
  padding-top: 150px;
  margin-bottom: 40px;
}
@media (max-width: 370px) {
  body { padding-left: 12px; padding-right: 12px; }
  .scene { zoom: .86; }
}
/* ---------- END SCENE ---------- */

/* ---------- HEAD, EAR TUFTS + CHEST ---------- */
.head {
  position: absolute;
  top: 0; left: 50%;
  width: 200px; height: 180px;
  margin-left: -100px;
  z-index: 1;
}
/* Ear tufts: narrow triangles tilted outwards */
.ear {
  position: absolute;
  top: -26px;
  width: 46px; height: 60px;
  background: var(--dark);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.ear.l { left: 20px;  transform: rotate(-24deg); }
.ear.r { right: 20px; transform: rotate(24deg); }
/* The head is a little wider at the bottom than a panda's (46% / 50%) */
.face {
  position: absolute;
  inset: 0;
  background: var(--feather);
  border-radius: 46% 46% 50% 50%;
  box-shadow: 0 6px 18px rgba(0,0,0,.3), inset 0 -8px 0 rgba(0,0,0,.1);
}
/* Chest feathers: three circles drawn with radial gradients */
.chest {
  position: absolute;
  left: 50%; bottom: 14px;
  width: 70px; height: 22px;
  margin-left: -35px;
  background:
    radial-gradient(circle at 25% 0,   #a1887f 7px, transparent 8px),
    radial-gradient(circle at 75% 0,   #a1887f 7px, transparent 8px),
    radial-gradient(circle at 50% 100%, #a1887f 7px, transparent 8px);
}
/* ---------- END HEAD ---------- */

/* ---------- BIG ROUND EYES ---------- */
/* Pale disc + a dark ring drawn with box-shadow (no extra element) */
.patch {
  position: absolute;
  top: 54px;
  width: 64px; height: 64px;
  background: var(--disc);
  border-radius: 50%;
  box-shadow: 0 0 0 5px var(--dark);
  display: grid;
  place-items: center;
}
.patch.l { left: 32px; }
.patch.r { right: 32px; }
.eye {
  position: relative;
  width: 38px; height: 38px;
  background: #ffca28;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #f57f17;
  overflow: hidden;
  animation: blink 4.5s infinite;
}
.pupil {
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  background: #1f1f24;
  border-radius: 50%;
  transform: translate(var(--px), var(--py));
  transition: transform .15s ease;
}
.pupil::after {
  content: '';
  position: absolute;
  top: 3px; left: 4px;
  width: 5px; height: 5px;
  background: #fff;
  border-radius: 50%;
}
@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.1); }
}
/* ---------- END EYES ---------- */

/* ---------- BEAK + CHEEKS ---------- */
/* A downward triangle: three clip-path points */
.beak {
  position: absolute;
  top: 100px; left: 50%;
  width: 22px; height: 26px;
  margin-left: -11px;
  background: var(--beak);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .3s ease;
  transform-origin: 50% 0;
}
.blush {
  position: absolute;
  top: 120px;
  width: 22px; height: 12px;
  background: #ffb3c1;
  border-radius: 50%;
  opacity: .7;
}
.blush.l { left: 30px; }
.blush.r { right: 30px; }
/* ---------- END BEAK ---------- */

/* ---------- WINGS ---------- */
/* Same arm + paw system as the panda, styled as wings:
   one sharp corner in border-radius gives each wing tip a point */
.arm {
  position: absolute;
  top: 75px;
  width: 44px; height: 145px;
  background: var(--wing);
  border-radius: 22px;
  transform-origin: 50% 100%;
  transform: scaleY(.5);
  z-index: 2;
  transition: transform .45s cubic-bezier(.68, -0.35, .27, 1.35);
}
.arm.l { left: 60px; }
.arm.r { right: 60px; }
.paw {
  position: absolute;
  top: 122px;
  width: 64px; height: 56px;
  background: var(--wing);
  border-radius: 60% 60% 20% 60%;
  box-shadow: inset 0 -10px 0 rgba(0,0,0,.18), inset 0 -20px 0 rgba(0,0,0,.08);
  z-index: 4;
  transition: transform .45s cubic-bezier(.68, -0.35, .27, 1.35);
}
.paw.l { left: 52px; }
.paw.r { right: 52px; border-radius: 60% 60% 60% 20%; }
/* ---------- END WINGS ---------- */

/* ---------- CARD / FORM ---------- */
.card {
  position: relative;
  z-index: 3;
  background: #fff;
  border-radius: 24px;
  padding: 46px 30px 30px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.card h2 { text-align: center; color: #1f1f24; font-weight: 700; margin-bottom: 2px; }
.card p.sub { text-align: center; color: #767676; font-size: 13px; margin-bottom: 22px; }
.field { position: relative; margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: #555; margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 12px 44px 12px 14px;
  border: 2px solid #e6e6e6;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field input[aria-invalid="true"] { border-color: #d64545; }
.toggle {
  position: absolute;
  right: 10px; bottom: 9px;
  padding: 4px;
  border: none;
  border-radius: 6px;
  background: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.toggle:focus-visible { outline: 2px solid var(--accent); }
/* Yellow button with dark text: white on yellow would be hard to read */
.btn {
  width: 100%;
  margin-top: 4px;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #1f1f24;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform .15s, filter .2s;
}
.btn:hover { filter: brightness(.92); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 3px solid #1f1f24; outline-offset: 2px; }
.msg { text-align: center; font-size: 13px; margin-top: 12px; min-height: 18px; font-weight: 500; }
/* ---------- END CARD ---------- */

/* ---------- TALONS ---------- */
.foot {
  position: absolute;
  bottom: -22px;
  width: 60px; height: 30px;
  background: var(--beak);
  border-radius: 40% 40% 50% 50%;
  z-index: 1;
}
.foot.l { left: 76px; }
.foot.r { right: 76px; }
/* Three claws peeking out under each foot */
.foot i {
  position: absolute;
  bottom: -4px;
  width: 10px; height: 14px;
  background: var(--dark);
  border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
}
.foot i:nth-of-type(1) { left: 8px; }
.foot i:nth-of-type(2) { left: 25px; bottom: -6px; }
.foot i:nth-of-type(3) { left: 42px; }
/* ---------- END TALONS ---------- */

/* ---------- STATES ---------- */
/* Typing in a text field: look down at the form */
.scene.look { --py: 4px; }

/* Typing a password: both wings over the eyes */
.scene.cover .arm.l { transform: rotate(21deg) scaleY(1); }
.scene.cover .arm.r { transform: rotate(-21deg) scaleY(1); }
.scene.cover .paw.l { transform: translate(52px, -66px) rotate(18deg); }
.scene.cover .paw.r { transform: translate(-52px, -66px) rotate(-18deg); }

/* Password shown: the right wing lifts to peek */
.scene.cover.peek .arm.r { transform: rotate(-24deg) scaleY(.82); }
.scene.cover.peek .paw.r { transform: translate(-58px, -40px) rotate(-30deg); }

/* Success: the beak opens a little, bounce, happy feet */
.scene.happy .beak { transform: scaleY(1.15); }
.scene.happy .foot { animation: tap .35s ease 3; }
.scene.happy .head { animation: bounce .5s ease 2; }
@keyframes tap { 50% { transform: translateY(-8px); } }
@keyframes bounce { 50% { transform: translateY(-10px); } }

/* Problem: a head shake (owls have no mouth to frown with) */
.scene.sad .head { animation: shake .45s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-8px) rotate(-3deg); }
  40%, 80% { transform: translateX(8px) rotate(3deg); }
}
/* ---------- END STATES ---------- */

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
/* ---------- END REDUCED MOTION ---------- */
