/* 世界一周新婚旅行 — page chrome. The 3D lives in #gl; everything here sits above it.
   Colours follow waooh.jp: cream paper, ink, the teal of the logo and the orange of its plane. */
:root {
  --cream: #f2f2e9;
  --paper: #faf7ef;
  --ink: #1c1814;
  --ink-dim: rgba(28, 24, 20, 0.62);
  --teal: #4eb2b7;
  --teal-d: #2e8d92;
  --sun: #ffaa15;
  --coral: #e5603b;
  --line: rgba(28, 24, 20, 0.16);
  --hud: #1c1814; /* header tone: flips to light over dark stations */
  --font-ui: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --font-round: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Zen Kaku Gothic New", sans-serif;
  --font-en: "Poppins", "Zen Kaku Gothic New", system-ui, sans-serif;
  --font-mono: "DM Mono", "Menlo", monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
html[data-hud="light"] { --hud: #f6f3ea; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--cream); color: var(--ink); font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased; touch-action: none; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; }

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; outline: none; }

.station-layer { position: fixed; inset: 0; pointer-events: none; }
.station-layer > .station { position: absolute; inset: 0; }
.station-layer > .station[hidden] { display: none; }
.station-layer .interactive { pointer-events: auto; }

/* ---------- header ---------- */
.ui-top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start;
  padding: calc(16px + var(--safe-t)) 22px 0; pointer-events: none; z-index: 20; color: var(--hud); transition: color .4s; }
.ui-top > * { pointer-events: auto; }
.ui-logo { background: var(--paper); border: 0; padding: 7px 10px 5px; border-radius: 8px; cursor: pointer; line-height: 0;
  box-shadow: 0 1px 0 rgba(28,24,20,.08); }
.ui-logo img { width: 172px; height: auto; display: block; }
.ui-logo:disabled { cursor: default; }
.ui-actions { display: flex; gap: 8px; }
.ui-btn { height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid currentColor; background: rgba(250,247,239,.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-family: var(--font-en); font-size: 12px; font-weight: 600; letter-spacing: .04em; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; color: inherit; }
html[data-hud="light"] .ui-btn { background: rgba(20,18,16,.3); }
.ui-btn:focus-visible, .ui-logo:focus-visible, .board__start button:focus-visible, .home__btns a:focus-visible, .home__btns button:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; }
.ui-btn--primary { background: var(--teal); border-color: var(--teal); color: #fff; font-family: var(--font-ui); font-weight: 700; }
html[data-hud="light"] .ui-btn--primary { background: var(--teal); }
.ui-btn--lang .sep { opacity: .4; }
html[lang="ja"] .ui-btn--lang .en, html[lang="en"] .ui-btn--lang .ja { opacity: .4; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.eq i { width: 2px; height: 3px; background: currentColor; border-radius: 1px; }
.ui-btn--sound[aria-pressed="true"] .eq i { animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s !important; } .eq i:nth-child(3) { animation-delay: -.6s !important; } .eq i:nth-child(4) { animation-delay: -.15s !important; }
@keyframes eq { 0%,100% { height: 3px; } 50% { height: 12px; } }

/* ---------- gate (the action that clears a station) ---------- */
.gate { position: fixed; z-index: 15; right: 24px; bottom: calc(24px + var(--safe-b)); max-width: min(360px, calc(100vw - 32px));
  pointer-events: none; transition: opacity .35s, transform .35s; }
.gate[data-state="hidden"] { opacity: 0; transform: translateY(8px); }
.gate__card { background: var(--paper); border-radius: 14px; padding: 12px 16px 12px; color: var(--ink);
  box-shadow: 0 10px 30px rgba(28,24,20,.18), 0 0 0 1px rgba(28,24,20,.06); }
.gate__label { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 9px; }
.gate__icon { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 999px; background: var(--teal); color: #fff;
  font-family: var(--font-en); font-size: 12px; font-weight: 700; }
.gate__progress { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--ink-dim); }
.gate__dots { display: flex; gap: 5px; }
.gate__dots i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid rgba(28,24,20,.3); }
.gate__dots i.on { background: var(--sun); border-color: var(--sun); }
.gate__bar { flex: 1; height: 5px; background: rgba(28,24,20,.1); border-radius: 3px; overflow: hidden; min-width: 120px; }
.gate__bar i { display: block; height: 100%; width: 0; background: var(--sun); transition: width .15s linear; }
.gate__rest b { color: var(--ink); font-size: 14px; }
.gate[data-cleared] .gate__card { box-shadow: 0 10px 30px rgba(28,24,20,.18), 0 0 0 2px var(--teal); }
.gate[data-cleared] .gate__label::after { content: "✓"; color: var(--teal-d); }

.hints { position: fixed; z-index: 14; left: 24px; bottom: calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.hints span { background: rgba(250,247,239,.9); border-radius: 999px; padding: 4px 12px; font-size: 12px; color: var(--ink); width: max-content; box-shadow: 0 0 0 1px rgba(28,24,20,.08); }

.chapter { position: fixed; z-index: 13; left: 24px; top: calc(84px + var(--safe-t)); font-family: var(--font-en); font-weight: 600; font-size: 13px; letter-spacing: .14em;
  color: var(--hud); opacity: .8; pointer-events: none; transition: color .4s; }
.chapter b { color: var(--sun); font-weight: 700; }

.flash { position: fixed; inset: 0; z-index: 30; pointer-events: none; opacity: 0; background: #fffdf6; }
.flash.go { animation: flash .9s ease-out forwards; }
.flash.wipe { background: var(--teal); animation: wipe .9s cubic-bezier(.7,0,.3,1) forwards; }
@keyframes flash { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }
@keyframes wipe { 0% { opacity: 1; clip-path: inset(0 100% 0 0); } 45% { clip-path: inset(0 0 0 0); } 55% { clip-path: inset(0 0 0 0); } 100% { opacity: 1; clip-path: inset(0 0 0 100%); } }

.joystick { position: fixed; z-index: 16; left: 24px; bottom: calc(84px + var(--safe-b)); width: 96px; height: 96px; border-radius: 50%;
  background: rgba(250,247,239,.45); border: 1.5px solid rgba(28,24,20,.25); display: none; pointer-events: auto; touch-action: none; }
.joystick i { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: var(--teal); }
html[data-joystick="on"] .joystick { display: block; }

/* ---------- fallback / about ---------- */
.ui-fallback { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--cream); padding: 24px; }
.ui-fallback[hidden] { display: none; }
.ui-fallback__inner { max-width: 520px; }
.ui-fallback h1 { font-size: 22px; font-family: var(--font-round); } .ui-fallback .detail { color: var(--ink-dim); font-size: 12px; }
.ui-fallback a { color: var(--teal-d); }
.eyebrow { font-family: var(--font-en); font-weight: 600; letter-spacing: .16em; color: var(--teal-d); font-size: 12px; margin: 0 0 8px; }

.ui-about { border: 0; padding: 0; background: transparent; color: var(--ink); max-width: min(560px, calc(100vw - 32px)); }
.ui-about::backdrop { background: rgba(28,24,20,.45); backdrop-filter: blur(4px); }
.ui-about__panel { background: var(--paper); border-radius: 16px; padding: 26px 26px 20px; position: relative; }
.ui-about__panel h2 { font-family: var(--font-round); font-size: 20px; line-height: 1.5; margin: 0 0 12px; }
.ui-about__panel p { font-size: 14px; line-height: 1.85; color: var(--ink-dim); margin: 0 0 12px; }
.ui-about__list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; font-size: 13.5px; }
.ui-about__list b { display: inline-block; width: 64px; font-family: var(--font-en); font-size: 11.5px; letter-spacing: .1em; color: var(--teal-d); }
.ui-about__note { font-size: 12px !important; }
.ui-about__close { position: absolute; right: 12px; top: 10px; background: none; border: 0; font-size: 18px; cursor: pointer; padding: 6px; color: var(--ink); }

.perf { position: fixed; left: 8px; bottom: 8px; z-index: 50; font: 11px/1.4 var(--font-mono); color: #fff; background: rgba(28,24,20,.7); padding: 4px 8px; pointer-events: none; white-space: pre; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; }

/* ---------- 01 DEPARTURE: split-flap board ---------- */
.board { background: radial-gradient(ellipse at 50% 0%, #2a2621 0%, #15130f 70%); color: #f2efe6; display: flex; flex-direction: column; align-items: center;
  padding: calc(96px + var(--safe-t)) 4vw calc(24px + var(--safe-b)); }
.board__head { width: min(1060px, 100%); display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.board__title { font-family: var(--font-en); font-weight: 700; font-size: clamp(20px, 2.6vw, 34px); letter-spacing: .06em; line-height: 1; }
.board__title small { display: block; font-family: var(--font-round); font-weight: 700; font-size: 13px; letter-spacing: .12em; color: var(--sun); margin-top: 8px; }
.board__clock { font-family: var(--font-mono); font-size: clamp(16px, 2vw, 26px); color: var(--sun); text-align: right; line-height: 1.1; }
.board__clock small { display: block; font-size: 11px; letter-spacing: .14em; color: rgba(242,239,230,.55); }
.board__table { width: min(1060px, 100%); border-top: 2px solid rgba(242,239,230,.25); }
.board__cols, .board__row { display: grid; grid-template-columns: 11.4em 1fr 9.5em 7.6em; gap: 0 14px; align-items: center; }
.board__cols { font-size: clamp(13px, 1.45vw, 19px); }
.board__cols span { font-size: 10.5px; }
.board__cols { font-family: var(--font-en); font-weight: 600; letter-spacing: .16em; color: rgba(242,239,230,.5); padding: 7px 0; }
.board__row { padding: 5px 0; border-top: 1px solid rgba(242,239,230,.08); font-family: var(--font-mono); font-size: clamp(13px, 1.45vw, 19px); }
.flap { display: inline-flex; gap: 2px; }
.flap i { display: inline-grid; place-items: center; width: 1.02em; height: 1.45em; background: linear-gradient(#24211d 0 49%, #0f0e0c 49% 51%, #1d1b18 51%);
  border-radius: 2px; font-style: normal; color: #f6f1e4; box-shadow: inset 0 0 0 1px rgba(0,0,0,.4); }
.flap i.spin { animation: flip .09s linear infinite; }
@keyframes flip { 50% { transform: scaleY(.15); } }
.board__ja { font-family: var(--font-round); font-weight: 700; font-size: clamp(12px, 1.25vw, 15px); color: rgba(242,239,230,.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board__st { font-family: var(--font-en); font-weight: 600; font-size: clamp(10.5px, 1.05vw, 13px); letter-spacing: .1em; color: rgba(242,239,230,.45); }
.board__st.ok { color: var(--teal); }
.board__st.go { color: var(--sun); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.board__foot { width: min(1060px, 100%); margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.board__log { font-family: var(--font-mono); font-size: 12px; color: rgba(242,239,230,.5); line-height: 1.6; white-space: pre; min-height: 3.2em; }
.board__start { display: flex; gap: 10px; flex-wrap: wrap; }
.board__start[hidden] { display: none; }
.board__start button { pointer-events: auto; height: 52px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 700; font-size: 15px;
  background: var(--sun); color: var(--ink); display: inline-flex; align-items: center; gap: 10px; }
.board__start button.ghost { background: transparent; color: #f2efe6; box-shadow: inset 0 0 0 1.5px rgba(242,239,230,.5); }
.board__start kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px; }

/* ---------- 02 ROUTE: the postcard beside the globe ---------- */
.card { position: absolute; width: min(330px, 42vw); background: var(--paper); border-radius: 6px; padding: 10px 10px 14px; color: var(--ink);
  box-shadow: 0 18px 40px rgba(28,24,20,.22); transform: rotate(-2.5deg) translateY(10px); opacity: 0; transition: opacity .45s, transform .55s cubic-bezier(.2,.9,.3,1.2); }
.card.on { opacity: 1; transform: rotate(-2.5deg); }
.card img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; border-radius: 3px; }
.card__when { font-family: var(--font-mono); font-size: 12px; color: var(--teal-d); margin: 10px 2px 2px; }
.card__name { font-family: var(--font-round); font-weight: 700; font-size: 21px; margin: 0 2px 6px; }
.card__line { font-size: 13px; line-height: 1.75; margin: 0 2px; color: var(--ink-dim); }
.route-card { right: 5vw; top: 50%; margin-top: -170px; }
.route-tag { position: absolute; font-family: var(--font-en); font-weight: 600; font-size: 11px; letter-spacing: .12em; color: var(--ink); background: var(--paper);
  padding: 3px 8px; border-radius: 999px; transform: translate(-50%, -150%); white-space: nowrap; box-shadow: 0 2px 6px rgba(28,24,20,.15); transition: opacity .3s; }

/* ---------- 04 AFRICA: slides ---------- */
.slides { position: absolute; right: 3vw; top: calc(104px + var(--safe-t)); width: min(460px, 38vw); height: 66vh; }
.slide { position: absolute; width: min(220px, 18vw); background: #fffdf7; padding: 8px 8px 30px; border-radius: 3px; box-shadow: 0 14px 34px rgba(0,0,0,.4);
  opacity: 0; transform: translateY(18px) rotate(var(--r)); transition: opacity .6s, transform .7s cubic-bezier(.2,.9,.3,1.15); }
.slide.on { opacity: 1; transform: rotate(var(--r)); }
.slide img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.slide span { position: absolute; left: 10px; right: 10px; bottom: 7px; font-family: var(--font-round); font-weight: 700; font-size: 12.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.africa-lead { position: absolute; left: 24px; top: calc(118px + var(--safe-t)); max-width: min(420px, 50vw); color: #fff6e8; text-shadow: 0 2px 14px rgba(0,0,0,.45); }
.africa-lead p { margin: 0; font-family: var(--font-round); font-weight: 700; font-size: clamp(18px, 2.2vw, 26px); line-height: 1.55; }
.africa-lead small { display: block; font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em; opacity: .85; margin-top: 8px; }
.clock24 { position: absolute; left: 24px; bottom: calc(96px + var(--safe-b)); font-family: var(--font-mono); font-size: 40px; color: #fff6e8; opacity: .9; text-shadow: 0 2px 12px rgba(0,0,0,.4); }

/* ---------- 05 SOUTH AMERICA: caption ---------- */
.sa-cap { position: absolute; left: 50%; top: calc(104px + var(--safe-t)); transform: translateX(-50%); width: min(560px, calc(100vw - 32px)); text-align: center; color: var(--ink);
  background: rgba(250,247,239,.86); border-radius: 14px; padding: 12px 18px 14px; transition: opacity .4s; opacity: 0; box-shadow: 0 10px 30px rgba(28,24,20,.12); }
.sa-cap .d { font-family: var(--font-mono); font-size: 12px; color: var(--teal-d); }
.sa-cap .n { font-family: var(--font-round); font-weight: 700; font-size: clamp(20px, 2.4vw, 28px); margin: 2px 0 4px; }
.sa-cap .l { font-size: 13.5px; line-height: 1.7; color: var(--ink-dim); }

/* ---------- 06 THE AMERICAS (2D road trip) ---------- */
.station-layer > .station.road { pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding-top: 40px; transition: background .6s; }
.station-layer > .station.road[hidden] { display: none; }
.road canvas { width: min(94vw, 1200px, calc(68vh * 2.1)); height: auto; aspect-ratio: 2.1 / 1; border-radius: 14px; display: block; box-shadow: 0 16px 40px rgba(28,24,20,.2); }
.road__hud { width: min(94vw, 1200px, calc(68vh * 2.1)); display: flex; gap: 24px; align-items: baseline; font-family: var(--font-en); font-weight: 600; font-size: 14px; letter-spacing: .08em; color: var(--ink); }
.road__hud b { color: var(--coral); font-weight: 700; }
.road__hud .where { margin-left: auto; font-family: var(--font-round); letter-spacing: .02em; color: var(--ink-dim); }

/* ---------- 07 HOME: end card ---------- */
.home__card { position: absolute; left: 50%; bottom: calc(6vh + var(--safe-b)); transform: translate(-50%, 14px); width: min(620px, calc(100vw - 32px));
  background: var(--paper); border-radius: 18px; padding: 22px 24px 20px; text-align: center; color: var(--ink); box-shadow: 0 20px 50px rgba(28,24,20,.22);
  opacity: 0; transition: opacity .6s .2s, transform .6s .2s; pointer-events: none; }
.home__card.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.home__tag { font-family: var(--font-en); font-weight: 700; font-size: clamp(28px, 4vw, 44px); letter-spacing: .04em; line-height: 1.05; }
.home__tag small { display: block; font-family: var(--font-round); font-size: 16px; letter-spacing: .14em; color: var(--teal-d); margin-top: 6px; }
.home__facts { display: flex; justify-content: center; gap: 22px; margin: 14px 0 16px; flex-wrap: wrap; }
.home__facts div { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); letter-spacing: .06em; }
.home__facts b { display: block; font-family: var(--font-en); font-weight: 700; font-size: 22px; color: var(--ink); letter-spacing: 0; }
.home__btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.home__btns button, .home__btns a { pointer-events: auto; height: 44px; padding: 0 20px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; text-decoration: none; }
.home__btns .primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.home__note { font-size: 12px; color: var(--ink-dim); margin: 12px 0 0; }
.home__note a { color: var(--teal-d); pointer-events: auto; }
.home__click { position: absolute; inset: 0; pointer-events: auto; cursor: pointer; }
.home__click[hidden] { display: none; }

@media (max-width: 640px) {
  .ui-top { padding: calc(10px + var(--safe-t)) 10px 0; }
  .ui-logo { padding: 5px 7px 3px; }
  .ui-logo img { width: 124px; }
  .ui-btn { height: 30px; padding: 0 9px; font-size: 10.5px; }
  .ui-btn--sound #ui-sound-label { display: none; }
  .gate { right: 10px; left: 10px; bottom: calc(12px + var(--safe-b)); max-width: none; }
  .hints { left: 10px; bottom: calc(108px + var(--safe-b)); }
  .chapter { left: 12px; top: calc(60px + var(--safe-t)); font-size: 11px; }
  .joystick { left: 50%; margin-left: -48px; bottom: calc(118px + var(--safe-b)); }
  .board { padding-top: calc(86px + var(--safe-t)); }
  .board__cols, .board__row { grid-template-columns: 11.2em 1fr 6em; gap: 0 8px; font-size: 10.5px; }
  .board__cols span:nth-child(3), .board__ja { display: none; }
  .board__clock { display: none; }
  .route-card { right: 50%; margin-right: calc(min(330px, 82vw) / -2); width: min(330px, 82vw); top: auto; bottom: calc(150px + var(--safe-b)); margin-top: 0; padding: 8px 8px 10px; }
  html[data-station="route"] .hints { display: none; }
  .route-card img { aspect-ratio: 16 / 7; }
  .route-card .card__line { font-size: 12px; line-height: 1.6; }
  .slides { right: 12px; top: auto; bottom: calc(130px + var(--safe-b)); width: 46vw; height: 36vh; }
  .slide { width: 46vw; left: 0 !important; top: 0 !important; }
  .africa-lead { left: 14px; top: calc(92px + var(--safe-t)); max-width: calc(100vw - 28px); }
  .clock24 { display: none; }
  .road__hud { font-size: 12px; gap: 12px; }
  .road__hud .where { display: none; }
  .station-layer > .station.road { justify-content: flex-start; padding-top: calc(130px + var(--safe-t)); }
  .home__card { padding: 16px 16px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .flash.go, .flash.wipe { animation-duration: .01s; }
  .flap i.spin { animation: none; }
}
