/* Calm night palette, after Design_Ref: deep indigo, muted lavender, neon mint/lime accents. */
:root {
  --infrared: #e02d34;
  --seaweed: #03e474;
  --bondi: #0197b4;
  --marine: #0040d4;
  --outer-rim: #321b7d;
  --violaceous: #75207c;
  --paper: #f3e9d8;
  --paper-dim: #c9bfd9;
  --ink: #1d1a33;
  --mint: #03e474;
  --lime: #03e474;
  --red: var(--infrared);
  --pink: #fd98a6;
  --card: rgba(50, 27, 125, 0.86);
  --line: rgba(243, 233, 216, 0.18);
  --head-en: "Josefin Sans", "Helvetica Neue", sans-serif;
  --head-ja: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
  --sans: "Zen Kaku Gothic New", -apple-system, "Hiragino Sans", sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 28% 72%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 44% 12%, #03e474 50%, transparent 51%),
    radial-gradient(1px 1px at 63% 38%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 78% 14%, #e02d34 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 64%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 8% 52%, #0197b4 50%, transparent 51%),
    radial-gradient(1px 1px at 52% 88%, #fff 50%, transparent 51%),
    linear-gradient(180deg, #1b2d6b 0%, #2f6fc0 45%, #7a4fb8 75%, #f2557a 100%);
  background-size: 420px 420px, 380px 380px, 520px 520px, 300px 300px, 460px 460px, 350px 350px, 600px 600px, 280px 280px, 100% 100%;
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
}

#world, #specimens {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#world { touch-action: none; }
#specimens { pointer-events: none; z-index: 7; }

/* Film grain over everything */
.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  z-index: 3;
  opacity: 0.16;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 0.6s steps(3) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-3%, 2%); }
  66% { transform: translate(2%, -3%); }
}

/* Black pill labels, as in the references */
.hud, .shelf-label, .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud {
  position: fixed;
  top: 22px;
  left: 24px;
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: #000;
  color: var(--paper);
  z-index: 4;
}
.blink {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--mint);
  animation: blink 1.2s infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }

/* Game frame: thick blue rounded border with chamfered corners, like the HUD reference */
.frame {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border: 14px solid var(--marine);
  border-radius: 34px;
  box-shadow: inset 0 0 0 4px #6a7cff, inset 0 0 0 7px #2a2fb8;
}
.frame::before, .frame::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 46%;
  height: 22px;
  transform: translateX(-50%);
  background: var(--marine);
  box-shadow: inset 0 -4px 0 #2a2fb8;
}
.frame::before { display: none; }
.frame::after { bottom: -14px; border-radius: 22px 22px 0 0; box-shadow: inset 0 4px 0 #2a2fb8; }

/* Specimen shelf: bottom bar with icon circles and fill bars */
.shelf {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 18px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--marine);
  box-shadow: inset 0 0 0 3px #6a7cff;
}
.shelf-label {
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: #000;
  color: var(--paper);
}
.slots { display: flex; gap: 14px; }
.item { display: flex; align-items: center; gap: 6px; }
.slot {
  width: 52px;
  height: 52px;
  border: 3px solid #6a7cff;
  border-radius: 50%;
  background: #1a0f45;
}
.slot.filled {
  border-color: var(--seaweed);
  background: radial-gradient(circle, #3a2a8a 0%, #1a0f45 100%);
  animation: popin 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.bar {
  position: relative;
  width: 96px;
  height: 18px;
  border-radius: 999px;
  background: #1a0f45;
  box-shadow: inset 0 0 0 2px #2a2fb8;
  overflow: hidden;
}
.bar .fill {
  position: absolute;
  inset: 3px;
  width: 0;
  border-radius: 999px;
  background: var(--c);
  transition: width 0.6s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.item.on .fill { width: calc(100% - 6px); }
.bar .lbl {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--paper);
  font: 700 10px/1 var(--sans);
  letter-spacing: 0.04em;
}
@keyframes popin { from { transform: scale(0.4); } }

/* Story cards: the text is split into several small cards that hang from strings and sway */
.card {
  position: fixed;
  left: 34px;
  top: 0;
  bottom: 100px;
  z-index: 4;
  width: min(380px, calc(100% - 68px));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}
.step, .step > div:not(.bubble) { display: contents; }
.step[hidden], .step > div[hidden] { display: none !important; }
.bubble {
  --hang: 26px;
  position: relative;
  margin-top: var(--hang);
  padding: 14px 18px 12px;
  background: #fff8ec;
  border-radius: 18px;
  box-shadow: 0 6px 0 #0040d4, 0 14px 30px rgba(0, 30, 90, 0.3);
  color: #1d2340;
  pointer-events: auto;
  transform-origin: 50% calc(-1 * var(--hang));
  animation: sway 4.5s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * -1.3s);
}
.bubble:nth-child(even) { margin-left: 22px; }
/* Two strings from the top of each card up to the card above (the top card's strings reach the sky) */
.bubble::before, .bubble::after {
  content: "";
  position: absolute;
  bottom: 100%;
  width: 1.5px;
  height: var(--hang);
  background: linear-gradient(to top, #fff8ec, rgba(255, 248, 236, 0.7));
}
.bubble::before { left: 22%; }
.bubble::after { right: 22%; }
.bubble.top { --hang: 100vh; margin-top: 0; }
.bubble.top::before, .bubble.top::after { background: linear-gradient(to top, rgba(243, 233, 216, 0.85), rgba(243, 233, 216, 0)); }
.bubble.top { transform-origin: 50% -300px; }
.bubble > :last-child { margin-bottom: 0; }
@keyframes sway {
  from { transform: rotate(-1.2deg); }
  to { transform: rotate(1.2deg); }
}
@media (prefers-reduced-motion: reduce) { .bubble { animation: none; } }
.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  padding: 0;
  background: none;
  color: rgba(243, 233, 216, 0.75);
  font: 400 11px/1 var(--mono);
  letter-spacing: 0.22em;
}
h1, h2 {
  margin: 0 0 6px;
  padding-bottom: 10px;
  font-family: var(--head-ja);
  font-weight: 300;
  letter-spacing: 0.12em;
  line-height: 1.35;
  color: #fff;
}
h1::after, h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 1px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.7);
}
html[lang="en"] h1, html[lang="en"] h2 { font-family: var(--head-en); font-weight: 300; text-transform: uppercase; letter-spacing: 0.2em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
p { margin: 0 0 10px; color: rgba(255, 255, 255, 0.88); font-weight: 300; font-size: 14px; line-height: 1.8; }
.hint { color: #ffd58a; font-weight: 500; }
.found {
  font-family: var(--head-ja);
  font-weight: 300;
  font-size: 18px;
  letter-spacing: 0.12em;
  color: #fff;
}
html[lang="en"] .found { font-family: var(--head-en); text-transform: uppercase; letter-spacing: 0.2em; }
.chain { font-family: var(--head-ja); font-weight: 500; font-size: 15px; letter-spacing: 0.08em; color: #ffd58a; }
.todo {
  padding: 8px 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
}

button.next, button.ghost, .investigate {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 11px 18px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: 400 12px/1.4 var(--head-en);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
html[lang="ja"] button.next, html[lang="ja"] button.ghost, html[lang="ja"] .investigate { font-family: var(--head-ja); font-weight: 500; font-size: 13px; letter-spacing: 0.18em; }
button.next:hover, .investigate:hover { background: #fff; color: var(--outer-rim); }
button.ghost { border-color: rgba(255, 255, 255, 0.4); color: rgba(255, 255, 255, 0.7); }
.investigate { background: linear-gradient(90deg, #ff8a3d, #fd4f8e); border: 0; }

/* "Investigate this house" pops up when the UFO is above the house */
.investigate {
  position: fixed;
  left: 50%;
  bottom: 26%;
  z-index: 5;
  width: auto;
  padding: 14px 28px;
  transform: translateX(-50%);
  box-shadow: 0 0 0 6px rgba(3, 228, 116, 0.25), 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(3, 228, 116, 0.08), 0 10px 30px rgba(0, 0, 0, 0.4); } }

/* D-pad, shown only while flying */
.pad {
  position: fixed;
  right: 30px;
  bottom: 100px;
  z-index: 5;
  display: none;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(3, 54px);
  gap: 6px;
}
body.flying .pad { display: grid; }
.pad button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(50, 27, 125, 0.8);
  color: var(--paper);
  font-size: 18px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.pad button:active { background: var(--mint); color: var(--ink); }
.pad [data-pad="up"] { grid-column: 2; grid-row: 1; }
.pad [data-pad="left"] { grid-column: 1; grid-row: 2; }
.pad [data-pad="right"] { grid-column: 3; grid-row: 2; }
.pad [data-pad="down"] { grid-column: 2; grid-row: 3; }

/* Camera shutter flash and "photo taken" toast */
.flash { position: fixed; inset: 0; z-index: 6; pointer-events: none; background: #fff; opacity: 0; }
.flash.on { animation: flash 0.45s ease-out; }
@keyframes flash { 0% { opacity: 0.9; } 100% { opacity: 0; } }
.toast {
  position: fixed;
  top: 104px;
  left: 50%;
  z-index: 6;
  margin: 0;
  padding: 8px 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8a3d, #fd4f8e);
  color: #fff;
  font: 400 12px/1.4 var(--head-en);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateX(-50%);
  pointer-events: none;
}
html[lang="ja"] .toast { font-family: var(--head-ja); font-weight: 500; letter-spacing: 0.18em; }
.toast.on { animation: toast 1.8s ease-out; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  25% { transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Language switching: html[lang] decides which version shows. */
html[lang="ja"] .en,
html[lang="en"] .ja { display: none; }

.lang-switch {
  position: fixed;
  top: 20px;
  right: 22px;
  z-index: 4;
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #000;
}
.lang-switch button {
  padding: 3px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--paper-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }

@media (max-width: 700px) {
  .card {
    left: 12px;
    right: 12px;
    bottom: 70px;
    width: auto;
  }
  .bubble { padding: 11px 14px 10px; --hang: 18px; }
  .bubble:nth-child(even) { margin-left: 14px; }
  .pad { right: 12px; bottom: 12px; grid-template-columns: repeat(3, 50px); grid-template-rows: repeat(3, 50px); }
  .slot { width: 40px; height: 40px; }
  .bar { display: none; }
  .slots { gap: 10px; }
  .shelf { bottom: 8px; gap: 10px; padding: 6px 12px; }
  body.flying .card { right: 140px; }
  .pad { right: 10px; bottom: 70px; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px); gap: 4px; }
  .pad button { font-size: 14px; border-radius: 10px; }
  .frame { border-width: 8px; border-radius: 20px; }
  .frame::before, .frame::after { display: none; }
  .hud { display: none; }
  .investigate { bottom: 48%; }
}
.investigate[hidden] { display: none; }

/* Tracking gauge (chases only) */
.gauge {
  position: fixed;
  top: 64px;
  left: 50%;
  z-index: 5;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--marine);
  box-shadow: inset 0 0 0 3px #6a7cff;
  color: #fff;
  font: 500 12px/1 var(--head-ja);
  letter-spacing: 0.12em;
}
body.chasing .gauge { display: flex; }
.g-bar { position: relative; width: 220px; height: 14px; border-radius: 999px; background: #1a0f45; overflow: hidden; }
.g-fill { position: absolute; inset: 2px auto 2px 2px; width: calc((100% - 4px) * var(--p, 0)); border-radius: 999px; background: linear-gradient(90deg, #ff8a3d, #fd4f8e); }
.gauge.locked .g-fill { background: linear-gradient(90deg, #03e474, #9bff6c); }

/* Info card: hangs from strings on the right */
.infocard {
  --hang: 120px;
  position: fixed;
  top: var(--hang);
  right: 40px;
  z-index: 6;
  width: min(320px, calc(100% - 80px));
  padding: 16px 18px 14px;
  background: linear-gradient(160deg, #0f5a8a 0%, #0040d4 100%);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
  color: #fff;
  transform-origin: 50% calc(-1 * var(--hang));
  animation: sway 4s ease-in-out infinite alternate;
}
.infocard.fun { background: linear-gradient(160deg, #75207c 0%, #b0338c 100%); }
.infocard[hidden] { display: none; }
.infocard.drop { animation: drop 0.6s cubic-bezier(0.3, 1.5, 0.5, 1), sway 4s ease-in-out 0.6s infinite alternate; }
@keyframes drop { from { transform: translateY(-140%) rotate(-4deg); } }
.infocard::before, .infocard::after {
  content: "";
  position: absolute;
  bottom: 100%;
  width: 1.5px;
  height: var(--hang);
  background: linear-gradient(to top, rgba(243, 233, 216, 0.85), rgba(243, 233, 216, 0));
}
.infocard::before { left: 22%; }
.infocard::after { right: 22%; }
.info-title { font-size: 17px; }
.info-body { font-size: 13.5px; }
.info-src { margin: 0; font-size: 11px; }
.info-src a { display: block; color: rgba(255, 255, 255, 0.75); }
.info-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 20px;
  cursor: pointer;
}
.found-label { background: var(--seaweed) !important; color: var(--ink) !important; }

/* Underwater tint */
body.underwater #world { filter: saturate(1.1) hue-rotate(-8deg); }
body.underwater .frame { box-shadow: inset 0 0 0 4px #6a7cff, inset 0 0 0 7px #2a2fb8, inset 0 0 120px rgba(20, 120, 220, 0.45); }

@media (max-width: 700px) {
  .infocard { --hang: 70px; right: 12px; width: calc(100% - 24px); }
  .g-bar { width: 120px; }
  .gauge { top: 60px; }
}

/* ---- Pop theme for the hanging story cards (cream paper, dark ink, bright accents) ---- */
.card .eyebrow { color: #0040d4; font-weight: 700; }
.card h1, .card h2 { color: #1d2340; font-weight: 500; }
.card h1::after, .card h2::after { background: #e02d34; height: 3px; border-radius: 3px; width: 40px; }
.card p { color: #2c3150; font-weight: 400; }
.card .hint { color: #e02d34; font-weight: 700; }
.card .found { color: #0040d4; font-weight: 700; }
.card .chain { color: #0197b4; font-weight: 700; }
.card .todo { border-left-color: #e02d34; background: #ffe9e0; color: #2c3150; }
.card button.next {
  border: 0;
  background: #0040d4;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 0 #002a8f;
}
.card button.next:hover { background: #1a5cff; color: #fff; }
.card button.next:active { transform: translateY(2px); box-shadow: 0 2px 0 #002a8f; }
.card button.ghost { border: 2px solid #c9cfe6; color: #4a5070; }
.infocard { background: #e9f6ff; color: #1d2340; box-shadow: 0 6px 0 #0197b4, 0 14px 30px rgba(0, 30, 90, 0.3); }
.infocard.fun { background: #ffeef3; box-shadow: 0 6px 0 #e02d34, 0 14px 30px rgba(0, 30, 90, 0.3); }
.infocard .eyebrow { color: #0197b4; font-weight: 700; }
.infocard h2 { color: #1d2340; font-weight: 600; }
.infocard h2::after { background: #0197b4; height: 3px; border-radius: 3px; width: 40px; }
.infocard p { color: #2c3150; font-weight: 400; }
.infocard .info-src a { color: #0040d4; }
.infocard .info-close { color: #4a5070; }
.infocard::before, .infocard::after { background: linear-gradient(to top, #e9f6ff, rgba(233, 246, 255, 0)); }
.found-label { white-space: nowrap; }

/* ---- Title screen: retro-futuristic transmission, old video game feel ---- */
:root { --neon: #8dff3a; }
.title {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(ellipse at 50% 45%, #0d1a0a 0%, #000 70%);
  color: var(--neon);
  font-family: "DotGothic16", var(--mono);
  text-align: center;
  transition: opacity 0.9s ease, filter 0.9s ease;
}
.title.gone { opacity: 0; filter: blur(6px) brightness(2); pointer-events: none; }
.scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(141, 255, 58, 0.06) 0 1px, transparent 1px 3px);
  animation: flicker 3s infinite steps(1);
}
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: 0.75; } 48% { opacity: 1; } 82% { opacity: 0.85; } }
.corner { position: absolute; width: 26px; height: 26px; border: 4px solid var(--neon); }
.corner.tl { top: 28px; left: 28px; border-right: 0; border-bottom: 0; }
.corner.tr { top: 28px; right: 28px; border-left: 0; border-bottom: 0; }
.corner.bl { bottom: 28px; left: 28px; border-right: 0; border-top: 0; }
.corner.br { bottom: 28px; right: 28px; border-left: 0; border-top: 0; }
.globe { width: min(34vh, 60vw); height: auto; overflow: visible; filter: drop-shadow(0 0 6px rgba(141, 255, 58, 0.6)); }
.globe circle, .globe ellipse, .globe line { fill: none; stroke: var(--neon); stroke-width: 1.4; }
.globe .spin ellipse { animation: meridian 6s linear infinite; transform-origin: 0 0; }
.globe .spin ellipse:nth-child(2) { animation-delay: -1.5s; }
.globe .spin ellipse:nth-child(3) { animation-delay: -3s; }
.globe .spin ellipse:nth-child(4) { animation-delay: -4.5s; }
@keyframes meridian { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
.globe .ping { fill: var(--neon); animation: ping 1.4s ease-out infinite; transform-origin: 58px -34px; }
@keyframes ping { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(3.5); } }
.glyphs { letter-spacing: 0.6em; font-size: 15px; opacity: 0.7; }
.t-logo {
  margin: 0;
  font: 400 clamp(64px, 12vw, 120px)/1 "Audiowide", sans-serif;
  letter-spacing: 0.08em;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(141, 255, 58, 0.7), 3px 0 0 rgba(255, 60, 120, 0.5), -3px 0 0 rgba(60, 200, 255, 0.5);
}
.t-logo::after { display: none; }
.t-line { margin: 0; color: var(--neon); font-size: clamp(13px, 2vw, 17px); letter-spacing: 0.12em; opacity: 0; }
.t-line.l1 { animation: type 0.1s 0.3s forwards, blinkTxt 1s 0.3s 3; }
.t-line.l2 { animation: type 0.1s 1.4s forwards; }
.t-line.l3 { animation: type 0.1s 2.6s forwards; }
@keyframes type { to { opacity: 1; } }
@keyframes blinkTxt { 50% { opacity: 0.2; } }
.press {
  margin-top: 18px;
  padding: 10px 28px;
  border: 2px solid var(--neon);
  border-radius: 0;
  background: transparent;
  color: var(--neon);
  font: 400 18px/1 "Audiowide", sans-serif;
  letter-spacing: 0.25em;
  cursor: pointer;
  opacity: 0;
  animation: type 0.1s 3.6s forwards, blinkTxt 1.1s 3.8s infinite steps(1);
}
.press:hover { background: var(--neon); color: #000; animation: none; opacity: 1; }
.t-foot { position: absolute; bottom: 40px; margin: 0; color: rgba(141, 255, 58, 0.5); font-size: 11px; letter-spacing: 0.2em; }
@media (prefers-reduced-motion: reduce) {
  .scan, .globe .spin ellipse, .globe .ping, .press { animation: none; }
  .t-line, .press { opacity: 1; animation: none; }
}
/* Hide the game HUD under the title */
body.titling .card, body.titling .shelf, body.titling .hud, body.titling .lang-switch { visibility: hidden; }
@media (max-width: 700px) {
  .glyphs { letter-spacing: 0.3em; font-size: 12px; }
  .t-foot { bottom: 64px; padding: 0 40px; font-size: 10px; }
}

/* ==== Ship console theme: black space, neon green lines, pixel type (matches the title) ==== */
html, body { background: #000 !important; }
.grain { opacity: 0.08; }
.frame {
  border: 2px solid rgba(141, 255, 58, 0.55);
  border-radius: 0;
  inset: 14px;
  box-shadow: none;
}
.frame::before, .frame::after { display: none; }
body::before, body::after {
  content: "";
  position: fixed;
  z-index: 3;
  width: 26px;
  height: 26px;
  border: 4px solid var(--neon);
  pointer-events: none;
}
body::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
body::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

.hud, .lang-switch, .shelf, .gauge {
  background: #000 !important;
  border: 1.5px solid var(--neon);
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--neon) !important;
  font-family: "DotGothic16", var(--mono) !important;
}
.hud { padding: 5px 12px; }
.blink { background: var(--neon); border-radius: 0; }
.lang-switch button { color: rgba(141, 255, 58, 0.6); border-radius: 0; font-family: "DotGothic16", var(--mono); }
.lang-switch button[aria-pressed="true"] { background: var(--neon); color: #000; }
.shelf { padding: 8px 14px; }
.shelf-label { background: transparent !important; color: var(--neon) !important; border: 1px solid var(--neon); border-radius: 0 !important; }
.found-label { background: var(--neon) !important; color: #000 !important; }
.slot { border: 1.5px solid rgba(141, 255, 58, 0.5); border-radius: 0; background: #000; }
.slot.filled { border-color: var(--neon); background: #071a04; }
.bar { border-radius: 0; background: #000; box-shadow: inset 0 0 0 1px rgba(141, 255, 58, 0.5); }
.bar .fill { border-radius: 0; background: var(--neon) !important; }
.bar .lbl { color: var(--neon); font-family: "DotGothic16", var(--mono); mix-blend-mode: difference; }
.g-bar { border-radius: 0; background: #000; box-shadow: inset 0 0 0 1px rgba(141, 255, 58, 0.5); }
.g-fill, .gauge.locked .g-fill { border-radius: 0; background: var(--neon) !important; }
.gauge:not(.locked) .g-fill { background: #ff3d6e !important; }

/* Story cards and the info card: black console panels hanging on green wires */
.bubble, .infocard, .infocard.fun {
  background: rgba(0, 0, 0, 0.88) !important;
  border: 1.5px solid var(--neon);
  border-radius: 0 !important;
  box-shadow: 4px 4px 0 rgba(141, 255, 58, 0.35) !important;
  color: var(--neon) !important;
}
.bubble::before, .bubble::after, .infocard::before, .infocard::after {
  width: 1px;
  background: linear-gradient(to top, var(--neon), rgba(141, 255, 58, 0)) !important;
}
.card .eyebrow, .infocard .eyebrow { color: rgba(141, 255, 58, 0.7) !important; font-family: "DotGothic16", var(--mono); letter-spacing: 0.2em; }
.card h1, .card h2, .infocard h2 { color: var(--neon) !important; font-family: "DotGothic16", var(--mono) !important; font-weight: 400 !important; letter-spacing: 0.08em; text-transform: none; }
html[lang="en"] .card h1, html[lang="en"] .card h2 { font-family: "Audiowide", sans-serif !important; letter-spacing: 0.06em; }
.card h1::after, .card h2::after, .infocard h2::after { background: var(--neon) !important; height: 2px; border-radius: 0; }
.card p, .infocard p { color: #d6ffc0 !important; font-family: "DotGothic16", var(--sans); font-size: 14px; line-height: 1.8; letter-spacing: 0.04em; }
.card .hint { color: #fff36b !important; }
.card .found { color: var(--neon) !important; font-family: "DotGothic16", var(--mono) !important; font-size: 18px; }
.card .chain { color: #4fd1ff !important; font-family: "DotGothic16", var(--mono) !important; }
.card .todo { background: transparent !important; border-left: 2px solid #ff3d6e !important; color: #ffd0da !important; }
.infocard .info-src a { color: #4fd1ff !important; }
.infocard .info-close { color: var(--neon) !important; }
.infocard.fun { border-color: #ff3d6e; box-shadow: 4px 4px 0 rgba(255, 61, 110, 0.4) !important; }

.card button.next, .investigate, .press {
  background: transparent !important;
  border: 1.5px solid var(--neon) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: var(--neon) !important;
  font: 400 14px/1.3 "DotGothic16", var(--mono) !important;
  letter-spacing: 0.18em !important;
  text-transform: uppercase;
}
.card button.next:hover, .investigate:hover { background: var(--neon) !important; color: #000 !important; }
.card button.ghost { border-radius: 0 !important; border: 1px solid rgba(141, 255, 58, 0.4) !important; color: rgba(141, 255, 58, 0.7) !important; font-family: "DotGothic16", var(--mono); }
.investigate { background: #000 !important; animation: none; }
.pad button { background: #000 !important; border: 1.5px solid var(--neon); border-radius: 0 !important; color: var(--neon); }
.pad button:active { background: var(--neon) !important; color: #000; }
.toast { background: var(--neon) !important; color: #000 !important; border-radius: 0 !important; font-family: "DotGothic16", var(--mono) !important; }
.flash { background: var(--neon); }

/* Patrol car warning */
.warn {
  position: fixed;
  top: 112px;
  left: 50%;
  z-index: 8;
  margin: 0;
  padding: 10px 18px;
  transform: translateX(-50%);
  border: 2px solid #ff2a3a;
  background: #000;
  color: #ff2a3a;
  font: 400 16px/1.3 "DotGothic16", monospace;
  letter-spacing: 0.1em;
  animation: blinkTxt 0.5s steps(1) infinite;
}
.warn[hidden] { display: none; }
.warn .w-safe, .warn .w-caught { display: none; }
.warn.safe { border-color: var(--neon); color: var(--neon); animation: none; }
.warn.safe .w-on { display: none; }
.warn.safe .w-safe { display: inline; }
.warn.caught .w-on, .warn.caught .w-safe { display: none; }
.warn.caught .w-caught { display: inline; }
.warn.caught { background: #ff2a3a; color: #000; }

/* Leader line from a note to its object */
.leader { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; overflow: visible; }
.leader line { stroke: var(--neon); stroke-width: 1.6; filter: drop-shadow(0 0 1px #000) drop-shadow(0 0 1px #000); }
.leader circle { fill: none; stroke: var(--neon); stroke-width: 1.5; }
/* Draggable note: once moved, it no longer hangs from strings */
.infocard { cursor: grab; touch-action: none; }
.infocard.dragging { cursor: grabbing; animation: none !important; transform: none !important; }
.infocard.dragging::before, .infocard.dragging::after { display: none; }
/* The top card no longer hangs from long strings that cross the whole screen */
.bubble.top::before, .bubble.top::after { display: none !important; }
.bubble.top { transform-origin: 50% -40px; }

/* CO2 meter during truck chases */
.co2 {
  position: fixed;
  top: 112px;
  right: 30px;
  z-index: 5;
  width: 240px;
  padding: 10px 14px;
  border: 1.5px solid var(--neon);
  background: #000;
  color: var(--neon);
  font-family: "DotGothic16", monospace;
}
.co2[hidden] { display: none; }
.co2 p { margin: 0 0 4px; color: var(--neon) !important; font-size: 12px; }
.co2-title { letter-spacing: 0.2em; opacity: 0.8; }
.co2-route { color: #d6ffc0 !important; }
.co2-km { font-size: 22px !important; }
.co2-g b { font-size: 22px; color: #fff36b; font-weight: 400; }
.co2-note { opacity: 0.6; font-size: 10px !important; }
@media (max-width: 700px) { .co2 { top: auto; bottom: 230px; right: 10px; width: 180px; } }

/* Intro typing: cards wait hidden until their turn */
.bubble.pending { visibility: hidden; }
.step[data-step="start"] .bubble { transition: opacity 0.3s; }

/* Long intro: let the column scroll instead of running off the top of the screen */
.card { overflow-y: auto; overflow-x: visible; scrollbar-width: none; padding-top: 60px; }
.card::-webkit-scrollbar { display: none; }
.card { justify-content: flex-start; }
.card > .step:not([hidden]) > .bubble:first-child, .card > .step:not([hidden]) > :first-child { margin-top: auto; }

/* Game title */
.t-logo { font-size: clamp(36px, 7vw, 76px) !important; letter-spacing: 0.06em !important; }
.t-sub { margin: -4px 0 6px; color: var(--neon); font: 400 clamp(14px, 2.2vw, 20px)/1 "DotGothic16", monospace; letter-spacing: 0.5em; }
@media (max-width: 700px) { .t-logo { font-size: 30px !important; } }

/* Oyster identity clues */
.card .clue { color: #fff36b !important; border-top: 1px dashed rgba(141, 255, 58, 0.4); padding-top: 6px; margin-top: 6px; }

/* ---- Mission title card (anime episode-title style, shown once after PRESS START) ---- */
.mission {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 24px;
  background: #000;
  color: var(--neon);
  font-family: "DotGothic16", var(--mono);
  text-align: center;
  cursor: pointer;
  animation: missionIn 0.35s ease-out;
}
.mission[hidden] { display: none; }
.mission.gone { animation: missionOut 0.45s ease-in forwards; pointer-events: none; }
@keyframes missionIn { from { opacity: 0; } }
@keyframes missionOut { to { opacity: 0; filter: blur(6px) brightness(2); } }
.mission::before, .mission::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 10px;
  background: repeating-linear-gradient(90deg, var(--infrared) 0 28px, transparent 28px 40px);
  animation: stripes 1.2s linear infinite;
}
.mission::before { top: 14%; }
.mission::after { bottom: 14%; animation-direction: reverse; }
@keyframes stripes { to { background-position: 40px 0; } }
.m-eyebrow { margin: 0; font-size: clamp(12px, 1.8vw, 16px); letter-spacing: 0.3em; opacity: 0; animation: type 0.1s 0.25s forwards; }
.m-title {
  margin: 0;
  font: 900 clamp(34px, 7.2vw, 88px)/1.15 var(--head-ja);
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 5px 5px 0 var(--infrared), -4px -4px 0 var(--marine), 0 0 24px rgba(141, 255, 58, 0.45);
  transform: scale(2.4);
  opacity: 0;
  animation: slam 0.42s 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
.m-title::after { display: none; }
html[lang="en"] .m-title { font-family: "Audiowide", var(--head-en); font-weight: 400; }
@keyframes slam { to { transform: scale(1); opacity: 1; } }
.m-sub { margin: 6px 0 0; max-width: 640px; font-size: clamp(13px, 2vw, 18px); letter-spacing: 0.08em; opacity: 0; animation: type 0.1s 1.0s forwards; }
.m-goal { margin: 0; padding: 6px 16px; border: 1px solid var(--neon); font-size: clamp(11px, 1.6vw, 14px); letter-spacing: 0.2em; opacity: 0; animation: type 0.1s 1.4s forwards; }
.m-skip { position: absolute; bottom: 40px; margin: 0; font-size: 11px; letter-spacing: 0.2em; opacity: 0; animation: type 0.1s 1.8s forwards; color: rgba(141, 255, 58, 0.5); }
@media (prefers-reduced-motion: reduce) {
  .mission::before, .mission::after { animation: none; }
  .m-eyebrow, .m-title, .m-sub, .m-goal, .m-skip { opacity: 1; animation: none; transform: none; }
}
/* Goal line inside the intro story card */
.card .todo.goal { border-left: 3px solid #e02d34; background: #ffe9e0; color: #1d2340; font-size: 13px; font-weight: 700; }

/* ---- Progress bar: the journey as a row of stops across the top ---- */
.progress {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 4;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: #000;
  max-width: calc(100% - 420px);
}
body.titling .progress { visibility: hidden; }
.p-list { display: flex; align-items: center; gap: 0; margin: 0; padding: 0; list-style: none; }
.p-list li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 54px;
  font: 500 10px/1 var(--head-ja);
  letter-spacing: 0.04em;
  color: var(--paper-dim);
}
html[lang="en"] .p-list li { width: 68px; font-family: var(--mono); font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.p-list li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: #3a3560;
}
.p-list li:first-child::before { display: none; }
.p-list li.done::before, .p-list li.now::before { background: var(--mint); }
.p-dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #2a2550;
  box-shadow: inset 0 0 0 2px #3a3560;
  transition: background 0.4s, box-shadow 0.4s;
}
.p-list li.done .p-dot { background: var(--mint); box-shadow: inset 0 0 0 2px var(--mint); }
.p-list li.now .p-dot { background: #fff; box-shadow: 0 0 0 3px var(--mint), 0 0 14px var(--mint); animation: blink 1.2s infinite; }
.p-lbl { margin-top: 5px; white-space: nowrap; opacity: 0.75; }
.p-list li.now .p-lbl { color: #fff; opacity: 1; font-weight: 700; }
.p-list li.done .p-lbl { color: var(--mint); }
@media (max-width: 900px) {
  .progress { top: auto; bottom: 86px; max-width: calc(100% - 24px); padding: 5px 10px; }
  .p-list li { width: 22px; }
  .p-lbl { display: none; }
  .p-list li.now .p-lbl { display: block; position: absolute; top: 14px; }
}

/* ---- Stuck? help bubble and the nudged button ---- */
.card .bubble.help { background: #fff6c8; box-shadow: 0 6px 0 #e0a800, 0 14px 30px rgba(0, 30, 90, 0.3); }
.card .bubble.help::before, .card .bubble.help::after { background: linear-gradient(to top, #fff6c8, rgba(255, 246, 200, 0)); }
.card .bubble.help .eyebrow { color: #b87a00; }
.card .bubble.help .help-text { color: #1d2340; font-weight: 700; margin: 4px 0 0; }
.card .bubble.help button.guide { margin-top: 10px; }
.nudge { animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(255, 216, 77, 0.55), 0 10px 30px rgba(0, 0, 0, 0.4); } }

/* ---- Sign reading tooltip (English version only) ---- */
.signtip {
  position: fixed;
  z-index: 9;
  max-width: 260px;
  padding: 7px 11px 8px;
  border-radius: 10px;
  background: #fff6c8;
  color: #1d2340;
  box-shadow: 0 4px 0 #e0a800, 0 10px 24px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.45;
}
.signtip[hidden] { display: none; }
.signtip b { display: block; font: 700 15px/1.3 var(--head-ja); }
.signtip .s-ro { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em; color: #7a5a00; }
.signtip .s-en { display: block; font-weight: 500; }

/* ---- Sound on/off (next to the language switch) ---- */
.lang-switch .mute { margin-left: 2px; border-left: 1px solid rgba(243, 233, 216, 0.25); border-radius: 0 999px 999px 0; padding: 3px 11px 3px 12px; color: var(--paper); }
.lang-switch .mute[aria-pressed="true"] { color: var(--paper-dim); text-decoration: line-through; background: transparent; }

/* ---- Continue from where you left off (title screen) ---- */
.press.resume { margin-top: 8px; animation-delay: 3.8s, 4s; }
.press.resume[hidden] { display: none; }

/* ---- Epilogue: sources and the intercepted calendar ---- */
.card .src { margin: -2px 0 0; font-size: 11px !important; line-height: 1.5 !important; }
.card .src a { display: block; color: #4fd1ff; text-decoration: none; }
.card .src a:hover { text-decoration: underline; }
.card .events { margin: 0; padding: 0; list-style: none; }
.card .events li { margin: 0 0 8px; padding-left: 10px; border-left: 2px solid #4fd1ff; }
.card .events li.past { opacity: 0.5; border-left-color: #666; }
.card .events .ev-date { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; color: #fff36b; }
.card .events .ev-name { display: block; font-size: 13px; color: #d6ffc0; }
.card .events .ev-meta { display: block; font-size: 11px; color: rgba(214, 255, 192, 0.75); }
.card .events a { color: #4fd1ff; text-decoration: none; font-size: 11px; }
