:root {
  --bg: #06080d;
  --ink: #edf1f7;
  --muted: #9aa6b8;
  --faint: #5d6778;
  --line: rgba(255, 255, 255, 0.09);
  --glass: rgba(9, 12, 19, 0.72);
  --lime: #b6f23a;
  --red: #ff5a5f;
  --yellow: #ffcf47;
  --c: var(--lime);
  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --hud-h: 64px;
  --gutter: clamp(16px, 4vw, 56px);
  color-scheme: dark;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html[data-motion="reduce"] { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: 0.02em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

.skip {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--lime); color: #0a0d06; padding: 8px 14px; border-radius: 8px; font-weight: 700;
}
.skip:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; border-radius: 6px; }

/* ---------- 3D の背景 ---------- */
#scene {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh;
  display: block; z-index: 0;
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(3, 4, 8, 0.75) 100%),
    linear-gradient(to bottom, rgba(6, 8, 13, 0.55), transparent 18%, transparent 80%, rgba(6, 8, 13, 0.6));
}
.alarm {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  background: radial-gradient(90% 70% at 50% 50%, transparent 40%, rgba(255, 40, 50, 0.28) 100%);
  transition: opacity 0.6s ease;
}
body.is-alarm .alarm { opacity: 1; animation: alarm 2.4s ease-in-out infinite; }
@keyframes alarm { 50% { opacity: 0.45; } }

/* WebGL が使えないときの背景 */
.no-webgl #scene { display: none; }
.no-webgl body, body.no-webgl {
  background:
    radial-gradient(60% 50% at 70% 40%, rgba(182, 242, 58, 0.12), transparent 70%),
    radial-gradient(50% 40% at 20% 80%, rgba(79, 216, 255, 0.1), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: var(--hud-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; justify-self: start; }
.brand-mark {
  width: 18px; height: 18px; border-radius: 50%; align-self: center;
  border: 3px solid var(--lime); box-shadow: 0 0 14px rgba(182, 242, 58, 0.55), inset 0 0 0 3px var(--bg);
  background: var(--lime);
}
.brand-name { font-family: var(--mono); font-weight: 600; font-size: 20px; letter-spacing: 0.06em; }
.brand-sub { font-size: 12px; color: var(--muted); letter-spacing: 0.12em; }

.hud-clock {
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--mono); padding: 6px 14px; border-radius: 999px;
  background: rgba(9, 12, 19, 0.55); border: 1px solid var(--line);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hud-label { font-size: 11px; color: var(--muted); letter-spacing: 0.14em; }
.hud-time { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 5ch; text-align: center; }
body.is-alarm .hud-time { color: var(--red); }

.hud-actions { justify-self: end; display: flex; gap: 10px; align-items: center; }
.motion-toggle {
  font: inherit; font-size: 12px; color: var(--muted); cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}
.motion-toggle[aria-pressed="true"] { color: var(--ink); border-color: rgba(182, 242, 58, 0.5); }
.motion-toggle:hover { color: var(--ink); }
.hud-cta {
  text-decoration: none; font-size: 13px; font-weight: 700;
  background: var(--lime); color: #0b1004; padding: 7px 16px; border-radius: 999px;
  box-shadow: 0 0 22px rgba(182, 242, 58, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hud-cta:hover { transform: translateY(-1px); box-shadow: 0 0 30px rgba(182, 242, 58, 0.5); }

/* 章のナビ */
.chapters {
  position: fixed; right: var(--gutter); top: 50%; transform: translateY(-50%); z-index: 20;
}
.chapters ol { display: grid; gap: 14px; }
.chapters a {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  text-decoration: none; font-size: 12px; color: var(--faint);
}
.chapters a::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid currentColor; transition: all 0.3s ease;
}
.chapters a span { opacity: 0; transform: translateX(6px); transition: all 0.3s ease; }
.chapters a:hover span, .chapters a:focus-visible span, .chapters a.is-active span { opacity: 1; transform: none; }
.chapters a.is-active { color: var(--ink); }
.chapters a.is-active::after { background: var(--lime); border-color: var(--lime); box-shadow: 0 0 10px var(--lime); }

.progress { position: fixed; left: 0; right: 0; bottom: 0; height: 2px; z-index: 20; background: rgba(255, 255, 255, 0.05); }
.progress span { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: var(--lime); box-shadow: 0 0 8px var(--lime); }

/* ---------- ステップとカード ---------- */
main { position: relative; z-index: 5; }

.step {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--hud-h) + 24px) var(--gutter) 48px;
}
.step[data-align="left"] { justify-content: flex-start; }
.step[data-align="right"] { justify-content: flex-end; padding-right: calc(var(--gutter) + 120px); }
.step[data-align="center"] { justify-content: center; text-align: center; }
.step--crew, .step--time, .step--fail { min-height: 90vh; min-height: 90svh; }

.card {
  width: min(460px, 100%);
  padding: 30px 32px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 20px;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateY(28px);
  transition: opacity 0.8s cubic-bezier(.2, .7, .2, 1), transform 0.8s cubic-bezier(.2, .7, .2, 1);
}
.card.is-visible { opacity: 1; transform: none; }
.card > * + * { margin-top: 14px; }
.card p { color: #c9d1dd; }
.card--center { width: min(600px, 100%); }

.kicker {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; letter-spacing: 0.16em; color: var(--muted) !important;
}
.card--center .kicker { justify-content: center; }
.kicker .num { font-family: var(--mono); color: var(--lime); font-weight: 600; }

h2 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.4; font-weight: 900; letter-spacing: 0.02em; }
h3 { font-size: 22px; line-height: 1.5; font-weight: 700; }
strong { color: var(--ink); font-weight: 700; }
.note { font-size: 13px; color: var(--muted) !important; border-left: 2px solid var(--lime); padding-left: 12px; }

/* HERO */
.step--hero { min-height: 100vh; min-height: 100svh; }
.card--hero {
  width: min(760px, 100%); background: none; border: 0; box-shadow: none;
  backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0;
}
.card--hero { background: radial-gradient(closest-side, rgba(6, 8, 13, 0.62), rgba(6, 8, 13, 0.25) 70%, transparent); padding: 40px 24px; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; color: var(--lime) !important; }
.hero-title {
  font-size: clamp(34px, 6.4vw, 76px); line-height: 1.22; font-weight: 900; letter-spacing: 0.01em;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.6);
}
.hero-title .line { display: block; }
.hero-title em { font-style: normal; color: var(--lime); text-shadow: 0 0 30px rgba(182, 242, 58, 0.35); }
.lead { font-size: clamp(15px, 1.6vw, 18px); color: #d5dbe5 !important; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); }
.scroll-hint { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; font-size: 12px; letter-spacing: 0.2em; color: var(--muted) !important; margin-top: 44px !important; }
.scroll-hint span { width: 1px; height: 44px; background: linear-gradient(var(--lime), transparent); animation: drip 2.2s ease-in-out infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* about */
.trio { display: grid; gap: 10px; }
.trio li {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: baseline;
  padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
}
.trio b { font-family: var(--mono); color: var(--lime); font-size: 15px; }
.trio li:nth-child(3) b { font-family: var(--font); }
.trio span { color: #d5dbe5; font-size: 15px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  font-family: var(--mono); font-size: 13px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(182, 242, 58, 0.35); color: var(--ink); background: rgba(182, 242, 58, 0.06);
}

.feature-list { display: grid; gap: 12px; }
.feature-list div { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.feature-list div:first-child { border-top: 0; padding-top: 0; }
.feature-list dt { font-family: var(--mono); font-size: 13px; color: var(--lime); padding-top: 2px; }
.feature-list dt:not([lang]) { font-family: var(--font); font-weight: 700; }
.feature-list dd { font-size: 14.5px; color: #cfd6e1; line-height: 1.75; }
.verdicts { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 0 4px; vertical-align: middle; }
.verdicts span { font-size: 12px; padding: 1px 8px; border-radius: 6px; font-weight: 700; }
.v-ok { background: rgba(182, 242, 58, 0.16); color: var(--lime); }
.v-split { background: rgba(255, 207, 71, 0.16); color: var(--yellow); }
.v-ng { background: rgba(255, 90, 95, 0.16); color: var(--red); }
.tag { font-family: var(--mono); font-size: 12px; padding: 1px 7px; border-radius: 6px; margin: 0 3px; font-weight: 600; }
.tag--yellow { background: rgba(255, 207, 71, 0.16); color: var(--yellow); }
.tag--red { background: rgba(255, 90, 95, 0.16); color: var(--red); }

/* crew */
.roster { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.roster li {
  font-weight: 700; font-size: 15px; padding: 6px 14px; border-radius: 999px;
  color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: color-mix(in srgb, var(--c) 8%, transparent);
}

.card--crew { position: relative; border-top: 3px solid var(--c); overflow: visible; }
.crew-no { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; color: var(--muted) !important; }
.crew-name { font-size: clamp(44px, 6vw, 64px); line-height: 1.1; font-weight: 900; color: var(--c); text-shadow: 0 0 36px color-mix(in srgb, var(--c) 40%, transparent); margin-top: 6px !important; }
.crew-role { font-weight: 700; font-size: 17px; color: var(--ink) !important; }
.crew-job { font-size: 16px; }
.crew-foot { font-size: 12px; color: var(--muted) !important; padding-top: 12px; border-top: 1px solid var(--line); }
.crew-portrait {
  float: right; width: 108px; height: auto; margin: -8px -8px 0 12px;
  filter: drop-shadow(0 0 24px rgba(182, 242, 58, 0.25));
  shape-outside: margin-box;
}

/* day */
.card--time { border-left: 3px solid var(--c); }
.time { font-family: var(--mono); font-weight: 600; font-size: clamp(54px, 8vw, 88px); line-height: 1; letter-spacing: -0.02em; color: var(--ink) !important; font-variant-numeric: tabular-nums; }
.time small { font-size: 0.34em; color: var(--muted); margin-left: 8px; letter-spacing: 0; }
.who { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--c) !important; }
.who .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 12px var(--c); }
.what { font-size: 17px; color: #dde3ec !important; }

/* fail */
.card--alert { border-color: rgba(255, 90, 95, 0.3); }
.card--alert .kicker .num { color: var(--red); }
.card--fail { border-color: rgba(255, 90, 95, 0.35); background: rgba(22, 8, 11, 0.76); }
.card--fail h3 { font-size: clamp(22px, 2.6vw, 28px); }
.card--fail strong { color: var(--red); font-family: var(--mono); font-size: 1.25em; }
.incident { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 14px; color: #ffb3b5 !important; }
.badge { font-family: var(--font); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px; background: var(--red); color: #1a0506; }
.badge--ok { background: var(--lime); color: #0b1004; }
.card--recover { border-color: rgba(182, 242, 58, 0.4); background: rgba(9, 16, 8, 0.76); }
.card--recover .incident { color: #d7f7a6 !important; }

/* member */
.step--member { min-height: 110vh; min-height: 110svh; }
.card--member { width: min(520px, 100%); border-color: rgba(182, 242, 58, 0.3); }
.weekly { padding: 20px; border-radius: 14px; background: rgba(182, 242, 58, 0.06); border: 1px solid rgba(182, 242, 58, 0.22); }
.weekly > * + * { margin-top: 6px; }
.weekly-label { font-size: 12px; letter-spacing: 0.16em; color: var(--lime) !important; }
.weekly-title { font-size: clamp(26px, 3vw, 32px); font-weight: 900; color: var(--ink) !important; line-height: 1.3; }
.weekly-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 !important; }
.weekly-list li { font-weight: 700; padding: 5px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); }
.weekly-list li:nth-child(3) { color: #ffb3b5; border-color: rgba(255, 90, 95, 0.35); }

.cta {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-top: 24px !important; padding: 18px 24px; border-radius: 14px;
  background: var(--lime); color: #0b1004; text-decoration: none;
  font-size: 18px; font-weight: 900; letter-spacing: 0.04em;
  box-shadow: 0 0 0 0 rgba(182, 242, 58, 0.5), 0 14px 40px rgba(182, 242, 58, 0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: pulse 2.6s ease-out infinite;
}
.cta:hover { transform: translateY(-2px); box-shadow: 0 0 0 0 rgba(182, 242, 58, 0), 0 18px 50px rgba(182, 242, 58, 0.45); }
.cta svg { transition: transform 0.2s ease; }
.cta:hover svg { transform: translateX(4px); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(182, 242, 58, 0.45), 0 14px 40px rgba(182, 242, 58, 0.28); } 70%, 100% { box-shadow: 0 0 0 16px rgba(182, 242, 58, 0), 0 14px 40px rgba(182, 242, 58, 0.28); } }
.cta-note { font-size: 12px; color: var(--muted) !important; text-align: center; }

.footer {
  position: relative; z-index: 5; padding: 48px var(--gutter) 64px; text-align: center;
  font-size: 12px; color: var(--faint); background: linear-gradient(transparent, rgba(6, 8, 13, 0.92) 40%);
}
.footer p + p { margin-top: 6px; }
.footer .copy { margin-top: 16px; font-family: var(--mono); color: var(--muted); }

.pc { display: inline; }

/* ---------- タブレット ---------- */
@media (max-width: 1100px) {
  .step[data-align="right"] { padding-right: var(--gutter); }
  .chapters { display: none; }
}

/* ---------- スマートフォン ---------- */
@media (max-width: 720px) {
  :root { --hud-h: 56px; }
  body { font-size: 15px; }
  .hud { grid-template-columns: auto 1fr auto; gap: 8px; }
  .brand-sub { display: none; }
  .hud-clock { justify-self: center; padding: 4px 10px; gap: 6px; }
  .hud-label { font-size: 10px; }
  .hud-time { font-size: 14px; }
  .motion-toggle { display: none; }
  .hud-cta { font-size: 12px; padding: 6px 12px; }
  .pc { display: none; }

  /* 3D を上に見せ、カードは下に寄せる */
  .step, .step[data-align="left"], .step[data-align="right"] {
    align-items: flex-end; justify-content: center; padding: calc(var(--hud-h) + 16px) 16px 40px;
  }
  .step--hero { align-items: center; }
  .step[data-align="center"]:not(.step--hero) { align-items: center; }
  .card { width: 100%; padding: 22px 20px; border-radius: 16px; }
  .card > * + * { margin-top: 12px; }
  .card--hero { padding: 0; }
  .card--hero { padding: 24px 4px; background: radial-gradient(closest-side, rgba(6, 8, 13, 0.7), transparent); }
  h2 { font-size: 23px; }
  .card--fail h3 { font-size: 20px; }
  .trio li { grid-template-columns: 80px 1fr; padding: 10px 12px; }
  .feature-list div { grid-template-columns: 1fr; gap: 2px; }
  .feature-list dd { font-size: 14px; }
  .crew-portrait { width: 82px; margin: -4px -4px 0 8px; }
  .cta { font-size: 16px; padding: 16px 18px; }
}

/* ---------- 動きを減らす ---------- */
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) { scroll-behavior: auto; }
  html:not([data-motion="full"]) *, html:not([data-motion="full"]) *::before, html:not([data-motion="full"]) *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  html:not([data-motion="full"]) .card { opacity: 1; transform: none; }
}
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}
html[data-motion="reduce"] .card { opacity: 1; transform: none; }
