/* /settings の Zenn風 1 カラム。
 * spec: docs/superpowers/specs/2026-07-31-settings-zenn-style-redesign-design.md
 *
 * ダークモード指定は意図的に書かない。本サイトは body を暗色にするルールを
 * 持たない (Bootstrap 4.5 ベース) ため、ここで dark media query を足すと
 * 「白地に薄いグレーの文字」になる。これは今回直したバグそのもの。
 */

/* ---- ページ骨格 ---- */
.dlc-set { max-width: 820px; margin: 0 auto; padding: 16px 16px 80px; }
.dlc-set-title { font-size: 24px; font-weight: 700; margin: 8px 0 4px; letter-spacing: .01em; }
.dlc-set-lead { color: #868e96; font-size: 13px; margin: 0 0 24px; }

/* ---- 群見出し (h2) = 目次に載る単位 ---- */
.dlc-set h2.dlc-eh-sec {
  font-size: 19px; font-weight: 700; margin: 34px 0 12px;
  padding-left: 10px; border-left: 5px solid #c2185b;
  scroll-margin-top: calc(var(--dlc-scroll-margin, 48px) + 12px);
}
.dlc-set h2.dlc-eh-sec:first-of-type { margin-top: 20px; }

/* ---- カード ---- */
.dlc-set-card {
  background: #fff; border: 1px solid #e9ecef; border-radius: 10px;
  padding: 18px 20px; margin: 0 0 12px;
  scroll-margin-top: calc(var(--dlc-scroll-margin, 48px) + 12px);
}
.dlc-set-card > h3 {
  font-size: 15px; font-weight: 700; margin: 0 0 4px;
  display: flex; align-items: center; gap: 7px;
}
.dlc-set-card > h3 + .dlc-set-desc { margin-top: 0; }
.dlc-set-desc { font-size: 13px; color: #868e96; line-height: 1.75; margin: 6px 0 0; }
.dlc-set-desc code {
  background: #f1f3f5; border-radius: 3px; padding: 1px 5px;
  font-size: 12px; color: #495057;
}
.dlc-set-desc a { color: #c2185b; }
/* テンプレートから style="margin-top:0" を追い出すための位置ルール。
   「先頭に来た説明文は上マージンを持たない」を CSS 側の責務にする。 */
.dlc-set-fold-body > .dlc-set-desc:first-child { margin-top: 0; }
.dlc-set-sub-h + .dlc-set-desc { margin-top: 0; }
.dlc-set-acc-body > .dlc-set-desc:first-child { margin-top: 0; }
.dlc-set-desc + .dlc-set-linkbtns { margin-top: 10px; }

/* カード内の区切り (サブブロック) */
.dlc-set-sub { margin-top: 18px; padding-top: 16px; border-top: 1px solid #f1f3f5; }
.dlc-set-sub-h { font-size: 13px; font-weight: 700; color: #495057; margin: 0 0 8px; }
.dlc-set-sub > .dlc-set-row:first-child { margin-top: 0; }

/* フォーム下のフィードバック行 / 画面外の file input */
.dlc-set-feedback { margin-top: 12px; font-size: 0.9em; }
.dlc-set-hidden-input { display: none; }

/* ---- 折りたたみカード (details/summary) ---- */
.dlc-set-fold { padding: 0; }
.dlc-set-fold > summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 16px 20px; display: flex; align-items: center; gap: 10px;
  border-radius: 10px;
}
.dlc-set-fold > summary::-webkit-details-marker { display: none; }
.dlc-set-fold > summary:hover { background: #fafbfc; }
.dlc-set-fold > summary::after {
  content: "▾"; color: #adb5bd; font-size: 12px; margin-left: 10px;
  transition: transform .2s; flex-shrink: 0;
}
.dlc-set-fold[open] > summary::after { transform: rotate(180deg); }
.dlc-set-fold[open] > summary { border-bottom: 1px solid #f1f3f5; border-radius: 10px 10px 0 0; }
.dlc-set-card-h {
  font-size: 15px; font-weight: 700; margin-right: auto;
  display: flex; align-items: center; gap: 7px;
}
.dlc-set-card-h .opt { font-size: 11.5px; font-weight: 400; color: #adb5bd; }
.dlc-set-sum { font-size: 12px; color: #868e96; text-align: right; }
.dlc-set-sum.is-empty { color: #adb5bd; }
.dlc-set-fold-body { padding: 16px 20px 18px; }

/* ---- 設定行 (トグル / ラジオ) ---- */
.dlc-set-row {
  display: flex; align-items: flex-start; gap: 10px;
  cursor: pointer; user-select: none; margin-top: 14px; padding: 2px 0;
}
.dlc-set-row:first-of-type { margin-top: 10px; }
.dlc-set-row-label { font-size: 14px; line-height: 1.6; }
.dlc-set-row-note { font-size: 12px; color: #868e96; line-height: 1.7; margin: 6px 0 0 38px; }
.dlc-set-radios { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.dlc-set-radios label {
  display: flex; align-items: center; gap: 9px;
  font-size: 14px; cursor: pointer; user-select: none; padding: 4px 0;
}
.dlc-set-radios input { accent-color: #c2185b; }
/* トグルのつまみ本体は .dlc-filter-modal-badge-sw (responsive.css) を流用する。
   設定ページでは行の先頭に来るので上マージンだけ揃える。 */
.dlc-set-row .dlc-filter-modal-badge-sw { margin-top: 3px; }

/* ---- ボタン ---- */
.dlc-set-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  border-radius: 6px; border: 1px solid #d1d1d6; background: #fff;
  color: #1d1d1f; cursor: pointer; text-decoration: none;
}
.dlc-set-btn:hover { background: #f8f9fa; }
.dlc-set-btn-primary { background: #007bff; border-color: #007bff; color: #fff; }
.dlc-set-btn-primary:hover { background: #0069d9; color: #fff; }
.dlc-set-btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.dlc-set-btn-discord:hover { background: #4752c4; color: #fff; }
.dlc-set-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ---- フォーム ---- */
.dlc-set-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin-top: 14px; }
.dlc-set-form input {
  flex: 1; min-width: 220px; padding: 9px 11px; font-size: 14px;
  border: 1px solid #d1d1d6; border-radius: 6px; background: #fff; color: #1d1d1f;
}
.dlc-set-form input:focus {
  outline: none; border-color: #c2185b; box-shadow: 0 0 0 3px rgba(194,24,91,.12);
}
.dlc-set-status {
  margin-top: 14px; font-size: 13px; padding: 10px 12px;
  background: #f1f3f5; border-radius: 6px; color: #495057;
}
/* 将来 alert-email.js / alert-discord.js を書き換える時用の成功色。
   現状この class を付与する経路は無い (両 JS は innerHTML に inline
   style を書く実装で、既存 JS は変更禁止のため触れていない)。 */
.dlc-set-status.ok { background: #e6f7ec; color: #1b6e3c; }

/* ---- 注意書き ---- */
.dlc-set-callout {
  margin: 12px 0 0; padding: 11px 14px 11px 32px;
  background: #fff8f0; border: 1px solid #ffe0b2; border-radius: 8px;
  font-size: 12.5px; color: #8a5a00; line-height: 1.8; position: relative;
}
.dlc-set-callout::before { content: "⚠"; position: absolute; left: 12px; top: 10px; font-size: 13px; }
.dlc-set-callout ul { margin: 0; padding-left: 16px; }
.dlc-set-callout li + li { margin-top: 5px; }

/* ---- 同期トークン ---- */
.dlc-set-sync { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-top: 12px; }
.dlc-set-token {
  display: inline-block; padding: 7px 12px; background: #f1f3f5;
  border: 1px solid #e9ecef; border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px; letter-spacing: .08em; color: #1d1d1f;
  word-break: break-all;   /* 32 桁 hex。旧 #dlc-sync-token-display にあった指定を維持 */
}
.dlc-set-qr { min-width: 160px; }
.dlc-set-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: #868e96; word-break: break-all; margin-top: 8px;
}

/* ---- インポート (入れ子の details) ---- */
.dlc-set-acc { border: 1px solid #e9ecef; border-radius: 8px; margin-top: 8px; overflow: hidden; }
.dlc-set-acc > summary {
  list-style: none; padding: 11px 14px; cursor: pointer;
  font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px;
  background: #fafbfc;
}
.dlc-set-acc > summary::-webkit-details-marker { display: none; }
.dlc-set-acc > summary::after { content: "▾"; margin-left: auto; color: #adb5bd; font-size: 11px; }
.dlc-set-acc[open] > summary::after { transform: rotate(180deg); }
.dlc-set-acc[open] > summary { border-bottom: 1px solid #e9ecef; }
.dlc-set-acc-body { padding: 12px 14px 14px; }
.dlc-set-acc-sub { font-size: 11.5px; color: #adb5bd; font-weight: 400; }
.dlc-set-linkbtns { display: flex; flex-wrap: wrap; gap: 7px; }
.dlc-set-linkbtn {
  padding: 6px 12px; font-size: 12.5px; border-radius: 6px;
  border: 1px solid #d1d1d6; background: #fff; color: #495057;
  text-decoration: none; display: inline-flex; align-items: center; gap: 5px;
}
.dlc-set-linkbtn:hover { background: #f8f9fa; border-color: #adb5bd; color: #495057; }
.dlc-set-linkbtn.is-fav { border-color: #b6d4fe; color: #0b5ed7; background: #f5f9ff; }
.dlc-set-linkbtn.is-follow { border-color: #b7e4c7; color: #1b6e3c; background: #f4fbf6; }

/* ---- バックアップ結果モーダル (旧 settings.html の <style> から移設) ---- */
.sync-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 10040; align-items: center; justify-content: center;
}
.sync-overlay.active { display: flex; }
.sync-modal {
  background: #fff; color: #1d1d1f; border-radius: 10px; padding: 24px;
  max-width: 420px; width: 90%; position: relative; box-shadow: 0 8px 30px rgba(0,0,0,.3);
}
.sync-modal h3 { margin: 0 0 16px; font-size: 18px; }
.sync-modal .close-btn {
  position: absolute; top: 10px; right: 14px; background: none; border: none;
  color: #adb5bd; font-size: 22px; cursor: pointer;
}
.sync-modal .close-btn:hover { color: #495057; }
.sync-result {
  background: #f1f3f5; border-radius: 6px; padding: 12px; margin-top: 12px;
  font-size: 13px; line-height: 1.6;
}
.sync-result .added { color: #1b6e3c; }
.sync-result .skipped { color: #868e96; }
.sync-result .error { color: #dc3545; }
.sync-action-btn {
  display: block; width: 100%; padding: 10px; margin-top: 12px;
  font-size: 15px; font-weight: bold; border: none; border-radius: 6px; cursor: pointer;
}
.sync-action-btn.primary { background: #c2185b; color: #fff; }
.sync-action-btn.primary:hover { background: #a4164e; }
.sync-action-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- フローティング目次 (entity-hub-toc.js が生成する DOM) ----
 * entity-hub.css / article.css にも同種のルールがあるが、あちらは
 * .dlc-entity-hub スコープ全体 / 720px カラム向けで、読み込むと設定ページの
 * レイアウトに干渉する。位置だけ 820px 向けに調整した独立コピーを置く
 * (spec §6「目次 CSS の 3 コピー目」)。 */
.dlc-eh-toc { display: none; z-index: 1045; }
/* 目次: Zenn 風に縦線 + 丸マーカー。丸の大きさで階層を表す
   (lv1 = 群見出し / lv2 = カード名。class は entity-hub-toc.js が付与) */
.dlc-eh-toc ul { list-style: none; margin: 0; padding: 0; position: relative; }
.dlc-eh-toc ul::before {
  content: ''; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 1px; background: #e9ecef;
}
.dlc-eh-toc li a {
  display: block; position: relative; padding: 4px 0 4px 18px;
  font-size: 12.5px; color: #6c757d; text-decoration: none; line-height: 1.5;
}
.dlc-eh-toc li a::before {
  content: ''; position: absolute; top: 50%; transform: translateY(-50%);
  border-radius: 50%; background: #ced4da; transition: background .15s, transform .15s;
}
.dlc-eh-toc li.lv1 a::before { width: 9px; height: 9px; left: 1px; }
.dlc-eh-toc li.lv2 a { padding-left: 30px; font-size: 11.5px; color: #868e96; }
.dlc-eh-toc li.lv2 a::before { width: 5px; height: 5px; left: 13px; background: #dee2e6; }
.dlc-eh-toc li a:hover { color: #c2185b; }
.dlc-eh-toc li a:hover::before { background: #f06595; }
.dlc-eh-toc li.on a { color: #c2185b; font-weight: 700; }
.dlc-eh-toc li.on a::before { background: #c2185b; transform: translateY(-50%) scale(1.15); }
.dlc-eh-toc-fab {
  display: none; position: fixed; right: 12px; bottom: 90px; z-index: 1045;
  background: #c2185b; color: #fff; border: none; border-radius: 18px;
  padding: 9px 16px; font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 10px rgba(0,0,0,.25); cursor: pointer;
}
body.dlc-ann-bar-shown .dlc-eh-toc-fab { bottom: 104px; }
@media (min-width: 1280px) {
  /* カラム 820px → 右端は中央 +410px。その外側に目次を置く */
  .dlc-eh-toc {
    display: block; position: fixed; top: 130px; left: calc(50% + 434px); width: 180px;
    max-height: 70vh; overflow-y: auto;
  }
  .dlc-eh-toc::before {
    content: "目次"; display: block; font-size: 11px; font-weight: 700;
    color: #adb5bd; margin: 0 0 7px 12px; letter-spacing: .05em;
  }
}
@media (max-width: 1279.98px) {
  .dlc-eh-toc-fab { display: block; }
  .dlc-eh-toc.open {
    display: block; position: fixed; right: 12px; bottom: 138px;
    background: #fff; border: 1px solid #e9ecef; border-radius: 10px;
    padding: 12px 16px; box-shadow: 0 4px 18px rgba(0,0,0,.18); max-width: 230px;
  }
  body.dlc-ann-bar-shown .dlc-eh-toc.open { bottom: 152px; }
  /* 項目数が 14 に増えたため、狭幅パネルが縦に伸びすぎないよう上限を設ける */
  .dlc-eh-toc.open { max-height: 70vh; overflow-y: auto; }
}
/* 目次から折りたたみカードの中見出しへ飛んだとき、固定ナビの下に潜らないように */
.dlc-set-card-h {
  scroll-margin-top: calc(var(--dlc-scroll-margin, 48px) + 12px);
}
@media (max-width: 600px) {
  .dlc-set { padding: 12px 12px 80px; }
  .dlc-set-card { padding: 15px 15px; border-radius: 9px; }
  .dlc-set-fold > summary { padding: 14px 15px; }
  .dlc-set-fold-body { padding: 14px 15px 16px; }
  .dlc-set-title { font-size: 21px; }
}
