:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --card: #ffffff;
  --ink: #1a2a40;
  --sub: #5f7189;
  --line: #dde3eb;
  --sky: #a5b0bf;
  --soft: #edf1f6;
  --accent: #1f3a5f;
  --accent-deep: #162b47;
  --accent-ink: #ffffff;
  --warn: #a85a00;
  --gold: #f2b84b;
  --missing: #fff6bf;
  --danger: #b3261e;
  --ok: #0d9488;
  --ok-soft: #e6f6f4;
  --shadow: 0 2px 10px rgba(31, 58, 95, .08);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { background: linear-gradient(180deg, #ffffff 0, var(--bg) 280px) no-repeat, var(--bg); }
body { font: 16px/1.55 -apple-system, "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.screen { max-width: 640px; margin: 0 auto; min-height: 100dvh; padding: calc(var(--safe-t) + 8px) 16px calc(var(--safe-b) + 96px); }
.topbar { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 8px; }
.topbar h1 { flex: 1; margin: 0; font-size: 20px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.big-title { font-size: 30px; font-weight: 800; margin: 12px 0 2px; letter-spacing: .02em; color: var(--accent); }
.lead { color: var(--sub); margin: 0 0 20px; font-size: 14px; }

.link { background: none; border: 0; color: var(--accent); padding: 10px 8px; min-height: 44px; font-weight: 600; transition: opacity .15s; }
.link:active { opacity: .55; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--accent); transition: background-color .15s; }
.icon-btn:active { background: var(--soft); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spinning svg { animation: spin .8s linear infinite; }
.btn { border: 0; border-radius: 12px; padding: 12px 16px; min-height: 48px; font-weight: 700; background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 12px rgba(31, 58, 95, .25); transition: transform .15s var(--ease), box-shadow .15s, background-color .15s; }
.btn:active:not(:disabled) { transform: scale(.97); box-shadow: 0 1px 4px rgba(31, 58, 95, .25); background: var(--accent-deep); }
.btn.secondary { background: var(--soft); color: var(--accent-deep); box-shadow: none; }
.btn.secondary:active:not(:disabled) { background: #dfe5ed; }
.btn.danger { background: var(--card); color: var(--danger); box-shadow: inset 0 0 0 1px #f0cfcc; }
.btn.danger:active:not(:disabled) { background: #fdf0ef; box-shadow: inset 0 0 0 1px #f0cfcc; }
.btn.wide { width: 100%; }
/* Googleのブランドガイドラインに沿った白いボタン */
.google-login { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 16px; border-radius: 999px; background: #fff; border: 1px solid #747775; color: #1f1f1f; font: 500 15px/1 Roboto, -apple-system, "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif; text-decoration: none; transition: background-color .15s, box-shadow .15s, transform .15s var(--ease); }
.google-login:hover { background: #f8f9fa; box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); }
.google-login:active { transform: scale(.98); background: #eef0f1; }
.google-login svg { flex: none; }
.google-login:disabled { opacity: .6; cursor: default; }
button.google-login { cursor: pointer; }
/* Wordアドイン：本文へドラッグできるもの */
[draggable="true"] { cursor: grab; }
[draggable="true"]:active { cursor: grabbing; }
.btn:disabled { opacity: .5; }

.card { background: var(--card); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 0 0 1px var(--line), var(--shadow); transition: transform .15s var(--ease), box-shadow .15s; }
.project-row:active { transform: scale(.985); box-shadow: 0 0 0 1px var(--sky); }
.project-row { display: flex; align-items: center; width: 100%; text-align: left; border: 0; gap: 12px; min-height: 64px; }
.project-row .name { font-weight: 700; display: block; }
.project-row .meta { color: var(--sub); font-size: 13px; }
.project-row .chev { margin-left: auto; color: var(--accent); font-size: 20px; }
/* フォルダと提出済み */
.folder-icon { flex: none; width: 26px; height: 26px; fill: var(--gold); }
.project-row.archived .name { color: var(--sub); }
.project-row.selected { box-shadow: 0 0 0 2px var(--accent), var(--shadow); background: var(--soft); }
.pick-box { flex: none; display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--sky); background: var(--card); }
.project-row.selected .pick-box { background: var(--accent); border-color: var(--accent); }
.project-row.selected .pick-box::after { content: ''; width: 5px; height: 10px; margin-top: -2px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.list-label { margin: 16px 4px 8px; color: var(--sub); font-size: 13px; font-weight: 700; }
.archived-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 8px; padding: 8px 4px; border: 0; background: none; color: var(--sub); font-size: 14px; font-weight: 700; text-align: left; }
.archived-toggle .chev { width: 12px; color: var(--accent); }
.center-title { text-align: center; font-size: 17px !important; }
.back-link { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-form { display: flex; gap: 8px; margin-top: 16px; }
.inline-form input { flex: 1; }
.inline-form .btn { flex: none; min-height: 44px; padding: 8px 14px; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: stretch; }
select, input, textarea { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; font-size: 16px; transition: border-color .15s, box-shadow .15s, background-color .25s; }
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(31, 58, 95, .18); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.controls select { flex: 1; min-width: 160px; width: auto; }
.seg { display: flex; background: var(--soft); border-radius: 10px; padding: 2px; flex: none; }
.seg button { border: 0; background: none; border-radius: 8px; padding: 6px 10px; font-size: 14px; white-space: nowrap; color: var(--accent-deep); transition: background-color .2s, color .2s; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg-wide button { flex: 1; padding: 10px; font-size: 15px; }
/* 追加の画面から戻ったときの、追加した文献の印 */
.ref.just-added { animation: just-added 2.4s ease; }
@keyframes just-added { 0%, 60% { box-shadow: 0 0 0 2px var(--accent), var(--shadow); background: var(--soft); } 100% { box-shadow: 0 0 0 1px var(--line), var(--shadow); background: var(--card); } }

.ref { padding: 12px 14px; }
.ref-body { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 0; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.ref-tools { display: flex; gap: 4px; align-items: center; margin-top: 4px; justify-content: flex-end; }
.ref-tools .warn { margin-right: auto; color: var(--warn); font-size: 12px; }
/* 編集中：文献を選ぶ */
.ref.selected { box-shadow: 0 0 0 2px var(--accent), var(--shadow); background: var(--soft); }
.ref-check { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 8px; color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.ref-check input { width: 20px; height: 20px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
/* 編集中のレポート名：その場で書き換えられる */
.topbar h1:has(.title-edit) { display: flex; min-width: 0; }
.title-edit { display: flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; margin-left: -8px; cursor: text; }
/* 見えない複製の文字で欄の幅を決める */
.title-size { display: inline-grid; min-width: 0; }
.title-size::after, .title-input { grid-area: 1 / 1; padding: 4px 8px; font-size: 20px; font-weight: 700; white-space: pre; }
.title-size::after { content: attr(data-value) ' '; visibility: hidden; overflow: hidden; height: 0; border: 1px solid transparent; }
.title-input { width: 100%; min-width: 3em; min-height: 40px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink); text-overflow: ellipsis; }
.title-edit:hover .title-input { border-color: var(--line); }
.title-input:focus { background: var(--card); }
.title-pencil { flex: none; fill: none; stroke: var(--sub); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: opacity .15s; }
.title-size:focus-within + .title-pencil { opacity: 0; }
.link.edit-done { color: var(--danger); }
.icon-btn.trash-btn { color: var(--danger); }
.icon-btn.trash-btn:active { background: #fdecea; }
.mini { background: none; border: 0; color: var(--accent); font-size: 14px; font-weight: 600; min-height: 36px; min-width: 40px; padding: 4px 8px; }

.empty { text-align: center; color: var(--sub); padding: 48px 16px; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255, 255, 255, .88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 10px 16px calc(var(--safe-b) + 10px); z-index: 5; }
.dock-inner { max-width: 608px; margin: 0 auto; display: flex; gap: 8px; }
.dock .btn { flex: 1; padding: 12px 8px; }

.overlay { position: fixed; inset: 0; background: rgba(26, 42, 64, .4); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 640px; max-height: 94dvh; overflow-y: auto; -webkit-overflow-scrolling: touch; border-radius: 18px 18px 0 0; padding: 8px 16px calc(var(--safe-b) + 20px); }
.sheet-head { display: flex; align-items: center; min-height: 48px; position: sticky; top: -8px; background: var(--card); z-index: 2; margin: -8px -16px 8px; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; margin: 0; font-size: 17px; text-align: center; }
.sheet-head .link { min-width: 76px; }
.sheet-head .link:last-child { text-align: right; }

.camera { position: relative; background: #162b47; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; margin-bottom: 8px; }
.camera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera .aim { position: absolute; left: 8%; right: 8%; top: 32%; bottom: 32%; border: 2px solid rgba(255,255,255,.9); border-radius: 10px; pointer-events: none; }
.camera .hint { position: absolute; left: 0; right: 0; bottom: 8px; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 3px #000; padding: 0 8px; }
.camera-off { display: flex; align-items: center; justify-content: center; text-align: center; color: #fff; padding: 16px; height: 100%; font-size: 14px; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.row > .btn { padding: 12px 6px; white-space: nowrap; }
.note { font-size: 13px; color: var(--warn); margin: -6px 0 12px; }
input.missing { background: var(--missing); }
.missing-legend { background: var(--missing); border-radius: 10px; padding: 8px 12px; margin: 0 0 16px; font-size: 13px; }
.help { font-size: 13px; color: var(--sub); margin: 8px 0; }
.divider { font-size: 13px; color: var(--sub); margin: 18px 0 8px; font-weight: 700; }
.preview { background: var(--soft); border-radius: 12px; padding: 12px; margin-bottom: 16px; font-size: 14px; overflow-wrap: anywhere; }
.preview small { display: block; color: var(--sub); margin-bottom: 2px; }
.creator { background: var(--bg); box-shadow: 0 0 0 1px var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; }
.creator .row { margin-bottom: 8px; }
.creator-foot { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.creator-foot select { flex: 1; }
.creator-foot label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.creator-foot input[type=checkbox] { width: 20px; min-height: 20px; }
.sources { color: var(--sub); font-size: 12px; margin-top: 24px; line-height: 1.6; }

.cite-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cite-row code { flex: 1; font: inherit; overflow-wrap: anywhere; }

.seg-row { display: flex; gap: 6px; align-items: center; background: var(--card); box-shadow: 0 0 0 1px var(--line); border-radius: 10px; padding: 4px 8px; margin-bottom: 6px; }
.seg-row .label { flex: 1; font-size: 14px; }
.seg-row input { width: 74px; flex: none; min-height: 36px; padding: 4px 8px; text-align: center; }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 88px); transform: translate(-50%, 12px); background: var(--accent-deep); color: #fff; padding: 8px 16px; border-radius: 20px; font-size: 14px; box-shadow: 0 6px 18px rgba(22, 43, 71, .3); opacity: 0; transition: opacity .2s, transform .3s var(--ease); pointer-events: none; z-index: 30; max-width: 86vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.spin { text-align: center; padding: 28px 0; color: var(--sub); white-space: pre-line; }
.book-hit { display: block; width: 100%; text-align: left; border: 0; min-height: 64px; }
.book-hit:active { transform: scale(.985); box-shadow: 0 0 0 1px var(--sky); }
.book-hit strong { display: block; font-size: 15px; line-height: 1.45; }
.book-hit .sub { font-weight: 400; }
.book-hit.is-added { box-shadow: 0 0 0 1px #f0cfcc, var(--shadow); }
.added-badge { float: right; margin: 0 0 4px 8px; padding: 2px 8px; border-radius: 999px; background: #fdecea; color: var(--danger); font-size: 12px; font-weight: 700; }
/* 確認画面：同じ文献が既にあるとき */
.dup-alert { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: #fdecea; color: var(--danger); box-shadow: inset 0 0 0 1px #f0cfcc; font-size: 14px; font-weight: 700; }
.book-hit small { display: block; color: var(--sub); font-size: 13px; margin-top: 2px; }
.spin::before { content: ''; display: block; width: 32px; height: 32px; margin: 0 auto 12px; border: 3px solid var(--soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }

/* ---- アニメーション ---- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* 画面を移動したときだけ流す（同期による再描画では動かさない） */
.enter .topbar, .enter .big-title, .enter .lead, .enter .controls { animation: fade .3s ease backwards; }
.enter .card, .enter .camera, .enter .empty { animation: rise .4s var(--ease) backwards; }
.enter .card:nth-of-type(2) { animation-delay: .04s; }
.enter .card:nth-of-type(3) { animation-delay: .08s; }
.enter .card:nth-of-type(4) { animation-delay: .12s; }
.enter .card:nth-of-type(5) { animation-delay: .16s; }
.enter .card:nth-of-type(n+6) { animation-delay: .2s; }
.enter .dock { animation: rise .4s var(--ease) backwards; }
.login-screen > * { animation: rise .5s var(--ease) backwards; }
.login-screen > :nth-child(2) { animation-delay: .06s; }
.login-screen > :nth-child(n+3) { animation-delay: .12s; }

.overlay.enter { animation: fade .22s ease backwards; }
.overlay.enter .sheet { animation: sheet-in .32s var(--ease) backwards; }
.overlay.leaving { pointer-events: none; animation: fade-out .22s ease both; }
.overlay.leaving .sheet { animation: sheet-out .22s ease-in both; }

/* 端末で動きを減らす設定にしている人には動かさない */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- 紹介ページ ---- */
.home-nav { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; max-width: 1040px; margin: 0 auto; padding: calc(var(--safe-t) + 10px) 16px 10px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.home-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 18px; color: var(--accent); text-decoration: none; }
.home-brand img { border-radius: 7px; }
.home .btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.home-nav-cta { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.home main { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

.home-hero { display: grid; gap: 32px; align-items: center; padding: 32px 0 48px; }
.home-kicker { display: inline-block; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--accent-deep); font-size: 13px; font-weight: 700; }
.home-hero h1 { margin: 0 0 16px; font-size: clamp(28px, 7vw, 44px); line-height: 1.3; font-weight: 800; letter-spacing: .01em; }
.home-hero h1 .nb { display: inline-block; }
.home-hero h1 .grad { background: linear-gradient(90deg, var(--accent), #4a6d99); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-lead { color: var(--sub); margin: 0 0 24px; font-size: 16px; max-width: 34em; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.home-actions .btn { flex: 1 1 160px; max-width: 220px; }
.home-hero-text > * { animation: rise .6s var(--ease) backwards; }
.home-hero-text > :nth-child(2) { animation-delay: .08s; }
.home-hero-text > :nth-child(3) { animation-delay: .16s; }
.home-hero-text > :nth-child(4) { animation-delay: .24s; }

.home-demo { display: flex; justify-content: center; animation: rise .8s .2s var(--ease) backwards; }
.demo-phone { width: min(320px, 100%); background: var(--card); border-radius: 28px; padding: 14px; box-shadow: 0 0 0 1px var(--line), 0 20px 50px rgba(31, 58, 95, .18); }
.demo-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.demo-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--soft); color: var(--accent-deep); font-size: 12px; font-weight: 700; transition: background-color .3s, color .3s; }
.demo-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: demo-pulse 1.2s ease-in-out infinite; }
.demo-status.done { background: var(--ok-soft); color: var(--ok); }
.demo-status.done .demo-dot { animation: none; }
.demo-count { font-size: 12px; color: var(--sub); white-space: nowrap; }
.demo-count b { color: var(--ink); font-size: 14px; }
.demo-camera { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: linear-gradient(160deg, #162b47, #2c4a73); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.demo-book { background: #fff; border-radius: 6px; padding: 8px 12px 5px; text-align: center; transform: rotate(-4deg); box-shadow: 0 6px 16px rgba(0, 0, 0, .3); }
.demo-barcode { display: block; width: 120px; height: 40px; fill: var(--accent); }
.demo-isbn { display: block; font-size: 10px; color: var(--accent); letter-spacing: .05em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.demo-aim { position: absolute; left: 18%; right: 18%; top: 16%; bottom: 16%; border: 2px solid rgba(255, 255, 255, .85); border-radius: 10px; transition: border-color .2s, transform .3s var(--ease); }
.demo-camera.hit .demo-aim { border-color: var(--gold); transform: scale(.96); }
.demo-camera.hit::after { content: ''; position: absolute; inset: 0; background: rgba(242, 184, 75, .18); animation: demo-flash .5s ease-out forwards; }
.demo-list-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 6px; font-size: 11px; color: var(--sub); }
.demo-style { padding: 1px 6px; border-radius: 4px; background: var(--soft); color: var(--accent-deep); font-weight: 700; }
/* 3冊分の高さを先に取っておき、積み上がるときに下の内容が動かないようにする */
.demo-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; align-content: start; min-height: 196px; }
.demo-list li { background: var(--card); border-radius: 10px; padding: 8px 10px; font-size: 12px; line-height: 1.5; box-shadow: 0 0 0 1px var(--line); border-left: 3px solid var(--gold); }
.demo-list li.enter { animation: demo-in .5s var(--ease) backwards; }
@keyframes demo-pulse { 50% { transform: scale(1.5); opacity: .4; } }
@keyframes demo-flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes demo-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }

.home-section { padding: 40px 0; }
.home-section > h2, .home-final h2 { font-size: clamp(22px, 5vw, 28px); margin: 0 0 20px; text-align: center; }
.home-section > h2:has(+ .home-section-lead) { margin-bottom: 8px; }
.home-section-lead { max-width: 36em; margin: 0 auto 20px; text-align: center; color: var(--sub); font-size: 15px; }
.home-grid { display: grid; gap: 12px; }
.home-card { background: var(--card); border-radius: 18px; padding: 20px; box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.home-card h3 { margin: 10px 0 6px; font-size: 17px; }
.home-card p { margin: 0; color: var(--sub); font-size: 14px; }
.home-icon { width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--soft); fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.home-steps { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; }
.home-steps li { position: relative; display: flex; gap: 16px; align-items: flex-start; padding: 0 0 28px; }
.home-steps li:last-child { padding-bottom: 0; }
.home-steps li:not(:last-child)::before { content: ''; position: absolute; left: 19px; top: 44px; bottom: 6px; width: 2px; border-radius: 1px; background: linear-gradient(var(--accent), var(--gold)); opacity: .45; }
.home-steps h3 { margin: 6px 0 4px; font-size: 17px; }
.home-steps p { margin: 0; color: var(--sub); font-size: 14px; }
.step-num { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent); color: #fff; font-weight: 800; box-shadow: 0 0 0 4px var(--soft), 0 0 0 6px var(--gold); }

/* 書式の見本 */
.style-demo { max-width: 640px; margin: 0 auto; background: var(--card); border-radius: 18px; padding: 20px; box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.style-tabs { width: 100%; margin-bottom: 14px; }
.style-tabs button { flex: 1; padding: 8px 6px; font-size: 14px; }
.style-sample { margin: 0; min-height: 4.8em; padding: 14px 16px; border-radius: 12px; background: var(--bg); border-left: 3px solid var(--gold); font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; transition: opacity .2s; }
.style-sample.switching { opacity: 0; }
.style-note { margin: 12px 0 0; color: var(--sub); font-size: 13px; }

.home-pair { display: grid; gap: 12px; max-width: 880px; margin: 0 auto; }
.home-install { text-align: center; background: linear-gradient(135deg, #ffffff, var(--soft)); }
.home-install h2 { margin: 0 0 8px; font-size: 20px; }
.home-final { text-align: center; padding: 40px 0 64px; max-width: 520px; margin: 0 auto; }
.home-final .btn { min-width: 220px; }
.home-footer { text-align: center; color: var(--sub); font-size: 12px; padding: 24px 16px calc(var(--safe-b) + 24px); border-top: 1px solid var(--line); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-bottom: 8px; }
.footer-links a { color: var(--sub); }

/* ---- プライバシーポリシー・利用規約・サポート ---- */
.home main.doc { max-width: 720px; padding: 16px 16px 48px; line-height: 1.8; }
.doc h1 { margin: 16px 0 4px; font-size: clamp(24px, 6vw, 30px); color: var(--accent); }
.doc h2 { margin: 32px 0 8px; font-size: 18px; }
.doc h3 { margin: 24px 0 4px; font-size: 16px; }
.doc p, .doc li { font-size: 15px; }
.doc p { margin: 0 0 12px; }
.doc ul { margin: 0 0 12px; padding-left: 1.4em; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--accent); }
.doc-date { color: var(--sub); font-size: 13px !important; }
.doc-contact { margin-top: 16px; padding: 4px 20px 12px; border-radius: 16px; background: var(--card); box-shadow: 0 0 0 1px var(--line), var(--shadow); }
.doc-contact h2 { margin-top: 16px; }
.doc-mail { font-size: 18px !important; font-weight: 700; }
.doc-note { color: var(--sub); font-size: 13px !important; }
.doc-links { margin-top: 32px !important; color: var(--sub); }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.shown { opacity: 1; transform: none; }
.home-grid .reveal:nth-child(3n+2), .home-steps .reveal:nth-child(2) { transition-delay: .08s; }
.home-grid .reveal:nth-child(3n), .home-steps .reveal:nth-child(3) { transition-delay: .16s; }
.home-pair .reveal:nth-child(2) { transition-delay: .08s; }

@media (min-width: 720px) {
  .home-hero { grid-template-columns: 1.15fr 1fr; padding: 64px 0 72px; }
  .home-grid { grid-template-columns: repeat(2, 1fr); }
  .home-pair { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .home-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .home *, .home *::before { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
.back-home { display: inline-flex; align-items: center; margin-left: -8px; text-decoration: none; }

/* ---- 文献の種類を選ぶシート ---- */
.add-choices { display: grid; gap: 10px; margin-bottom: 4px; }
.add-choice { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; text-align: left; border: 0; background: var(--card); border-radius: 14px; padding: 14px 16px; box-shadow: 0 0 0 1px var(--line), var(--shadow); transition: transform .15s var(--ease), box-shadow .15s; }
.add-choice:active { transform: scale(.98); box-shadow: 0 0 0 1px var(--sky); }
.add-choice strong { display: block; font-size: 16px; }
.add-choice small { display: block; color: var(--sub); font-size: 13px; }
.add-choice .chev { margin-left: auto; color: var(--accent); font-size: 20px; }
.choice-icon { flex: none; width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--soft); fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.overlay.enter .add-choice { animation: rise .45s var(--ease) backwards; }
.overlay.enter .add-choice:nth-child(1) { animation-delay: .1s; }
.overlay.enter .add-choice:nth-child(2) { animation-delay: .16s; }
.overlay.enter .add-choice:nth-child(3) { animation-delay: .22s; }
@media (prefers-reduced-motion: reduce) {
  .overlay.enter .add-choice { animation: none; }
}

/* ---- Wordアドイン：サイドバーの幅（320px前後）に収める ---- */
body[data-addin="1"] { font-size: 15px; }
body[data-addin="1"] .screen { padding-left: 12px; padding-right: 12px; padding-bottom: calc(var(--safe-b) + 80px); }
body[data-addin="1"] .topbar { gap: 2px; }
/* 名前が長くても2行までは見せる */
body[data-addin="1"] .topbar h1:not(:has(.title-edit)) { font-size: 16px; line-height: 1.35; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
body[data-addin="1"] .title-size::after, body[data-addin="1"] .title-input { font-size: 17px; }
body[data-addin="1"] .big-title { font-size: 24px; }
body[data-addin="1"] .lead { margin-bottom: 12px; }
body[data-addin="1"] .link { padding: 8px 6px; }
body[data-addin="1"] .icon-btn { width: 36px; height: 36px; }
body[data-addin="1"] .controls { gap: 6px; margin-bottom: 10px; }
body[data-addin="1"] .controls select { min-width: 0; }
body[data-addin="1"] .seg button { padding: 5px 8px; font-size: 13px; }
body[data-addin="1"] .card { padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; }
body[data-addin="1"] .ref-body { font-size: 14px; line-height: 1.55; }
body[data-addin="1"] .ref-tools { margin-top: 2px; }
body[data-addin="1"] .mini { min-height: 32px; font-size: 13px; }
body[data-addin="1"] .project-row { min-height: 52px; gap: 10px; }
body[data-addin="1"] .help { font-size: 12px; }
body[data-addin="1"] .sources { font-size: 11px; }
body[data-addin="1"] .dock { padding: 8px 12px calc(var(--safe-b) + 8px); }
body[data-addin="1"] .dock-inner { gap: 6px; }
body[data-addin="1"] .dock .btn { min-height: 44px; padding: 10px 4px; font-size: 14px; white-space: nowrap; }
body[data-addin="1"] .sheet { padding-left: 12px; padding-right: 12px; }
body[data-addin="1"] .sheet-head { margin-left: -12px; margin-right: -12px; }
