@font-face { font-family: 'Bagel Fat One'; src: url(fonts/bagel-fat-one.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Patrick Hand'; src: url(fonts/patrick-hand.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Atkinson'; src: url(fonts/atkinson-400.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Atkinson'; font-weight: 700; src: url(fonts/atkinson-700.woff2) format('woff2'); font-display: swap; }

:root { --pink: #ff5c9d; --bubble: #ffb8da; --cream: #fff9f2; --plum: #6b2d5c; --butter: #ffe566; --mint: #b8f5dc; --lilac: #e4d0ff; }
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
main { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
textarea { user-select: text; -webkit-user-select: text; }
body {
  color: var(--plum); font: 16px/1.4 'Atkinson', system-ui, sans-serif; background-color: var(--bubble);
  background-image: radial-gradient(#fff 5px, transparent 6px), radial-gradient(#fff 5px, transparent 6px), linear-gradient(160deg, #ffc9e3, #ffb0d5 55%, var(--lilac));
  background-size: 44px 44px, 44px 44px, 100% 100%; background-position: 0 0, 22px 22px, 0 0; background-attachment: fixed;
}

/* Phones: one column that fills the screen, with the globe taking what is left. */
main {
  height: 100vh; height: 100dvh;
  display: grid; grid-template: 'head' auto 'photo' auto 'world' 1fr 'panel' auto / minmax(0, 1fr);
  gap: 6px;
  padding: max(8px, env(safe-area-inset-top)) 14px max(5px, env(safe-area-inset-bottom));
}
header { grid-area: head; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
h1 { display: flex; font: 400 1.85rem/1.1 'Bagel Fat One', sans-serif; }
h1 span {
  display: inline-block; color: var(--pink); -webkit-text-stroke: 7px var(--plum); paint-order: stroke fill;
  margin-right: -1px; animation: boing 1.8s ease-in-out infinite; animation-delay: calc(var(--i) * .09s);
}
h1 span:nth-child(3n+2) { color: var(--butter); }
h1 span:nth-child(3n) { color: var(--mint); }
@keyframes boing { 0%, 60%, 100% { translate: 0 0; rotate: -4deg; } 30% { translate: 0 -5px; rotate: 6deg; } }
header p { display: flex; align-items: center; gap: 6px; font: 1.05rem 'Patrick Hand', cursive; white-space: nowrap; }
header p > span { background: var(--cream); border: 3px solid var(--plum); border-radius: 999px; padding: 0 9px; }
header strong { font-weight: 400; background: var(--butter); border: 3px solid var(--plum); border-radius: 999px; padding: 0 10px; box-shadow: 0 3px 0 var(--plum); }
header strong::before, #final-list li span::before, .fact strong::before, .fact .more::before {
  content: ''; display: inline-block; width: 1.05em; height: 1.05em; margin-right: 4px; vertical-align: -.15em; background: center / contain no-repeat;
}
header strong::before { background-image: url(art/star.svg); }

/* The photo: a frilly framed portrait with a bow on top. */
.specimen {
  grid-area: photo; position: relative; margin-top: 10px; padding: 8px 8px 3px; background: var(--cream);
  border: 3px solid var(--plum); border-radius: 26px; box-shadow: 0 0 0 5px #fff, 0 0 0 8px var(--pink), 0 9px 0 6px rgb(107 45 92 / .35);
  margin-inline: 8px;
}
.bow { position: absolute; z-index: 1; width: 66px; top: -20px; right: -10px; rotate: 16deg; animation: wiggle 2.4s ease-in-out infinite; pointer-events: none; }
@keyframes wiggle { 0%, 70%, 100% { rotate: 16deg; } 78% { rotate: 4deg; } 88% { rotate: 24deg; } }
#enlarge { display: block; width: 100%; height: 23dvh; border: 3px dashed var(--pink); border-radius: 18px; overflow: hidden; background: var(--lilac); cursor: zoom-in; }
#photo { width: 100%; height: 100%; object-fit: contain; display: block; }
figcaption { font-size: .64rem; line-height: 1.25; padding-top: 3px; text-align: center; }
a { color: inherit; }

.world { grid-area: world; position: relative; min-height: 0; margin-top: 6px; }
#globe {
  position: absolute; inset: 0; width: 100%; height: 100%;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent; cursor: crosshair; border-radius: 20px; filter: drop-shadow(0 7px 0 rgb(107 45 92 / .28));
}
.zoom { position: absolute; right: 0; bottom: 2px; display: grid; gap: 9px; }
.zoom button { width: 42px; height: 42px; border: 3px solid var(--plum); border-radius: 50%; background: var(--mint); color: var(--plum); box-shadow: 0 4px 0 var(--plum); font: 400 1.4rem/1 'Bagel Fat One', sans-serif; cursor: pointer; }
#press-ring {
  position: absolute; width: 76px; height: 76px; margin: -38px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--pink) var(--fill), transparent 0);
  mask: radial-gradient(closest-side, transparent 66%, #000 68%);
  animation: hold 550ms linear forwards;
}
@property --fill { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes hold { to { --fill: 360deg; } }

.panel { grid-area: panel; min-height: 0; }
.mascot { display: block; overflow: visible; }
.mascot .eyes-happy, .mascot .mouth-sad, .mascot .mouth-wow, .mascot .tear, .mascot .paws { display: none; }
.mascot .pupils { transform: translate(var(--look-x, 0), var(--look-y, 0)); transition: transform .12s; }
.mascot.hiding .paws { display: inline; }
.mascot.wow .mouth-smile { display: none; }
.mascot.wow .mouth-wow { display: inline; }
.mascot.wow .eyes-open { transform: scale(1.12); transform-origin: 60px 55px; }
#result > .mascot.happy { animation: cheer .5s ease-in-out 5; }
@keyframes cheer { 50% { translate: 0 -14px; rotate: -8deg; } }
.mascot.sad .tear { animation: drip 1.1s ease-in infinite; }
@keyframes drip { from { translate: 0 -4px; } to { translate: 0 12px; opacity: 0; } }
.mascot.happy .eyes-open, .mascot.sad .mouth-smile { display: none; }
.mascot.happy .eyes-happy, .mascot.sad .mouth-sad, .mascot.sad .tear { display: inline; }
.ask { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 2px 0; }
.ask .mascot { width: 66px; flex: none; animation: hop 1.4s ease-in-out infinite; }
@keyframes hop { 50% { translate: 0 -7px; } }
.hint { position: relative; font: 1.2rem/1.2 'Patrick Hand', cursive; background: var(--cream); border: 3px solid var(--plum); border-radius: 22px; padding: 7px 14px; box-shadow: 0 4px 0 var(--plum); }
.hint::before { content: ''; position: absolute; left: -9px; top: 50%; width: 13px; height: 13px; margin-top: -7px; rotate: 45deg; background: var(--cream); border: solid var(--plum); border-width: 0 0 3px 3px; }

#result, #final { position: relative; margin-top: 26px; background: var(--cream); border: 3px solid var(--plum); border-radius: 28px; padding: 9px 14px 12px; box-shadow: 0 0 0 5px #fff, 0 0 0 8px var(--pink); margin-inline: 8px; animation: pop .45s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes pop { from { scale: .6; rotate: -4deg; } }
#result > .mascot, #final > .mascot { position: absolute; width: 70px; top: -52px; left: 14px; }
.verdict { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-top: 6px; }
.cheer { font: 1.15rem 'Patrick Hand', cursive; color: #c2185b; }
h2 { font: 400 1.35rem/1.15 'Bagel Fat One', sans-serif; }
.scientific { font-style: italic; opacity: .75; font-size: .85rem; }
/* The score sits on a flower. */
.score { flex: none; position: relative; isolation: isolate; display: grid; place-content: center; justify-items: center; width: 84px; height: 84px; font: .8rem/1 'Patrick Hand', cursive; }
.score::before {
  content: ''; position: absolute; z-index: -1; inset: 0; animation: spin 14s linear infinite;
  background: radial-gradient(circle at center, var(--butter) 44%, transparent 45%),
    radial-gradient(circle at 50% 18%, var(--bubble) 17%, transparent 18%), radial-gradient(circle at 50% 82%, var(--bubble) 17%, transparent 18%),
    radial-gradient(circle at 18% 50%, var(--bubble) 17%, transparent 18%), radial-gradient(circle at 82% 50%, var(--bubble) 17%, transparent 18%),
    radial-gradient(circle at 27% 27%, var(--bubble) 17%, transparent 18%), radial-gradient(circle at 73% 27%, var(--bubble) 17%, transparent 18%),
    radial-gradient(circle at 27% 73%, var(--bubble) 17%, transparent 18%), radial-gradient(circle at 73% 73%, var(--bubble) 17%, transparent 18%);
}
@keyframes spin { to { rotate: 360deg; } }
.score strong { font: 400 1.7rem/1 'Bagel Fat One', sans-serif; }
#distance { font: 1.05rem/1.2 'Patrick Hand', cursive; }
.fact { font-size: .82rem; line-height: 1.3; margin-top: 5px; background: var(--mint); border: 3px dotted var(--plum); border-radius: 16px; padding: 5px 10px; }
.fact strong::before { background-image: url(art/bulb.svg); }
.fact .more::before { background-image: url(art/book.svg); }
.fact a { font-size: .72rem; }
.fact .more { font-size: .82rem; font-weight: 700; white-space: nowrap; margin-left: 8px; }

.button { display: block; width: 100%; margin-top: 8px; min-height: 46px; border: 3px solid var(--plum); border-radius: 999px; background: linear-gradient(#ff9ac4, var(--pink)); color: var(--plum); box-shadow: inset 0 4px 0 rgb(255 255 255 / .55), 0 5px 0 var(--plum); font: 400 1.1rem 'Bagel Fat One', sans-serif; cursor: pointer; }
.button::before, .button::after { content: ' ♡ '; }
.button.quiet { background: var(--lilac); }
.button:hover { rotate: -1deg; scale: 1.02; }
.button, .zoom button { transition: scale .5s cubic-bezier(.3, 3, .4, 1), translate .1s, rotate .2s; }
.button:active, .zoom button:active { translate: 0 4px; box-shadow: 0 1px 0 var(--plum); scale: 1.07 .84; transition-duration: .08s; }
.zoom button:active { scale: 1.18 .8; }
.copied { text-align: center; font: 1.05rem 'Patrick Hand', cursive; margin-top: 6px; }
.copied:empty { display: none; }
textarea { width: 100%; margin-top: 6px; border: 3px dashed var(--plum); border-radius: 14px; padding: 6px; font: .85rem 'Atkinson', sans-serif; color: inherit; background: none; resize: none; }
#final h2 { text-align: center; margin-top: 8px; }
#final-list { list-style: none; margin-top: 4px; font: 1.05rem/1.35 'Patrick Hand', cursive; }
#final-list li { display: flex; justify-content: space-between; border-bottom: 3px dotted var(--bubble); }
#final-list li span::before { background-image: url(art/paw.svg); }

.source { font-size: .6rem; text-align: center; width: fit-content; margin: 9px auto 0; background: rgb(255 249 242 / .85); border-radius: 999px; padding: 0 8px; }
.link { border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 3px; }
:focus-visible { outline: 3px solid var(--plum); outline-offset: 3px; }

#confetti { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
#confetti img { position: absolute; top: -40px; animation: fall 1.9s ease-in forwards; opacity: 0; }
@keyframes fall { 10% { opacity: 1; } to { opacity: 0; transform: translate(var(--drift), 90vh) rotate(360deg); } }

dialog { margin: auto; border: 0; padding: 0; background: none; color: var(--plum); max-width: 96vw; max-height: 92dvh; }
dialog::backdrop { background: rgb(107 45 92 / .85); }
#photo-dialog { cursor: zoom-out; }
#photo-dialog img { display: block; max-width: 96vw; max-height: 92dvh; border-radius: 22px; border: 5px solid var(--pink); }
.sheet { width: min(520px, 92vw); background: var(--cream); border: 3px solid var(--plum); border-radius: 26px; padding: 18px 20px; font-size: .85rem; overflow-wrap: anywhere; }
.sheet h3 { font: 1.2rem 'Patrick Hand', cursive; margin-top: 12px; }
.sheet p { margin-top: 4px; }
.sheet ul { padding-left: 18px; margin-top: 4px; }

/* Once answered, short screens give the globe the room the photo had. */
@media (max-width: 819px) and (max-height: 860px) {
  .answered #enlarge { height: 10dvh; }
  .answered .scientific, .answered .cheer { display: none; }
  .answered .score { width: 70px; height: 70px; }
  .answered .score strong { font-size: 1.4rem; }
}
@media (max-width: 819px) and (max-height: 700px) {
  .answered .bow, .answered #result > .mascot { display: none; }
  .answered #enlarge { height: 7dvh; }
  .answered #result { margin-top: 8px; padding-block: 6px 9px; }
  .answered .verdict { margin-top: 0; }
  .answered .score { width: 58px; height: 58px; }
  .answered .score strong { font-size: 1.15rem; }
  .answered .fact { font-size: .74rem; padding-block: 3px; margin-top: 3px; }
  .answered .button { min-height: 42px; margin-top: 6px; }
}
@media (max-width: 380px) { h1 { font-size: 1.6rem; } header p { font-size: .95rem; } }

/* Wide screens: photo and answer on the left, a big globe on the right. */
@media (min-width: 820px) {
  main {
    grid-template: 'head world' auto 'photo world' auto 'panel world' 1fr / 390px minmax(0, 1fr);
    gap: 14px 32px; padding: 20px 32px;
  }
  #enlarge { height: min(260px, 28dvh); }
  figcaption { font-size: .72rem; }
  .panel { display: flex; flex-direction: column; }
  .source { margin-top: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }
