/* Utsushibi 紹介サイト。
   配色はアプリのデフォルト外観（テーマ: ネオン × メインカラー #6E50FF）に合わせてあり、
   同梱ガイド web/scripts/dist-assets/README.html と同じ計算済みの値を使う */
:root {
  --main: #6e50ff;
  --main-hi: #adaeff;
  --main-lift: #938eff;
  --bg: #120e26;
  --bg-2: #1b1437;
  --panel: #1f1743;
  --panel-2: #251c55;
  --text: #f2eefc;
  --muted: #9b98ce;
  --border: rgba(110, 80, 255, 0.22);
  --border-strong: rgba(110, 80, 255, 0.45);
  --radius: 14px;

  /* shared/figures.css（アプリと共通のステップ図）が参照する名前。
     アプリ側ではテーマ変数が入る場所を、ここではネオンの固定値で埋める */
  --accent: var(--main-hi);
  --ctl-bg: #251c55;
  --ctl-border: rgba(110, 80, 255, 0.35);
  --checker-a: #171034;
  --checker-b: #221a4a;

  /* 文字の大きさはこの段階だけを使う（12 / 14 / 16 / 18 / 20 / 24 / 30 / 36） */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-4xl: 36px;
  --fs-hero: clamp(48px, 9vw, 76px);
  --shell: min(1080px, 100% - 48px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* display を持つ要素にも hidden 属性を効かせる（JS 側で表示を落とすため） */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Segoe UI", sans-serif;
  font-size: var(--fs-base);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--main-hi); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.35; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 12px; top: 12px; z-index: 100;
  padding: 8px 16px; background: var(--main); color: #fff; border-radius: 8px;
}

/* ---- 言語ヒント ---- */
.lang-hint {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.lang-hint[hidden] { display: none; }
.lang-hint button {
  background: none; border: none; color: var(--muted); font-size: var(--fs-lg);
  line-height: 1; cursor: pointer; padding: 0 4px;
}
.lang-hint button:hover { color: var(--text); }

/* ---- ヘッダ ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  width: 100%; padding: 12px max(24px, calc((100% - var(--shell)) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--text); font-weight: 700; letter-spacing: 0.04em;
}
.brand:hover { text-decoration: none; }
.brand img { border-radius: 7px; }

.topnav { display: flex; gap: 22px; margin-right: auto; font-size: var(--fs-sm); }
.topnav a { color: var(--muted); }
.topnav a:hover { color: var(--text); text-decoration: none; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.lang-toggle {
  font-size: var(--fs-sm); color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px;
}
.lang-toggle:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }

/* ---- ボタン ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 26px;
  background: linear-gradient(120deg, var(--main), var(--main-lift));
  color: #fff; font-weight: 600; white-space: nowrap; border-radius: 999px;
  box-shadow: 0 8px 26px -10px rgba(110, 80, 255, 0.9);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 12px 30px -10px rgba(110, 80, 255, 1); }
.btn-sm { padding: 7px 18px; font-size: var(--fs-sm); }
.btn-lg { padding: 15px 34px; font-size: var(--fs-lg); }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent; color: var(--main-hi);
  border: 1px solid var(--border-strong); box-shadow: none;
}
.btn-ghost:hover { background: rgba(110, 80, 255, 0.12); box-shadow: none; }

/* ---- ヒーロー ---- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(56px, 9vw, 104px) 24px clamp(64px, 10vw, 112px);
  text-align: center;
  background: radial-gradient(ellipse 90% 80% at 50% 100%, #332576 0%, #22184d 52%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(rgba(173, 174, 255, 0.06) 1px, transparent 1px) 0 0 / 100% 38px,
    linear-gradient(90deg, rgba(173, 174, 255, 0.06) 1px, transparent 1px) 0 0 / 38px 100%;
  mask-image: linear-gradient(to top, #000 0%, transparent 78%);
}
.hero-inner { position: relative; width: var(--shell); margin: 0 auto; }
.app-icon {
  display: block;
  margin: 0 auto;
  border-radius: 24px;
  filter: drop-shadow(0 10px 30px rgba(110, 80, 255, 0.55));
}
.hero h1 {
  margin: 10px 0 0;
  font-size: var(--fs-hero);
  letter-spacing: 0.05em;
  background: linear-gradient(120deg, var(--main-hi), #ffffff 55%, var(--main-hi));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(110, 80, 255, 0.5));
}
.tagline {
  margin: 6px 0 0;
  font-size: clamp(var(--fs-lg), 2.6vw, var(--fs-2xl));
  color: var(--text);
}
.lead {
  max-width: 720px; margin: 20px auto 0;
  color: var(--muted); font-size: var(--fs-lg);
}
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 32px; }
.cta-sub { margin: 12px 0 0; font-size: var(--fs-sm); color: var(--muted); }

/* ---- セクション ---- */
.section { width: var(--shell); margin: 0 auto; padding: clamp(48px, 7vw, 88px) 0; }
.section + .section { border-top: 1px solid var(--border); }
.section h2 {
  margin: 0;
  font-size: clamp(var(--fs-2xl), 3.4vw, var(--fs-3xl));
  color: var(--main-hi);
  text-shadow: 0 0 18px rgba(110, 80, 255, 0.35);
}
.section-lead { margin: 10px 0 32px; color: var(--muted); }

.section-figure { padding-top: clamp(36px, 5vw, 56px); }
.figure { margin: 0; }
/* 枠線と角丸は SVG 側が持つ（CSS で足すと角丸が二重になってずれる） */
.figure svg {
  display: block; width: 100%; height: auto;
  border-radius: 18px;
  box-shadow: 0 0 60px -26px rgba(110, 80, 255, 0.9);
}

/* ---- 自動で流れる並び ---- */
/* 21 枚のサムネイルを縦に積むと場所を取りすぎるので、横へ流し続けて 2 段に収める */
.marquee { overflow: hidden; }
.marquee-track {
  list-style: none; margin: 0; padding: 2px 0;
  display: flex; gap: 14px; width: max-content;
  animation: marquee-scroll 64s linear infinite;
}
.marquee[data-dir="right"] .marquee-track { animation-direction: reverse; }
/* 2 セット並べて半分ぶん送る。gap の半分だけ戻すと継ぎ目が出ない */
@keyframes marquee-scroll {
  to { transform: translateX(calc(-50% - 7px)); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; }
  .marquee-track { animation: none; }
}

/* ---- カード ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 18px; }
@media (min-width: 880px) { .cards { grid-template-columns: repeat(3, 1fr); } }
/* 1 列だと縦に長くなりすぎるので、スマホ幅でも 2 列に並べる */
@media (max-width: 620px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card { padding: 14px 14px 16px; }
  .card h3 { font-size: var(--fs-base); }
  .card p, .card small { font-size: var(--fs-xs); }
}
.card {
  display: flex; flex-direction: column;
  padding: 20px 22px 22px;
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card .illus {
  display: block; width: 100%; height: auto; margin-bottom: 14px;
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid var(--border); border-radius: 10px;
}
.card h3 { margin: 0 0 6px; font-size: var(--fs-lg); color: var(--main-hi); }
.card p { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.7; }

/* ---- 背景の種類 ---- */
/* 5 種類。広い画面では 1 行、狭い画面でも 2 列までは畳んで縦を食わせない */
.types { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 14px; }
.type {
  display: block; padding: 12px 14px 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  color: inherit;
}
a.type:hover { border-color: var(--border-strong); background: var(--panel); text-decoration: none; }
/* 5 種類とも同じ viewBox のイラストなので、比率は素のまま使う（高さは自然に揃う）。
   SVG の中身は border-radius だけでは切り取られないので overflow も要る */
.type > .illus {
  display: block; width: 100%; height: auto;
  border-radius: 8px; overflow: hidden; margin-bottom: 10px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.type b { display: block; color: var(--main-hi); font-size: var(--fs-sm); }
.type span { display: block; margin-top: 4px; font-size: var(--fs-sm); line-height: 1.25; color: var(--muted); }

/* ---- 背景ギャラリー ---- */
.gallery-title { margin: 44px 0 4px; font-size: var(--fs-xl); scroll-margin-top: 96px; }
.gallery-lead { margin: 0 0 12px; color: var(--muted); font-size: var(--fs-sm); }
.marquee li {
  flex: 0 0 312px;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--bg-2);
}
.marquee img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.marquee span {
  display: block; padding: 10px 12px 12px; text-align: center;
  font-size: var(--fs-base); font-weight: 700; color: var(--text);
}

/* ---- ダウンロード ---- */
.download-card {
  text-align: center;
  max-width: 400px;
  margin: 28px auto 0;
}
.download-card .req { margin: 16px 0 0; font-size: var(--fs-sm); color: var(--muted); }

/* カードの中の注釈 */
.card small {
  display: block; margin-top: auto; padding-top: 12px;
  font-size: var(--fs-xs); line-height: 1.5; color: var(--muted); opacity: 0.75;
}

/* ---- 文書ページ（利用規約） ---- */
.more { margin: 26px 0 0; font-size: var(--fs-sm); }
.doc { max-width: 760px; }
.doc h1 { margin: 0; font-size: clamp(var(--fs-2xl), 4vw, var(--fs-4xl)); color: var(--main-hi); }
.doc h2 {
  margin: 40px 0 0; font-size: var(--fs-xl); color: var(--text);
  text-shadow: none;
}
.doc-updated { margin: 6px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.doc-lead { margin: 22px 0 0; color: var(--muted); }
.doc p { color: var(--muted); font-size: var(--fs-base); }
.doc h2 + p { margin-top: 12px; }
/* オープンソースライセンス。アプリ同梱の THIRD-PARTY-LICENSES.txt をそのまま掲示する */
.licenses-pre {
  margin: 26px 0 0; padding: 18px 20px; overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.7;
  white-space: pre-wrap; overflow-wrap: break-word; color: var(--muted);
  background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 12px;
}

/* ---- セットアップガイド ---- */
/* 幅はトップページと同じ --shell いっぱい。本文は目次のぶんだけ内側に入る。
   上は目次と見出しが並ぶだけなので、節と節の間ほどの余白は要らない */
.guide { max-width: none; padding-top: clamp(40px, 5vw, 72px); }
.guide-hero { margin: 28px 0 0; }
/* 目次はページの左端に置き、見出しや全体像の図も右カラムの中に入れる
   （目次だけが本文の途中から始まると、見出しが目次に割り込んで見えるため） */
.guide-layout {
  display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 44px;
  align-items: start;
}
/* 見出しの上の余白はトップバーぶん html の scroll-padding-top が確保するので、
   ここで scroll-margin を足すと二重にずれる */
.guide-section { margin-top: 52px; }
.guide-section h2 {
  margin: 0 0 14px; padding-bottom: 8px;
  font-size: var(--fs-xl); color: var(--main-hi);
  border-bottom: 2px solid var(--main); text-shadow: 0 0 14px rgba(110, 80, 255, 0.45);
}
.guide h3 { margin: 26px 0 8px; font-size: var(--fs-base); color: var(--main-hi); }
.guide p { margin: 12px 0; }
.guide b { color: var(--main-hi); }
.guide ul, .guide ol { margin: 12px 0; padding-left: 1.4em; color: var(--muted); }
.guide li { margin: 6px 0; }
.guide .muted { color: var(--muted); font-size: var(--fs-sm); }
.guide table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.guide th, .guide td {
  text-align: left; padding: 10px 14px 10px 0; vertical-align: top;
  border-bottom: 1px solid var(--border); font-size: var(--fs-sm); line-height: 1.75;
}
.guide th { width: 1%; white-space: nowrap; color: var(--main-hi); font-weight: 600; }
.guide td { color: var(--muted); }
/* 注釈カード。.card はカード一覧用に縦 flex なので、地の文を流すため block に戻す
   （flex のままだと <b> ごとに行が分かれる）。装飾は付けず、地色を一段変えるだけ */
.guide .card {
  display: block; margin: 18px 0; background: var(--bg-2);
  color: var(--muted); font-size: var(--fs-sm); line-height: 1.8;
}
.guide kbd {
  padding: 1px 7px; font: inherit; font-size: var(--fs-xs);
  background: var(--panel); border: 1px solid rgba(180, 172, 214, 0.3);
  border-bottom-width: 2px; border-radius: 5px; color: var(--text);
}
/* 図は文字とのバランスで少し内側に置く（本文いっぱいに広げると図の文字が大きくなりすぎる）。
   節の図は絵そのものが枠を持つので、トップページのような影は付けない */
.guide-section .figure svg { max-width: 760px; margin: 22px auto; box-shadow: none; }
/* 背景の 5 種類だけは横に並ぶタイルなので、本文の幅いっぱいまで使って大きく見せる */
#background .figure svg { max-width: none; }

/* 節の一覧。読みながら現在地が分かるよう、横に貼り付けておく。
   狭い幅では同じ並びのまま畳めるようにするので <details> で組んである
   （広い幅では summary を隠し、open のまま出しっぱなしにする） */
.guide-toc { position: sticky; top: 96px; }
.guide-toc > summary { display: none; }
.guide-toc nav { display: flex; flex-direction: column; gap: 2px; }
.guide-toc a {
  padding: 8px 12px; border-radius: 9px; line-height: 1.5;
  font-size: var(--fs-sm); color: var(--muted);
}
.guide-toc a:hover { color: var(--text); background: var(--bg-2); text-decoration: none; }
.guide-toc a.on {
  color: var(--main-hi); background: color-mix(in srgb, var(--main) 16%, transparent);
}

/* 仮想カメラの初回セットアップ 3 手順 */
.steps { display: flex; gap: 12px; margin: 18px 0; }
.steps .step {
  flex: 1; padding: 14px 16px;
  background: linear-gradient(160deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
}
.steps .num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin-bottom: 8px; border-radius: 50%;
  background: linear-gradient(100deg, var(--main), var(--main-lift));
  color: #fff; font-weight: 700; font-size: var(--fs-sm);
  box-shadow: 0 0 14px -2px rgba(110, 80, 255, 0.7);
}
.steps .step b { display: block; color: var(--text); font-size: var(--fs-sm); }
.steps .step small { display: block; margin-top: 4px; color: var(--muted); font-size: var(--fs-xs); line-height: 1.6; }
@media (max-width: 720px) { .steps { flex-direction: column; } }

/* 目次を横に置けない幅では、本文の上に畳んだ状態で置く（並びはそのまま）。
   閉じた状態にするのは main.js（JS が無ければ open のまま出る） */
@media (max-width: 900px) {
  .guide-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .guide-toc {
    position: static;
    background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  }
  .guide-toc > summary {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 16px; cursor: pointer; list-style: none;
    font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  }
  .guide-toc > summary::-webkit-details-marker { display: none; }
  .guide-toc > summary::after { content: "＋"; color: var(--main-hi); font-weight: 400; }
  .guide-toc[open] > summary::after { content: "−"; }
  .guide-toc nav { padding: 0 8px 10px; }

  /* 見出し列が長い日本語だと 1 列目が横幅を食いすぎるので、比率で切る。
     25% だと 1 行で入るはずの語まで折り返すので 30% にしてある */
  .guide th { width: 30%; white-space: normal; padding-right: 14px; }
  .guide td { width: 70%; }
}

/* ---- FAQ ---- */
.faq { display: grid; gap: 10px; margin-top: 28px; }
.faq details {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 4px 20px;
}
/* 見出しが折り返す幅でも ＋ が行から落ちないよう、float ではなく flex で右端に置く */
.faq summary {
  cursor: pointer; padding: 14px 0; font-weight: 600; font-size: var(--fs-base);
  list-style: none;
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "＋"; color: var(--main-hi); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 0 0 16px; color: var(--muted); font-size: var(--fs-sm); }

/* ---- フッタ ---- */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 40px 24px 32px;
}
.footer-inner {
  width: var(--shell); margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 20px; justify-content: space-between; align-items: flex-start;
}
.footer-brand { margin: 0; font-weight: 700; letter-spacing: 0.05em; color: var(--main-hi); }
.footer-tagline { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--muted); }
/* 折り返したときに行間が空きすぎないよう、行の高さも詰める */
.footer-links {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-size: var(--fs-sm); line-height: 1.6;
}
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer-note {
  width: var(--shell); margin: 28px auto 0;
  font-size: var(--fs-xs); color: var(--muted); opacity: 0.75;
}

@media (max-width: 720px) {
  :root { --shell: min(1080px, 100% - 32px); }
  .topnav { display: none; }
  .topbar { gap: 12px; justify-content: space-between; }
  .brand { margin-right: auto; }
  body { font-size: var(--fs-base); }
}
