:root {
  --bg: #eef0f2;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-border: rgba(20, 24, 31, 0.08);
  --text: #16191f;
  --muted: #5b6270;
  --accent: #0b57d0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 87, 208, 0.1);
  --warn-soft: #fff4d6;
  --warn-ink: #6b4d00;
  --dot: #c9ced6;
  --shadow: 0 10px 40px rgba(16, 24, 40, 0.14);
  --card: #ffffff;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181d;
    --panel: rgba(28, 32, 39, 0.86);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text: #eceff3;
    --muted: #a3abb8;
    --accent: #7cacf8;
    --accent-ink: #0b1a33;
    --accent-soft: rgba(124, 172, 248, 0.14);
    --warn-soft: #3a3120;
    --warn-ink: #f2d38a;
    --dot: #3b424d;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    --card: #1e232b;
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; outline: none; touch-action: none; }

.top {
  position: fixed; top: 20px; left: 24px;
  max-width: calc(100vw - 360px - 72px);
  display: flex; flex-direction: column; gap: 14px;
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--accent); display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.logo svg { width: 26px; height: 26px; fill: var(--accent-ink); }
.brand h1 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.brand p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.picker { display: flex; flex-wrap: wrap; gap: 6px; pointer-events: auto; }
.chip {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  color: var(--text); background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 2px 10px rgba(16, 24, 40, 0.08);
  transition: background .2s, color .2s, transform .1s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(.97); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip.home { text-decoration: none; color: var(--muted); margin-right: 4px; }
.chip.home:hover { color: var(--text); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel {
  position: fixed; right: 24px; top: 24px; bottom: 24px;
  width: 360px; max-width: calc(100vw - 48px);
  display: flex; flex-direction: column;
  padding: 22px 22px 16px;
  background: var(--panel);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.step-meta { display: flex; align-items: center; gap: 8px; }
.badge {
  background: var(--accent-soft); color: var(--accent);
  font-weight: 600; font-size: 12px; padding: 4px 10px; border-radius: 999px;
}
.count { font-size: 12px; color: var(--muted); }
.panel h2 { font-size: 22px; line-height: 1.25; margin: 12px 0 8px; letter-spacing: -0.015em; }
.desc { margin: 0 0 14px; color: var(--muted); font-size: 14.5px; line-height: 1.55; }

.parts {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto; min-height: 0; flex: 0 1 auto;
}
.parts li {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; padding: 7px 10px;
  border: 1px solid var(--panel-border); border-radius: 10px;
}
.parts .tag {
  flex: none; width: 24px; height: 24px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.parts .name { flex: 1; }
.parts .qty { color: var(--muted); font-variant-numeric: tabular-nums; }

.tip {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--warn-soft); color: var(--warn-ink);
  font-size: 13px; line-height: 1.45;
}

.progress { display: flex; gap: 6px; margin: auto 0 14px; padding-top: 16px; }
.progress button {
  flex: 1; height: 6px; border: 0; padding: 0; border-radius: 3px;
  background: var(--dot); cursor: pointer; transition: background .25s;
}
.progress button.done { background: var(--accent); opacity: .45; }
.progress button.active { background: var(--accent); }

.controls { display: flex; gap: 8px; }
.btn {
  font: inherit; font-size: 14px; font-weight: 600;
  border-radius: 12px; border: 1px solid var(--panel-border);
  padding: 11px 14px; cursor: pointer; color: var(--text);
  background: transparent; transition: transform .1s, background .2s, opacity .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.primary { flex: 1; background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { flex: 1; }
.btn.icon { width: 44px; padding: 0; display: grid; place-items: center; }
.btn.icon svg { width: 20px; height: 20px; fill: currentColor; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }

.note {
  position: fixed; left: 24px; bottom: 18px;
  font-size: 12px; color: var(--muted); pointer-events: none;
}

.loader {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: var(--bg); color: var(--muted); font-size: 14px;
  transition: opacity .5s;
}
.loader span {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--dot); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.loader.hide { opacity: 0; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .top { top: 12px; left: 0; right: 0; max-width: none; gap: 10px; }
  .brand { padding: 0 16px; }
  .picker { flex-wrap: nowrap; overflow-x: auto; padding: 2px 16px 6px; scrollbar-width: none; }
  .picker::-webkit-scrollbar { display: none; }
  .chip { font-size: 12.5px; padding: 6px 11px; }
  .brand h1 { font-size: 16px; }
  .logo { width: 36px; height: 36px; }
  .panel {
    top: auto; left: 12px; right: 12px; bottom: 12px;
    width: auto; max-width: none; max-height: 46vh;
    padding: 16px 16px 12px; border-radius: 18px;
  }
  .panel h2 { font-size: 18px; margin: 8px 0 4px; }
  .desc { font-size: 13.5px; margin-bottom: 10px; }
  .parts li { padding: 5px 8px; }
  .progress { padding-top: 10px; margin-bottom: 10px; }
  .hint, .note { display: none; }
}

/* ------------------------------------------------------------ Landing page */
.landing {
  position: fixed; inset: 0; z-index: 20;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--bg);
  padding: 0 24px calc(32px + env(safe-area-inset-bottom, 0px));
  scroll-behavior: smooth;
}
.landing > * { max-width: 1160px; margin-left: auto; margin-right: auto; }
body.on-landing .top, body.on-landing .panel, body.on-landing .note { visibility: hidden; }

.l-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 0 20px;
}
.l-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none;
}
.l-brand .logo { width: 36px; height: 36px; border-radius: 10px; box-shadow: none; }
.l-brand .logo svg { width: 22px; height: 22px; }
.l-link { color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.l-link:hover { color: var(--text); }

.hero {
  display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center;
  padding: 40px 0 64px;
}
.eyebrow {
  margin: 0 0 14px; font-size: 13px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--accent);
}
.hero h1 {
  margin: 0; font-size: clamp(32px, 4.4vw, 52px); line-height: 1.08;
  letter-spacing: -0.03em; font-weight: 700; text-wrap: balance;
}
.lede { margin: 18px 0 28px; font-size: 17px; line-height: 1.6; color: var(--muted); max-width: 34em; }
.hero-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-cta .btn { flex: none; text-decoration: none; text-align: center; display: inline-block; padding: 13px 24px; }
.hero-meta { font-size: 13.5px; color: var(--muted); }
.hero-art { margin: 0; }
.hero-art img {
  display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 20px; box-shadow: var(--shadow);
}

.guides { padding: 8px 0 56px; scroll-margin-top: 16px; }
.guides h2, .how h3 { letter-spacing: -0.015em; }
.guides h2 { font-size: 26px; margin: 0 0 22px; }
.cards {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}
.card {
  display: flex; flex-direction: column;
  background: var(--card); color: var(--text); text-decoration: none;
  border: 1px solid var(--panel-border); border-radius: 18px; overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-img { aspect-ratio: 4 / 3; overflow: hidden; background: var(--dot); }
.card-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card-img img { transform: scale(1.03); }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.card h3 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.card p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.card-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; }
.card-meta li {
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.card-go { margin-top: auto; padding-top: 8px; font-size: 14px; font-weight: 600; color: var(--accent); }

.how {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  padding: 32px 0 40px; border-top: 1px solid var(--panel-border);
}
.how .num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px;
}
.how h3 { margin: 12px 0 6px; font-size: 16px; }
.how p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.l-foot { padding: 20px 0 0; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--panel-border); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 16px 0 44px; }
  .hero-art { order: -1; }
  .how { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 560px) {
  .landing { padding-left: 16px; padding-right: 16px; }
  .lede { font-size: 15.5px; }
  .guides h2 { font-size: 22px; }
  .hero-cta .btn { flex: 1 1 100%; }
}
