:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1c2024;
  --ink-2: #5a6472;
  --ink-3: #8b96a5;
  --line: #e2e6ec;
  --accent: #2f6df6;
  --good: #1f9d5c;
  --ok: #b4901a;
  --warn: #e07b1f;
  --bad: #d63f3f;
  --sev1: rgba(180, 144, 26, .20);
  --sev2: rgba(224, 123, 31, .24);
  --sev3: rgba(214, 63, 63, .22);
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --panel: #1c2026;
    --ink: #e8ecf1;
    --ink-2: #a4b0bf;
    --ink-3: #76828f;
    --line: #2c333c;
    --accent: #6c9bff;
    --good: #45c07f;
    --ok: #d9b13c;
    --warn: #f0954a;
    --bad: #f46a6a;
    --sev1: rgba(217, 177, 60, .22);
    --sev2: rgba(240, 149, 74, .26);
    --sev3: rgba(244, 106, 106, .26);
  }
}

* { box-sizing: border-box; }

/* display を指定した要素にも hidden 属性を効かせる（.pane や .field.block が上書きするため） */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- ヘッダ ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px 24px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  flex-wrap: wrap;
}
.topbar h1 {
  margin: 0; font-size: 16px; font-weight: 700;
  display: flex; align-items: baseline; gap: 10px;
  flex-wrap: wrap; white-space: nowrap;
}
.phase {
  font-size: 11px; font-weight: 500; color: var(--ink-3);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
  white-space: nowrap; flex: none;
}
.tabs { display: flex; gap: 4px; flex: none; }
.tab {
  border: none; background: transparent; color: var(--ink-2);
  font: inherit; font-size: 13px; padding: 6px 14px;
  border-radius: 999px; cursor: pointer; white-space: nowrap;
}
@media (max-width: 620px) {
  .phase { display: none; }
  .topbar h1 { font-size: 15px; }
}
.tab:hover { background: var(--bg); }
.tab.is-active { background: var(--accent); color: #fff; }

.tabpanel { display: none; padding: 18px 24px 40px; }
.tabpanel.is-active { display: block; }

/* ---------- 小分類タブ ---------- */
.subtabbar {
  position: sticky; top: 53px; z-index: 9;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.subtabs { display: flex; gap: 2px; padding: 0 20px; }
.subtabs:empty { display: none; }
.subtabbar:has(.subtabs:not([hidden]):empty) { display: none; }
.subtab {
  border: none; background: transparent; color: var(--ink-3);
  font: inherit; font-size: 13px; padding: 10px 14px 8px;
  cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.subtab:hover { color: var(--ink); }
.subtab.is-active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }

/* ---------- ツールバー ---------- */
.toolbar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.field { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.field > span { color: var(--ink-2); }
select {
  font: inherit; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink);
}
.preset-note { margin: 0; font-size: 12px; color: var(--ink-3); }
.spacer { flex: 1; }

.btn {
  font: inherit; font-size: 13px; cursor: pointer;
  border-radius: 8px; padding: 6px 14px; white-space: nowrap;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { opacity: .88; color: #fff; }
.btn.tiny { padding: 2px 10px; font-size: 12px; margin-left: 8px; }

/* ---------- レイアウト ---------- */
.workspace, .profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.workspace { align-items: stretch; }
.profile-grid { align-items: start; }
@media (max-width: 980px) {
  .workspace, .profile-grid { grid-template-columns: minmax(0, 1fr); }
}

.pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.pane-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.pane-head h2 { margin: 0; font-size: 13px; font-weight: 700; }
.meta { font-size: 11px; color: var(--ink-3); }
.meta.ok { color: var(--good); }
.pane-body { padding: 14px; overflow: auto; max-height: calc(100vh - 190px); }
.pane-foot { margin: 0; padding: 8px 14px; font-size: 11px; color: var(--ink-3); border-top: 1px solid var(--line); }
.pane-actions { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }

textarea {
  width: 100%; border: none; outline: none; resize: vertical;
  padding: 14px; font: inherit; line-height: 1.9;
  background: transparent; color: var(--ink);
  min-height: 420px;
  flex: 1;
}
#input { min-height: calc(100vh - 250px); }
#profileInput { min-height: 300px; flex: none; }

.empty {
  color: var(--ink-3); font-size: 13px;
  padding: 28px 10px; text-align: center; line-height: 2;
}

/* ---------- スコア ---------- */
.scorecard {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, rgba(127,127,127,.04));
}
.scorecard[data-tone="good"] { border-color: var(--good); }
.scorecard[data-tone="ok"]   { border-color: var(--ok); }
.scorecard[data-tone="warn"] { border-color: var(--warn); }
.scorecard[data-tone="bad"]  { border-color: var(--bad); }

.score-num { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.score-num small { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.score-label { font-weight: 700; font-size: 14px; }
.score-label.good { color: var(--good); }
.score-label.ok   { color: var(--ok); }
.score-label.warn { color: var(--warn); }
.score-label.bad  { color: var(--bad); }
.score-hint { font-size: 11px; color: var(--ink-3); }

/* ---------- 軸バー ---------- */
.axes { margin: 14px 0 6px; display: grid; gap: 6px; }
.axis { display: grid; grid-template-columns: 130px 1fr 32px; align-items: center; gap: 10px; font-size: 12px; }
.axis-name b { color: var(--accent); margin-right: 3px; }
.axis-bar { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; }
.axis-bar i { display: block; height: 100%; border-radius: 999px; transition: width .2s ease; }
.axis-bar i.good { background: var(--good); }
.axis-bar i.ok   { background: var(--ok); }
.axis-bar i.warn { background: var(--warn); }
.axis-bar i.bad  { background: var(--bad); }
.axis-val { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- セクション見出し ---------- */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 20px 0 8px;
}
.section-head h3 { margin: 0; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.section-head .count { font-weight: 400; color: var(--ink-3); }
.legend { display: flex; gap: 6px; }
.lg { font-size: 10px; padding: 1px 8px; border-radius: 999px; color: var(--ink-2); }
.lg.sev1 { background: var(--sev1); }
.lg.sev2 { background: var(--sev2); }
.lg.sev3 { background: var(--sev3); }

/* ---------- プレビュー ---------- */
.preview {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; max-height: 380px; overflow: auto;
  line-height: 2.1; font-size: 13px;
  white-space: normal; word-break: break-word;
}
mark.hl {
  background: var(--sev1); color: inherit;
  border-radius: 3px; padding: 1px 1px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.06);
}
mark.hl.sev2 { background: var(--sev2); }
mark.hl.sev3 { background: var(--sev3); }
mark.hl.flash { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- 指摘リスト ---------- */
.findings { display: grid; gap: 8px; }
.finding {
  border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
  border-radius: 8px; padding: 10px 12px;
}
.finding.sev3 { border-left-color: var(--bad); }
.finding.sev2 { border-left-color: var(--warn); }
.finding.sev1 { border-left-color: var(--ok); }

.finding-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.finding-title { font-size: 13px; }
.chip {
  font-size: 10px; font-weight: 700; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px; background: var(--line); color: var(--ink-2);
}
.num { font-size: 11px; color: var(--ink-3); }
.ignore {
  margin-left: auto; font: inherit; font-size: 11px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-3);
  border-radius: 6px; padding: 1px 10px;
}
.ignore:hover { color: var(--bad); border-color: var(--bad); }

.finding-why { margin: 6px 0 0; font-size: 12px; color: var(--ink-2); }
.finding-fix { margin: 5px 0 0; font-size: 12px; color: var(--accent); }
.jumps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.jump {
  font: inherit; font-size: 11px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2);
  border-radius: 5px; padding: 1px 8px;
}
.jump:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- プロファイルタブ ---------- */
.prose { max-width: 820px; margin: 0 0 16px; }
.prose h2 { font-size: 14px; margin: 20px 0 6px; }
.prose p { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
.prose code {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 5px; font-size: 12px;
}
.notice {
  border-left: 3px solid var(--good); padding-left: 10px;
}

table.kv { width: 100%; border-collapse: collapse; font-size: 12px; }
table.kv th, table.kv td { text-align: left; padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.kv th { font-weight: 500; color: var(--ink-2); width: 42%; }
table.kv.rules th { width: 60%; }
.tag { font-size: 10px; padding: 1px 8px; border-radius: 999px; }
.thin-warn {
  margin: 10px 0 0; font-size: 12px; color: var(--ink-2);
  border-left: 3px solid var(--warn); padding-left: 10px;
}
.tag.off  { background: var(--sev3); color: var(--bad); }
.tag.down { background: var(--sev1); color: var(--ok); }

/* ==================== 追加機能 ==================== */

input[type="number"], input[type="password"], input[type="text"] {
  font: inherit; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); width: 100%;
}
.field.block { display: block; margin-bottom: 10px; }
.field.block > span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.field.block select { width: 100%; }
.fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 2px; margin-bottom: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pane-actions.flush { padding: 10px 0 0; border: none; align-items: center; flex-wrap: wrap; }
.pane-foot-inline { margin: 0 0 0 auto; font-size: 11px; color: var(--ink-3); }

/* ---------- AI判定 ---------- */
.detectcard {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.detectcard[data-tone="good"] { border-color: var(--good); }
.detectcard[data-tone="ok"]   { border-color: var(--ok); }
.detectcard[data-tone="warn"] { border-color: var(--warn); }
.detectcard[data-tone="bad"]  { border-color: var(--bad); }
.detect-main { display: flex; align-items: center; gap: 14px; }
.detect-num { font-size: 28px; font-weight: 800; line-height: 1; }
.detect-num small { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.detect-label { font-weight: 700; font-size: 13px; }
.detect-label.good { color: var(--good); }
.detect-label.ok { color: var(--ok); }
.detect-label.warn { color: var(--warn); }
.detect-label.bad { color: var(--bad); }
.detect-main .btn { margin-left: auto; }
.caveat {
  margin: 8px 0 0; font-size: 11px; color: var(--ink-3);
  border-left: 2px solid var(--line); padding-left: 8px;
}
.detect-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

table.signals { margin-top: 10px; }
table.signals td.c, table.signals th.c { text-align: center; }
table.signals tr.hintrow td {
  font-size: 11px; color: var(--ink-3); padding: 0 4px 8px; border-bottom: 1px solid var(--line);
}
.pill {
  display: inline-block; font-size: 11px; font-weight: 700;
  padding: 1px 9px; border-radius: 999px; background: var(--line); color: var(--ink-2);
}
.pill.good { background: rgba(31,157,92,.18); color: var(--good); }
.pill.ok   { background: var(--sev1); color: var(--ok); }
.pill.warn { background: var(--sev2); color: var(--warn); }
.pill.bad  { background: var(--sev3); color: var(--bad); }

/* ---------- Gemini講評 ---------- */
#judgeResult { margin-top: 12px; display: grid; gap: 8px; }
.judge-head { display: flex; align-items: center; gap: 10px; }
.judge-verdict { margin: 0; font-size: 12px; color: var(--ink-2); }
.judge-good { margin: 0; font-size: 12px; color: var(--good); }
.finding.judge { border-left-color: var(--accent); }
.chip.axG { background: var(--accent); color: #fff; }
mark.hl.axG { background: rgba(47,109,246,.24); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- ファイル ---------- */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 28px; text-align: center; margin-bottom: 14px;
  background: var(--panel); transition: border-color .15s, background .15s;
}
.dropzone p { margin: 4px 0; font-size: 13px; }
.dropzone.over { border-color: var(--accent); background: rgba(47,109,246,.06); }
.dropzone.busy { opacity: .6; pointer-events: none; }

table.filetable th, table.filetable td { padding: 8px 6px; }
table.filetable td.c, table.filetable th.c { text-align: center; white-space: nowrap; }
table.filetable td.name { font-size: 12px; word-break: break-all; width: 34%; }
table.filetable tr.err td { color: var(--bad); font-size: 12px; }
table.filetable tr.warnrow td {
  color: var(--warn); font-size: 11px;
  border-bottom: none; padding-bottom: 0;
}
table.filetable b.good { color: var(--good); }
table.filetable b.ok { color: var(--ok); }
table.filetable b.warn { color: var(--warn); }
table.filetable b.bad { color: var(--bad); }
.axcell { white-space: nowrap; }
.mini-bar {
  display: inline-block; width: 22px; height: 6px; margin: 0 1px;
  background: var(--line); border-radius: 999px; overflow: hidden; vertical-align: middle;
}
.mini-bar i { display: block; height: 100%; }
.mini-bar i.good { background: var(--good); }
.mini-bar i.ok { background: var(--ok); }
.mini-bar i.warn { background: var(--warn); }
.mini-bar i.bad { background: var(--bad); }

/* ---------- 生成 ---------- */
.gen-grid, .settings-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px; align-items: start;
}
@media (max-width: 980px) {
  .gen-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .row3 { grid-template-columns: minmax(0, 1fr); }
}
textarea.mini {
  border: 1px solid var(--line); border-radius: 8px; min-height: 190px;
  padding: 10px; line-height: 1.8;
}
textarea.mini.short { min-height: 80px; }
#genOutput {
  border: 1px solid var(--line); border-radius: 8px; min-height: 340px;
  padding: 12px; line-height: 2; margin-top: 10px;
}

.attempts { margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.attempts-head { font-size: 11px; color: var(--ink-3); padding: 6px 10px; border-bottom: 1px solid var(--line); }
.attempt {
  display: grid; grid-template-columns: 28px 70px 60px 1fr;
  align-items: center; font-size: 12px; padding: 5px 10px;
  border-bottom: 1px solid var(--line);
}
.attempt:last-child { border-bottom: none; }
.attempt .n { color: var(--ink-3); }
.attempt .diff { color: var(--warn); font-variant-numeric: tabular-nums; }
.attempt.ok .diff { color: var(--good); }
.attempt .mark { color: var(--good); font-size: 11px; }

.compare { display: grid; gap: 6px; }
.cmp { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cmp b { font-size: 18px; }
.cmp b.good { color: var(--good); }
.cmp b.ok { color: var(--ok); }
.cmp b.warn { color: var(--warn); }
.cmp b.bad { color: var(--bad); }
.cmp-label { color: var(--ink-3); font-size: 11px; }
.cmp .arrow { color: var(--ink-3); }

/* ---------- 学習 ---------- */
table.karte th { width: 30%; vertical-align: top; }
table.karte td { font-size: 12px; }
.tagword {
  display: inline-block; font-size: 11px; margin: 2px 4px 2px 0;
  padding: 1px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
}
table.log th { width: 30%; font-size: 11px; }
table.log th .num { margin-left: 8px; }
table.log td { display: flex; align-items: center; gap: 10px; }
table.log td .logtext { flex: 1; }
.logtext { font-size: 12px; color: var(--ink-2); }
#karteView { margin-top: 10px; }
.notice.warn { border-left-color: var(--warn); }
ul.plain { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
ul.plain li { margin-bottom: 6px; }

/* ---------- トースト ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  padding: 9px 18px; border-radius: 999px; font-size: 13px;
  z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 90vw;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.warn { background: var(--warn); color: #fff; }

/* ---------- MDプロファイル ---------- */
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 980px) { .row2 { grid-template-columns: minmax(0, 1fr); } }

.profiles-grid {
  display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 16px; align-items: stretch; margin-bottom: 16px;
}
@media (max-width: 980px) { .profiles-grid { grid-template-columns: minmax(0, 1fr); } }

.pcard {
  border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 8px;
}
.pcard.active { border-left-color: var(--good); }
.pcard.editing { background: rgba(127,127,127,.06); }
.pcard-head { display: flex; align-items: center; gap: 8px; }
.pcard-head b { font-size: 13px; word-break: break-word; }
.pcard-meta { font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.pcard-meta .src {
  margin-left: 8px; border: 1px solid var(--line);
  border-radius: 999px; padding: 0 7px;
}
.pcard-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pcard-actions .btn.tiny { margin-left: 0; }
.tag { white-space: nowrap; }
.tag.on {
  background: rgba(31,157,92,.18); color: var(--good);
  font-size: 10px; padding: 1px 8px; border-radius: 999px;
  margin-left: auto; flex: none;
}

#mdEditor {
  min-height: 520px; padding: 14px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, "Hiragino Sans", monospace;
  font-size: 12.5px; line-height: 1.9;
}
.warn-text { color: var(--warn); }

/* ---------- レポート作成 ---------- */
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: auto; margin: 0; }
.check span { color: var(--ink); }

.step-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 16px 0 6px; font-size: 12px;
}
.step-head b { font-size: 13px; }

#rpOutline { min-height: 260px; }
#rpBody {
  border: 1px solid var(--line); border-radius: 8px;
  min-height: 380px; padding: 12px; line-height: 2; margin-top: 6px;
}

.gaps {
  border: 1px solid var(--warn); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 10px;
}
.gaps b { font-size: 12px; color: var(--warn); }
.gaps ul { margin: 6px 0 0; }

/* ---------- ステップ（アコーディオン） ---------- */
.steps { display: grid; gap: 8px; }
.step { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.step.is-open { border-color: var(--accent); }

.step-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 12px 14px; border: none; cursor: pointer;
  background: transparent; color: var(--ink); font: inherit; text-align: left;
}
.step-head:hover { background: rgba(127,127,127,.06); }
.step-no {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--line); color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.step.is-open .step-no { background: var(--accent); color: #fff; }
.step-title { font-size: 13px; font-weight: 700; flex: none; }
.step-sum {
  font-size: 11px; color: var(--ink-3); margin-left: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%;
}
.step-sum.todo { color: var(--warn); }
.step-caret { flex: none; color: var(--ink-3); font-size: 11px; transition: transform .15s; }
/* 開いているときは要約が消えるので、矢印を右端に寄せ直す */
.step.is-open .step-caret { margin-left: auto; transform: rotate(180deg); }
.step.is-open .step-sum { display: none; }

.step-body { display: none; padding: 0 14px 14px; }
.step.is-open .step-body { display: block; }
.step-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.step-actions.left { justify-content: flex-start; margin-top: 8px; }

.step-head-plain {
  display: flex; align-items: baseline; gap: 10px; margin: 18px 0 6px;
}
.step-head-plain b { font-size: 13px; }

/* ---------- 詳細設定 ---------- */
details.advanced {
  border: 1px dashed var(--line); border-radius: 8px;
  margin: 12px 0; background: rgba(127,127,127,.03);
}
details.advanced > summary {
  cursor: pointer; padding: 8px 12px; font-size: 12px; color: var(--ink-2);
  list-style: none;
}
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: '▸ '; color: var(--ink-3); }
details.advanced[open] > summary::before { content: '▾ '; }
details.advanced > summary:hover { color: var(--ink); }
.advanced-body { padding: 4px 12px 10px; border-top: 1px solid var(--line); }

/* ---------- 実行バー ---------- */
.runbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.btn.big { padding: 9px 22px; font-size: 14px; }

/* ---------- 使い方の案内 ---------- */
.howto { display: grid; gap: 14px; padding: 10px 4px; }
.howto-step { display: flex; gap: 12px; align-items: flex-start; }
.howto-step > b {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.howto-step strong { font-size: 13px; display: block; }
.howto-step p { margin: 3px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.7; }
.howto-foot { margin-top: 4px; }

.field.block > span em { font-style: normal; color: var(--ink-3); font-weight: 400; }
.meta.indent { margin: 2px 0 10px 26px; line-height: 1.7; }

table.seccheck th { width: 46%; font-size: 12px; }
table.seccheck td.c { text-align: center; white-space: nowrap; }
#rpSectionCheck:empty { display: none; }

.grounded {
  border: 1px solid var(--good); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px;
}
.grounded b { font-size: 12px; color: var(--good); }
.grounded p { margin: 4px 0 0; }
ul.srclist { margin: 8px 0 0; padding-left: 18px; font-size: 12px; }
ul.srclist li { margin-bottom: 4px; word-break: break-word; }
ul.srclist a { color: var(--accent); }
.searchentry { margin-top: 8px; }
.searchentry:empty { display: none; }

.refbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.refbar b { font-size: 16px; }
table.reftable th { width: 92px; }
table.reftable td { font-size: 12px; word-break: break-word; }
table.reftable tr.need td { color: var(--warn); }
table.reftable .pill { margin-left: 8px; }

/* ---------- APIを使わない受け渡し ---------- */
.manualbox {
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px;
}
.manual-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.manual-head b { font-size: 13px; }
.manual-steps { margin: 10px 0 0; padding-left: 20px; font-size: 13px; }
.manual-steps li { margin-bottom: 14px; }
.manual-steps textarea { width: 100%; margin-top: 8px; }
.manual-steps #mnPrompt { min-height: 200px; }
.manual-steps #mnPaste { min-height: 160px; }
.manual-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.manual-retry {
  border-left: 3px solid var(--warn); padding-left: 10px; margin-top: 4px;
}
.manual-retry b { font-size: 12px; color: var(--warn); }
.manual-retry p { margin: 4px 0 0; }

#promptFallback { margin-bottom: 16px; }
#promptText { min-height: 220px; border: none; border-radius: 0; }
#promptFallback .pane-head .btn { margin-left: auto; }
#mdPreview table.karte th { width: 26%; }
