:root {
  --ink: #1a1a1a; --muted: #5b6470; --orange: #f88335; --blue: #2c86c7;
  --ok: #24935a; --sim: #2c86c7; --design: #c77a12; --plan: #7d7369; --vision: #7a5cc7;
  --font: "Noto Sans JP", ui-sans-serif, system-ui, -apple-system, "Hiragino Sans", sans-serif;
}
* { box-sizing: border-box; }
html { background: #f3eee7; }
body { margin: 0; font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; }
#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.label { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: 13px; font-weight: 700; color: var(--ink); opacity: 0; transition: opacity .25s;
  display: flex; align-items: center; gap: 7px; }
.label i { width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 4px rgba(248,131,53,.25); flex: none; }
.label span { background: rgba(255,255,255,.92); padding: 4px 9px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.label small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }
.label.on { opacity: 1; }
.label.tag i { background: #19b36b; box-shadow: 0 0 0 4px rgba(25,179,107,.25); }

#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; z-index: 5;
  background: #f3eee7; font-size: 15px; color: var(--muted); transition: opacity .6s; }
#loading.done { opacity: 0; pointer-events: none; }
#loading small { display: block; font-size: 11px; color: #a39a8f; margin-left: 6px; }
.spinner { width: 18px; height: 18px; border: 3px solid #e2d7ca; border-top-color: var(--orange); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

nav.top { position: fixed; top: 0; left: 0; right: 0; z-index: 4; display: flex; align-items: center; gap: 18px;
  padding: 14px 22px; pointer-events: none; }
nav.top a { pointer-events: auto; text-decoration: none; }
.brand { font-weight: 700; color: var(--orange); font-size: 20px; letter-spacing: .02em; }
.progress { flex: 1; height: 3px; background: rgba(0,0,0,.08); border-radius: 3px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--orange); }
.wave { background: #fff8f0; color: var(--ink); border: 2px solid var(--orange); border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px; }

main { position: relative; z-index: 2; }
#wall { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; background: rgba(243,238,231,.94); }
#wall video { position: absolute; left: min(42vw, 520px); right: 28px; top: 70px; bottom: 30px; width: calc(100% - min(42vw, 520px) - 28px); height: calc(100% - 100px); object-fit: contain; }
.count { display: flex; align-items: baseline; gap: 6px; margin: 12px 0 6px; }
.count b { font-size: 46px; line-height: 1; color: var(--orange); font-variant-numeric: tabular-nums; }
.count span { font-size: 15px; font-weight: 700; color: var(--muted); }
.learn-stats { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 5px; }
.learn-stats li { font-size: 13px; line-height: 1.55; color: #333; }
.learn-stats b { color: var(--blue); }
.turn { position: fixed; top: 58px; right: 14px; z-index: 6; display: flex; align-items: center; gap: 6px; max-width: min(64vw, 320px);
  padding: 6px 12px; border-radius: 999px; background: #1d1b2f; color: #fff; text-decoration: none; font-weight: 700; font-size: 12.5px; box-shadow: 0 4px 16px rgba(0,0,0,.16); white-space: nowrap; }
.turn span:last-child { overflow: hidden; text-overflow: ellipsis; }
.turn[hidden] { display: none; }
.turn.performing { background: var(--orange); animation: turnpulse 1s ease-in-out infinite; }
.turn.done { background: var(--ok); }
@keyframes turnpulse { 50% { transform: scale(1.06); } }
.chapter { position: relative; height: var(--len); padding: 0 0 0 max(4vw, 24px); }
.card { position: sticky; top: 15vh; width: min(440px, 40vw); background: rgba(255,255,255,.86);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-radius: 22px; padding: 26px 28px 24px; box-shadow: 0 10px 40px rgba(60,40,20,.10); }
.card.hero { background: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; top: 22vh; width: min(640px, 52vw); }
.hero h1 span { display: inline-block; white-space: nowrap; }
.eyebrow { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--blue); }
h1 { margin: 0; font-size: clamp(28px, 3.5vw, 54px); line-height: 1.18; font-weight: 700; color: var(--orange); letter-spacing: -.01em; }
h2 { margin: 0; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.3; font-weight: 700; color: var(--orange); }
.en { margin: 6px 0 14px; color: var(--muted); font-size: 14px; }
.hero .en { font-size: 17px; margin-top: 14px; }
.card p { line-height: 1.75; font-size: 15px; }
.hint { margin-top: 36px; font-weight: 700; color: var(--muted); }
.hint span { display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

.stats { list-style: none; padding: 0; margin: 16px 0 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats li { background: #f6f2ec; border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.stats b { font-size: 28px; color: var(--blue); min-width: 54px; }
.stats span { font-size: 13px; line-height: 1.35; font-weight: 700; }
.stats small { font-weight: 500; color: var(--muted); }

.chip { display: inline-block; font-style: normal; font-size: 11.5px; font-weight: 700; color: #fff; border-radius: 999px; padding: 3px 9px; margin-right: 8px; white-space: nowrap; vertical-align: 1px; }
.chip.ok { background: var(--ok); } .chip.sim { background: var(--sim); } .chip.design { background: var(--design); }
.chip.plan { background: var(--plan); } .chip.vision { background: var(--vision); }
.chips { font-size: 13.5px; color: var(--muted); margin: 6px 0 0; }

.status, .legend { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 9px; }
.status li, .legend li { font-size: 13.5px; line-height: 1.55; color: #333; }

.sensors { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.sensors li { border-radius: 12px; padding: 7px 11px; background: #f6f2ec; transition: background .3s, transform .3s, opacity .3s; opacity: .6;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.sensors li b { font-size: 13.5px; }
.sensors li em { margin: 0; font-size: 10.5px; padding: 2px 8px; }
.sensors li span { grid-column: 1 / -1; font-size: 12.5px; line-height: 1.6; color: #444; display: none; margin-top: 4px; }
.sensors li.on { opacity: 1; background: #fff3e8; transform: translateX(4px); box-shadow: inset 3px 0 0 var(--orange); }
.sensors li.on span { display: block; }
.lead-ja { font-size: 16px !important; color: var(--muted); margin: 16px 0 0; }
.note { font-size: 12px !important; color: var(--muted); margin: 10px 0 0; }
.step { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 8px; padding: 10px 12px; background: #fff3e8; border-radius: 12px; box-shadow: inset 3px 0 0 var(--orange); }
.step b { font-size: 13px; color: var(--orange); white-space: nowrap; }
.step span { font-size: 16px; font-weight: 700; }
.steps { list-style: none; padding: 0; margin: 0 0 4px; display: flex; gap: 5px; }
.steps li { flex: 1; height: 5px; border-radius: 3px; background: #e7ded3; transition: background .3s; }
.steps li.on { background: var(--orange); }

.outro .cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 6px; }
.button { display: inline-block; text-decoration: none; font-weight: 700; font-size: 15px; padding: 11px 18px; border-radius: 999px; background: var(--orange); color: #fff; }
.button.ghost { background: transparent; color: var(--ink); border: 2px solid #d9cfc3; }
.credits { font-size: 11.5px !important; line-height: 1.6 !important; color: var(--muted); margin: 14px 0 0; }

@media (max-width: 760px) {
  .chapter { padding: 0; }
  .card, .card.hero { position: fixed; top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; margin: 0;
    max-height: 46vh; overflow: auto; padding: 16px 16px 14px; border-radius: 18px;
    background: rgba(255,255,255,.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 8px 30px rgba(60,40,20,.14); }
  .card .en { display: none; }
  .hero .en { display: block; font-size: 14px; }
  .card p { font-size: 13.5px; line-height: 1.65; margin: 8px 0; }
  h2 { font-size: 21px; }
  .stats { gap: 6px; margin: 10px 0 6px; } .stats li { padding: 7px 9px; } .stats b { font-size: 20px; min-width: 38px; } .stats span { font-size: 11.5px; }
  #wall video { left: 12px; right: 12px; top: 58px; width: calc(100% - 24px); height: calc(50vh - 70px); }
  .sensors li { padding: 5px 9px; } .sensors li:not(.on) { display: none; } .sensors li.on { transform: none; }
  .hint { margin-top: 10px; }
  .label { font-size: 11px; }
  .label small { display: none; }
  nav.top { padding: 10px 12px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { .hint span, .spinner { animation: none; } }

/* 3D unavailable: plain reading layout */
.fail-note { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 9; background: #1d1b2f; color: #fff; font-size: 12.5px; line-height: 1.6; padding: 10px 14px; border-radius: 12px; }
.no3d #stage, .no3d #labels, .no3d #wall { display: none !important; }
.no3d .chapter { height: auto !important; padding: 12px !important; }
.no3d .card { position: relative !important; top: auto !important; bottom: auto !important; left: auto !important; right: auto !important; opacity: 1 !important; visibility: visible !important;
  margin: 70px auto 10px !important; width: min(560px, 100%) !important; max-height: none !important; }
.no3d .sensors li span { display: block; } .no3d .sensors li { opacity: 1; display: grid !important; }

.scroll-hint { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  background: rgba(29,27,47,.88); color: #fff; font-weight: 700; font-size: 14.5px; box-shadow: 0 6px 24px rgba(0,0,0,.18); transition: opacity .5s; pointer-events: none; white-space: nowrap; }
.scroll-hint span { display: inline-block; animation: bob 1.2s ease-in-out infinite; font-size: 18px; }
.scroll-hint.gone { opacity: 0; }
@media (max-width: 760px) { .scroll-hint { bottom: auto; top: 104px; } }

/* video mode: the same journey as pre-rendered clips */
.vmode #stage, .vmode #labels, .vmode #wall, .vmode #loading { display: none !important; }
.vstage { position: fixed; z-index: 0; left: min(40vw, 500px); right: 0; top: 0; bottom: 0; background: #f3eee7; }
.vstage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .45s; background: transparent; }
@media (max-width: 760px) {
  .vstage { left: 0; top: 48px; bottom: auto; height: min(100vw, calc(100vh - 48px - 44vh)); }
  .vmode .card { max-height: 44vh; }
}

.scrolling-badge { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 16px 26px 14px; border-radius: 22px; background: rgba(248,131,53,.95); color: #fff; box-shadow: 0 10px 40px rgba(248,131,53,.35); pointer-events: none; transition: opacity .35s; }
.scrolling-badge i { font-style: normal; font-size: 22px; line-height: 0.9; animation: chev 0.7s linear infinite; opacity: 0; }
.scrolling-badge i:nth-child(2) { animation-delay: .12s; } .scrolling-badge i:nth-child(3) { animation-delay: .24s; }
.scrolling-badge b { font-size: 16px; margin-top: 8px; white-space: nowrap; letter-spacing: .04em; }
.scrolling-badge.gone { opacity: 0; }
@keyframes chev { 0% { opacity: 0; transform: translateY(-6px); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(8px); } }
@media (max-width: 760px) { .scrolling-badge { top: 30%; } }

.autoplay-pill { position: fixed; left: 14px; top: 58px; z-index: 8; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: rgba(29,27,47,.82); color: #fff; font-size: 13px; line-height: 1;
  box-shadow: 0 3px 12px rgba(0,0,0,.18); cursor: pointer; transition: opacity .4s, background .2s; }
.autoplay-pill.paused { background: var(--orange); }
.autoplay-pill.gone { opacity: 0; pointer-events: none; }
