/* 共通の見た目（ハブ・事務ツール）。外部のフォントや画像は読まない（ページの CSP で外部への通信を止めているため） */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1a1d23;
  --text-2: #3d434d;
  --muted: #646b76;
  --border: #dde1e7;
  --border-strong: #c3c9d2;
  --input-border: #8a919c;
  --accent: #1a56c4;
  --accent-hover: #1446a3;
  --accent-soft: #e8effc;
  --accent-text: #ffffff;
  --error: #b42318;
  --error-bg: #fdecea;
  --warning: #8a5300;
  --warning-bg: #fff4dc;
  --ok: #17663a;
  --ok-bg: #e6f4eb;
  --info-bg: #eef3fa;
  --code-bg: #eef0f4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-hover: 0 4px 12px rgba(16, 24, 40, .10);
  --radius: 10px;
  --radius-sm: 6px;
  --read: 46rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e232b;
    --text: #e8eaee;
    --text-2: #c9ced6;
    --muted: #9aa2ad;
    --border: #2b313a;
    --border-strong: #3a414c;
    --input-border: #6b7480;
    --accent: #7aa8ff;
    --accent-hover: #a3c2ff;
    --accent-soft: #1b2740;
    --accent-text: #0b1526;
    --error: #ff8f85;
    --error-bg: #3a1d1b;
    --warning: #ffc56b;
    --warning-bg: #3a2d14;
    --ok: #7ed6a0;
    --ok-bg: #15301f;
    --info-bg: #19222f;
    --code-bg: #232933;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-hover: 0 6px 16px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "BIZ UDPGothic", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.8;
  letter-spacing: .01em;
  font-feature-settings: "palt" 0;
}

a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* ヘッダー：ロゴとナビ */
header.site { background: var(--surface); border-bottom: 1px solid var(--border); }
header.site .wrap { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 24px; padding-top: 14px; padding-bottom: 12px; }
header.site .brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; padding-top: 2px;
}
header.site .brand::before {
  content: "";
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background:
    linear-gradient(var(--accent-text), var(--accent-text)) 7px 8px / 12px 2px no-repeat,
    linear-gradient(var(--accent-text), var(--accent-text)) 7px 12px / 12px 2px no-repeat,
    linear-gradient(var(--accent-text), var(--accent-text)) 7px 16px / 8px 2px no-repeat,
    var(--accent);
}
header.site nav { flex: 1 1 520px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
header.site .nav-group { position: relative; display: flex; align-items: center; gap: 2px 4px; flex-wrap: wrap; padding-left: 6.5em; }
header.site .nav-label {
  position: absolute; left: 0; top: 5px; font-size: .75rem; font-weight: 700; letter-spacing: .04em; color: var(--muted);
}
header.site nav a {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .87rem; line-height: 1.6; color: var(--text-2); text-decoration: none; white-space: nowrap;
}
header.site nav a:hover { background: var(--surface-2); color: var(--text); }
header.site nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ハブのヘッダー（ナビなし） */
header.site .wrap > .brand:only-child { padding-bottom: 2px; }

main { padding: 28px 0 56px; }

/* パンくず（ビルドで入る） */
.crumbs { font-size: .82rem; color: var(--muted); margin: 0 0 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs span[aria-hidden] { margin: 0 6px; }

h1 { font-size: clamp(1.45rem, 1.1rem + 1.4vw, 1.9rem); line-height: 1.4; letter-spacing: .02em; margin: 0 0 12px; }
h2 { font-size: 1.25rem; line-height: 1.5; margin: 40px 0 12px; }
h3 { font-size: 1.05rem; line-height: 1.5; margin: 24px 0 6px; }
p { margin: 0 0 14px; }
.lead { font-size: 1.05rem; color: var(--text-2); margin: 0 0 22px; max-width: var(--read); }

code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, "BIZ UDGothic", monospace;
  font-size: .88em; background: var(--code-bg); border-radius: 4px; padding: 1px 6px; word-break: break-all;
}

/* 「どこにも送信しません」の帯 */
.privacy {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--ok-bg); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
  border-radius: var(--radius); padding: 12px 16px; margin: 0 0 24px; font-size: .93rem; line-height: 1.7;
}
.privacy::before {
  content: "✓"; flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 2px;
  border-radius: 50%; background: var(--ok); color: var(--surface); font-size: .75rem; font-weight: 700; line-height: 1;
}

/* ツールの操作の枠 */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 22px; margin: 0 0 18px;
}
.panel > h2:first-child { margin-top: 0; font-size: 1.1rem; }
/* 手順の番号（「1」「2」…の丸） */
h2 .step {
  display: inline-grid; place-items: center; flex: none;
  width: 1.6em; height: 1.6em; margin-right: .55em; border-radius: 50%;
  background: var(--accent); color: var(--accent-text); font-size: .8em; font-weight: 700; line-height: 1; vertical-align: .12em;
}

.drop {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2);
  padding: 28px 16px; text-align: center; transition: border-color .15s, background .15s;
}
.drop.over, .drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.drop label { display: block; font-weight: 700; margin-bottom: 10px; }

fieldset { border: 0; padding: 0; margin: 14px 0 0; }
legend { font-weight: 700; margin-bottom: 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 6px 20px; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; font-size: .95rem; line-height: 1.5;
  padding: 9px 20px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.secondary:hover, .button.secondary:hover { background: var(--accent-soft); color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions + p { margin-top: 14px; font-size: .88rem; color: var(--muted); }
.panel > p:last-child, .panel > :last-child { margin-bottom: 0; }

.status { margin: 12px 0 0; color: var(--text-2); }
.sample { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 14px 0 0; font-size: .88rem; color: var(--muted); }
.sample button { padding: 5px 14px; font-size: .85rem; }
.badge { display: inline-block; vertical-align: middle; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; margin-left: 4px; }
.badge.error { background: var(--error-bg); color: var(--error); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--text); }

ul.issues { list-style: none; padding: 0; margin: 8px 0 0; }
ul.issues li { padding: 8px 0; border-bottom: 1px solid var(--border); }
ul.issues li:last-child { border-bottom: 0; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 4px 0 0; }
.summary div { background: var(--surface-2); border-radius: 8px; padding: 10px 14px; }
.summary dt { font-size: .8rem; color: var(--muted); }
.summary dd { margin: 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* 表 */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.table-scroll table { border: 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { border-bottom: 1px solid var(--border); padding: 8px 12px; text-align: left; white-space: nowrap; vertical-align: top; }
thead th { background: var(--surface-2); font-size: .82rem; font-weight: 700; color: var(--text-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
tr.has-error td { background: var(--error-bg); }
tr.has-warning td { background: var(--warning-bg); }
tr.group-start td { border-top: 2px solid var(--border-strong); }

pre.preview {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; max-height: 260px; overflow: auto; font-size: .85rem; white-space: pre;
}

/* トップのカード */
.section-title { display: flex; align-items: baseline; gap: 12px; margin: 36px 0 12px; font-size: 1.1rem; }
.section-title small { font-size: .82rem; font-weight: 400; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.cards a.card {
  display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cards a.card:hover, .cards a.card:focus-visible { border-color: var(--accent); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.cards h2, .cards h3 { margin: 0; font-size: 1.02rem; line-height: 1.5; color: var(--text); }
.cards a.card:hover h2, .cards a.card:hover h3 { color: var(--accent); }
.cards p { margin: 0; font-size: .9rem; line-height: 1.7; color: var(--muted); }
.cards a.card::after { content: "使ってみる →"; margin-top: auto; padding-top: 6px; font-size: .82rem; font-weight: 700; color: var(--accent); }
.cards.guides a.card::after { content: "読む →"; }

/* ハブのトップ */
.hero { padding: 28px 0 8px; }
.hero-kicker { margin: 0 0 6px; font-size: .8rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: clamp(1.7rem, 1.1rem + 2.4vw, 2.6rem); line-height: 1.35; margin-bottom: 16px; }
.hero .lead { font-size: 1.08rem; }
.points { list-style: none; padding: 0; margin: 32px 0 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.points li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.points strong { display: block; margin-bottom: 4px; font-size: 1rem; }
.points span { display: block; font-size: .88rem; line-height: 1.7; color: var(--muted); }
.service { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.service-head h3 { margin: 0 0 4px; font-size: 1.2rem; }
.service-head h3 a { text-decoration: none; }
.service-head p { margin: 0 0 14px; color: var(--muted); font-size: .92rem; }
.service-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 28px; border-top: 1px solid var(--border); padding-top: 14px; }
.service-label { margin: 0 0 4px; font-size: .75rem; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.service ul { list-style: none; padding: 0; margin: 0 0 8px; }
.service li { padding: 3px 0; font-size: .93rem; }
.service li a { text-decoration: none; }
.service li a:hover { text-decoration: underline; }
.more { margin: 14px 0 0; font-size: .9rem; font-weight: 700; }
.more a { text-decoration: none; }

.related { margin: 44px 0 8px; padding: 22px 22px 24px; background: var(--accent-soft); border-radius: var(--radius); }
.related h2, .article .related h2 { margin: 0 0 12px; padding: 0; border: 0; font-size: 1.05rem; }
.related .cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.related .card { padding: 14px 16px; }
.related .card h3 { font-size: .95rem; }
.related .card p { font-size: .84rem; }

dl.faq { margin: 0; }
dl.faq dt { font-weight: 700; margin-top: 18px; }
dl.faq dd { margin: 4px 0 0; color: var(--text-2); }

/* 解説のページ：読みやすい行の長さ */
.wrap.article { max-width: calc(var(--read) + 40px); }
.article > p, .article > ul, .article > ol, .article > dl { color: var(--text-2); }
.article h2 { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--border); }
.article h1 + .lead + h2, .article .lead + h2 { border-top: 0; padding-top: 0; margin-top: 32px; }
.article ul, .article ol { padding-left: 1.4em; margin: 0 0 16px; }
.article li { margin: 4px 0; }
.article li::marker { color: var(--muted); }
.article table { margin: 8px 0 18px; border: 1px solid var(--border); border-radius: 8px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.article th, .article td { white-space: normal; min-width: 4em; overflow-wrap: anywhere; }
.article p > code:only-child { display: block; padding: 10px 14px; font-size: .92rem; border: 1px solid var(--border); }
ul.sources { font-size: .88rem; padding-left: 1.2em; }
ul.sources li { margin: 6px 0; }
p.sources { font-size: .88rem; color: var(--muted); }

footer.site { border-top: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: .85rem; padding: 20px 0 36px; }
footer.site p { margin: 0; }
footer.site a { color: var(--muted); }
footer.site a:hover { color: var(--accent); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.grid label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 700; }
input:not([type="radio"]):not([type="file"]):not([type="checkbox"]), select, textarea {
  font: inherit; font-weight: 400; padding: 8px 10px;
  border: 1px solid var(--input-border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input[type="checkbox"], input[type="radio"] { width: 1.05em; height: 1.05em; accent-color: var(--accent); }
input[type="file"] { font: inherit; font-size: .9rem; max-width: 100%; }
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 700; margin-right: 10px; padding: 6px 14px; cursor: pointer;
  border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--accent);
}
input[type="file"]::file-selector-button:hover { background: var(--accent-soft); }
textarea { display: block; width: 100%; margin: 8px 0 14px; resize: vertical; line-height: 1.6; }
label.check { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
td.kana { font-family: ui-monospace, Consolas, monospace; }

/* キーボードで操作しているときのフォーカスをはっきり見せる */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* 広告（広告のページだけ。ツールのページには入らない） */
.ad { margin: 2.2rem 0; padding-top: 6px; border-top: 1px dashed var(--border); }
.ad-label { margin: 0 0 .25rem; font-size: .72rem; color: var(--muted); }
.ad ins.adsbygoogle { display: block; }

/* 幅が狭いときは、ナビをロゴの下に全幅で置く */
@media (max-width: 1100px) {
  header.site nav { flex-basis: 100%; }
}

/* スマホ：ナビは横に流して、ヘッダーを短く */
@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  header.site .wrap { gap: 8px; }
  header.site nav { flex-basis: 100%; gap: 4px; }
  header.site .nav-group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding: 0 16px 0 0; }
  header.site .nav-group::-webkit-scrollbar { display: none; }
  header.site .nav-label { position: static; flex: none; margin-right: 4px; }
  main { padding-top: 20px; }
  .panel { padding: 16px; }
  h2 { font-size: 1.15rem; }
  .article h2 { margin-top: 36px; padding-top: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
