:root {
  --navy: #1f4fa3;
  --ink: #1b2a44;
  --leaf: #8cc63f;
  --sun: #ffd23f;
  --sky-top: #d9eefa;
  --sky-mid: #eef7fc;
  --white: #ffffff;
  --header-h: 76px;
  --footer-h: 56px;
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 48%, var(--white) 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- sky ---------- */
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud {
  position: absolute; left: -30vw; width: 26vw; height: 8vw; min-width: 220px; min-height: 68px;
  background:
    radial-gradient(closest-side at 30% 60%, rgba(255,255,255,.95), rgba(255,255,255,0)),
    radial-gradient(closest-side at 55% 40%, rgba(255,255,255,.95), rgba(255,255,255,0)),
    radial-gradient(closest-side at 75% 65%, rgba(255,255,255,.9), rgba(255,255,255,0));
  filter: blur(2px);
  animation: drift linear infinite;
}
.c1 { top: 9vh;  animation-duration: 95s;  animation-delay: -20s; }
.c2 { top: 22vh; animation-duration: 120s; animation-delay: -70s; transform: scale(.7); }
.c3 { top: 4vh;  animation-duration: 140s; animation-delay: -110s; transform: scale(.55); opacity: .8; }
.c4 { top: 78vh; animation-duration: 110s; animation-delay: -45s; transform: scale(.8); opacity: .7; }
@keyframes drift { from { translate: 0 0; } to { translate: 160vw 0; } }

/* ---------- header / footer ---------- */
.site-header {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(16px, 3vw, 40px);
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }

.logo {
  display: inline-flex; align-items: center; gap: .18em;
  text-decoration: none; color: var(--navy);
  font-weight: 900; font-size: clamp(22px, 2.3vw, 32px); letter-spacing: .02em;
  line-height: 1;
}
.logo-plus { width: .82em; height: .82em; translate: 0 -.42em; }
.logo:focus-visible, .menu:focus-visible { outline: 3px solid var(--sun); outline-offset: 4px; border-radius: 10px; }

.menu {
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--white);
  box-shadow: 0 6px 18px rgba(31, 79, 163, .16);
  display: grid; place-content: center; gap: 5px;
}
.menu span { display: block; width: 20px; height: 2.5px; border-radius: 2px; background: var(--navy); }

.site-footer {
  position: fixed; inset: auto 0 0 0; height: var(--footer-h); z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 0 clamp(16px, 3vw, 40px);
  pointer-events: none;
}
.hint {
  margin: 0; padding: .55em 1.2em; border-radius: 999px;
  background: rgba(255,255,255,.86); color: var(--ink);
  font-size: clamp(12px, 1vw, 14px); font-weight: 700;
  box-shadow: 0 4px 14px rgba(27, 42, 68, .08);
}
.copy {
  position: absolute; left: clamp(16px, 3vw, 40px); bottom: 18px;
  font-size: 11px; color: rgba(27, 42, 68, .55); letter-spacing: .04em;
}

/* ---------- town ---------- */
.town { position: fixed; inset: 0; z-index: 10; }
.viewport {
  position: absolute; inset: var(--header-h) 0 var(--footer-h) 0;
  display: grid; place-items: center;
  overflow: hidden;
}
.stage-wrap {
  position: relative;
  /* width / height set from JS: view size x scale */
  animation: arrive 1.1s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes arrive {
  from { opacity: 0; transform: translateY(26px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
.stage {
  position: absolute; left: 0; top: 0;
  width: 2000px; height: 1400px;
  transform-origin: 0 0;
  will-change: transform;
}
.stage > * { position: absolute; left: 0; top: 0; }
.base { width: 2000px; height: 1400px; display: block; user-select: none; -webkit-user-drag: none; z-index: 0; }
.highlight { width: 2000px; height: 1400px; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .25s ease; }
.highlight.on { opacity: 1; }
.movers { width: 2000px; height: 1400px; z-index: 2; pointer-events: none; }
.fg { z-index: 3; pointer-events: none; user-select: none; }
.fx { width: 2000px; height: 1400px; z-index: 1; pointer-events: none; } /* under the movers: people walk in front of the fountain */
.parts { width: 2000px; height: 1400px; z-index: 4; pointer-events: none; }
.hit { width: 2000px; height: 1400px; z-index: 5; }
.labels { width: 2000px; height: 1400px; z-index: 6; pointer-events: none; }

/* movers */
.mover {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  will-change: transform, opacity;
}
.mover img { display: block; position: absolute; left: 0; top: 0; }

/* swaying parts (crane load, tree crowns), see tools/cut_parts.py */
.part {
  position: absolute; display: block; user-select: none; -webkit-user-drag: none;
  animation: sway ease-in-out infinite alternate;
  transition: filter .25s ease;
}
.part-crane { animation-name: swing; }
.part.lit { filter: brightness(1.12); }
@keyframes sway  { from { rotate: -1.1deg; } to { rotate: 1.1deg; } }
@keyframes swing { from { rotate: -1.5deg; } to { rotate: 1.5deg; } }

/* hit polygons */
.hit polygon { fill: transparent; cursor: pointer; outline: none; }
.hit polygon:focus-visible { stroke: var(--sun); stroke-width: 6; stroke-linejoin: round; }

/* ---------- labels (sign-like bubbles) ---------- */
.label {
  position: absolute; left: 0; top: 0;
  transform-origin: 50% 100%;
  translate: -50% -100%;
  display: flex; flex-direction: column; align-items: center;
  opacity: 0; scale: .4; rotate: -6deg;
  transition: opacity .16s ease, scale .16s ease, rotate .16s ease;
}
.label.on {
  opacity: 1; scale: 1; rotate: 0deg;
  transition: opacity .18s ease, scale .5s cubic-bezier(.3, 1.9, .45, 1), rotate .5s cubic-bezier(.3, 1.9, .45, 1);
}
.label-body {
  display: inline-flex; align-items: center; gap: 18px;
  padding: 16px 34px 16px 18px;
  border-radius: 999px;
  background: var(--c, var(--navy));
  color: var(--white);
  font-size: 46px; font-weight: 900; letter-spacing: .04em; line-height: 1;
  white-space: nowrap;
  box-shadow: 0 6px 0 rgba(0,0,0,.14), 0 18px 34px rgba(27, 42, 68, .22);
  border: 5px solid var(--white);
}
.label-icon {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--white); color: var(--c, var(--navy));
  display: grid; place-items: center; flex: none;
}
.label-icon svg { width: 38px; height: 38px; }
.label-tail {
  width: 34px; height: 26px; margin-top: -5px;
  background: var(--c, var(--navy));
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.label.brand .label-body { background: var(--white); color: var(--navy); border-color: var(--navy); }
.label.brand .label-tail { background: var(--navy); }
.label.brand .label-icon { background: var(--navy); }

/* ---------- effects ---------- */
.smoke {
  position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 40%, rgba(255,255,255,.98) 0 34%, rgba(232,238,246,.85) 55%, rgba(232,238,246,0) 72%);
  opacity: 0;
  animation: smoke 5.4s cubic-bezier(.25, .6, .4, 1) infinite;
}
@keyframes smoke {
  0%   { transform: translate(0, 0) scale(.35); opacity: 0; }
  12%  { opacity: .95; }
  70%  { opacity: .55; }
  100% { transform: translate(var(--wx, 70px), -210px) scale(2.1); opacity: 0; }
}

.drop-x { position: absolute; width: 0; height: 0; animation: drop-x 1.25s linear infinite; }
.drop-y {
  position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff 0 30%, #7fd0f5 60%, rgba(127,208,245,0) 72%);
  animation: drop-y 1.25s cubic-bezier(.3, -0.55, .7, .9) infinite;
}
@keyframes drop-x { from { transform: translateX(0); } to { transform: translateX(var(--dx)); } }
@keyframes drop-y { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translateY(var(--dy)); opacity: .2; } }

.ripple {
  position: absolute; width: 120px; height: 34px; margin: -17px 0 0 -60px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.85);
  opacity: 0;
  animation: ripple 2.6s ease-out infinite;
}
@keyframes ripple {
  0%   { transform: scale(.25); opacity: 0; }
  15%  { opacity: .9; }
  100% { transform: scale(1); opacity: 0; }
}

/* ---------- small screens: let the town be wider than the phone and pan sideways ---------- */
@media (max-width: 760px) {
  :root { --header-h: 64px; --footer-h: 64px; }
  .menu { width: 44px; height: 44px; }
  .viewport { overflow-x: auto; overflow-y: hidden; place-items: center start; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .viewport::-webkit-scrollbar { display: none; }
  .copy { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, .smoke, .drop-x, .drop-y, .ripple, .stage-wrap, .part { animation: none !important; }
  .smoke, .ripple, .drop-y { display: none; }
  .label, .label.on { transition: opacity .15s ease; rotate: 0deg; scale: 1; }
}
