:root {
  --dialog-bg: #0a0f18;
  --field-bg: #0f1622;
  --field-border: #5b6b7c;
  --ok: #5fd39a;
  --err: #ff8a8a;
  --bg: #05070d;
  --text: #eef4fa;
  --muted: #a9b6c4;
  --accent: #00e5ff;
  --panel: rgba(8, 12, 20, 0.62);
  --panel-border: rgba(255, 255, 255, 0.10);
  --on-accent: #021016;
  --lead: #cfd9e3;
  --topbar-fade: rgba(5, 7, 13, .75);
  --chip-bg: rgba(5, 7, 13, .45);
  --chip-on: rgba(255, 255, 255, .14);
  --inset: rgba(255, 255, 255, .05);
  --hero-shadow: 0 2px 24px rgba(0,0,0,.85), 0 0 2px rgba(0,0,0,.6);
  --hero-veil: rgba(3, 5, 10, .72);
  --panel-shadow: 0 20px 60px rgba(0,0,0,.35);
  color-scheme: dark;
  --font: "Space Grotesk", "Zen Kaku Gothic New", system-ui, sans-serif;
}
:root[data-theme="light"] {
  --dialog-bg: #f7fafc;
  --field-bg: #ffffff;
  --field-border: #7a8692;
  --ok: #1d7044;
  --err: #b42318;
  --bg: #eef3f7;
  --text: #0d1620;
  --muted: #45535f;
  --accent: #0a6e7e;
  --panel: rgba(255, 255, 255, 0.74);
  --panel-border: rgba(13, 22, 32, 0.10);
  --on-accent: #ffffff;
  --lead: #24323e;
  --topbar-fade: rgba(238, 243, 247, .85);
  --chip-bg: rgba(255, 255, 255, .6);
  --chip-on: rgba(13, 22, 32, .10);
  --inset: rgba(13, 22, 32, .05);
  --hero-shadow: 0 1px 18px rgba(255,255,255,.95), 0 0 2px rgba(255,255,255,.9);
  --hero-veil: rgba(238, 243, 247, .82);
  --panel-shadow: 0 18px 50px rgba(30, 50, 70, .14);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  transition: background-color .5s, color .5s;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.no-webgl {
  background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 22%, var(--bg)) 0%, var(--bg) 70%) fixed;
}
#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  z-index: 0;
  transition: filter .3s ease, transform .3s ease;
}
/* reading blur (set by tunnel.js once scrolling stops); the slight scale hides the blurred edge */
body.reading #scene { filter: blur(7px); transform: scale(1.03); transition: filter 1.2s ease, transform 1.2s ease; }
body.no-webgl #scene { display: none; }

/* top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 14px;
  padding: 16px clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, var(--topbar-fade), transparent);
}
.brand { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .14em; font-size: 15px; }
.pill {
  font-size: 11px; letter-spacing: .06em; color: var(--muted);
  border: 1px solid var(--panel-border); border-radius: 99px; padding: 3px 10px;
}
.lang-switch {
  margin-left: auto; display: flex; gap: 2px; padding: 3px;
  border: 1px solid var(--panel-border); border-radius: 99px;
  background: var(--chip-bg);
}
.lang-switch button {
  font: inherit; font-size: 12px; line-height: 1; color: var(--muted);
  background: none; border: 0; border-radius: 99px; padding: 6px 10px; cursor: pointer; white-space: nowrap;
  transition: background .2s, color .2s;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--chip-on); color: var(--text); }
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle {
  width: 32px; height: 32px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--panel-border); border-radius: 50%; background: var(--chip-bg);
  color: var(--text); cursor: pointer; padding: 0;
}
.theme-toggle:hover { background: var(--chip-on); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }
.top-cta {
  color: var(--on-accent); background: var(--accent);
  text-decoration: none; font-weight: 600; font-size: 13px;
  padding: 8px 16px; border-radius: 99px; transition: background .6s; white-space: nowrap;
}

/* section rail */
.rail {
  position: fixed; right: clamp(10px, 2vw, 28px); top: 50%; transform: translateY(-50%);
  z-index: 10; display: flex; flex-direction: column; gap: 14px;
}
.rail a {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  color: var(--muted); text-decoration: none; font-size: 12px;
}
.rail a::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid var(--muted); transition: all .3s;
}
.rail a span { opacity: 0; transform: translateX(6px); transition: all .3s; }
.rail a:hover span, .rail a:focus-visible span, .rail a.on span { opacity: 1; transform: none; }
.rail a.on { color: var(--text); }
.rail a.on::after { background: var(--accent); border-color: var(--accent); transform: scale(1.3); }

/* stages */
main { position: relative; z-index: 1; }
.stage {
  min-height: 140vh;
  display: flex; align-items: center;
  padding: 96px clamp(16px, 6vw, 96px);
}
.hero { min-height: 100vh; }
#s6 { min-height: 100vh; }
.panel {
  max-width: 500px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: clamp(22px, 3vw, 36px);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: var(--panel-shadow);
  opacity: 0; transform: translateY(40px);
  transition: opacity .8s ease, transform .8s ease, background-color .5s, border-color .5s;
}
.panel.in { opacity: 1; transform: none; }
.panel.left { margin-right: auto; }
.panel.right { margin-left: auto; margin-right: clamp(24px, 9vw, 130px); }   /* clear of the section rail labels */
.panel.center { margin: 0 auto; text-align: center; max-width: 720px; }
.panel.wide { max-width: 640px; }
.hero .panel h1, .hero .panel .lead, .hero .panel .kicker { text-shadow: var(--hero-shadow); }
.hero::before {
  content: ""; position: absolute; left: 50%; top: 50vh; width: min(900px, 100vw); height: 520px;
  transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(ellipse at center, var(--hero-veil) 0%, transparent 68%);
}
.hero { position: relative; }
.hero .panel { position: relative; background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }

.kicker { margin: 0 0 12px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); transition: color .6s; }
.kicker b { color: var(--text); margin-right: 8px; font-weight: 600; }
h1 { font-size: clamp(34px, 6vw, 68px); line-height: 1.08; margin: 0 0 18px; letter-spacing: -.02em; font-weight: 600; }
h2 { font-size: clamp(26px, 3.6vw, 40px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -.01em; font-weight: 600; }
p { margin: 0 0 14px; color: var(--muted); }
.lead { font-size: clamp(16px, 1.6vw, 20px); color: var(--lead); }
ul { margin: 18px 0 0; padding: 0; list-style: none; }
ul li { padding: 9px 0 9px 22px; border-top: 1px solid var(--panel-border); position: relative; font-size: 15px; }
ul li::before { content: ""; position: absolute; left: 2px; top: 17px; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); transition: background .6s; }

.steps { counter-reset: s; list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 40px 1fr; gap: 2px 12px; padding: 12px 0; border-top: 1px solid var(--panel-border); }
.steps li::before { content: counter(s, decimal-leading-zero); grid-row: span 2; color: var(--accent); font-weight: 600; font-size: 18px; transition: color .6s; }
.steps span { color: var(--muted); font-size: 14px; }

.live { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; padding: 12px 14px; border-radius: 12px; background: var(--inset); font-size: 14px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #66717d; flex: none; }
.live.on .live-dot { background: var(--accent); box-shadow: 0 0 0 0 var(--accent); }
.live.flash .live-dot { box-shadow: 0 0 0 6px transparent; transition: box-shadow .6s; }
.live-count { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.note { font-size: 13px; }

.scroll-hint { margin-top: 48px; font-size: 13px; letter-spacing: .1em; display: inline-flex; flex-direction: column; align-items: center; gap: 10px; }
.scroll-hint em { font-style: normal; }
.scroll-hint span { width: 1px; height: 40px; background: linear-gradient(var(--accent), transparent); animation: hint 2s ease-in-out infinite; transform-origin: top; }
@keyframes hint { 0%,100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .scroll-hint em { font-style: normal; }
.scroll-hint span { animation: none; } .panel { transition: none; } }

.cta {
  display: inline-block; margin-top: 10px; padding: 14px 30px; border-radius: 99px;
  background: var(--accent); color: var(--on-accent); font-weight: 600; text-decoration: none; font-size: 17px;
}
.foot { margin-top: 48px; font-size: 12px; }

a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 720px) {
  .pill { display: none; }
  .topbar { gap: 8px; padding: 14px 16px; }
  .brand { font-size: 13px; letter-spacing: .1em; }
  .lang-switch button { padding: 6px 8px; font-size: 11px; }
  .top-cta { font-size: 12px; padding: 8px 12px; }
  .rail { right: 8px; gap: 12px; }
  .rail a span { display: none; }
  .stage { padding: 88px 16px; min-height: 130vh; }
  .panel.left, .panel.right { margin: 0 20px 0 0; max-width: none; }
  #s6 { align-items: flex-end; padding-bottom: 40px; }
  #s6 .panel.contact { margin: 0 auto; text-align: center; padding: 22px 20px; }
}

/* contact: panel on the right, the logo forms on the left (phones: logo above, panel below) */
#s6 .panel.contact { text-align: left; max-width: 460px; }
#s6 .foot { margin-top: 20px; }

/* Japanese typography: no negative tracking, taller lines, phrase-aware wrapping */
h1, h2 { text-wrap: balance; }
:lang(ja) h1, :lang(ja) h2, :lang(ja) p, :lang(ja) li { word-break: auto-phrase; }
:lang(ja) h1 { font-size: clamp(30px, 5.2vw, 60px); line-height: 1.3; letter-spacing: .02em; font-weight: 700; }
:lang(ja) h2 { font-size: clamp(24px, 3.1vw, 36px); line-height: 1.4; letter-spacing: .02em; font-weight: 700; }
:lang(ja) p, :lang(ja) li { line-height: 1.85; }
:lang(ja) .kicker { letter-spacing: .08em; }
:lang(ja) .steps span { line-height: 1.75; }

/* finale: the logo can be dragged (mouse) or tapped */
@media (hover: hover) { body[data-stage="6"] #s6 { cursor: grab; } body[data-stage="6"] #s6 .panel { cursor: auto; } }
body.grabbing, body.grabbing * { cursor: grabbing !important; user-select: none; }

/* legal links beside the copyright line */
.foot a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.foot a:hover { color: var(--text); }

/* pause-motion control, bottom left */
.motion-toggle {
  position: fixed; left: 16px; bottom: 16px; z-index: 10;
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 12px; line-height: 1; color: var(--text);
  background: var(--chip-bg); border: 1px solid var(--panel-border); border-radius: 99px;
  padding: 8px 14px 8px 10px; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.motion-toggle:hover { background: var(--chip-on); }
.motion-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.motion-toggle .play { display: none; }
body.motion-paused .motion-toggle .pause { display: none; }
body.motion-paused .motion-toggle .play { display: block; }
body.no-webgl .motion-toggle { display: none; }
/* paused: the page's own CSS motion stops too */
body.motion-paused .scroll-hint span { animation: none; }
body.motion-paused .panel { transition: none; }
html:has(body.motion-paused) { scroll-behavior: auto; }
@media (max-width: 720px) { #s6 { padding-bottom: 72px; } }   /* keep the button off the contact panel */

/* flick: pointer cursor over a shape */
body.over-shape { cursor: pointer; }

/* contact: form button in the panel, address as plain text below it */
button.cta { border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 17px; }
button.cta:focus-visible, .cf-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mail-alt { margin: 14px 0 0; font-size: 13px; }

/* contact dialog */
.dialog-open { overflow: hidden; }   /* the page behind must not scroll (scrolling changes the section) */
.contact-dialog {
  width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: clamp(20px, 4vw, 32px); border: 1px solid var(--panel-border); border-radius: 18px;
  background: var(--dialog-bg); color: var(--text); box-shadow: var(--panel-shadow); font-family: var(--font);
}
.contact-dialog::backdrop { background: rgba(3, 6, 12, .55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.cf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.cf-head h2 { margin: 0; font-size: clamp(22px, 3vw, 28px); }
.cf-close { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--inset); color: var(--text); cursor: pointer; }
.cf-field { display: block; margin-bottom: 14px; }
.cf-field > span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--lead); }
.cf-field input, .cf-field select, .cf-field textarea {
  width: 100%; box-sizing: border-box; padding: 11px 13px; border: 1px solid var(--field-border); border-radius: 10px;
  background: var(--field-bg); color: var(--text); font: inherit; font-size: 16px;   /* 16px: no zoom-on-focus on iPhone */
}
.cf-field textarea { resize: vertical; min-height: 120px; }
.cf-field input:focus-visible, .cf-field select:focus-visible, .cf-field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.cf-field ::placeholder { color: var(--muted); opacity: .8; }
.cf-submit { width: 100%; margin-top: 6px; }
.cf-submit:disabled { opacity: .6; cursor: progress; }
.cf-status { min-height: 1.4em; margin: 12px 0 0; font-size: 14px; }
.cf-status.success { color: var(--ok); }
.cf-status.error { color: var(--err); }
.cf-legal { margin: 10px 0 0; font-size: 11px; line-height: 1.5; color: var(--muted); }
.cf-legal a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.grecaptcha-badge { visibility: hidden; }   /* allowed by Google when the notice above is shown */
