:root {
  --ink: #1a1a1b;
  --muted: #787c7e;
  --paper: #fff8f1;
  --blush: #ffb8c6;
  --rose: #e95778;
  --mint: #91d9bd;
  --sky: #9ddcf0;
  --sun: #ffd36a;
  --violet: #8d7ae6;
  --tile: #ffffff;
  --correct: #6aaa64;
  --present: #c9b458;
  --absent: #787c7e;
  color-scheme: light;
  font-family: 'Quicksand', sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #ffffff;
  overflow-x: hidden;
}

body.revealing,
body.celebrating {
  background: #FFFDF9;
}

body:not(.celebrating) {
  overflow: hidden;
}

body:not(.celebrating) .milestones,
body:not(.celebrating) .finale {
  display: none;
}

button,
input {
  font: inherit;
}

#sparkle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

main {
  position: relative;
  z-index: 1;
}

.wordle-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px 12px;
  overflow: hidden;
}

.wordle-screen.solved {
  min-height: 112vh;
}



.wordle-panel {
  width: min(96vw, 500px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  transition:
    transform 800ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 500ms ease;
}

.wordle-screen.solved .wordle-panel {
  transform: translateY(-42px) scale(0.94);
  opacity: 0;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: 0;
  line-height: 1.02;
}

h1 {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d3d6da;
  font-family: 'Fredoka', sans-serif;
  font-size: 2.28rem;
  font-weight: 700;
  text-align: center;
}

.wordle-meta {
  display: none;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  width: min(100%, var(--grid-max));
}

.grid {
  display: grid;
  gap: 8px;
  margin: 0 auto 16px;
  width: min(100%, var(--grid-max));
}

.row {
  display: grid;
  grid-template-columns: repeat(var(--letters), minmax(34px, 58px));
  gap: 8px;
  justify-content: center;
}

.tile {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid #d3d6da;
  border-radius: 0;
  background: var(--tile);
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.1rem, 7vw, 1.75rem);
  font-weight: 600;
  text-transform: uppercase;
  transform-style: preserve-3d;
  transition:
    background 260ms ease,
    border-color 260ms ease,
    color 260ms ease,
    transform 260ms ease;
}

.tile.filled {
  border-color: #878a8c;
  transform: scale(1.04);
}

.tile.revealing {
  animation: flip 560ms ease both;
}

.tile.correct {
  color: white;
  border-color: var(--correct);
  background: var(--correct);
}

.tile.present {
  color: white;
  border-color: var(--present);
  background: var(--present);
}

.tile.absent {
  color: white;
  border-color: var(--absent);
  background: var(--absent);
}

.letter-flight {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 8;
  display: grid;
  width: var(--start-size);
  height: var(--start-size);
  place-items: center;
  border-radius: 0;
  color: white;
  background: var(--correct);
  font-size: var(--flight-font-size);
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
  text-transform: uppercase;
  box-shadow: 0 18px 36px rgba(52, 34, 54, 0.16);
  contain: layout paint style;
  backface-visibility: hidden;
  will-change: transform, opacity;
  transform: translate3d(var(--start-x), var(--start-y), 0);
  animation: letter-flight 1180ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay);
}

.letter-flight.landed {
  position: absolute;
  opacity: 1;
  animation: letter-landed 2200ms ease-in-out infinite;
}

.status {
  min-height: 1.45em;
  margin-bottom: 16px;
  color: #1a1a1b;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

.status.bump {
  animation: bump 320ms ease;
}

.keyboard {
  display: grid;
  gap: 8px;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.key {
  min-width: 0;
  height: 58px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  color: #1a1a1b;
  background: #d3d6da;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 180ms ease,
    color 180ms ease;
}

.key:hover {
  transform: none;
}

.key.wide {
  padding: 0 14px;
  font-size: 0.72rem;
}

.key.correct,
.key.present,
.key.absent {
  color: white;
}

.key.correct {
  background: var(--correct);
}

.key.present {
  background: var(--present);
}

.key.absent {
  background: var(--absent);
}

.reveal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(92vw, 680px);
  transform: translate(-50%, -40%);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  background: #ffffff;
  padding: 48px;
  border-radius: 36px;
  box-shadow: 0 24px 56px rgba(59, 53, 62, 0.12);
}

.wordle-screen.solved .reveal {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  transition: opacity 800ms ease 560ms, transform 800ms cubic-bezier(0.2, 0.8, 0.2, 1) 560ms;
}

#reveal-letters-placeholder {
  height: 85px;
  margin-bottom: 16px;
  width: 100%;
}

.reveal h2 {
  margin-top: 0;
  margin-bottom: 20px;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(2rem, 6vw, 3.6rem);
  color: #3b353e;
  letter-spacing: -0.02em;
}

.reveal p:not(.reveal-name) {
  max-width: 520px;
  margin: 0 auto 36px;
  color: #4a444a;
  font-size: clamp(1.1rem, 2.4vw, 1.25rem);
  line-height: 1.65;
  font-weight: 500;
}

.scroll-cue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #FFFDF9;
  color: var(--rose);
  border: 3px solid var(--rose);
  text-decoration: none;
  box-shadow: 0 8px 16px rgba(233, 87, 120, 0.15);
  transition: transform 200ms ease, background 200ms ease, color 200ms ease;
}

.scroll-cue:hover {
  transform: translateY(-4px);
  background: var(--rose);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(233, 87, 120, 0.25);
}

.scroll-cue svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: bounce-arrow 2s infinite;
}

.milestones {
  position: relative;
  padding: 120px 24px 120px;
  background: transparent;
  overflow: hidden;
}

.section-header,
.finale {
  width: min(100%, 900px);
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 5;
}

.section-header h2,
.finale h2 {
  font-family: 'Fredoka', sans-serif;
  margin-bottom: 18px;
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  font-weight: 700;
  color: #3b353e;
  letter-spacing: -0.02em;
}

.section-header p:last-child,
.finale p:last-child {
  max-width: 690px;
  margin: 0 auto;
  color: #4a444a;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.6;
  font-weight: 500;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 72px;
  width: min(100%, 720px);
  margin: 80px auto 0;
  position: relative;
  z-index: 5;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: rgba(59, 53, 62, 0.08);
  border-radius: 2px;
  z-index: -1;
}

@media (max-width: 720px) {
  .timeline {
    gap: 48px;
  }
}

.milestone {
  position: relative;
  display: flex;
}



.milestone-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: var(--card-color);
  border: none;
  border-radius: 28px;
  box-shadow: 0 16px 40px rgba(59, 53, 62, 0.08);
  overflow: hidden;
  padding: 0;
  transition: transform 300ms ease, box-shadow 300ms ease;
}

.milestone-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px rgba(59, 53, 62, 0.12);
}

.milestone-card::before {
  content: attr(data-number);
  position: absolute;
  top: 24px;
  left: 24px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  color: #3b353e;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 99px;
  z-index: 10;
}

.doodle-scene {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: none;
  background: transparent;
}

@media (max-width: 720px) {
  .doodle-scene {
    aspect-ratio: 1;
  }
}

.generated-doodle {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generated-doodle img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0px 8px 12px rgba(0,0,0,0.06));
}

.milestone-text {
  position: relative;
  z-index: 2;
  padding: 40px;
  background: #ffffff;
  text-align: left;
}

@media (max-width: 720px) {
  .milestone-text {
    padding: 24px;
  }
}

.milestone h3 {
  font-family: 'Fredoka', sans-serif;
  margin: 0 0 12px;
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 600;
  color: #3b353e;
  letter-spacing: -0.01em;
}

@media (max-width: 720px) {
  .milestone h3 {
    font-size: 1.6rem;
  }
}

.milestone p {
  font-family: 'Quicksand', sans-serif;
  margin: 0;
  color: #4a444a;
  font-size: 1.15rem;
  line-height: 1.6;
  font-weight: 500;
}

.finale {
  min-height: 86vh;
  padding: 120px 18px 92px;
}

.finale-sky {
  position: relative;
  margin-bottom: 30px;
}

.cat-window {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 126px;
  height: 126px;
  transform: translateX(-50%);
  border: 10px solid #f9dfe6;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 18px 42px rgba(52, 34, 54, 0.12);
  animation: bob 5.5s ease-in-out infinite;
}

.cat-ear {
  position: absolute;
  top: 16px;
  width: 36px;
  height: 36px;
  rotate: 45deg;
  border-radius: 8px;
  background: #625260;
}

.cat-ear.left {
  left: 20px;
}

.cat-ear.right {
  right: 20px;
}

.cat-face {
  position: absolute;
  left: 27px;
  top: 44px;
  width: 52px;
  height: 46px;
  border-radius: 45% 45% 50% 50%;
  background: #625260;
}

.cat-face span {
  position: absolute;
  top: 17px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

.cat-face span:first-child {
  left: 15px;
}

.cat-face span:last-child {
  right: 15px;
}

.house {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(78vw, 420px);
  height: 92px;
  transform: translateX(-50%);
  border-radius: 8px 8px 0 0;
  background: #a7dac7;
  box-shadow: 0 22px 50px rgba(52, 34, 54, 0.12);
}

.house::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 58px;
  width: 210px;
  height: 210px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 8px;
  background: #ff9eb2;
}

.house::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 44px;
  height: 68px;
  transform: translateX(-50%);
  border-radius: 22px 22px 0 0;
  background: #fff7e8;
}

@keyframes flip {
  0% {
    transform: rotateX(0);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0);
  }
}

@keyframes bump {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

@keyframes letter-flight {
  0% {
    opacity: 1;
    transform: translate3d(var(--start-x), var(--start-y), 0) scale(1) rotate(0);
  }
  72% {
    opacity: 1;
    transform: translate3d(var(--end-x), var(--end-y), 0) scale(var(--end-scale, 1.42)) rotate(var(--rotate));
  }
  100% {
    opacity: 1;
    transform: translate3d(var(--end-x), var(--end-y), 0) scale(var(--end-scale, 1.42)) rotate(var(--rotate));
  }
}

@keyframes letter-landed {
  0%,
  100% {
    transform: translate3d(var(--end-x), var(--end-y), 0) scale(var(--end-scale, 1.42)) rotate(var(--rotate));
  }
  50% {
    transform: translate3d(var(--end-x), calc(var(--end-y) - 6px), 0) scale(var(--end-scale, 1.42))
      rotate(var(--rotate));
  }
}

@keyframes bounce-arrow {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
  60% {
    transform: translateY(-3px);
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-16px);
  }
}



@keyframes doodle-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0);
  }
  50% {
    transform: translate3d(0, -6px, 0) rotate(1deg);
  }
}

@media (max-width: 720px) {
  .wordle-screen {
    padding-top: 28px;
  }

  .wordle-screen.solved {
    min-height: 100vh;
  }

  .milestones {
    padding: 50px 16px 50px;
  }

  .wordle-panel {
    padding: 20px 8px;
    width: 100%;
  }

  .keyboard {
    gap: 6px;
    width: 100%;
  }

  .key-row {
    gap: 4px;
    width: 100%;
  }

  .key {
    flex: 1;
    height: 62px;
    padding: 0;
    font-size: 1.15rem;
    touch-action: manipulation;
  }

  .key.wide {
    flex: 1.4;
    font-size: 0.8rem;
  }

  .reveal p:not(.reveal-name),
  .section-header p:last-child,
  .finale p:last-child,
  .milestone p {
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
