:root {
  /* Fonts from Google Fonts: Space Mono, IBM Plex Mono, Spline Sans Mono */
  --abyss: #031521;
  --kelp: #0B3545;
  --cyan: #78F2E7;
  --lavender: #B8A7FF;
  --pearl: #DDFCF5;
  --coral: #FF8FA3;
  --gold: #F6D27A;
  --glass: rgba(221,252,245,0.08);
  --cyan-glass: rgba(120,242,231,0.16);
  --lav-glass: rgba(184,167,255,0.18);
}

* { box-sizing: border-box; }

html {
  background: var(--abyss);
  color: var(--pearl);
  font-family: "Spline Sans Mono", monospace;
}

body {
  margin: 0;
  min-height: 300vh;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse at 48% 102%, rgba(11,53,69,0.95) 0%, rgba(3,21,33,0.15) 43%, transparent 66%),
    radial-gradient(circle at 18% -5%, rgba(184,167,255,0.25), transparent 31%),
    radial-gradient(circle at 84% 4%, rgba(120,242,231,0.18), transparent 34%),
    linear-gradient(180deg, #031521 0%, #041b28 42%, #031521 100%);
}

.village-map {
  position: relative;
  min-height: 300vh;
  isolation: isolate;
}

.ocean-haze,
.plankton-field {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ocean-haze {
  z-index: -3;
  background:
    repeating-linear-gradient(111deg, rgba(221,252,245,0.022) 0 1px, transparent 1px 62px),
    radial-gradient(ellipse at 50% 78%, rgba(11,53,69,0.62), transparent 52%);
  filter: blur(0.2px);
}

.plankton-field {
  z-index: -2;
}

.plankton {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold);
  opacity: var(--o, 0.75);
  transform: translate3d(var(--tx, 0), var(--ty, 0), 0);
  transition: transform 900ms cubic-bezier(.2,1.4,.33,1), opacity 500ms ease;
}

.coordinate-mark {
  position: fixed;
  top: 7vh;
  left: 8vw;
  z-index: 8;
  display: grid;
  gap: 0.4rem;
  font-family: "Space Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--pearl);
  text-shadow: 0 0 22px rgba(120,242,231,0.45);
  transition: transform 700ms cubic-bezier(.22,1.45,.28,1), opacity 400ms ease;
}

.coordinate-mark .glyph {
  color: var(--gold);
  font-size: 1.1rem;
  text-shadow: 0 0 18px var(--gold);
}

.coordinate-mark small {
  max-width: 22rem;
  color: rgba(221,252,245,0.62);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.route-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 300vh;
  pointer-events: none;
  overflow: visible;
}

.route-path,
.route-ghost {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route-ghost {
  stroke: rgba(221,252,245,0.08);
  stroke-width: 2;
  stroke-dasharray: 10 18;
}

.route-path {
  stroke: url(#none);
  stroke: var(--cyan);
  stroke-width: 3;
  filter: url(#routeGlow);
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0.95;
}

.scene {
  position: relative;
  min-height: 100vh;
  z-index: 2;
}

.glass-module,
.final-name {
  position: absolute;
  left: var(--x, 10vw);
  top: var(--y, 20vh);
  width: min(38rem, 38vw);
  min-height: 17rem;
  padding: 1.35rem;
  border: 1px solid rgba(120,242,231,0.36);
  border-radius: 2rem;
  background:
    linear-gradient(135deg, rgba(221,252,245,0.12), rgba(11,53,69,0.2) 45%, rgba(184,167,255,0.08)),
    rgba(3,21,33,0.34);
  box-shadow:
    inset 0 0 44px rgba(221,252,245,0.055),
    inset 0 0 12px rgba(120,242,231,0.10),
    0 28px 90px rgba(0,0,0,0.36),
    0 0 0 1px rgba(221,252,245,0.04);
  backdrop-filter: blur(18px) saturate(140%);
  transform: translate3d(0, var(--d, 0), 0) rotate(var(--r, 0deg)) scale(0.94);
  opacity: 0.58;
  overflow: hidden;
  transition: transform 900ms cubic-bezier(.18,1.55,.22,1), opacity 700ms ease, border-color 700ms ease, box-shadow 700ms ease;
}

.glass-module::before,
.final-name::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 4%, rgba(120,242,231,0.34), transparent 26%, rgba(184,167,255,0.22), transparent 62%, rgba(246,210,122,0.18));
  opacity: 0.32;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  padding: 1px;
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.glass-module::after,
.final-name::after {
  content: "";
  position: absolute;
  width: 16rem;
  height: 16rem;
  right: -8rem;
  top: -7rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(184,167,255,0.16), rgba(120,242,231,0.08) 35%, transparent 68%);
  animation: breathe 8s ease-in-out infinite;
}

.glass-module.active,
.glass-module.in-view,
.final-name.in-view {
  opacity: 1;
  border-color: rgba(120,242,231,0.7);
  transform: translate3d(0, calc(var(--d, 0px) * .25), 0) rotate(calc(var(--r, 0deg) * .42)) scale(1.015);
  box-shadow:
    inset 0 0 55px rgba(221,252,245,0.09),
    0 34px 110px rgba(0,0,0,0.42),
    0 0 42px rgba(120,242,231,0.17),
    0 0 38px rgba(184,167,255,0.10);
}

.module-label {
  position: relative;
  z-index: 1;
  font-family: "Space Mono", monospace;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--gold);
  text-transform: uppercase;
}

h1,
h2 {
  position: relative;
  z-index: 1;
  margin: 1.15rem 0 1rem;
  max-width: 11ch;
  font-family: "IBM Plex Mono", monospace;
  font-weight: 300;
  font-size: clamp(2.2rem, 4.8vw, 5.8rem);
  line-height: 0.94;
  letter-spacing: -0.07em;
  color: var(--pearl);
}

h2 { font-size: clamp(1.75rem, 3.7vw, 4.5rem); }

p {
  position: relative;
  z-index: 1;
  max-width: 28rem;
  margin: 0;
  color: rgba(221,252,245,0.76);
  font-size: clamp(0.86rem, 1.15vw, 1rem);
  line-height: 1.8;
}

.module-art {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 8rem;
  margin-top: 1rem;
  overflow: visible;
}

.module-art path,
.module-art ellipse {
  fill: none;
  stroke: rgba(120,242,231,0.58);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.module-art circle {
  fill: var(--gold);
  filter: drop-shadow(0 0 7px rgba(246,210,122,0.9));
}

.tide-gate { width: min(44rem, 43vw); }
.lantern-meadow { width: min(31rem, 34vw); min-height: 20rem; }
.small { width: min(23rem, 27vw); min-height: 12rem; }
.star-orchard { width: min(40rem, 43vw); }
.moonwell { width: min(35rem, 36vw); min-height: 21rem; }
.far-pier { width: min(44rem, 48vw); min-height: 21rem; }

.shrine { border-color: rgba(255,143,163,0.35); }
.shrine h2, .bellhouse h2 { max-width: 9ch; }
.shrine::after { background: radial-gradient(circle, rgba(255,143,163,0.17), transparent 68%); }

.arrival-ring {
  position: absolute;
  left: 51vw;
  top: 40vh;
  width: min(34rem, 42vw);
  aspect-ratio: 1;
  border: 1px solid rgba(221,252,245,0.13);
  border-radius: 50%;
  box-shadow: inset 0 0 70px rgba(120,242,231,0.06), 0 0 45px rgba(184,167,255,0.08);
  animation: slowTurn 28s linear infinite;
}

.arrival-ring span {
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 18px var(--gold);
}

.arrival-ring span:nth-child(1) { left: 50%; top: -0.25rem; }
.arrival-ring span:nth-child(2) { right: 8%; top: 19%; background: var(--cyan); box-shadow: 0 0 18px var(--cyan); }
.arrival-ring span:nth-child(3) { right: -0.2rem; top: 58%; background: var(--lavender); box-shadow: 0 0 18px var(--lavender); }
.arrival-ring span:nth-child(4) { left: 35%; bottom: -0.25rem; }
.arrival-ring span:nth-child(5) { left: 3%; top: 62%; background: var(--coral); box-shadow: 0 0 18px var(--coral); }
.arrival-ring span:nth-child(6) { left: 12%; top: 18%; background: var(--cyan); box-shadow: 0 0 18px var(--cyan); }

.final-name {
  --x: 53vw;
  --y: 25vh;
  --r: 2deg;
  width: min(34rem, 36vw);
  min-height: 16rem;
  border-color: rgba(246,210,122,0.36);
}

.final-name h2 {
  color: var(--pearl);
  text-shadow: 0 0 30px rgba(246,210,122,0.22), 0 0 48px rgba(255,143,163,0.14);
}

@keyframes breathe {
  0%, 100% { transform: scale(0.92) translate(0,0); opacity: 0.65; }
  50% { transform: scale(1.16) translate(-1rem, 1rem); opacity: 1; }
}

@keyframes slowTurn { to { transform: rotate(360deg); } }

@media (max-width: 820px) {
  body { min-height: 360vh; }
  .village-map { min-height: 360vh; }
  .route-veil { height: 360vh; opacity: 0.55; }
  .coordinate-mark { left: 6vw; top: 4vh; }
  .scene { min-height: 120vh; }
  .glass-module,
  .final-name {
    left: 6vw !important;
    top: var(--mobile-y, var(--y)) !important;
    width: 88vw !important;
    min-height: 14rem;
  }
  .tide-gate { --mobile-y: 19vh; }
  .lantern-meadow { --mobile-y: 57vh; }
  .shrine { --mobile-y: 91vh; }
  .star-orchard { --mobile-y: 12vh; }
  .moonwell { --mobile-y: 52vh; }
  .bellhouse { --mobile-y: 91vh; }
  .far-pier { --mobile-y: 12vh; }
  .final-name { --mobile-y: 58vh; }
  .arrival-ring { left: 20vw; top: 78vh; width: 60vw; }
}
