:root {
  --paper: #24352f;
  --ink: #f9f6ef;
  --muted-ink: #dedfd4;
  --focus: #e5d0a8;
  --answer-paper: #fffdf8;
  --answer-ink: #30291f;
  --answer-edge: #ddd6cb;
  --suit: #8b5936;
  --serif: Lora, Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  min-height: 100svh;
  margin: 0;
  background: radial-gradient(ellipse at 48% 50%, #536559, #364b41aa 31%, transparent 68%), var(--paper);
  color: var(--ink);
  font: 1rem/1.47 system-ui, sans-serif;
}

.globe-screen {
  max-width: 400px;
  margin-inline: auto;
  padding: max(28px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  text-align: center;
}

h1 {
  margin: 0 0 11px;
  font: 600 clamp(1.75rem, 7vw, 2.375rem)/1.15 var(--serif);
  letter-spacing: -.045em;
}

.globe-intro {
  max-width: 30ch;
  margin: 0 auto;
  color: var(--muted-ink);
  text-wrap: pretty;
}

.globe-action {
  appearance: none;
  position: relative;
  display: block;
  width: min(100%, 318px);
  aspect-ratio: 1;
  margin: 13px auto 3px;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.globe-object {
  position: absolute;
  inset: 0;
  transform-origin: 50% 90%;
}

.globe-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

.globe-snow {
  position: absolute;
  inset: 2% 9% 20% 7%;
  clip-path: ellipse(50% 49% at 50% 50%);
  pointer-events: none;
}

.globe-flake {
  position: absolute;
  top: var(--y);
  left: var(--x);
  width: var(--size);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fffaf5;
  box-shadow: 0 0 3px #fff8ef;
  opacity: 0;
  animation: snow-fall var(--duration) var(--delay) linear both;
}

.globe-object.is-shaking { animation: globe-shake 680ms ease-in-out both; }

.globe-answer {
  display: grid;
  align-items: center;
  min-height: 107px;
}

.globe-answer-text {
  position: relative;
  width: min(100%, 290px);
  margin: 0 auto;
  padding: 16px 23px;
  border: 1px solid var(--answer-edge);
  border-radius: 7px;
  background: var(--answer-paper);
  color: var(--answer-ink);
  font: 500 1.0625rem/1.43 var(--serif);
  text-wrap: pretty;
  animation: answer-reveal 260ms ease-out both;
}

.globe-answer-text::before,
.globe-answer-text::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--suit);
  transform: rotate(45deg);
}

.globe-answer-text::before { top: 10px; left: 10px; }
.globe-answer-text::after { bottom: 10px; right: 10px; }

.motion-permission {
  min-height: 44px;
  padding: 5px 12px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-ink);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

@keyframes globe-shake {
  0%, 100% { transform: rotate(0); }
  39% { transform: rotate(-2.2deg); }
  75% { transform: rotate(.7deg); }
}

@keyframes snow-fall {
  0% {
    opacity: 0;
    transform: translate(0, 18px);
    animation-timing-function: ease-out;
  }
  25% {
    opacity: .93;
    transform: translate(var(--wind), -19px);
    animation-timing-function: cubic-bezier(.36, .06, .52, .95);
  }
  80% { opacity: .8; }
  100% { opacity: 0; transform: translate(calc(var(--wind) * 1.7), 53px); }
}

@keyframes answer-reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 380px) {
  .globe-answer { min-height: 130px; }
}

@media (prefers-reduced-motion: reduce) {
  .globe-object.is-shaking,
  .globe-flake,
  .globe-answer-text { animation: none; }
}
