/* 創作工房 共通スタイル */

:root {
  --paper: #f6f1e7;
  --paper-2: #fffdf8;
  --paper-3: #efe7d8;
  --ink: #2a2622;
  --ink-2: #5d554c;
  --ink-3: #8a8073;
  --line: #ddd2bf;
  --accent: #a2452f;      /* 朱 */
  --accent-ink: #ffffff;
  --accent-soft: #f3dfd6;
  --indigo: #2f4a6d;      /* 藍 */
  --indigo-soft: #dfe6ef;
  --ok: #3d6b45;
  --ok-soft: #e1ecdf;
  --warn: #8a5a12;
  --warn-soft: #f6e8c8;
  --danger: #a12b2b;
  --danger-soft: #f6dcdc;
  --shadow: none;
  --radius: 3px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c1a17;
    --paper-2: #24211d;
    --paper-3: #2d2924;
    --ink: #ece5d8;
    --ink-2: #c3b9a9;
    --ink-3: #93897b;
    --line: #3d3730;
    --accent: #e0805f;
    --accent-ink: #1c1a17;
    --accent-soft: #3d2a22;
    --indigo: #9db6d8;
    --indigo-soft: #26303d;
    --ok: #93c49b;
    --ok-soft: #233024;
    --warn: #e2b562;
    --warn-soft: #3a2f1c;
    --danger: #ec8d8d;
    --danger-soft: #3c2323;
    --shadow: none;
    color-scheme: dark;
  }
}
@media (prefers-color-scheme: dark) { .sample img { filter: brightness(.85); } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site-main { flex: 1; padding-bottom: 48px; }
a { color: var(--indigo); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.4; font-family: var(--font-serif); font-weight: 700; letter-spacing: .02em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: .2em 0 .3em; }
h2 { font-size: 1.3rem; margin: 1.6em 0 .6em; }
h3 { font-size: 1.08rem; margin: 1.2em 0 .4em; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 720px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--paper-2); padding: 8px 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.lead { color: var(--ink-2); font-size: 1.02rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ヘッダー */
.site-header {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 5px;
  border: 2px solid var(--accent); color: var(--accent); background: transparent;
  font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; transform: rotate(-4deg);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-serif); font-weight: 700; font-size: 1.15rem; letter-spacing: .08em; }
.brand-sub { font-size: .7rem; color: var(--ink-3); }
.stage-nav { display: flex; gap: 4px; flex: 1; justify-content: center; overflow-x: auto; scrollbar-width: none; }
.stage-nav a {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-bottom: 2px solid transparent;
  color: var(--ink-2); text-decoration: none; white-space: nowrap; font-size: .92rem;
}
.stage-nav a:hover { color: var(--ink); border-bottom-color: var(--line); }
.stage-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.stage-no {
  font-family: var(--font-serif); font-size: .85rem; color: var(--ink-3); line-height: 1;
}
.header-tools { display: flex; align-items: center; gap: 10px; }
.set-chip {
  display: flex; align-items: center; gap: 6px; max-width: 260px; padding: 5px 12px;
  border: 1px solid var(--line); border-radius: 3px; background: var(--paper);
  color: var(--ink); text-decoration: none; font-size: .85rem;
}
.set-chip:hover { border-color: var(--accent); color: var(--ink); }
.set-chip-label { color: var(--ink-3); font-size: .72rem; }
.set-chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.save-state { font-size: .72rem; color: var(--ink-3); white-space: nowrap; }
.save-state.is-error { color: var(--danger); }
.account-link { font-size: .88rem; white-space: nowrap; }

@media (max-width: 1080px) {
  .header-inner { gap: 8px; }
  .stage-nav { order: 3; flex-basis: 100%; justify-content: flex-start; margin: 0 -16px; padding: 0 16px 4px; }
  .header-tools { margin-left: auto; }
  .brand-sub { display: none; }
  .set-chip { max-width: 170px; }
  .set-chip-label { display: none; }
}

/* フッター */
.site-footer { background: var(--paper-3); border-top: 1px solid var(--line); padding: 28px 0 16px; font-size: .88rem; color: var(--ink-2); }
.footer-inner { display: flex; gap: 32px; justify-content: space-between; flex-wrap: wrap; }
.footer-inner > div { max-width: 520px; }
.footer-brand { font-family: var(--font-serif); font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.footer-nav { display: flex; flex-direction: column; gap: 4px; }
.copyright { margin: 20px 0 0; color: var(--ink-3); font-size: .78rem; }

/* 汎用部品 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--paper-2); color: var(--ink); font: inherit; font-size: .92rem; font-weight: 600;
  cursor: pointer; text-decoration: none; line-height: 1.3;
}
.btn:hover { border-color: var(--ink-3); color: var(--ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper-3); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .84rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row select { width: auto; min-height: 32px; padding: 4px 8px; font-size: .88rem; }

.panel {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 16px; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }

.notice { background: var(--indigo-soft); border-radius: 3px; padding: 12px 14px; color: var(--ink); font-size: .92rem; }
.notice-warn { background: var(--warn-soft); }
.flashes { margin-top: 16px; }
.flash { padding: 12px 16px; border-radius: 3px; margin: 0 0 8px; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--indigo-soft); color: var(--indigo); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 3px; font-size: .74rem; background: var(--paper-3); color: var(--ink-2); vertical-align: middle; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }

/* フォーム */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.field > span, .field > label { font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--ink-3); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px; min-height: 40px;
}
textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
fieldset { border: 1px solid var(--line); border-radius: 3px; padding: 10px 14px; margin: 0 0 14px; }
legend { font-size: .86rem; font-weight: 600; color: var(--ink-2); padding: 0 4px; }

/* パンくず・ツール枠 */
.breadcrumb { display: flex; gap: 8px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-3); margin: 18px 0 4px; }
.breadcrumb a { color: var(--ink-3); }
.tool-head { margin-bottom: 20px; }
.tool-root { min-height: 320px; }
.loading { color: var(--ink-3); }
.tool-foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 40px; padding-top: 8px; border-top: 1px dashed var(--line); }
.tool-foot h2 { font-size: 1rem; margin: 12px 0 8px; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.next-link { display: flex; flex-direction: column; padding: 12px 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--paper-2); text-decoration: none; font-weight: 700; }
.next-link span { font-weight: 400; color: var(--ink-2); font-size: .86rem; }

.tool-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.tool-layout.wide-side { grid-template-columns: minmax(0, 1fr) 380px; }
@media (max-width: 900px) { .tool-layout, .tool-layout.wide-side { grid-template-columns: 1fr; } }
.sticky-side { position: sticky; top: 84px; }
@media (max-width: 900px) { .sticky-side { position: static; } }

/* セット未作成時 */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state h2 { margin-top: 0; }

/* トップ */
.intro { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 40px; align-items: center; padding: 40px 0 8px; }
@media (max-width: 860px) { .intro { grid-template-columns: 1fr; gap: 24px; padding-top: 24px; } }
.intro h1 { font-size: clamp(1.7rem, 4.2vw, 2.4rem); line-height: 1.45; margin: 0 0 .5em; }
.intro .lead { margin-bottom: 20px; }
.intro-note { margin: 10px 0 0; }
.sample { margin: 0; }
.sample img { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: var(--paper-2); transform: rotate(.6deg); }
.sample figcaption { font-size: .8rem; color: var(--ink-3); margin-top: 8px; }

/* 目次のような道具の一覧 */
.toc { margin-top: 32px; border-top: 2px solid var(--ink); }
.toc > h2 { font-size: 1rem; letter-spacing: .1em; margin: 10px 0 4px; }
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list > li { display: grid; grid-template-columns: 15em minmax(0, 1fr); gap: 0 24px; padding: 14px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .toc-list > li { grid-template-columns: 1fr; } }
.toc-list h3 { margin: 0; font-size: 1.15rem; display: flex; flex-wrap: wrap; align-items: baseline; align-content: flex-start; align-self: start; gap: 2px 10px; }
.toc-list h3 a { color: var(--ink); text-decoration: none; }
.toc-list h3 a:hover { color: var(--accent); }
.toc-no { font-family: var(--font-serif); color: var(--accent); }
.toc-when { flex-basis: 100%; font-family: var(--font); font-weight: 400; font-size: .8rem; color: var(--ink-3); padding-left: 1.6em; }
.toc-list ul { list-style: none; margin: 0; padding: 0; }
.toc-list ul li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px; padding: 4px 0; }
.toc-list ul a { font-weight: 700; min-width: 8.5em; text-decoration-thickness: 1px; }
.toc-list ul span { color: var(--ink-2); font-size: .9rem; }
.plain-list { margin: 0; padding-left: 1.2em; max-width: 760px; }
.plain-list li { margin-bottom: .5em; }
.plain-list strong { margin-right: .3em; }
.compare { width: 100%; border-collapse: collapse; font-size: .92rem; border-top: 1px solid var(--ink-3); }
.compare th, .compare td { border-bottom: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.compare thead th { background: transparent; border-bottom: 1px solid var(--ink-3); }
.compare tbody th { white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* 工程ハブ */
.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
.tool-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.tool-card:hover { border-color: var(--accent); color: var(--ink); }
.tool-card strong { font-size: 1.06rem; font-family: var(--font-serif); }
.tool-card span { color: var(--ink-2); font-size: .9rem; }

/* 設定カード */
.type-tabs { display: flex; gap: 2px 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.type-tabs button { border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--ink-2); padding: 6px 10px; font: inherit; font-size: .9rem; cursor: pointer; }
.type-tabs button:hover { color: var(--ink); }
.type-tabs button[aria-pressed="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.s-card { text-align: left; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 14px; }
.s-card:hover { border-color: var(--accent); }
.s-card[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.s-card .card-type { font-size: .72rem; color: var(--ink-3); }
.s-card .card-name { font-weight: 700; font-size: 1.05rem; font-family: var(--font-serif); }
.s-card .card-reading { font-size: .78rem; color: var(--ink-3); }
.s-card .card-summary { font-size: .86rem; color: var(--ink-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.suggest-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.suggest-list button { border: 1px dashed var(--ink-3); background: var(--paper); border-radius: 3px; padding: 4px 10px; font: inherit; font-size: .88rem; cursor: pointer; color: var(--ink); }
.suggest-list button:hover { border-style: solid; border-color: var(--accent); }
.suggest-list small { color: var(--ink-3); margin-left: 4px; }
.inline-warn { font-size: .84rem; background: var(--warn-soft); color: var(--warn); border-radius: 3px; padding: 6px 10px; margin: -6px 0 12px; }

/* お題・能力の生成結果 */
.gen-result { display: grid; gap: 10px; }
.gen-row { display: grid; grid-template-columns: 7em 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; background: var(--paper); border-radius: 3px; border: 1px solid var(--line); }
.gen-row .gen-label { font-size: .8rem; color: var(--ink-3); font-weight: 700; }
.gen-row .gen-value { font-size: 1.04rem; font-weight: 600; }
.gen-row .lock { border: 1px solid var(--line); background: var(--paper-2); border-radius: 3px; font: inherit; font-size: .78rem; padding: 3px 8px; cursor: pointer; color: var(--ink-2); }
.gen-row .lock[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
@media (max-width: 520px) { .gen-row { grid-template-columns: 1fr auto; } .gen-row .gen-label { grid-column: 1 / -1; } }
.premise-text { font-family: var(--font-serif); font-size: 1.15rem; line-height: 1.9; padding: 16px 18px; background: var(--paper); border-left: 4px solid var(--accent); border-radius: 0; margin: 14px 0; }
.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.history-list li { font-size: .9rem; padding: 10px 12px; background: var(--paper); border-radius: 3px; border: 1px solid var(--line); }

/* 相関図 */
.map-box { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.map-node { touch-action: none; }
.map-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 18px; align-items: start; }
.map-side .panel + .panel { margin-top: 0; }
.map-box svg { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.map-node { cursor: grab; }
.map-node:active { cursor: grabbing; }
.map-node rect { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1.5; }
.map-node.t-character rect { stroke: var(--accent); }
.map-node.t-organization rect { stroke: var(--indigo); stroke-dasharray: 4 3; }
.map-node.t-place rect { stroke: var(--ok); }
.map-node.is-selected rect { stroke-width: 3; }
.map-node text { fill: var(--ink); font-size: 14px; font-weight: 700; font-family: var(--font); }
.map-node text.sub { font-size: 11px; font-weight: 400; fill: var(--ink-3); }
.map-edge line { stroke: var(--ink-2); stroke-width: 1.6; }
.map-edge text { fill: var(--ink-2); font-size: 12px; font-family: var(--font); paint-order: stroke; stroke: var(--paper-2); stroke-width: 4px; }
.rel-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.rel-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; background: var(--paper); border-radius: 3px; }

/* 年表 */
.timeline { list-style: none; margin: 0 0 0 8px; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li.auto { padding-bottom: 10px; }
.timeline li { position: relative; padding: 0 0 18px 18px; }
.timeline li::before { content: ""; position: absolute; left: -26px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }
.timeline li.auto::before { border-color: var(--ink-3); border-style: dashed; }
.timeline .t-year { font-weight: 700; font-family: var(--font-serif); color: var(--accent); }
.timeline .auto .t-year { color: var(--ink-3); }
.timeline .t-title { font-weight: 700; }
.timeline .t-meta { font-size: .84rem; color: var(--ink-3); }
.timeline .t-desc { font-size: .92rem; color: var(--ink-2); margin: 2px 0 0; white-space: pre-wrap; }
.timeline .t-actions { margin-top: 4px; }
.timeline .warn-line { display: block; font-size: .82rem; color: var(--warn); background: var(--warn-soft); border-radius: 3px; padding: 3px 8px; margin-top: 4px; }

/* プロット */
.beats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: beat; }
.beat { padding: 14px 16px; }
.beat-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.beat-head h3 { margin: 0; font-size: 1.02rem; }
.beat-hint { font-size: .84rem; color: var(--ink-3); margin: 2px 0 8px; }
.beat-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* 点検 */
.issue-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.issue { padding: 12px 14px; border-radius: 3px; background: var(--warn-soft); display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.issue.is-ignored { background: var(--paper-3); opacity: .75; }
.issue p { margin: 0; }
.issue > .btn { flex-shrink: 0; white-space: nowrap; }
.issue .issue-kind { font-size: .76rem; font-weight: 700; color: var(--warn); }
.all-clear { padding: 16px; border-radius: 3px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }

/* 資料 */
.sheet { background: #fff; color: #222; padding: 40px 44px; border-radius: 4px; box-shadow: var(--shadow); font-family: var(--font-serif); }
.sheet h1 { font-size: 1.9rem; border-bottom: 2px solid #222; padding-bottom: 8px; }
.sheet h2 { font-size: 1.25rem; border-left: 5px solid #a2452f; padding-left: 10px; margin-top: 2em; }
.sheet h3 { font-size: 1.05rem; margin-bottom: 2px; }
.sheet dl { display: grid; grid-template-columns: 7em 1fr; gap: 2px 12px; margin: 4px 0 12px; font-family: var(--font); font-size: .92rem; }
.sheet dt { color: #777; }
.sheet dd { margin: 0; white-space: pre-wrap; }
.sheet table { width: 100%; border-collapse: collapse; font-family: var(--font); font-size: .9rem; }
.sheet th, .sheet td { border-bottom: 1px solid #ddd; padding: 6px 8px; text-align: left; vertical-align: top; }
.sheet .sheet-meta { color: #666; font-family: var(--font); font-size: .86rem; }
.sheet .sheet-logline { font-size: 1.05rem; border-left: 3px solid #ccc; padding-left: 12px; }
.sheet .sheet-desc { color: #555; font-size: .9em; white-space: pre-wrap; margin-top: 2px; }
.sheet .sheet-text { white-space: pre-wrap; font-family: var(--font); font-size: .95rem; }
.sheet tr.sheet-auto td { color: #888; font-size: .86rem; }
.sheet .sheet-rel td.rel-mid { color: #a2452f; font-weight: 600; white-space: nowrap; text-align: center; }
.audience { border: 0; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.audience legend { font-weight: 700; font-size: .92rem; margin-bottom: 4px; padding: 0; }
.secret-box { border: 1px dashed var(--line, #ccc); border-radius: 3px; padding: 10px 12px 4px; margin: 4px 0 16px; }
.secret-box legend { font-size: .88rem; font-weight: 700; padding: 0 4px; }
@media (max-width: 600px) { .sheet { padding: 22px 18px; } .sheet dl { grid-template-columns: 1fr; } .sheet dt { margin-top: 6px; } }

/* セット一覧 */
.set-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.set-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.set-item.is-current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.set-item h3 { margin: 0; font-size: 1.08rem; }
.set-item p { margin: 0; font-size: .84rem; color: var(--ink-3); }

/* ダイアログ */
dialog { border: 1px solid var(--ink-3); border-radius: 3px; background: var(--paper-2); color: var(--ink); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(30, 24, 18, .45); }
dialog form, .dialog-body { padding: 22px; }
dialog h2 { margin-top: 0; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }

/* トースト */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); visibility: hidden; opacity: 0; pointer-events: none; background: var(--ink); color: var(--paper); padding: 12px 20px; border-radius: 3px; font-size: .95rem; font-weight: 600; line-height: 1.5; box-shadow: 0 6px 24px rgba(0,0,0,.35); border: 2px solid var(--paper); transition: opacity .15s, transform .15s, visibility 0s .15s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { visibility: visible; opacity: 1; transform: translate(-50%, 0); transition: opacity .15s, transform .15s; }

/* 文章ページ */
.prose { max-width: 720px; }
.prose h2 { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-bottom: .3em; }
.auth-box { max-width: 440px; margin: 32px auto 0; }

/* 印刷 */
@media print {
  .site-header, .site-footer, .breadcrumb, .tool-head, .tool-foot, .no-print, .toast, .skip { display: none !important; }
  body { background: #fff; }
  .site-main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .sheet { box-shadow: none; padding: 0; }
  .sheet h2 { break-after: avoid; }
  .sheet section { break-inside: avoid-page; }
}

/* グリッドの中ではパネル同士の余白をグリッドに任せる */
:is(.card-grid, .tool-cards, .map-side) > .panel + .panel { margin-top: 0; }
@media (max-width: 860px) {
  .site-header { position: static; }
}
@media (max-width: 520px) {
  .stage-nav { gap: 0; justify-content: space-between; }
  .stage-nav a { padding: 6px 6px; gap: 4px; font-size: .8rem; }
  .stage-no { font-size: .8rem; }
}

/* 関係の説明 */
.rel-note { margin-top: 4px; font-size: .84rem; }
.rel-note summary { cursor: pointer; color: var(--ink-3); white-space: pre-wrap; }
.rel-note[open] summary { color: var(--ink-2); }
.rel-note textarea { margin: 6px 0; min-height: 64px; font-size: .9rem; }

/* 能力：問いと作例 */
.ex-bar { margin-bottom: 16px; }
.ex-head { margin: 10px 0 0; font-size: .92rem; }
.q-block { padding: 12px 0; border-bottom: 1px solid var(--line); }
.q-block:first-child { padding-top: 0; }
.q-block:last-child { border-bottom: 0; padding-bottom: 0; }
.q-block .field { margin-bottom: 8px; }
.ex-box { font-size: .88rem; color: var(--ink-2); border-left: 2px solid var(--line); padding: 2px 0 2px 10px; }
.ex-box .ex-label { font-size: .72rem; color: var(--ink-3); margin-right: 8px; }
.ex-box ul { margin: 4px 0 0; padding-left: 1.2em; }
.note-q { margin: 0 0 14px; }
.note-q > summary { cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--indigo); margin-bottom: 8px; }
.note-q .field textarea { min-height: 56px; }
.ex-insight { display: block; margin-top: 4px; font-size: .86rem; color: var(--accent); }
.ex-list { margin-top: 10px; font-size: .9rem; }
.ex-list > summary { cursor: pointer; color: var(--indigo); font-size: .86rem; }
.ex-list ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 320px; overflow: auto; }
.ex-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.prompt-panel { margin-bottom: 8px; }
.prompt-q { margin: 10px 0 4px; font-weight: 600; }
.ex-list ul.q-list { list-style: disc; padding-left: 1.2em; max-height: none; overflow: visible; }
.ex-list ul.q-list li { display: list-item; border: 0; padding: 1px 0; }
/* スマホでは、完了の通知を画面の上に出す（下のボタンや入力欄に重ならないように） */
@media (max-width: 700px) {
  .toast { bottom: auto; top: 12px; transform: translate(-50%, -20px); }
  .toast.show { transform: translate(-50%, 0); }
}
.intro-links { margin: 12px 0 0; font-size: .92rem; color: var(--ink-2); }
.intro-links a { font-weight: 700; white-space: nowrap; }
.ex-summary { display: block; margin-top: 4px; font-size: .9rem; color: var(--ink); }
.ex-fold > summary { cursor: pointer; font-size: .82rem; color: var(--indigo); }
.ex-fold[open] > summary { margin-bottom: 4px; }
