/* Memozaki の見た目。
   Claude Code（VS Code 拡張）の画面を手本にしたダークの一通りの配色（仕様書 3.3）。色の切り替えはなし。 */

:root {
  --bg: #191a1b;          /* 背景 */
  --bg-deep: #121314;     /* 一段深い背景（コード・入力欄の奥） */
  --bg-raise: #1f2021;    /* 押せるものに指を乗せたとき */
  --line: #2a2b2c;        /* 枠線 */
  --text: #bfbfbf;        /* 本文の文字 */
  --text-bright: #faf9f5; /* 明るい文字 */
  --text-muted: #787878;  /* 控えめな文字（時刻など） */
  --accent: #d97757;      /* 差し色のオレンジ */
  --focus: #f48771;       /* フォーカスの枠（オレンジ寄りの赤） */
  --blue: #4a63af;        /* ボタン・選択中の印 */
  --navy: #20273b;        /* 紺の帯 */
  --navy-accent: #3765ab; /* 紺の差し色 */

  --radius: 10px;
  --col: 820px;           /* PC で広げすぎない列の幅 */
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Noto Sans Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
a { color: #8fa8e8; }
code { font-family: var(--mono); background: var(--bg-deep); border: 1px solid var(--line); border-radius: 5px; padding: 0 .3em; font-size: .9em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
[hidden] { display: none !important; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }
.pad { padding: 8px 16px; }
.spacer { flex: 1; }
.icon { display: block; }
.booting { margin: 40vh auto 0; text-align: center; color: var(--text-muted); letter-spacing: .1em; }

/* ---------- 骨組み ---------- */

.app {
  display: flex; flex-direction: column;
  height: 100dvh; max-width: var(--col); margin: 0 auto;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
@media (max-width: 820px) { .app { border: 0; } }

.topbar {
  display: flex; align-items: center; gap: 2px;
  height: 52px; padding: 0 6px 0 16px; flex: none;
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.view-title { font-size: 17px; font-weight: 600; color: var(--text-bright); margin: 0; letter-spacing: .02em; }
.top-extra { display: contents; }

.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px; background: #3a2420; color: var(--text-bright); font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.banner.warn { background: #4a1e1e; }
.banner.warn .btn { text-decoration: none; }
.filter-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 16px; background: var(--navy); border-bottom: 1px solid var(--line);
}
.link-btn { background: none; border: 0; color: #8fa8e8; font: inherit; font-size: 13px; padding: 4px 6px; cursor: pointer; }

.views { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }

.tabbar {
  display: flex; flex: none; border-top: 1px solid var(--line); background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: none; border: 0; color: var(--text-muted); font: inherit; font-size: 11.5px;
  padding: 7px 0 6px; cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--text-bright); }
.tab[aria-selected="true"] .icon { color: var(--accent); }
body.typing .tabbar { display: none; }

/* ---------- ボタン ---------- */

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  background: none; border: 0; border-radius: 8px; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-raise); color: var(--text-bright); }
.icon-btn.small { width: 30px; height: 30px; }
.icon-btn.small .icon { width: 17px; height: 17px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 8px;
  background: var(--bg-raise); border: 1px solid var(--line); color: var(--text-bright);
  font: inherit; font-size: 15px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #3a3b3c; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: var(--text-bright); }
.btn.primary:hover { background: #5570c0; }
.btn.danger { color: var(--focus); border-color: #4a2d27; background: none; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 14px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

.sync-dot {
  position: absolute; right: 7px; top: 8px; width: 8px; height: 8px; border-radius: 50%;
  background: transparent; border: 2px solid var(--bg);
}
.sync-dot.syncing { background: var(--navy-accent); }
.sync-dot.pending { background: var(--accent); }
.sync-dot.offline { background: var(--text-muted); }
.sync-dot.error, .sync-dot.auth, .sync-dot.outdated { background: var(--focus); }

/* ---------- タグの印 ---------- */

.chip {
  display: inline-flex; align-items: center; max-width: 100%;
  background: var(--navy); color: #a9bbea; border-radius: 999px; font-size: 12.5px; line-height: 1;
}
.chip-label, .chip.add {
  background: none; border: 0; color: inherit; font: inherit; padding: 5px 9px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip.add { display: inline-flex; align-items: center; gap: 4px; border: 1px dashed #34405f; border-radius: 999px; padding: 4px 10px; }
.chip-x { background: none; border: 0; color: inherit; padding: 3px 7px 3px 0; cursor: pointer; display: inline-flex; }
a.tag-chip { color: #a9bbea; text-decoration: none; background: var(--navy); border-radius: 5px; padding: 0 4px; }

/* ---------- チャット ---------- */

.timeline { flex: 1; overflow-y: auto; padding: 8px 10px 12px; overscroll-behavior: contain; }
.older { text-align: center; color: var(--text-muted); font-size: 12.5px; min-height: 24px; padding: 6px 0; }
.day-sep { display: flex; align-items: center; gap: 10px; margin: 14px 4px 6px; color: var(--text-muted); font-size: 12.5px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.post {
  position: relative; padding: 7px 44px 8px 10px; border-radius: var(--radius); cursor: pointer;
  border-left: 3px solid transparent;
}
.post:hover { background: var(--bg-raise); }
.post.flash { background: var(--navy); transition: background .3s; }
.post-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.post-head time { color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.post-body { color: var(--text-bright); overflow-wrap: anywhere; font-size: 15.5px; }
.post-tools { position: absolute; right: 6px; top: 6px; display: flex; }
.post-tools .icon-btn { color: var(--text-muted); }
.empty { text-align: center; color: var(--text); padding: 18vh 24px 0; }
.empty p { margin: 6px 0; }

.composer {
  flex: none; border-top: 1px solid var(--line); background: var(--bg); padding: 6px 8px 8px;
}
.composer-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 4px 6px; }
.composer-row { display: flex; align-items: flex-end; gap: 2px; }
.composer-tools { display: flex; align-items: flex-end; }
.composer-input {
  flex: 1; min-width: 0; resize: none; min-height: 40px; max-height: 40vh; overflow-y: auto; scrollbar-width: thin;
  background: var(--bg-deep); color: var(--text-bright); border: 1px solid var(--line); border-radius: 18px;
  padding: 8px 14px; font: inherit; font-size: 16px; line-height: 1.45; margin: 0 2px;
}
.composer-input:focus { outline: none; border-color: #4a4b4c; }
.send-btn {
  width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: #1a1310; display: inline-flex; align-items: center; justify-content: center;
}
.send-btn:hover { background: #e2876a; }
.badge {
  position: absolute; right: 2px; top: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--accent); color: #1a1310; font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
}

/* ---------- ノートの一覧 ---------- */

.notes-scroll { flex: 1; overflow-y: auto; padding: 10px 12px 96px; }
.notes-list { display: flex; flex-direction: column; gap: 8px; }
.note-card {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; cursor: pointer; border-top: 3px solid var(--line);
}
.note-card:hover { border-color: #3a3b3c; }
.note-title { color: var(--text-bright); font-weight: 600; overflow-wrap: anywhere; }
.note-snippet { color: var(--text); font-size: 14px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.fab {
  position: absolute; right: 18px; bottom: 18px; width: 56px; height: 56px; border-radius: 16px; border: 0;
  background: var(--accent); color: #1a1310; display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}

/* ---------- 全画面の層 ---------- */

#layers > * { z-index: 20; }
.screen {
  position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.screen > * { width: 100%; max-width: var(--col); margin-left: auto; margin-right: auto; }
.editor-header {
  display: flex; align-items: center; gap: 4px; height: 52px; flex: none; padding: 0 8px 0 4px;
  border-bottom: 1px solid var(--line);
}
.editor-heading { color: var(--text-bright); font-weight: 600; font-size: 16px; white-space: nowrap; }
.editor-header-extra { display: flex; align-items: center; gap: 2px; }
.editor-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 8px 16px 16px; }
.editor-title {
  background: none; border: 0; color: var(--text-bright); font: inherit; font-size: 21px; font-weight: 600;
  padding: 6px 0; width: 100%;
}
.editor-title:focus { outline: none; }
.editor-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 0 8px; }
.editor-body {
  flex: 1; min-height: 45vh; resize: none; width: 100%;
  background: none; border: 0; color: var(--text-bright); font: inherit; font-size: 16px; line-height: 1.7; padding: 4px 0;
}
.editor-body:focus { outline: none; }
.editor-panels:empty { display: none; }
.editor-toolbar { display: flex; gap: 2px; flex: none; border-top: 1px solid var(--line); padding: 4px 8px; overflow-x: auto; }

/* ---------- 下から出る一覧と確認の窓 ---------- */

.sheet {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center;
}
.sheet.center { align-items: center; padding: 16px; }
.sheet-panel {
  width: 100%; max-width: 560px; max-height: 80dvh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0;
  padding: 6px 0 calc(10px + env(safe-area-inset-bottom));
  transform: translateY(12px); opacity: .6; transition: transform .16s ease, opacity .16s ease;
}
.shown .sheet-panel { transform: none; opacity: 1; }
.sheet-panel.tall { min-height: 50dvh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 12px 6px 16px; }
.sheet-title { color: var(--text-muted); font-size: 13px; padding: 8px 16px 4px; }
.sheet-head .sheet-title { padding: 0; font-size: 15px; color: var(--text-bright); font-weight: 600; }
.sheet-item {
  display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text-bright);
  font: inherit; font-size: 16px; padding: 13px 20px; cursor: pointer;
}
.sheet-item:hover { background: var(--bg-raise); }
.sheet-item.danger { color: var(--focus); }
.sheet-panel .field { margin: 4px 16px 8px; width: calc(100% - 32px); }
.dialog {
  width: 100%; max-width: 420px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 14px;
}
.dialog p { margin: 0 0 16px; color: var(--text-bright); }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 8px; }

.field {
  width: 100%; background: var(--bg-deep); color: var(--text-bright); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font: inherit; font-size: 16px;
}
.field:focus { outline: none; border-color: var(--focus); }

.tag-list { display: flex; flex-direction: column; padding: 0 8px; }
.tag-option {
  display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: 8px;
  color: var(--text-bright); font: inherit; font-size: 15.5px; padding: 10px 10px; cursor: pointer; text-align: left;
}
.tag-option:hover { background: var(--bg-raise); }
.tag-option.new { color: var(--accent); }
.tag-check {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #4a4b4c; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.tag-option.on .tag-check { background: var(--blue); border-color: var(--blue); color: var(--text-bright); }
.tag-count { margin-left: auto; color: var(--text-muted); font-size: 12.5px; }

.draft-row { display: flex; align-items: center; padding: 0 8px 0 0; }
.draft-open {
  flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; background: none; border: 0;
  color: var(--text-bright); font: inherit; padding: 10px 20px; cursor: pointer;
}
.draft-open:hover { background: var(--bg-raise); }
.draft-kind { color: var(--text-muted); font-size: 12.5px; }
.draft-first { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- お知らせ ---------- */

.toasts {
  position: fixed; left: 0; right: 0; bottom: 120px; z-index: 50; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px;
  background: #2a2b2c; color: var(--text-bright); border-radius: 10px; padding: 10px 14px; font-size: 14.5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5); transition: opacity .3s;
}
.toast.out { opacity: 0; }
.toast-action { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 4px; }

/* ---------- 検索 ---------- */

.search .editor-header .field { flex: 1; margin-right: 4px; }
.search-status { padding: 8px 16px 4px; flex: none; }
.search-scroll { flex: 1; overflow-y: auto; }
.result {
  display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  color: var(--text); font: inherit; padding: 10px 16px; cursor: pointer;
}
.result:hover { background: var(--bg-raise); }
.result-head { display: flex; align-items: center; gap: 8px; }
.result-title { color: var(--text-bright); font-weight: 600; }
.result-snippet { color: var(--text-bright); font-size: 14.5px; margin-top: 2px; overflow-wrap: anywhere; }
.kind { font-size: 11.5px; border-radius: 4px; padding: 1px 6px; background: var(--navy); color: #a9bbea; }
.kind.note { background: #33241d; color: #e8a68c; }
mark { background: #5a3a2c; color: var(--text-bright); border-radius: 3px; padding: 0 1px; }

/* ---------- 設定 ---------- */

.settings-scroll { flex: 1; overflow-y: auto; }
.settings-body { padding: 4px 16px 40px; }
.settings-section { padding: 14px 0 6px; border-bottom: 1px solid var(--line); }
.settings-section h2 { font-size: 15px; color: var(--text-bright); margin: 4px 0 6px; }
.setting-group h3, .fake-tools h3 { font-size: 12.5px; color: var(--accent); font-weight: 600; letter-spacing: .06em; margin: 16px 0 4px; }
.setting-group { background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 14px 6px; margin-top: 10px; }
.setting-group h3 { margin-top: 10px; }
.setting-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; cursor: pointer; border-top: 1px solid #1f2021; }
.setting-group h3 + .setting-row { border-top: 0; }
.setting-text { flex: 1; display: flex; flex-direction: column; }
.setting-name { color: var(--text-bright); font-size: 15.5px; }
.setting-desc { color: var(--text-muted); font-size: 12.5px; line-height: 1.45; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  position: relative; width: 44px; height: 26px; flex: none; border-radius: 13px; background: #2f3031; transition: background .15s;
}
.switch::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #8a8a8a; transition: transform .15s, background .15s;
}
.switch-input:checked + .switch { background: var(--blue); }
.switch-input:checked + .switch::after { transform: translateX(18px); background: var(--text-bright); }
.switch-input:focus-visible + .switch { outline: 2px solid var(--focus); outline-offset: 2px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14.5px; }
.kv > :last-child { color: var(--text-bright); text-align: right; overflow-wrap: anywhere; }

/* ---------- 初回の画面 ---------- */

.onboarding { z-index: 30; }
.ob-scroll { flex: 1; overflow-y: auto; padding: 16px 18px 48px; }
.ob-hero { text-align: center; padding: 18px 0 8px; }
.ob-hero img { border-radius: 14px; }
.ob-hero h1 { color: var(--text-bright); font-size: 22px; margin: 10px 0 6px; }
.ob-hero p { margin: 0 auto; max-width: 520px; }
.ob-step { background: var(--bg-deep); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 14px; }
.ob-step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ob-step-head h2 { font-size: 16.5px; color: var(--text-bright); margin: 0; }
.ob-no {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #1a1310; font-weight: 700; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.ob-list { margin: 12px 0 0; padding-left: 1.4em; }
.ob-list li { margin: 6px 0; }
.ob-list b { color: var(--text-bright); }
.ob-list ul { margin: 4px 0; padding-left: 1.2em; }
.ob-list ul li { margin: 3px 0; }
.ob-step .field { margin: 10px 0; font-family: var(--mono); font-size: 14px; }
.ob-message { min-height: 1.5em; margin: 10px 0 0; font-size: 14px; }
.ob-message.error { color: var(--focus); }
.ob-message a { color: #8fa8e8; }
.ob-note { margin: 10px 0 0; }
/* 利用規約への同意（合鍵の欄のすぐ上）。チェックするまで「つなぐ」は押せない */
.ob-terms { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; }
.ob-terms-link { font-size: 15px; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; }
.ob-agree { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text-bright); }
.ob-agree-input { width: 20px; height: 20px; margin: 0; accent-color: var(--blue); }
.btn.primary.locked { background: var(--bg-raise, #2a2b2c); border-color: var(--line); color: var(--text-muted); opacity: 1; cursor: not-allowed; }
.ob-lock-hint { margin: 6px 0 0; }
.ob-lock-hint[hidden] { display: none; }

/* ---------- 2段目 p2b: 本文と編集（Markdown・チェックリスト・プレビュー・表示専用・文字数・最終更新・置換・テンプレート・ノート間リンク） ---------- */

/* Markdown で整えた本文。チャットの投稿の中でも間延びしないよう、余白は小さめ */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .45em; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { color: var(--text-bright); line-height: 1.35; margin: .7em 0 .35em; font-weight: 700; }
.md h1 { font-size: 1.3em; }
.md h2 { font-size: 1.18em; }
.md h3 { font-size: 1.07em; }
.md h4, .md h5, .md h6 { font-size: 1em; }
.md ul, .md ol { margin: .2em 0 .45em; padding-left: 1.5em; }
.md li { margin: .1em 0; }
.md li > ul, .md li > ol { margin: 0; }
.md li:has(> input[type="checkbox"]) { list-style: none; margin-left: -1.35em; }
.md blockquote { margin: .4em 0; padding: .1em 0 .1em .9em; border-left: 3px solid var(--navy-accent); color: var(--text); }
.md pre { background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-x: auto; margin: .4em 0 .55em; font-size: .9em; line-height: 1.5; }
.md pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: .8em 0; }
.md table { border-collapse: collapse; margin: .4em 0 .6em; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 9px; text-align: left; }
.md th { background: var(--bg-deep); color: var(--text-bright); }
.md img { max-width: 100%; height: auto; border-radius: 6px; }
.md del { color: var(--text-muted); }

/* チェック項目 */
.md input[type="checkbox"], .task-line input[type="checkbox"] {
  width: 18px; height: 18px; margin: 0 .45em 0 0; vertical-align: -3px; accent-color: var(--blue);
}
input.task-box { cursor: pointer; }
.task-line { display: inline-flex; align-items: flex-start; gap: 2px; }
.task-line input[type="checkbox"] { margin-top: .25em; flex: none; }
.md li:has(> input[type="checkbox"]:checked), .task-line:has(input:checked) > span { color: var(--text-muted); text-decoration: line-through; text-decoration-color: #555; }

/* ノート間リンク [[題名]] */
a.wikilink { color: #e8a68c; text-decoration: none; border-bottom: 1px dashed #8a5a48; }
a.wikilink::before { content: "[["; color: var(--text-muted); font-size: .85em; }
a.wikilink::after { content: "]]"; color: var(--text-muted); font-size: .85em; }

/* 投稿の「編集 10/28 12:05」 */
.updated-at { color: var(--text-muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* 編集画面: 見出しの列が狭いスマホでも押し出されないよう、見出しの文字を縮める */
.editor-header .editor-heading { min-width: 0; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--bg-raise); }
.char-count {
  background: none; border: 0; color: var(--text-muted); font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums;
  padding: 4px 6px; cursor: pointer; white-space: nowrap;
}
.editor-view { flex: 1; min-height: 45vh; padding: 4px 0; font-size: 16px; line-height: 1.7; }
.updated-panel { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 0 2px; border-top: 1px solid var(--line); margin-top: 8px; }

/* 表示専用モード: 本文だけを出す（戻るボタンと、このモードを切るボタンは残す） */
.editor.viewonly .editor-toolbar,
.editor.viewonly .editor-chips,
.editor.viewonly .editor-panels,
.editor.viewonly .editor-more,
.editor.viewonly .editor-heading,
.editor.viewonly .editor-header > .btn.primary,
.editor.viewonly .editor-header-extra > :not(.viewonly-toggle) { display: none !important; }
.editor.viewonly.no-title .editor-title { display: none; }
.editor.viewonly .editor-title { cursor: default; }
.editor.viewonly .editor-header { border-bottom-color: transparent; }

/* バックリンク */
.backlinks { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.backlinks h2 { font-size: 13px; color: var(--accent); font-weight: 600; letter-spacing: .04em; margin: 0 0 4px; }
.backlink-list { display: flex; flex-direction: column; }
.backlink {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px;
  color: var(--text-bright); font: inherit; font-size: 14.5px; padding: 8px 6px; cursor: pointer;
}
.backlink:hover { background: var(--bg-raise); }
.backlink-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* リンクを差し込む窓 */
.link-pick-list { display: flex; flex-direction: column; }
.sheet-item.muted-item { color: var(--accent); font-size: 15px; }

/* 検索と置換 */
.replace-panel .field { display: block; }
.replace-status { margin: 0 16px; min-height: 1.5em; }
.replace-fields { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 2px; flex: none; }
.replace-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.replace-row input[type="checkbox"] { width: 20px; height: 20px; margin: 3px 0 0; flex: none; accent-color: var(--blue); }
.replace-row-text { flex: 1; min-width: 0; display: block; }
.replace-row .result-head { display: flex; }
.replace-row .result-snippet { display: block; }
.replace-foot { flex: none; padding: 8px 16px 12px; border-top: 1px solid var(--line); }

/* テンプレート */
.template-list { padding: 2px 6px 2px 14px; }
.template-row { display: flex; align-items: center; gap: 4px; border-top: 1px solid #1f2021; }
.template-row:first-child { border-top: 0; }
.template-open { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; background: none; border: 0; padding: 10px 0; cursor: pointer; font: inherit; }
.template-open .setting-desc { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.danger-link { color: var(--focus); }
.template-edit .field { display: block; }
.template-text { resize: vertical; min-height: 120px; line-height: 1.5; }
/* ---------- 2段目 p2a: 整理と一覧（ノートの一覧・階層タグ・色分け・ピン留め・ゴミ箱・最近・To-do・日付へ飛ぶ） ---------- */

.center { text-align: center; }
.twisty { display: inline-flex; color: var(--text-muted); transition: transform .15s; }
[aria-expanded="true"] > .twisty { transform: rotate(90deg); }
.pin-head[aria-expanded="true"] > .twisty { transform: rotate(180deg); }

/* ノートの画面の上の列 */
.notes-bar {
  display: flex; align-items: center; gap: 2px; flex: none; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--line);
}
.seg { display: flex; gap: 2px; background: var(--bg-deep); border: 1px solid var(--line); border-radius: 9px; padding: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.seg-btn {
  background: none; border: 0; border-radius: 7px; color: var(--text-muted); font: inherit; font-size: 13.5px;
  padding: 5px 11px; cursor: pointer; white-space: nowrap;
}
.seg-btn:hover { color: var(--text-bright); }
.seg-btn[aria-selected="true"] { background: var(--navy); color: var(--text-bright); }

/* ノートの札（色はタグの色と連動） */
.note-card { border-top-color: var(--memo-color, var(--line)); }
.note-head { display: flex; align-items: flex-start; gap: 8px; }
.note-head .note-title { flex: 1; min-width: 0; }
.note-card.todo-done .note-title { text-decoration: line-through; color: var(--text-muted); }
.note-card.pinned { background: #15171c; }
.item-mark { display: inline-flex; color: var(--accent); flex: none; }
.note-head .item-mark { margin-top: 4px; }

/* グリッド */
.notes-list.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: start; }
.notes-list.grid .note-card { display: flex; flex-direction: column; min-height: 120px; padding: 10px 12px; }
.notes-list.grid .note-snippet { -webkit-line-clamp: 6; font-size: 13.5px; }
.notes-list.grid .note-foot { margin-top: auto; padding-top: 8px; }
.notes-list.grid .empty { grid-column: 1 / -1; }

/* 投稿とノートを混ぜた一覧（最近・To-do・ゴミ箱） */
.notes-list.rows { gap: 0; }
.list-heading {
  display: flex; align-items: center; gap: 4px; margin: 14px 4px 4px; color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  background: none; border: 0; font-family: inherit; padding: 0; text-align: left;
}
.notes-list.rows > .list-heading:first-child { margin-top: 2px; }
.list-heading.toggle { cursor: pointer; padding: 6px 0; }
.item-row {
  display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--memo-color, transparent); padding-left: 6px;
}
.item-open {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; background: none; border: 0;
  color: var(--text); font: inherit; padding: 9px 4px; cursor: pointer;
}
.item-open:hover { background: var(--bg-raise); }
.item-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-head { color: var(--text-bright); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.item-snippet { color: var(--text); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12px; min-width: 0; }
.item-tags { color: #a9bbea; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.item-row.todo-done .item-head { text-decoration: line-through; color: var(--text-muted); }
.trash-note { margin: 4px 4px 10px; }
.restore-btn { flex: none; margin-right: 4px; padding: 0 10px; }
.restore-btn .icon { width: 16px; height: 16px; }

/* To-do の丸 */
.todo-check {
  width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.6px solid #5a5b5c; background: none; color: var(--text-bright);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.todo-check:hover { border-color: var(--accent); }
.todo-check.done { background: var(--blue); border-color: var(--blue); }
.note-head .todo-check { margin-top: 2px; }
.item-row > .todo-check { margin-left: 2px; }
.post-head .todo-check { width: 20px; height: 20px; }

/* タイムラインの投稿（色はタグの色と連動） */
.post { border-left-color: var(--memo-color, transparent); }
.post.todo-done .post-body { color: var(--text-muted); text-decoration: line-through; text-decoration-color: #5a5b5c; }
.post-head .item-mark { margin-left: 2px; }

/* ピン留めの帯（チャットの上） */
.pin-strip { flex: none; border-bottom: 1px solid var(--line); background: #171a22; }
.pin-head {
  display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: var(--text-bright);
  font: inherit; font-size: 14px; padding: 8px 14px; cursor: pointer; text-align: left;
}
.pin-head:hover { background: var(--navy); }
.pin-icon { color: var(--accent); display: inline-flex; flex: none; }
.pin-first { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-count { color: var(--text-muted); font-size: 12.5px; flex: none; }
.pin-list { max-height: 40dvh; overflow-y: auto; border-top: 1px solid var(--line); }
.pin-item {
  display: flex; align-items: baseline; gap: 10px; width: 100%; background: none; border: 0; color: var(--text);
  font: inherit; font-size: 14px; padding: 8px 14px 8px 38px; cursor: pointer; text-align: left;
}
.pin-item:hover { background: var(--navy); }
.pin-item-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* タグの印の色 */
.chip.colored, a.tag-chip.colored { background: color-mix(in srgb, var(--tag-color) 20%, var(--bg)); color: var(--tag-color); }

/* 階層タグの木（タグを選ぶ窓） */
.tag-row { display: flex; align-items: center; padding-left: calc(var(--depth, 0) * 18px); }
.tag-row > .tag-option { flex: 1; min-width: 0; }
.tag-twisty {
  width: 28px; height: 36px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 0; border-radius: 6px;
}
.tag-twisty .icon { transition: transform .15s; }
.tag-twisty[aria-expanded="true"] .icon { transform: rotate(90deg); }
.tag-twisty:hover { color: var(--text-bright); background: var(--bg-raise); }
.tag-twisty.none { cursor: default; }
.tag-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tag-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* タグの色（設定画面） */
.tagcolor-list { display: flex; flex-direction: column; background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 0; margin: 8px 0 10px; }
.tagcolor-row {
  display: flex; align-items: center; gap: 12px; background: none; border: 0; color: var(--text-bright); font: inherit; font-size: 15px;
  padding: 9px 14px 9px calc(14px + var(--depth, 0) * 18px); cursor: pointer; text-align: left;
}
.tagcolor-row:hover { background: var(--bg-raise); }
.tagcolor-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.swatch.none { border: 1.5px dashed #4a4b4c; }
.swatch.inherited { opacity: .55; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, 44px); gap: 12px; justify-content: center; padding: 10px 16px 4px; }
.palette-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; background: var(--c); color: #16171a; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.palette-btn.on { border-color: var(--text-bright); }
.palette-btn.none { background: var(--bg-deep); border: 1.5px dashed #5a5b5c; color: var(--text-muted); }
.palette-btn.none.on { border-style: solid; border-color: var(--text-bright); }

/* 日付へ飛ぶ（カレンダー） */
.cal { padding: 0 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 6px; }
.cal-title { color: var(--text-bright); font-weight: 600; font-size: 16px; }
.cal-head .icon-btn:disabled { opacity: .3; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { text-align: center; font-size: 12px; color: var(--text-muted); padding: 2px 0 4px; }
.cal-week .sun, .cal-day.sun { color: #e08a8a; }
.cal-week .sat, .cal-day.sat { color: #8fa8e8; }
.cal-day {
  position: relative; height: 42px; background: none; border: 0; border-radius: 8px; color: var(--text-bright);
  font: inherit; font-size: 15px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.cal-day:hover:not(:disabled) { background: var(--bg-raise); }
.cal-day:disabled { opacity: .3; cursor: default; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal-day.has::after {
  content: ""; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent);
}
.cal-status { margin: 8px 0 0; min-height: 1.4em; }
.cal-foot { margin: 8px 0 4px; align-items: center; }
.day-sep.flash span { color: var(--text-bright); background: var(--navy); border-radius: 6px; padding: 0 8px; transition: background .3s; }
/* ---------- 3段目: 添付・手書き・マイク・版の履歴・OCR・キー操作 ---------- */

/* 本文の中の添付 */
img.att-img {
  display: block; max-width: min(100%, 360px); max-height: 320px; min-width: 60px; min-height: 60px;
  margin: 6px 0; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-deep);
  object-fit: contain; cursor: zoom-in;
}
img.att-img.loaded { min-width: 0; min-height: 0; }
img.att-img.att-missing {
  display: inline-flex; align-items: center; min-height: 0; padding: 6px 10px; font-size: 12.5px; color: var(--text-muted); cursor: default;
}
a.att-file {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin: 3px 0; padding: 5px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg-deep); color: var(--text-bright);
  text-decoration: none; font-size: 14px;
}
a.att-file:hover { border-color: #3a3b3c; }
.att-file-icon { color: var(--accent); display: inline-flex; }
.att-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 書いている途中の添付の一覧（入力欄の上・編集画面の本文の下） */
.att-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 4px 8px; }
.att-strip.in-editor { padding: 10px 0 4px; border-top: 1px solid var(--line); margin-top: 8px; flex-wrap: wrap; }
.att-thumb {
  position: relative; flex: none; width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-deep); cursor: pointer;
}
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-thumb.file {
  width: auto; max-width: 180px; display: flex; align-items: center; gap: 6px; padding: 0 30px 0 10px; color: var(--text-bright); font-size: 13px;
}
.att-thumb.file > span:first-child { color: var(--accent); display: inline-flex; }
.att-thumb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-thumb .att-remove {
  position: absolute; right: 2px; top: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0, 0, 0, .65); color: var(--text-bright);
}
.att-thumb .att-remove .icon { width: 14px; height: 14px; }

/* 画像を大きく見る */
.att-viewer .editor-header { gap: 6px; }
.att-viewer-body { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 8px; }
.att-viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
.att-viewer-img.actual { max-width: none; max-height: none; cursor: zoom-out; }
.att-viewer-status { text-align: center; }

/* 手書き */
.hw .editor-header { flex: none; }
.hw-paper { flex: 1; min-height: 0; position: relative; background: #ffffff; touch-action: none; overflow: hidden; }
.hw-canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: crosshair; }
.hw-tools {
  display: flex; align-items: center; gap: 4px; flex: none; padding: 6px 8px; border-top: 1px solid var(--line); overflow-x: auto;
}
.hw-color {
  width: 30px; height: 30px; flex: none; border-radius: 50%; border: 2px solid var(--bg); background: var(--c);
  box-shadow: 0 0 0 1px #8a8b8c; cursor: pointer; margin: 0 2px;
}
.hw-color.on { box-shadow: 0 0 0 2px var(--text-bright); }
.hw-width {
  width: 36px; height: 36px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
}
.hw-width span { display: block; width: 20px; border-radius: 4px; background: var(--text-bright); }
.hw-width.on, .hw-tools .icon-btn.on { border-color: #4a4b4c; background: var(--bg-raise); color: var(--text-bright); }
.hw-sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; flex: none; }

/* マイク */
.mic-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40;
  display: flex; align-items: center; gap: 10px; width: min(520px, calc(100% - 24px));
  background: #2a2b2c; color: var(--text-bright); border-radius: 12px; padding: 8px 10px 8px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}
.mic-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--focus); flex: none; animation: mic-pulse 1.2s ease-in-out infinite; }
.mic-live { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
@keyframes mic-pulse { 50% { opacity: .35; } }

/* 版の履歴 */
.hist-list { display: flex; flex-direction: column; }
.hist-row {
  display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; background: none; border: 0;
  border-bottom: 1px solid var(--line); color: var(--text-bright); font: inherit; padding: 10px 4px; cursor: pointer;
}
.hist-row:hover { background: var(--bg-raise); }
.hist-row.current { cursor: default; background: var(--bg-deep); border-radius: 8px; border: 1px solid var(--line); padding: 10px 12px; margin-bottom: 6px; }
.hist-when { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hist-tag { font-size: 11px; border-radius: 4px; padding: 0 6px; background: var(--navy); color: #a9bbea; }
.hist-first { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-title { color: var(--text-bright); font-size: 20px; margin: 6px 0; }
.hist-body { padding: 4px 0 24px; }

/* OCR の読み取り結果 */
.ocr-text {
  margin: 4px 16px 8px; padding: 10px 12px; max-height: 45dvh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 8px; color: var(--text-bright); font: inherit; font-size: 14.5px;
}

/* キーボードショートカットの一覧 */
.key-list { display: flex; flex-direction: column; gap: 2px; padding: 4px 16px 8px; }
.sheet-panel .key-list { padding-bottom: 12px; }
.settings-section .key-list { padding: 4px 0 8px; }
.key-row { display: flex; align-items: baseline; gap: 12px; padding: 4px 0; font-size: 14px; }
.key-row kbd {
  flex: none; min-width: 9.5em; font-family: var(--mono); font-size: 12.5px; color: var(--text-bright);
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
}


/* ---------- 統合後のデバッグ: 入力欄の「＋」、編集画面の見出しの列 ---------- */

/* 入力欄の「＋」: 広い画面では隠し、道具をそのまま並べる */
.composer-plus { display: none; }
@media (max-width: 600px) {
  /* スマホの幅: 道具は「＋」一つにまとめ、書く欄を広く保つ */
  .composer-tools { display: none; }
  .composer-plus { display: inline-flex; }
}

/* 「＋」から出る道具の一覧（大きめの押しやすいタイル） */
.composer-menu { padding-top: 12px; }
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 0 10px 6px; }
.tool-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0;
  background: none; border: 0; border-radius: 12px; color: var(--text-bright); font: inherit; font-size: 12.5px;
  padding: 10px 2px 8px; cursor: pointer;
}
.tool-tile:hover { background: var(--bg-raise); }
.tool-tile-icon {
  width: 48px; height: 48px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-deep); border: 1px solid var(--line); color: var(--accent);
}
.tool-tile-label { max-width: 100%; text-align: center; line-height: 1.3; overflow-wrap: anywhere; }

/* 編集画面の見出しの列: スマホの幅では見出しの文字（「ノート」など）を出さず、ボタンに場所を譲る
   （何を書いているかは、保存／送信のボタンと題名の欄で分かる） */
@media (max-width: 480px) {
  .editor .editor-header .editor-heading { display: none; }
  .editor .editor-header { gap: 0; padding-right: 6px; }
  .editor .editor-header-extra .icon-btn { width: 36px; }
}

/* ---------- 使い方（説明書） ---------- */

.help-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.help-inner { padding: 8px 16px 64px; }
.help-lead { margin: 10px 0 4px; font-size: 14px; }
.help-toc {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px 12px; margin: 12px 0 8px; scroll-margin-top: 12px;
}
.help-toc-title { font-size: 12.5px; color: var(--accent); font-weight: 600; letter-spacing: .06em; margin-bottom: 2px; }
.help-toc ol { margin: 0; padding-left: 1.6em; }
.help-toc li { margin: 0; }
.help-toc a { display: block; padding: 7px 0; color: var(--text-bright); text-decoration: none; }
.help-toc a:hover { color: var(--accent); }
.help-toc li::marker { color: var(--text-muted); }

.help-chapter { padding: 18px 0 4px; border-top: 1px solid var(--line); margin-top: 18px; scroll-margin-top: 4px; }
.help-chapter > h2 { display: flex; align-items: center; gap: 10px; font-size: 19px; color: var(--text-bright); margin: 0 0 6px; }
.help-no {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy); color: #8fa8e8; font-size: 14px; font-weight: 600;
}
.help-body { overflow-wrap: anywhere; }
.help-body h3 {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 15.5px; color: var(--text-bright); margin: 20px 0 4px; padding-left: 10px; border-left: 3px solid var(--accent);
}
.help-body p { margin: 6px 0; }
.help-body ul, .help-body ol { margin: 6px 0; padding-left: 1.4em; }
.help-body li { margin: 4px 0; }
.help-body b { color: var(--text-bright); font-weight: 600; }
.help-body .btn { margin: 4px 0; text-decoration: none; }
.help-note {
  font-size: 14px; color: var(--text); background: var(--navy); border-left: 3px solid var(--navy-accent);
  border-radius: 0 8px 8px 0; padding: 8px 12px; margin: 10px 0 !important;
}
.help-pill {
  font-size: 11.5px; font-weight: 500; color: #8fa8e8; border: 1px solid var(--navy-accent); border-radius: 999px;
  padding: 0 8px; line-height: 1.6; white-space: nowrap;
}
.help-pill.off { color: var(--focus); border-color: #4a2d27; }
.help-table { border-collapse: collapse; margin: 8px 0; font-size: 14px; width: 100%; max-width: 420px; }
.help-table th, .help-table td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.help-table th { background: var(--bg-deep); color: var(--text-muted); font-weight: 500; }
.help-keys { padding: 4px 0 8px; }
.help-keys .key-row kbd { min-width: 8.5em; }
.help-totop { margin: 14px 0 0; font-size: 13px; text-align: right; }
.help-totop a { text-decoration: none; }

.help-features { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.help-feature-group { background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 12px; }
.help-feature-group-name { font-size: 12.5px; color: var(--accent); font-weight: 600; letter-spacing: .06em; margin: 4px 0 2px; }
.help-feature {
  display: grid; grid-template-columns: 1fr auto; column-gap: 10px;
  padding: 6px 0; border-top: 1px solid #1f2021;
}
.help-feature-group-name + .help-feature { border-top: 0; }
.help-feature-name { color: var(--text-bright); font-size: 14.5px; }
.help-feature-state { font-size: 12px; align-self: center; }
.help-feature-state.on { color: #98c379; }
.help-feature-state.off { color: var(--focus); }
.help-feature-desc { grid-column: 1 / -1; font-size: 13px; color: var(--text-muted); }

.help-entry .button-row { margin: 8px 0 4px; }

/* ---------- 利用規約 ---------- */

.terms-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 16px 64px; }
/* 本文の書式は使い方のページ（.help-body）と同じ。ここでは題名と項の間隔だけを足す */
.terms-body .terms-title { font-size: 19px; color: var(--text-bright); margin: 14px 0 8px; }
.terms-body .terms-list > li { margin: 6px 0; }
.terms-body .terms-list ul { margin: 4px 0; }
.terms-foot { margin-top: 24px; }
