:root {
  color-scheme: light dark;
  --background: #f4f5ef;
  --foreground: #344138;
  --muted: #788274;
  --frame: #dce1d5;
  --accent: #668b40;
  --orbit: #bac9aa;
  --stone-top: #f9faf4;
  --stone-bottom: #e5e9dc;
  --stone-edge: #a2ad96;
  --stone-side: #ced6c2;
  --stone-inset: #c9d2bd;
  --spirit-top: #e2f7be;
  --spirit-bottom: #b8db91;
  --spirit-stroke: #7f9e5a;
  --spirit-eyes: #486034;
  --shadow: #778868;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  background: var(--background);
  color: var(--foreground);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #101310;
    --foreground: #dce4d6;
    --muted: #75806d;
    --frame: #2a3027;
    --accent: #b4e78b;
    --orbit: #404f34;
    --stone-top: #283123;
    --stone-bottom: #181e16;
    --stone-edge: #62734f;
    --stone-side: #10170e;
    --stone-inset: #3c4a30;
    --spirit-top: #d2f6ac;
    --spirit-bottom: #8eb563;
    --spirit-stroke: #c5ec9e;
    --spirit-eyes: #344a25;
    --shadow: #000;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 240px;
  padding: clamp(12px, 2.2vw, 32px);
}

.page {
  min-height: calc(100svh - clamp(12px, 2.2vw, 32px) * 2);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--frame);
}

.header, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(20px, 2.6vw, 38px);
}

.wordmark {
  color: var(--foreground);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 400;
  letter-spacing: -1.5px;
  line-height: 1;
  text-decoration: none;
}

.wordmark span { color: var(--accent); }
.wordmark:focus-visible { outline: 2px solid var(--accent); outline-offset: 8px; }

.status-light {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 9%, transparent);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px 24px;
}

.scene {
  width: min(100%, 460px);
}

.illustration { display: block; width: 100%; height: auto; overflow: visible; }
.guides { color: var(--muted); opacity: .3; }
.orbit { color: var(--orbit); }
.satellite { fill: var(--background); stroke: var(--accent); }
.satellite-small { fill: var(--accent); stroke: none; }
.spark { color: var(--accent); }
.halo-color { stop-color: var(--accent); }
.stone-top { stop-color: var(--stone-top); }
.stone-bottom { stop-color: var(--stone-bottom); }
.spirit-top { stop-color: var(--spirit-top); }
.spirit-bottom { stop-color: var(--spirit-bottom); }
.ground-shadow { fill: var(--shadow); opacity: .12; }
.ground-line { color: var(--stone-inset); }
.ghost-body { stroke: var(--spirit-stroke); }
.ghost-highlight { color: #fff; opacity: .5; }
.ghost-eyes { fill: var(--spirit-eyes); }
.ghost-smile { color: var(--spirit-eyes); }
.stone-side, .stone-base-side { fill: var(--stone-side); stroke: var(--stone-edge); }
.stone-front { stroke: var(--stone-edge); }
.stone-inset { stroke: var(--stone-inset); }
.stone-detail { stroke: var(--stone-edge); }
.stone-lettering { fill: var(--foreground); font: italic 24px Georgia, "Times New Roman", serif; letter-spacing: -1px; }
.stone-slots { fill: var(--stone-inset); }
.slot-active { fill: var(--accent); }
.stone-base { fill: var(--stone-bottom); stroke: var(--stone-edge); }
.grass { color: var(--stone-edge); }

h1 {
  max-width: 100%;
  margin: 8px 0 0;
  font-size: clamp(11px, 1.05vw, 13px);
  font-weight: 400;
  letter-spacing: .2em;
  line-height: 1.8;
  text-align: center;
  text-wrap: balance;
}

.activity {
  width: 64px;
  height: 2px;
  margin-top: 24px;
  overflow: hidden;
  background: var(--frame);
}

.activity span {
  display: block;
  width: 24px;
  height: 100%;
  background: var(--accent);
  animation: progress 3s ease-in-out infinite;
}

.footer { color: var(--muted); padding-top: 20px; padding-bottom: 20px; }
.corner-mark { font-size: 16px; font-weight: 300; }
.footer-symbol { width: 24px; height: 18px; opacity: .65; }

.ghost { animation: float 5s ease-in-out infinite; }
.ghost-eyes { transform-box: fill-box; transform-origin: center; animation: blink 7s ease-in-out infinite; }
.ground-shadow { transform-box: fill-box; transform-origin: center; animation: shadow 5s ease-in-out infinite; }
.spark { animation: twinkle 5s ease-in-out infinite; }
.spark-two { animation-delay: -1.7s; }
.spark-three { animation-delay: -3.3s; }
.slot-active { animation: twinkle 3s ease-in-out infinite; }

@keyframes float {
  0%, 100% { transform: translateY(2px) rotate(-3deg); }
  50% { transform: translateY(-14px) rotate(3deg); }
}

.ghost { transform-origin: 255px 165px; }

@keyframes blink {
  0%, 43%, 47%, 100% { transform: scaleY(1); }
  45% { transform: scaleY(.12); }
}

@keyframes shadow {
  0%, 100% { transform: scaleX(1); opacity: .12; }
  50% { transform: scaleX(.86); opacity: .07; }
}

@keyframes twinkle {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}

@keyframes progress {
  0%, 100% { transform: translateX(-24px); }
  50% { transform: translateX(64px); }
}

@media (max-height: 650px) and (min-width: 600px) {
  .scene { width: clamp(200px, 48svh, 330px); }
  .header { padding-top: 20px; padding-bottom: 12px; }
  main { padding-bottom: 12px; }
  .footer { padding-top: 12px; padding-bottom: 12px; }
  .activity { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .activity span { transform: translateX(20px); }
}
