/* mafutsu-ui.css — shinfutsu 共有 UI レイヤー (SHARED_LAYER step A)
 *
 *   <link rel="stylesheet" href="/shared/mafutsu-ui.css">
 *
 * canonical デザイントークン + class ベースの共通コンポーネント。
 * bare element セレクタ (body / main / textarea / select) は含めない
 * (page 毎にレイアウト・寸法が違うため各ページの inline <style> に残す)。
 * 各ページは本 CSS を link し、固有 CSS のみ inline に残す。 */

:root {
  --ink: #17202a;
  --muted: #62717d;
  --line: #d8e0e4;
  --soft: #f4f7f8;
  --panel: #ffffff;
  --brand: #166f7a;
  --brand-dark: #10545c;
  --accent: #b9862f;
  --danger: #b42318;
  --ok: #1a7f52;
  --warn: #92400e;
  --shadow: 0 18px 42px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

/* ---- topbar ---- */
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 2px 12px rgba(15, 23, 42, .06);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 750;
}
.mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
  font-size: 14px;
}
.topnote {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---- pane (二ペイン内側) ---- */
.pane {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.pane-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}
.pane-head h1,
.pane-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}
.pane-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ---- runner 部品 (input pane / sample / output) ---- */
.sample-row {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.sample-row label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.input-wrap {
  min-height: 0;
  padding: 14px;
  display: grid;
}
.output {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: #fff;
}

/* ---- actions / buttons ---- */
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfc;
}
.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.run {
  min-width: 132px;
  height: 40px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--brand);
  font-weight: 750;
  cursor: pointer;
}
.run.secondary {
  color: var(--brand-dark);
  background: var(--soft);
  border: 1px solid #cfe3e6;
}
.run:disabled {
  opacity: .58;
  cursor: wait;
}
:focus-visible { outline: 3px solid rgba(22, 111, 122, .22); outline-offset: 2px; }

/* ---- markdown 結果表示 ---- */
.result h2 {
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}
.result h3 {
  margin: 16px 0 6px;
  font-size: 15px;
  color: var(--brand-dark);
}
.result p { margin: 0 0 10px; line-height: 1.75; }
.result ul,
.result ol { margin: 6px 0 12px; padding-left: 24px; line-height: 1.7; }
.result li { margin: 4px 0; }
.result strong { color: #0f3f46; }

/* ---- sources (参考文献) ---- */
.sources {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #e2d7c5;
  border-radius: 7px;
  background: #fffaf1;
}
.sources h3 { margin-top: 0; color: #6f4a0f; }
.source-item {
  margin: 8px 0;
  color: #3b3b3b;
  font-size: 13px;
  line-height: 1.5;
}

/* ---- error / empty / safety ---- */
.error {
  color: var(--danger);
  background: #fff2f0;
  border: 1px solid #ffd1cc;
  border-radius: 7px;
  padding: 12px;
  line-height: 1.6;
}
.empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}
.safety {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #f4c7a1;
  border-radius: 7px;
  background: #fff7ed;
  color: #713f12;
  line-height: 1.6;
  font-size: 13px;
}
