/* 帳面+の骨格は共通。テーマの色の正本は地・字・テーマの色の3色と、全テーマ共通の朱。
   色はここ(と下のダーク)だけに書く。部品の CSS と JS は var(--…) だけを使う(scripts/check-colors.mjs が落とす)。 */
:root,
[data-swatch] {
  color-scheme: light;
  --base-bg: #f7f4ec;
  --base-text: #1c1d1a;
  /* テーマの色: 芝・暦の濃淡・統計とグラフのデータ・つなぐ色だけ。墨は墨の濃淡。 */
  --accent: var(--base-text);
  /* 朱(朱肉の赤): 全テーマで「今日・現在」だけ。意味の赤(--red)・♡ とは別。 */
  --vermilion: #b8402c;
  /* 今日・現在の印。墨は朱のワンポイント(本人 10/12 08:05「墨でワンポイントで朱肉が入るからおしゃれ」)。
     藍・抹茶はテーマの色の印、青は Apple のカレンダーの赤の丸。朱を墨の外へ広げない。 */
  --current: var(--vermilion);
  --on-current: var(--base-bg);
  /* 今日の枠。塗りは記録量のまま、地との隙間で濃い段からも分ける。 */
  --today-frame: var(--vermilion);
  --frame-sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  --frame-serif: "Hiragino Mincho ProN", "Hiragino Mincho Pro", "Yu Mincho", YuMincho, serif;
  --font-reading: var(--frame-serif);
  --frame-pillar: 64px;
  --frame-radius: 2px;
  --frame-hair: 0.5px;
  --text-scale: 1;
  --text-title: 1.5rem;
  --text-heading: 1.25rem;
  --text-body: 1.0625rem;
  --text-caption: 0.875rem;
  --text-minimum: var(--text-caption);
  --paper: var(--base-bg);
  --white: var(--base-bg);
  --ink: var(--base-text);
  --muted: color-mix(in srgb, var(--base-text) 70%, transparent);
  --frame-faint: color-mix(in srgb, var(--base-text) 40%, transparent);
  --line: color-mix(in srgb, var(--base-text) 16%, transparent);
  --field-line: var(--frame-faint);
  --soft: color-mix(in srgb, var(--base-text) 5%, transparent);
  --wash: var(--soft);
  /* 操作の色は全テーマで字の色(名前は古いまま)。 */
  --blue: var(--base-text);
  /* つなぐ色(ドラッグの落とし先・着いた光): 送る丸と同じテーマの色。墨は字の色(朱は現在地だけ。見た目の決まり2章)。 */
  --link-color: var(--accent);
  /* 芝の色: 芝・暦の濃淡・統計のデータだけに使う。操作の色(--blue)とは別。 */
  --grass: var(--accent);
  /* 量の段(見た目の決まり 2.2): 暦の升・芝・年の段で同じ淡 / 中 / 濃の3段。値はテーマ×明暗ごと(ここは墨のライト)。
     升の数字は --calendar-on-N(淡い段は字の色、濃い段は地の色で抜く)。淡い段と地 2:1・隣の段どうし 1.4:1・数字 4.5:1 を contrast-smoke が測る。 */
  --calendar-1: #afada7;
  --calendar-2: #62625d;
  --calendar-3: #1c1d1a;
  --calendar-on-1: var(--base-text);
  --calendar-on-2: var(--base-bg);
  --calendar-on-3: var(--base-bg);
  --grass-1: var(--calendar-1);
  --grass-2: var(--calendar-2);
  --grass-3: var(--calendar-3);
  /* 書いていない日の空き升(芝・年の段・7マス)は字の 8% の灰。 */
  --grass-empty: color-mix(in srgb, var(--base-text) 8%, var(--base-bg));
  --calendar-selected: var(--blue);
  /* つなぐ色(ドラッグの落とし先・着いた光)。墨は字の色。 */
  --link-target: var(--accent);
  /* グラフ: 記録は字の濃淡、名言は字、タグはテーマの色、本は字、人物はテーマの色の輪。 */
  /* グラフは分類の色で一目で分ける(本人 10/12「意味の違うものを単一の配色でやったら失敗する」、
     claim:function-first-design-plays-only-orthogonal)。値は ECD の見た目の決まり2章「グラフの分類の配色」(4テーマ共通、
     色覚の差・明るさの帯を検査済み)。記録は形と濃さで、タグ・本・人物は3色で分ける。 */
  --graph-node: color-mix(in srgb, var(--base-text) 45%, var(--base-bg));
  --graph-diary: var(--graph-node);
  --graph-quote: color-mix(in srgb, var(--base-text) 75%, var(--base-bg));
  --graph-tag: #1baf7a;
  --graph-book: #eb6834;
  --graph-person: var(--base-bg);
  --graph-person-border: #4a3aa7;
  /* 意味のまとまり: 分類・マークの色と区別する12色。 */
  /* まとまりの色: 件数の大きい順に 0〜8、9 は「そのほか」(ECD 10/12、Observable 10 が土台。正本 57a08241)。 */
  --graph-cluster-0: #00429a;
  --graph-cluster-label-0: #00429a;
  --graph-cluster-1: #916a00;
  --graph-cluster-label-1: #8e6801;
  --graph-cluster-2: #eb604c;
  --graph-cluster-label-2: #c53f30;
  --graph-cluster-3: #006655;
  --graph-cluster-label-3: #006655;
  --graph-cluster-4: #289943;
  --graph-cluster-label-4: #00812f;
  --graph-cluster-5: #af4271;
  --graph-cluster-label-5: #af4271;
  --graph-cluster-6: #9051de;
  --graph-cluster-label-6: #8d4edb;
  --graph-cluster-7: #668cc3;
  --graph-cluster-label-7: #4870a5;
  --graph-cluster-8: #673c22;
  --graph-cluster-label-8: #673c22;
  --graph-cluster-9: #8a8781;
  --graph-cluster-label-9: #716e68;
  --graph-cluster-fill: 0.1;
  /* つないだリンクは字の 70%、近い記録は 45%(濃さで分ける。ECD 10/12) */
  --graph-line: color-mix(in srgb, var(--base-text) 70%, var(--base-bg));
  --graph-near-line: color-mix(in srgb, var(--base-text) 45%, var(--base-bg));
  --weekday-sun: #b3261e;
  --weekday-sat: #1f5fad;
  --weekend-sunday: var(--weekday-sun);
  --weekend-saturday: var(--weekday-sat);
  --strong-hover: color-mix(in srgb, var(--blue) 82%, var(--base-bg));
  /* 検索の当たり: 黄の蛍光ペン(Apple のメモ)。 */
  --highlight: #ffe36e;
  --warning: var(--base-text);
  --warning-bg: var(--soft);
  --warning-line: var(--line);
  --danger-bg: var(--soft);
  /* 意味の赤(削除・壊す操作・失敗・録音中)。テーマで変えない。 */
  --red: #c8102e;
  --shadow: transparent;
  --overlay: color-mix(in srgb, var(--base-text) 30%, transparent);
  --toast-bg: var(--base-text);
  --toast-ink: var(--base-bg);
  --frame-segment: color-mix(in srgb, var(--base-text) 6%, transparent);
  /* 切り替えの選んだ札: 字の色で塗り、札の字は地の色で抜く(全テーマ・明暗で一目で分かる。本人 10/12 朝「選択状態がローコントラストで分かりにくい」)。 */
  --frame-thumb: var(--base-text);
  --on-thumb: var(--base-bg);
  /* 押した ♡・🔖(X に合わせる本人の決定。テーマで変えない)。 */
  --frame-favorite: #d52f48;
  --frame-bookmark: #1672ce;
  /* 欄の面(検索): 枠なしで字の 7%(ダークは 14%)。浮く部品(ポップオーバー・メニュー)の面と影。CD 10/17 案C。 */
  --field: color-mix(in srgb, var(--base-text) 7%, var(--base-bg));
  --raised: var(--base-bg);
  --raised-shadow: color-mix(in srgb, var(--base-text) 18%, transparent);
  /* 写真・書き出しの白地(写真の透明を埋める)。 */
  --photo-matte: #ffffff;
  font-family: var(--frame-sans);
  font-synthesis: none;
}
:root[data-theme="indigo"],
[data-swatch="indigo"] {
  --calendar-1: #a5b8d1;
  --calendar-2: #5578a8;
  --calendar-3: #1f4e8c;
  --calendar-on-1: var(--base-text);
  --calendar-on-2: var(--base-bg);
  --calendar-on-3: var(--base-bg);
  --current: var(--accent);
  --today-frame: var(--calendar-3);
  --base-bg: #ffffff;
  --base-text: #1d1d1f;
  --accent: #1f4e8c;
}
:root[data-theme="matcha"],
[data-swatch="matcha"] {
  --calendar-1: #a2ba88;
  --calendar-2: #75994e;
  --calendar-3: #4b7b19;
  --calendar-on-1: var(--base-text);
  --calendar-on-2: var(--base-text);
  --calendar-on-3: var(--base-bg);
  --current: var(--accent);
  --today-frame: var(--calendar-3);
  --base-bg: #fafaf7;
  --white: #fafaf7;
  --base-text: #1c1d1a;
  --accent: #4b7b19;
  --font-reading: var(--frame-serif);
}
:root[data-theme="blue"],
[data-swatch="blue"] {
  --calendar-1: #7dbbff;
  --calendar-2: #3696ff;
  --calendar-3: #026ee4;
  --calendar-on-1: var(--base-text);
  --calendar-on-2: var(--base-text);
  --calendar-on-3: var(--base-bg);
  --today-frame: var(--calendar-3);
  --base-bg: #ffffff;
  --base-text: #1d1d1f;
  --accent: #007aff;
  /* 青は和の帳面にしない(本人 10/12「青まで全部和風にしろと言った覚えはない」)。今日は Apple のカレンダーと同じ赤の丸。
     赤は白い数字が 4.5:1 を保つ Apple の濃い赤。 */
  --vermilion: #d70015;
  --font-reading: var(--frame-sans);
  /* 青は和の3つと比べる現代の対照(claim:four-themes-sumi-ai-matcha-blue-widgets「Apple らしい青」)。明朝・2px の角の帳面を持ち込まない。 */
  --frame-serif: var(--frame-sans);
  --frame-radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root,
  [data-swatch] {
    color-scheme: dark;
    --base-bg: #151513;
    --base-text: #e8e4d9;
    --vermilion: #de6a50;
    /* 量の段(墨のダーク)。 */
    --calendar-1: #4a4944;
    --calendar-2: #8d8b84;
    --calendar-3: #e8e4d9;
    --calendar-on-1: var(--base-text);
    --calendar-on-2: var(--base-bg);
    --calendar-on-3: var(--base-bg);
    --highlight: #8a6d00;
    --frame-favorite: #f0566a;
    --frame-bookmark: #4a9bea;
    --field: color-mix(in srgb, var(--base-text) 14%, var(--base-bg));
    --raised: color-mix(in srgb, var(--base-text) 11%, var(--base-bg));
    --raised-shadow: color-mix(in srgb, var(--base-bg) 60%, transparent);
    --graph-tag: #199e70;
    --graph-book: #d95926;
    --graph-person-border: #9085e9;
    /* まとまりの色: 件数の大きい順に 0〜8、9 は「そのほか」(ECD 10/12、Observable 10 が土台。正本 57a08241)。 */
    --graph-cluster-0: #3c65cb;
    --graph-cluster-label-0: #5779e2;
    --graph-cluster-1: #f5b621;
    --graph-cluster-label-1: #f5b621;
    --graph-cluster-2: #f86c57;
    --graph-cluster-label-2: #f86c57;
    --graph-cluster-3: #5ab39e;
    --graph-cluster-label-3: #5ab39e;
    --graph-cluster-4: #7fea8c;
    --graph-cluster-label-4: #7fea8c;
    --graph-cluster-5: #feb9d0;
    --graph-cluster-label-5: #feb9d0;
    --graph-cluster-6: #b677ff;
    --graph-cluster-label-6: #b677ff;
    --graph-cluster-7: #9bbff9;
    --graph-cluster-label-7: #9bbff9;
    --graph-cluster-8: #906043;
    --graph-cluster-label-8: #a67456;
    --graph-cluster-9: #84827d;
    --graph-cluster-label-9: #84827d;
    --graph-cluster-fill: 0.14;
    /* ダークの地でも日記の点・線が沈まないよう、字の濃さを上げる(地との比 3:1 以上)。 */
    --graph-node: color-mix(in srgb, var(--base-text) 62%, var(--base-bg));
    --graph-quote: color-mix(in srgb, var(--base-text) 85%, var(--base-bg));
    --graph-line: color-mix(in srgb, var(--base-text) 70%, var(--base-bg));
    --graph-near-line: color-mix(in srgb, var(--base-text) 50%, var(--base-bg));
    --red: #ff4d4f;
    --weekday-sun: #ff7a70;
    --weekday-sat: #79a8ff;
  }
  :root[data-theme="indigo"],
  [data-swatch="indigo"] {
    --calendar-1: #334156;
    --calendar-2: #566e92;
    --calendar-3: #7fa2d6;
    --calendar-on-1: var(--base-text);
    --calendar-on-2: var(--base-text);
    --calendar-on-3: var(--base-bg);
    --base-bg: #000000;
    --base-text: #f5f5f7;
    --accent: #7fa2d6;
  }
  :root[data-theme="matcha"],
  [data-swatch="matcha"] {
    --calendar-1: #3c4d21;
    --calendar-2: #678831;
    --calendar-3: #8fbf3f;
    --calendar-on-1: var(--base-text);
    --calendar-on-2: var(--base-bg);
    --calendar-on-3: var(--base-bg);
    --base-bg: #121312;
    --white: #121312;
    --base-text: #e8e8e2;
    --accent: #8fbf3f;
  }
  :root[data-theme="blue"],
  [data-swatch="blue"] {
    --calendar-1: #06407b;
    --calendar-2: #0760ba;
    --calendar-3: #0a84ff;
    --calendar-on-1: var(--base-text);
    --calendar-on-2: var(--base-text);
    --calendar-on-3: var(--base-bg);
    --base-bg: #000000;
    --base-text: #f5f5f7;
    --accent: #0a84ff;
    --vermilion: #ff453a;
  }
}
/* Keep the approved 17px preset's title, list and metadata proportions. */
:root[data-text-size="small"] {
  --text-scale: calc(15 / 17);
}
:root[data-text-size="large"] {
  --text-scale: calc(20 / 17);
}
:root[data-text-size="extra-large"] {
  --text-scale: calc(23 / 17);
}
:root[data-text-size="small"],
:root[data-text-size="large"],
:root[data-text-size="extra-large"] {
  --text-title: calc(1.5rem * var(--text-scale));
  --text-heading: calc(1.25rem * var(--text-scale));
  --text-body: calc(1.0625rem * var(--text-scale));
  --text-caption: calc(0.875rem * var(--text-scale));
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-body);
  -webkit-font-smoothing: antialiased;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.42;
}
a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
textarea,
select,
a {
  -webkit-tap-highlight-color: transparent;
}
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
/* biome-ignore lint/complexity/noImportantStyles: The native hidden state must override layout classes. */
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
.icon {
  width: 19px;
  height: 19px;
  flex: none;
  stroke-width: 1.65;
}
.mono,
time {
  font-family: var(--frame-sans);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: var(--text-caption);
  line-height: 1.8;
}
.button {
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--white);
  padding: 8px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  line-height: 1.4;
}
.button:hover:not(:disabled, [aria-pressed="true"]) {
  background: var(--soft);
}
.button.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.button.primary:hover:not(:disabled) {
  background: var(--strong-hover);
}
.button.text {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.button.text:hover:not(:disabled) {
  color: var(--ink);
  background: var(--soft);
}
.button.danger {
  color: var(--red);
  border-color: var(--red);
}
.button.danger:hover:not(:disabled) {
  background: var(--danger-bg);
}
.icon-button {
  background: transparent;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--frame-radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.icon-button:hover:not(:disabled, [aria-pressed="true"], [aria-disabled="true"]) {
  background: var(--soft);
  color: var(--ink);
}
.icon-button.active {
  color: var(--blue);
  background: var(--wash);
}
.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.field > span {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--muted);
}
.input {
  width: 100%;
  padding: 11px 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  outline: none;
}
.input:focus {
  border-color: var(--blue);
  box-shadow: none;
}
textarea.input {
  field-sizing: content;
  overflow-y: hidden;
  resize: none;
  line-height: 1.85;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.spread {
  justify-content: space-between;
}
.stack {
  display: grid;
  gap: 18px;
}
.error-message {
  color: var(--red);
  font-size: var(--text-caption);
  line-height: 1.8;
}
.export-controls {
  display: grid;
  gap: 9px;
  justify-items: start;
}
.export-controls progress {
  width: min(100%, 280px);
  accent-color: var(--blue);
}
.archive-actions {
  padding: 7px 0 12px;
}
.archive-actions .button {
  width: 100%;
}
.toast-action {
  margin-left: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
}
.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-story {
  padding: 64px clamp(40px, 7vw, 110px);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 600;
  letter-spacing: 0.055em;
  white-space: nowrap;
}
.brand-mark {
  width: 29px;
  height: 29px;
  stroke-width: 1.5;
}
.auth-copy {
  margin: auto 0;
  padding: 70px 0;
}
.eyebrow {
  font-size: var(--text-caption);
  letter-spacing: 0.2em;
  font-weight: 500;
  color: var(--muted);
}
.auth-copy h1 {
  margin: 25px 0;
  font-size: clamp(30px, 3.1vw, 47px);
  font-weight: 500;
  line-height: 1.65;
  letter-spacing: 0.04em;
}
.auth-copy > p {
  color: var(--muted);
  line-height: 2.1;
  font-size: var(--text-body);
}
.sketch {
  margin-top: 55px;
  width: 100%;
  max-width: 320px;
  height: 117px;
  color: var(--muted);
}
.auth-foot {
  color: var(--muted);
  font-size: var(--text-caption);
  letter-spacing: 0.2em;
}
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px 40px;
  background: var(--white);
}
.auth-form {
  width: 100%;
  max-width: 350px;
}
.auth-form h2 {
  font-size: var(--text-title);
  font-weight: 500;
  letter-spacing: 0.06em;
  margin: 0 0 11px;
}
.auth-form > p {
  margin-bottom: 34px;
  color: var(--muted);
  line-height: 1.8;
}
.auth-fields {
  display: grid;
  gap: 20px;
}
.auth-submit {
  width: 100%;
  margin-top: 25px;
  min-height: 44px;
}
.auth-switch {
  width: 100%;
  margin-top: 15px;
  font-size: var(--text-caption);
}
.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 218px 330px minmax(0, 1fr);
  overflow: hidden;
}
.sidebar {
  padding: 29px 16px 17px;
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* 記録・タグ・下書きは1本でスクロールする(タグの欄だけを狭い箱に押し込まない)。AI とつなぐと設定は下に残す。 */
.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px;
  /* 下にまだあるときだけ下端に線(送り切ると中身の端の地の色が線を隠す)。切れた行を「AI の連携」と重ねて見せない。 */
  background:
    linear-gradient(var(--paper), var(--paper)) bottom / 100% 1px no-repeat local,
    linear-gradient(var(--line), var(--line)) bottom / 100% 1px no-repeat scroll;
}
.sidebar .brand {
  padding-left: 9px;
  font-size: var(--text-body);
  gap: 9px;
}
.brand-home {
  display: flex;
  align-items: center;
  gap: inherit;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  border-radius: var(--frame-radius);
  cursor: pointer;
}
.brand-home:hover {
  background: var(--soft);
}
.sidebar .brand-mark {
  width: 25px;
  height: 25px;
}
.sidebar .new-record {
  margin: 32px 3px 27px;
  width: calc(100% - 6px);
  justify-content: flex-start;
  padding-left: 15px;
  background: var(--white);
  border-color: var(--line);
}
.nav-label {
  font-size: var(--text-caption);
  color: var(--muted);
  letter-spacing: 0.13em;
  padding: 0 13px;
  margin: 0 0 9px;
}
.nav-list {
  display: grid;
  gap: 4px;
}
.nav-item {
  min-height: 42px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: 0;
  border-radius: var(--frame-radius);
  padding: 9px 12px;
  text-align: left;
  font-size: var(--text-caption);
  color: var(--muted);
}
.nav-item:hover {
  background: var(--soft);
}
.nav-item.active {
  color: var(--ink);
  background: var(--soft);
  font-weight: 500;
}
.nav-item .count {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
  color: var(--muted);
  font: var(--text-caption) var(--frame-sans);
}
.tags-nav {
  margin-top: 29px;
}
.tag-nav {
  min-height: 34px;
  font-size: var(--text-caption);
}
.tag-hash {
  width: 19px;
  text-align: center;
  color: var(--muted);
  font: var(--text-body) var(--frame-sans);
}
.sidebar-bottom {
  padding-top: 12px;
}
.account {
  min-height: 48px;
  border-top: 1px solid var(--line);
  padding: 17px 9px 0;
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}
.avatar {
  background: var(--soft);
  width: 31px;
  height: 31px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: var(--text-caption);
  flex: none;
}
.account-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  font-size: var(--text-caption);
}
.list-panel {
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.list-header {
  padding: 29px 24px 17px;
}
.list-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 20px;
}
/* 中央の帯の戻る・進む。押せない間も場所を残す(web.center-bar#back・forward)。 */
.list-title-row h1 {
  font-size: var(--text-heading);
  font-weight: 600;
  letter-spacing: 0.03em;
  flex: 1;
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--soft);
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: var(--frame-radius);
  color: var(--muted);
}
.search-wrap:focus-within {
  border-color: var(--blue);
}
.search-wrap .icon {
  width: 16px;
  height: 16px;
}
.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  padding: 0;
  background: none;
  font-size: var(--text-caption);
}
.search-wrap input::placeholder {
  color: var(--muted);
}
.record-list {
  /* 下は執筆中の帯(48px)の分を先に空けておく。帯は上に重なり、出ても一覧を押し縮めない(見た目の決まり9章)。 */
  padding: 0 12px 68px;
  overflow-y: auto;
  flex: 1;
}
.date-group {
  font-size: var(--text-caption);
  color: var(--muted);
  padding: 16px 13px 9px;
  letter-spacing: 0.08em;
}
button.loose-search-toggle {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.loose-search-toggle::after {
  content: "›";
  font-size: 20px;
  transform: rotate(90deg);
}
.loose-search-toggle[aria-expanded="true"]::after {
  transform: rotate(-90deg);
}
.loose-search-toggle:hover {
  background: var(--soft);
}
.loose-search-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
.record-card {
  width: 100%;
  text-align: left;
  padding: 16px 13px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: 0;
  background: transparent;
  display: block;
}
.record-card:hover {
  background: var(--soft);
  border-radius: var(--frame-radius);
}
.record-card.selected {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: var(--frame-radius);
}
.record-card h2 {
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 1.7;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.record-card .preview {
  margin-top: 6px;
  font-size: var(--text-caption);
  line-height: 1.85;
  color: var(--muted);
  display: -webkit-box;
  /* 行数の正本は display-limits.js(applyDisplayLimitStyles が変数を置く)。 */
  -webkit-line-clamp: var(--card-lines-masonry-diary);
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-caption);
  color: var(--muted);
  margin-top: 12px;
}
.card-meta .icon {
  width: 11px;
  height: 11px;
}
.card-meta time {
  margin-left: auto;
}
.card-tags {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 155px;
}
.empty-list {
  padding: 65px 21px;
  text-align: center;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 2;
}
.empty-list .icon {
  width: 29px;
  height: 29px;
  margin: 0 auto 17px;
  display: block;
  stroke-width: 1.2;
}
.detail-panel {
  background: var(--white);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.detail-toolbar {
  height: 77px;
  flex: none;
  border-bottom: 1px solid var(--line);
  padding: 0 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.detail-toolbar > .row {
  min-width: 0;
}
.detail-path {
  color: var(--muted);
  font-size: var(--text-caption);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-content {
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 16px clamp(28px, 4vw, 70px) 65px;
  /* 下に重なる保存の帯(#save-footer、44px 以上)に、焦点で送った欄が隠れないように。 */
  scroll-padding-bottom: 64px;
}
.reading-width {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.entry-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: var(--text-caption);
  margin-bottom: 8px;
}
.entry-title {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: var(--text-title);
  font-weight: 600;
  letter-spacing: 0.025em;
  line-height: 1.6;
  resize: none;
  outline: none;
  overflow: hidden;
}
/* 題の欄は新規も保存済みも同じ形。空のときの案内「題」は薄い細い字で、題があるように見せない。 */
.entry-title::placeholder {
  color: var(--muted);
  font-weight: 400;
  opacity: 0.7;
}
.search-hit {
  border-radius: var(--frame-radius);
  background: var(--highlight);
  color: inherit;
}
/* タグの行は日記は題の直下、名言は名言の文の直下(claim:tags-at-top-below-title-not-bottom・claim:quote-tag-input-right-below-quote-body)。
   下の本文を揺らさないよう、高さを決めた1行にする: 開く・足す・外すで高さを変えず、折り返さない。札は縮めず、入らない分は
   行を横に送る(打っている欄が見える所まで自動で送る。tags.js の revealTagEditor)。多いときは +N で畳む。 */
.record-meta {
  display: flex;
  /* 広い幅は1行のまま。タグが増えてもプロジェクトを折り返さず、タグの行の中で横に送る(本文を動かさない)。 */
  flex-wrap: nowrap;
  align-items: center;
  column-gap: 4px;
  margin: 8px 0 16px;
}
.entry-tags {
  display: flex;
  flex: 0 1 auto;
  /* プロジェクトが長くても、タグの行は少なくとも6割(中身が短ければ中身の幅)を保つ。+ と札を押せなくしない。 */
  min-width: min(60%, max-content);
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  height: 32px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  margin: 0;
}
.tag-row {
  min-width: 0;
}
.tag-chip {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-add {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0 0 0 6px;
  min-width: 20px;
  min-height: 20px;
  cursor: pointer;
}
.tag-add {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
}
.tag-editor {
  width: min(180px, 38vw);
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: none;
  padding: 4px;
  background: transparent;
}
/* 枠は付けない(欄は箱にしない)。焦点は下線を字の色で太くして示す。outline を消したままだと焦点が見えなかった。 */
.tag-editor:focus {
  border-bottom: 1.5px solid var(--ink);
}
.entry-tags .tag-chip,
.entry-tags .tag-add,
.entry-tags .tag-overflow,
.entry-tags .tag-editor {
  flex: none;
}
/* 候補の一覧(datalist)の ▼ の印は出さない。候補は打つと出る。 */
.entry-tags .tag-editor::-webkit-calendar-picker-indicator {
  display: none !important;
}
button.tag-overflow {
  cursor: pointer;
}
/* 「+N」で開く、全部のタグ。押した札の下に重ねて出す。長いタグは折り返して全部見せる。 */
#tag-overflow-menu {
  max-width: min(360px, calc(100vw - 16px));
  max-height: 60vh;
  overflow: auto;
}
#tag-overflow-menu .tag-overflow-item {
  display: flex;
  width: 100%;
  gap: 8px;
}
#tag-overflow-menu .tag-chip {
  flex: 1;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.inline-source {
  margin-top: 8px;
}
.inline-section-title {
  margin: 30px 0 10px;
  font-size: var(--text-caption);
}
.recording-global,
.recording-dialog .recording,
.calendar-button.recording {
  color: var(--danger);
}
.global-recording {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  border-radius: var(--frame-radius);
  background: var(--white);
  color: var(--danger);
  padding: 9px 13px;
  box-shadow: none;
}
.global-recording .icon {
  width: 14px;
  height: 14px;
}
.chip {
  display: inline-flex;
  font-size: var(--text-caption);
  padding: 4px 8px;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--white);
  color: var(--muted);
}
.entry-body {
  width: 100%;
  /* 新規も保存済みも同じ高さ。押して書ける範囲を取りつつ、タグの行を本文から遠ざけない。 */
  min-height: 6lh;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  padding: 0;
  line-height: 1.8;
  font-size: var(--text-body);
  letter-spacing: 0.025em;
}
.entry-body {
  position: relative;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: text;
}
.entry-body.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  color: var(--muted);
  pointer-events: none;
}
/* Markdown の行(markdown.js)。印は見せず、見た目だけを出す。 */
.md-line {
  min-height: 1lh;
}
.md-h1,
.md-h2,
.md-h3,
.md-h4,
.md-h5,
.md-h6 {
  font-weight: 650;
  line-height: 1.6;
  letter-spacing: 0.01em;
}
.md-h1 {
  font-size: 1.75em;
  margin: 0.35em 0 0.15em;
}
.md-h2 {
  font-size: 1.4em;
  margin: 0.3em 0 0.1em;
}
.md-h3 {
  font-size: 1.15em;
}
.md-li {
  position: relative;
  padding-left: calc(1.6em + var(--depth, 0) * 1.4em);
}
.md-li::before {
  position: absolute;
  left: calc(var(--depth, 0) * 1.4em);
  width: 1.4em;
  color: var(--muted);
  text-align: center;
}
.md-ul::before {
  content: "•";
}
.md-ol::before {
  content: attr(data-marker);
  font-variant-numeric: tabular-nums;
}
.md-check::before {
  content: none;
}
.md-checkbox {
  position: absolute;
  left: calc(var(--depth, 0) * 1.4em + 0.15em);
  top: calc(0.5lh - 0.55em);
  width: 1.1em;
  height: 1.1em;
  border: 1.5px solid var(--field-line);
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
}
.md-check.checked .md-checkbox {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: none;
}
.md-check.checked {
  color: var(--muted);
}
.md-quote {
  padding-left: 1em;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.md-hr {
  padding: 0.6lh 0 0;
}
.md-hr hr {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
}
.md-raw {
  margin: 0.3em 0;
  padding: 10px 14px;
  border-radius: var(--frame-radius);
  background: var(--soft);
  font-family: var(--frame-sans);
  font-size: 0.86em;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.entry-body code {
  padding: 0.1em 0.35em;
  border-radius: var(--frame-radius);
  background: var(--soft);
  font-family: var(--frame-sans);
  font-size: 0.88em;
}
.entry-body mark {
  background: var(--highlight);
  color: inherit;
}
.entry-body a,
.md-wikilink {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.md-wikilink {
  cursor: pointer;
}
/* 行き先の無いリンク(Obsidian と同じく薄く)。押すと「書く」の札。 */
.md-wikilink.md-unresolved {
  color: var(--muted);
  text-decoration-style: dashed;
}
.md-wikilink.md-flash {
  background: color-mix(in srgb, var(--blue) 22%, transparent);
  border-radius: var(--frame-radius);
  transition: background 0.4s;
}
.unresolved-link {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--white);
  box-shadow: none;
  font-size: var(--text-body);
  line-height: 1.6;
}
.unresolved-link p {
  color: var(--muted);
  margin-bottom: 6px;
}
.unresolved-link .row {
  justify-content: space-between;
}
.md-tag {
  color: var(--blue);
}
/* 書式の帯(Apple のメモの「Aa」の並び)。文を選んだときと「Aa」を押したときだけ、文の近くに浮かぶ。 */
.format-bar {
  position: absolute;
  z-index: 5;
  display: flex;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}
.format-bar[hidden] {
  display: none;
}
.format-toggle {
  /* Aa is an icon, like the adjacent SVG controls. */
  font-size: 14px;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0;
}
.format-toggle[aria-pressed="true"] {
  background: var(--soft);
}
.format-button {
  flex: none;
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--frame-radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-caption);
  cursor: pointer;
}
.format-button:hover {
  background: var(--soft);
}
.format-button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}
/* 選択から「名言に」「タグに」する操作は、書式(❝ のブロック引用を含む)と罫1本で分ける。 */
.format-make-quote,
.format-make-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.format-make-quote[hidden],
.format-make-tag[hidden],
.format-rule[hidden] {
  display: none;
}
/* 押した後も帯は出たまま(選択が残る)なので、押した色を残さない。色はキーボードで来たときだけ(ECD 10/11)。 */
.format-make-quote:hover,
.format-make-tag:hover {
  background: transparent;
}
.format-make-quote:focus-visible,
.format-make-tag:focus-visible {
  background: var(--soft);
}
.format-make-quote .icon {
  width: 14px;
  height: 14px;
}
.format-rule {
  flex: none;
  align-self: stretch;
  width: 0.5px;
  margin: 4px 4px;
  background: var(--line);
}
.format-strong {
  font-weight: 700;
}
.format-em {
  font-style: italic;
}
.format-s {
  text-decoration: line-through;
}
.format-p {
  margin-right: 8px;
}
.format-s {
  margin-right: 8px;
}
.entry-body.quote {
  font-size: var(--text-heading);
  line-height: 1.8;
  font-weight: 400;
  padding-left: 20px;
  border-left: 2px solid var(--line);
  min-height: 170px;
}
.reading-body {
  color: var(--ink);
  font-size: var(--text-body);
  line-height: 1.8;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.reading-body p {
  margin: 0 0 1.45em;
  white-space: pre-wrap;
}

.original-input h2 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 600;
}
.draft-link-context {
  display: flex;
  flex-direction: column;
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: var(--text-caption);
}
.draft-link-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 0.5px solid var(--line);
}
.record-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 32px 0 0;
}

.record-links {
  margin: 4px 0 18px;
}
.record-links > summary {
  width: fit-content;
  color: var(--muted);
  font-size: var(--text-caption);
  cursor: pointer;
}
.record-link {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 0.5px solid var(--line);
}
.record-link-main {
  display: grid;
  flex: 1;
  gap: 4px;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.record-link-main strong {
  overflow-wrap: anywhere;
  font-size: var(--text-caption);
  font-weight: 500;
}
/* 行き先の無い本文のリンク(本文と同じく薄く)。 */
.record-link.unresolved .record-link-main strong {
  color: var(--muted);
}
.record-link-main q {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.7;
}
.record-link > .icon-button {
  flex: 0 0 auto;
  margin-right: 8px;
}
.record-link > .button {
  flex: 0 0 auto;
  margin-right: 8px;
}
/* つなぐ一覧(link-list.js。設計 6.1)。本文の下、リンクの節のすぐ下に埋める石垣のカード。 */
.link-list {
  margin: 8px 0 24px;
  container: link-list / inline-size;
}
.link-list-heading,
.link-list-subheading {
  margin: 0 0 8px;
  font-size: var(--text-caption);
  font-weight: 600;
}
.link-list-subheading {
  margin-top: 10px;
}
.link-list-reason {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-list-field {
  margin-bottom: 10px;
}
.link-list-caption {
  margin: 0 0 8px;
}
.link-list-grid {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.link-list-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 0;
  gap: 10px;
  min-width: 0;
}
.link-list-column > div {
  min-width: 0;
  position: relative;
}
/* 本文幅を四角の開くボタンに割かず、接続は鎖ひとつへ。 */
.link-pick-link {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin-left: auto;
  color: var(--muted);
}
.link-pick-link[aria-pressed="true"] {
  color: var(--blue);
}
@media (max-width: 700px) {
  .link-pick-link {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }
}
.link-pick {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 11px 13px 12px;
  border: 0.5px solid color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: 2px;
  background: var(--white);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.link-pick:hover {
  border-color: var(--ink);
}
.link-pick:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.link-pick[aria-pressed="true"] {
  /* つないだことは ✓ だけで示す(枠を太くすると、選んだカードと同じ表し方になる)。 */
}
.link-pick.fixed {
  cursor: pointer;
}
.link-pick-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: var(--muted);
  font-size: var(--text-caption);
}
.link-pick-date {
  font-variant-numeric: tabular-nums;
}
.link-pick-mark {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}
.link-pick-mark.check {
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--field-line);
  border-radius: 50%;
}
.link-pick[aria-pressed="true"] .link-pick-mark.check {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--white);
}
.link-pick-mark .icon {
  width: 14px;
  height: 14px;
}
.link-pick-badge {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: var(--text-caption);
}
.link-pick-title {
  overflow-wrap: anywhere;
  font-family: var(--font-reading, inherit);
  font-size: var(--text-caption);
  font-weight: 600;
  line-height: 1.6;
}
.link-pick-preview,
.link-pick-quote {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--card-lines-near);
  font-size: var(--text-caption);
  line-height: 1.75;
}
.link-pick-preview {
  color: var(--muted);
  font-family: var(--font-reading, inherit);
}
.link-pick-quote {
  font-family: var(--font-reading, inherit);
}
.near-graph {
  /* 点の押せる大きさ。狭い幅では画面のボタンの決まり(44px)に合わせる。中心寄せと名前の位置はこの値から決める。 */
  --near-node: 28px;
  position: relative;
  width: 100%;
  height: 240px;
  overflow: hidden;
  container-type: inline-size;
  background: var(--paper);
  color: var(--ink);
}
@container link-list (min-width: 520px) {
  .near-graph {
    height: 280px;
  }
}
@media (max-width: 700px) {
  .near-graph {
    --near-node: 44px;
  }
}
.near-graph-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.near-graph-line.linked {
  stroke: var(--graph-line);
  stroke-width: 1.2px;
}
/* 近いだけの線は破線(3px 線・3px 空き)。つないだ線と太さ・濃さだけでは見分けにくい(ECD 10/12)。 */
.near-graph-line.near {
  stroke: var(--graph-near-line);
  stroke-width: 1px;
  stroke-dasharray: 3 3;
}
/* 点は transform を使わずに中心へ寄せる(重なりの文脈を作らず、名前をすべての点の上に出すため)。 */
.near-node,
.near-node-center {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--near-node);
  height: var(--near-node);
  margin: calc(var(--near-node) / -2) 0 0 calc(var(--near-node) / -2);
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
}
.near-node {
  cursor: pointer;
}
.near-node-center {
  left: 50%;
  top: 50%;
}
.near-node:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}
.near-node-shape {
  width: 8px;
  height: 8px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--graph-diary);
}
.near-node-center .near-node-shape {
  width: 12px;
  height: 12px;
  box-shadow:
    0 0 0 2px var(--paper),
    0 0 0 3.5px var(--ink);
}
.near-node-shape.quote {
  border: 1.2px solid var(--graph-quote);
  border-radius: 0;
  background: var(--paper);
  transform: rotate(45deg);
}
/* 名前は点の縁から 4px 空け(◇の角と縁取りの分を足して中心から 14px)、すべての点と線の上に描く。 */
.near-node-label {
  position: absolute;
  z-index: 2;
  left: calc(var(--near-node) / 2 + 14px);
  max-width: calc(var(--near-label-room, 50) * 1cqw - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.4;
  -webkit-text-stroke: 3px var(--paper);
  paint-order: stroke fill;
  pointer-events: none;
}
.near-node-left .near-node-label {
  left: auto;
  right: calc(var(--near-node) / 2 + 14px);
  text-align: right;
}
.near-node-above .near-node-label,
.near-node-below .near-node-label,
.near-node-center .near-node-label {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  max-width: 40cqw;
}
.near-node-above .near-node-label {
  bottom: calc(var(--near-node) / 2 + 12px);
}
.near-node-below .near-node-label,
.near-node-center .near-node-label {
  top: calc(var(--near-node) / 2 + 14px);
}
.near-node-center .near-node-label {
  z-index: 3;
  font-weight: 600;
}
.near-node-quiet .near-node-label {
  visibility: hidden;
}
.near-graph-key {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.near-graph-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.near-graph-key .line {
  width: 18px;
  border-top: 1.2px solid var(--graph-line);
}
.near-graph-key .line.near {
  border-top: 1px dashed var(--graph-near-line);
}
.near-graph-pop {
  position: fixed;
  z-index: 30;
  width: min(260px, calc(100vw - 12px));
  max-height: calc(100vh - 12px);
  overflow: hidden;
  pointer-events: auto;
}
.near-graph-pop .link-pick {
  border-color: var(--muted);
  background: var(--paper);
  color: var(--ink);
  cursor: grab;
}
/* 吹き出しのカードはつまめる。✓ の丸は押せる物・選んだ状態に見えるので出さない(ECD 10/12)。 */
.near-graph-pop .link-pick-mark {
  display: none;
}
.link-search-form {
  display: flex;
  gap: 8px;
}
.link-search-form .input {
  flex: 1;
  min-width: 0;
}
.link-search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.link-search-result > div {
  flex: 1;
  min-width: 0;
}
.link-search-result strong {
  font-size: var(--text-caption);
  font-weight: 500;
}
.link-search-result p {
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.original-inputs {
  display: grid;
  gap: 18px;
}
.original-input {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--white);
}
.original-input > p {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-caption);
  line-height: 2;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.original-input img {
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: var(--frame-radius);
  background: var(--soft);
}
.original-input audio {
  width: 100%;
}
.original-input .media-name {
  margin-top: 9px;
  color: var(--muted);
  font-size: var(--text-caption);
}
.original-input h3 {
  margin: 18px 0 6px;
  color: var(--muted);
  font-size: var(--text-caption);
}
.original-input .transcript-engine,
.original-input .in-body {
  margin-top: 7px;
  color: var(--muted);
  font-size: var(--text-caption);
}
.entry-source {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 12px 0 28px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.entry-source .icon {
  color: var(--muted);
}
.entry-source .author {
  font-size: var(--text-caption);
  font-weight: 500;
  margin-bottom: 4px;
}
.entry-source .book-title {
  color: var(--muted);
  font-size: var(--text-caption);
}
.entry-source .source-note {
  color: var(--muted);
  font-size: var(--text-caption);
  margin-top: 4px;
  white-space: pre-wrap;
}
.entry-source > div {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.entry-source a {
  font-size: var(--text-caption);
  overflow-wrap: anywhere;
}
.metadata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
  padding: 7px 0 3px;
}
.metadata-grid .full {
  grid-column: 1 / -1;
}
.metadata-grid .input {
  font-size: var(--text-caption);
  padding: 9px 11px;
}
.editor-footer {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.save-status {
  font-size: var(--text-caption);
  color: var(--muted);
  line-height: 1.7;
}
.entry-notice {
  font-size: var(--text-caption);
  line-height: 1.9;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  padding: 12px 15px;
  margin-bottom: 22px;
}
.entry-notice.error {
  border-color: var(--red);
  color: var(--red);
}
.entry-notice .button {
  margin-top: 9px;
  font-size: var(--text-caption);
  min-height: 30px;
}
.attachments {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}
.attachment {
  margin: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  overflow: hidden;
  background: var(--white);
}
.attachment img {
  width: 100%;
  max-height: 270px;
  object-fit: contain;
  display: block;
  background: var(--soft);
}
.attachment audio {
  width: 100%;
  height: 42px;
  margin: 12px 0 0;
}
.attachment figcaption {
  padding: 10px 11px;
  font-size: var(--text-caption);
  color: var(--muted);
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  gap: 8px;
}
.attachment figcaption span {
  flex: 1;
}
.pending-file {
  padding: 12px;
}
.original {
  margin-top: 24px;
  font-size: var(--text-caption);
  color: var(--muted);
}
.original summary {
  cursor: pointer;
}
.original p {
  white-space: pre-wrap;
  line-height: 2;
  padding: 14px 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.empty-detail {
  height: 100%;
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.empty-detail .empty-inner {
  max-width: 355px;
  padding: 40px 25px;
}
.empty-art {
  width: 110px;
  height: 103px;
  color: var(--muted);
  margin-bottom: 29px;
}
.empty-detail h2 {
  /* 「記録を選ぶと、ここに開きます」を1字だけ折り返さない。 */
  word-break: keep-all;
  text-wrap: balance;
  font-size: var(--text-title);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.04em;
}
.empty-detail p {
  font-size: var(--text-caption);
  color: var(--muted);
  line-height: 2.1;
  margin: 15px 0 25px;
}
.mobile-only {
  display: none;
}
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  /* 区画の境の線(.pane-resizer 30)と書く窓(35)より上。知らせの上を線が横切らない。 */
  z-index: 100;
  max-width: calc(100% - 32px);
  padding: 12px 21px;
  border-radius: var(--frame-radius);
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: var(--text-caption);
  line-height: 1.7;
  box-shadow: none;
  pointer-events: none;
}
.toast-action {
  pointer-events: auto;
}
dialog {
  contain: layout style;
  width: min(510px, calc(100% - 32px));
  max-height: calc(100dvh - 50px);
  padding: 0;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}
dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
}
.dialog-header {
  flex-shrink: 0;
  padding: 22px 25px 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.dialog-header h2 {
  font-size: var(--text-heading);
  font-weight: 500;
}
.dialog-body {
  min-height: 0;
  overflow-y: auto;
  padding: 24px 26px 28px;
}
.dialog-body > p {
  line-height: 1.9;
  color: var(--muted);
  font-size: var(--text-caption);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
}
.settings-section:empty {
  display: none;
}
.settings-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
  margin-top: 28px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}
.settings-section h3 {
  font-size: var(--text-caption);
  margin-bottom: 9px;
  font-weight: 500;
}
.settings-section > p {
  font-size: var(--text-caption);
  color: var(--muted);
  line-height: 1.9;
  margin-bottom: 14px;
}
.usage-section .usage-amount {
  color: var(--ink);
  margin-bottom: 8px;
}
/* 使用量の見出しは、ほかの設定の見出し(文字の大きさ)と同じ段。 */
.usage-section h3 {
  margin-bottom: 12px;
  font-size: var(--text-heading);
  font-weight: inherit;
}
/* 棒は区切り線と見分けがつく面(地は罫線の色、使った分は --blue。墨のテーマでは墨になる)。 */
.usage-meter {
  display: block;
  width: 100%;
  height: 6px;
  margin-bottom: 14px;
  border: 0;
  border-radius: var(--frame-radius);
  overflow: hidden;
  background: var(--line);
  appearance: none;
  -webkit-appearance: none;
}
.usage-meter::-webkit-progress-bar {
  background: var(--line);
  border-radius: var(--frame-radius);
}
.usage-meter::-webkit-progress-value {
  background: var(--blue);
  border-radius: var(--frame-radius);
}
.usage-meter::-moz-progress-bar {
  background: var(--blue);
  border-radius: var(--frame-radius);
}
.usage-warning .usage-meter::-webkit-progress-value {
  background: var(--warning);
}
.usage-warning .usage-meter::-moz-progress-bar {
  background: var(--warning);
}
.usage-warning .usage-note {
  color: var(--warning);
}
.device-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.device-row > div {
  flex: 1;
  min-width: 0;
}
.device-row strong {
  font-size: var(--text-caption);
  font-weight: 500;
}
.device-row p {
  font-size: var(--text-caption);
  color: var(--muted);
  margin-top: 4px;
}
/* Same glyph size and column width for both marks: the Apple file carries padding,
   so it is drawn taller to make its apple as tall as Google's "G". */
.device-row .provider-logo {
  flex: none;
  width: 31px;
  height: 19px;
  color: var(--ink);
}
.device-row .provider-logo[data-logo="apple"] {
  height: 44px;
  margin: -12px 0;
}
.provider-row .button {
  min-width: 136px;
}
.button.text.destructive {
  color: var(--red);
}
.conflict-text {
  white-space: pre-wrap;
  font-size: var(--text-caption);
  line-height: 1.9;
  background: var(--paper);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  margin: 16px 0;
}
@media (min-width: 1550px) {
  .app {
    grid-template-columns: 235px 360px minmax(0, 1fr);
  }
  .sidebar {
    padding-left: 20px;
    padding-right: 20px;
  }
}
@media (max-width: 1100px) {
  .app {
    grid-template-columns: 190px 285px minmax(0, 1fr);
  }
  .sidebar {
    padding-left: 11px;
    padding-right: 11px;
  }
  .sidebar .brand {
    font-size: var(--text-caption);
    gap: 7px;
  }
  .list-header {
    padding-left: 20px;
    padding-right: 20px;
  }
  .detail-toolbar {
    padding: 0 18px;
  }
  .detail-content {
    padding: 16px 28px 45px;
  }
  .entry-title {
    font-size: var(--text-title);
  }
  .detail-path {
    max-width: 160px;
  }
}
@media (max-width: 820px) {
  .app {
    grid-template-columns: 170px 245px minmax(0, 1fr);
  }
  .sidebar .brand {
    font-size: var(--text-caption);
  }
  .sidebar .brand-mark {
    width: 20px;
  }
  .sidebar .new-record {
    font-size: var(--text-caption);
  }
  .detail-content {
    /* 下の余白は保存の帯より高く(最後の欄が帯の下に隠れない)。 */
    padding: 16px 22px 72px;
  }
  .detail-path {
    display: none;
  }
  .detail-toolbar {
    justify-content: flex-end;
  }
  .metadata-grid {
    grid-template-columns: 1fr;
  }
  .attachments {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 700px) {
  .auth {
    grid-template-columns: 1fr;
    align-content: start;
  }
  .auth-story {
    border: 0;
    padding: 24px 24px 0;
  }
  .auth-copy,
  .auth-foot {
    display: none;
  }
  .auth-panel {
    padding: 28px 24px 40px;
    align-items: flex-start;
    background: var(--paper);
  }
  .auth-form {
    max-width: none;
  }
  .auth-form h2 {
    font-size: var(--text-heading);
  }
  .auth-form > p {
    margin-bottom: 24px;
  }
  .app {
    display: block;
  }
  .sidebar {
    position: fixed;
    z-index: 6;
    width: 260px;
    left: 0;
    top: 0;
    bottom: 0;
    padding: 27px 18px 22px;
    box-shadow: none;
  }
  .app:not(.nav-open) .sidebar {
    display: none;
  }
  .sidebar .brand {
    font-size: var(--text-body);
  }
  .sidebar .brand-mark {
    width: 26px;
  }
  .sidebar .new-record {
    font-size: var(--text-body);
  }
  .sidebar-shade {
    position: fixed;
    inset: 0;
    z-index: 5;
    background: var(--overlay);
    border: 0;
  }
  .app:not(.nav-open) .sidebar-shade {
    display: none;
  }
  .mobile-only {
    display: inline-flex;
  }
  .list-panel {
    border: 0;
  }
  .list-panel,
  .detail-panel {
    height: 100dvh;
  }
  .app[data-mobile="list"] .detail-panel {
    display: none;
  }
  /* 記録を開いている間も一覧の箱は残し、見えなくするだけにする(display:none は送り位置を捨てる)。 */
  .app[data-mobile="detail"] .list-panel {
    position: absolute;
    inset: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .list-header {
    padding: 22px 23px 12px;
  }
  .list-title-row {
    margin-bottom: 16px;
  }
  .list-title-row h1 {
    font-size: var(--text-title);
  }
  .list-title-row .mobile-only {
    margin-left: -8px;
    margin-right: 4px;
  }
  .list-title-row .add-mobile {
    margin-left: 7px;
    margin-right: -7px;
  }
  .record-list {
    padding: 0 16px 30px;
  }
  .record-card {
    padding: 18px 15px;
  }
  .record-card h2 {
    font-size: var(--text-body);
  }
  .record-card .preview {
    font-size: var(--text-caption);
  }
  .card-meta {
    font-size: var(--text-caption);
  }
  .detail-toolbar {
    height: 65px;
    padding: 0 15px;
    justify-content: space-between;
  }
  /* 帯に残すのは Aa・キラキラ・リンク・ピンと「その他」。ほかは「その他」のメニューから(detail.js の secondary)。 */
  .detail-toolbar :is(.toolbar-secondary, .toolbar-narrow-secondary) {
    display: none;
  }
  .popup-menu-item {
    min-height: 44px;
  }
  .detail-toolbar .button {
    font-size: var(--text-caption);
    padding: 7px 10px;
    min-height: 35px;
  }
  .detail-content {
    padding: 16px 26px 50px;
  }
  .original-input {
    padding: 17px;
  }
  .metadata-grid {
    grid-template-columns: 1fr 1fr;
  }
  .attachments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .editor-footer {
    flex-wrap: wrap;
  }
  .toast {
    bottom: 20px;
    width: max-content;
  }
  .input {
    font-size: var(--text-body);
  }
  .metadata-grid .input {
    font-size: var(--text-body);
  }
  .search-wrap input {
    font-size: var(--text-body);
  }
  .search-wrap {
    padding: 11px;
  }
  .entry-source {
    margin-top: 15px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button,
  a {
    transition:
      background 0.14s,
      color 0.14s;
  }
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px;
  margin: 22px 0 10px;
  font-size: var(--text-caption);
  color: var(--muted);
}
.auth-links .button {
  min-height: 44px;
  padding: 0 6px;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--ink);
}
.field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: -12px 0 -12px;
}
.field-head label {
  font-size: var(--text-caption);
  font-weight: 500;
  color: var(--muted);
}
.field-head .button {
  min-height: 44px;
  padding: 0 2px;
  font-size: var(--text-caption);
}
.auth-hint {
  font-size: var(--text-caption);
  line-height: 1.8;
  color: var(--muted);
  margin: -8px 0 20px;
}
.auth-sent-to {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}
.auth-sent-label {
  color: var(--muted);
}
.auth .input {
  min-height: 44px;
  border-color: var(--field-line);
}
.auth-form .error-message {
  color: var(--red);
  background: var(--danger-bg);
  border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  border-radius: var(--frame-radius);
  padding: 12px 14px;
  margin: 0 0 20px;
  white-space: pre-line;
}
.auth-fields .error-message {
  margin: 0;
}
.auth-form .error-message:empty {
  display: none;
}
.auth-form .auth-message {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--paper);
  font-size: var(--text-caption);
  line-height: 1.8;
  margin: 0 0 20px;
  white-space: pre-line;
}
.auth-fields .auth-submit {
  margin-top: 5px;
}
/* Cloudflare Turnstile の部品(高さ65px)。読み込む前から場所を取り、送るボタンが跳ねないようにする。 */
.auth-fields .auth-turnstile {
  min-height: 65px;
}
.auth-fields .small {
  margin-top: -8px;
}
.show-password {
  margin-top: -8px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  font-size: var(--text-caption);
  color: var(--muted);
  cursor: pointer;
}
.show-password input {
  width: 16px;
  height: 16px;
  margin: 0;
}
.auth-actions {
  display: grid;
  gap: 14px;
  margin-top: 26px;
}
.social-buttons {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}
/* Provider buttons follow each brand's published button, and match each other:
   same height, same white fill, same title size, weight and font (Google: "at least
   as prominently"; Apple: "no smaller", and a custom button may change its title font
   and size). Google: light theme of the branding guidelines (#FFF, #747775 stroke,
   Google Sans Medium, 12/10/12 padding) at the 44px touch height. Apple: HIG custom
   button, "white with outline" on light backgrounds and "white" on dark ones, with the
   logo file as tall as the button. */
.provider-button {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid;
  border-radius: var(--frame-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font:
    500 15px / 20px "Google Sans",
    "Noto Sans JP",
    sans-serif;
  letter-spacing: 0.25px;
}
.provider-button:disabled {
  opacity: 0.6;
}
.provider-button[data-provider="google"] {
  gap: 10px;
  background: #fff;
  border-color: #747775;
  color: #1f1f1f;
}
.provider-button[data-provider="google"] .provider-logo {
  width: 19px;
  height: 19px;
}
.provider-button[data-provider="apple"] {
  /* The logo file carries ~7px side padding; 3px more makes the same 10px gap as Google's. */
  gap: 3px;
  background: #fff;
  border-color: #747775;
  color: #000;
}
.provider-button[data-provider="apple"] .provider-logo {
  /* The file is as tall as the whole button (44px, its padding overlaps the 1px border),
     which makes its apple the same 19px as Google's "G". */
  width: 31px;
  height: 44px;
  margin: -1px 0;
}
.provider-button:hover:not(:disabled) {
  filter: brightness(0.96);
}
.auth-separator {
  font-size: var(--text-caption);
  color: var(--muted);
  text-align: center;
  margin: 18px 0;
}
.deletion-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: var(--text-caption);
  line-height: 1.8;
}
.deletion-check input {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 2px 0 0;
  flex: none;
}
.auth-account {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  margin: 20px 0;
  line-height: 1.8;
}
/* 上の帯の左の種類(media.js の inputKindButton)。押すと日記・名言を選ぶメニュー。 */
.input-kind-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 0 6px 0 10px;
  border: 0;
  border-radius: var(--frame-radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.input-kind-button svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.input-kind-button:hover:not(:disabled) {
  background: var(--soft);
}
.input-kind-button:disabled {
  opacity: 0.45;
  cursor: default;
}
.popup-menu-item[role="menuitemradio"][aria-checked="true"] {
  font-weight: 600;
}
.popup-menu-item[role="menuitemradio"][aria-checked="true"]::after {
  content: "✓";
  margin-left: auto;
  color: var(--muted);
}
.popup-menu-separator {
  height: 1px;
  margin: 6px 4px;
  background: var(--line);
}
.popup-menu-glyph {
  display: inline-flex;
  justify-content: center;
  min-width: 20px;
  font-size: var(--text-minimum);
  font-weight: 600;
}
/* 帯の ♡ 🔖 🔗 と ✨ の間を少し空ける(同じ並びの別の組)。操作は右に寄せ、× の隣に置く。 */
.detail-marks {
  margin-right: 6px;
}
#record-detail-toolbar > .row:nth-child(2) {
  margin-left: auto;
}
.detail-toolbar .icon-button:disabled {
  opacity: 0.35;
}
@media (max-width: 520px) {
  /* 390 幅でも ‹ 種類 ♡ 🔖 🔗 ✨ … が1行に収まるように詰める。 */
  #record-detail-toolbar > .row,
  #record-detail-toolbar .detail-marks {
    gap: 0;
  }
  #record-detail-toolbar .icon-button {
    width: 34px;
  }
  #record-detail-toolbar .detail-marks {
    margin-right: 0;
  }
}
.recording-button {
  min-width: 132px;
}
.recording-button.recording {
  color: var(--red);
  border-color: var(--red);
}
.recording-status {
  flex-basis: 100%;
  color: var(--muted);
  font-size: var(--text-minimum);
  line-height: 1.8;
}
.pending-file img {
  width: 100%;
  height: 140px;
  object-fit: contain;
}
.pending-file audio {
  margin: 0;
}
.attachment .icon-button {
  width: 28px;
  height: 28px;
}
.list-refresh {
  margin-left: 4px;
  flex: none;
}
.local-draft-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
}
.local-draft-row > div {
  flex: 1;
  min-width: 0;
}
.local-draft-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-caption);
}
.link-output {
  width: 100%;
  font-family: var(--frame-sans);
  font-size: var(--text-caption);
  line-height: 1.7;
  resize: none;
}
.tag-nav p {
  padding: 0 12px;
}
@media (max-width: 700px) {
  .app .list-panel,
  .app .detail-panel {
    height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .entry-meta {
    font-size: var(--text-minimum);
  }
  .editor-footer {
    margin-left: -26px;
    margin-right: -26px;
    padding: 15px 26px;
    background: var(--white);
    border-top: 1px solid var(--line);
    gap: 10px;
  }
  .editor-footer > .row:last-child {
    margin-left: auto;
  }
  .toast {
    bottom: 85px;
  }
}
.search-origin-badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 2px 7px;
  border-radius: var(--frame-radius);
  background: var(--soft);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 600;
}

.search-origin-preview {
  margin-top: 4px;
}

/* AI とつなぐ(サイドバーの下に独立した入口) */
.connect-ai {
  color: var(--ink);
  margin-bottom: 10px;
}

/* 一覧の頭: 検索の欄と、並べ替えと絞り込みの1つのボタン(iPhone と同じ) */
.search-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.search-row .search-wrap {
  flex: 1;
  min-width: 0;
}
.sort-filter {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  min-width: 36px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--frame-radius);
  background: var(--soft);
  color: var(--blue);
  font-size: var(--text-caption);
  font-weight: 600;
  white-space: nowrap;
}
.sort-filter .icon {
  width: 16px;
  height: 16px;
}
.sort-filter.changed {
  background: var(--blue);
  color: var(--white);
  padding: 0 12px;
}
.list-menu-clear {
  flex: none;
}
.list-menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}
.list-menu-title {
  padding: 8px 10px 4px;
  font-size: var(--text-caption);
  color: var(--muted);
  letter-spacing: 0.1em;
}
.list-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 32px;
  border: 0;
  border-radius: var(--frame-radius);
  background: transparent;
  text-align: left;
  font-size: var(--text-caption);
}
.list-menu-item[aria-checked="true"] {
  padding-left: 10px;
  font-weight: 600;
}
.list-menu-item .icon {
  width: 14px;
  height: 14px;
}
.list-menu-item:hover,
.list-menu-item:focus-visible {
  background: var(--soft);
}
.record-card .preview.quote {
  color: var(--ink);
  font-size: var(--text-caption);
  /* 文字数で省略した名言は、その範囲を全文表示する。 */
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  white-space: pre-line;
}
/* 本人が書いた名言の題も省略しない。 */
.record-card h2.quote-title {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
}
.archive-actions .small {
  margin-bottom: 8px;
}

/* 記録が1件もないとき: iPhone の記録がここに出る・書く・AI とつなぐ */
.first-steps {
  display: grid;
  gap: 10px;
  padding: 40px 12px;
}
.first-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.8;
}
.first-step .icon {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}
.first-steps .button {
  justify-content: center;
}

/* 元の入力が本文と違うときだけの切り替え */
.proposal-switch {
  display: inline-flex;
  gap: 2px;
  margin: 4px 0 12px;
  padding: 3px;
  border-radius: var(--frame-radius);
  background: var(--soft);
}
.proposal-switch-option {
  border: 0;
  border-radius: var(--frame-radius);
  padding: 5px 16px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-caption);
  cursor: pointer;
}
.proposal-switch-option[aria-pressed="true"] {
  background: var(--white);
  box-shadow: none;
  font-weight: 600;
}
/* 新しい頁の一番上の「日記|名言」。頁の幅いっぱいの2つ割り(iPhone の案A と同じ)。 */
.new-page-kind {
  display: flex;
  margin: 0 0 16px;
}
.new-page-kind .proposal-switch-option {
  flex: 1;
  /* 置き換えた上の帯の「日記 ▾」と同じく 44px で押せる(web-ui-smoke)。 */
  min-height: 44px;
}
/* 名言にしたとき、日記で書いた題を薄く1行残す。 */
.kept-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: var(--text-caption);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 押した記号の下に出すメニュー(app.js の popupMenu。キラキラ・「その他」)。 */
.popup-menu {
  position: fixed;
  margin: 0;
  padding: 6px;
  min-width: 220px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--white);
  color: var(--ink);
  box-shadow: none;
}
.popup-menu-head {
  margin: 0;
  padding: 4px 10px 6px;
  font-size: var(--text-caption);
  color: var(--muted);
}
.popup-menu-choice {
  margin: 0;
}
.popup-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: var(--frame-radius);
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.popup-menu-item:hover:not(:disabled),
.popup-menu-item:focus-visible {
  background: var(--wash);
}
.popup-menu-item:disabled {
  color: var(--muted);
  cursor: default;
}
/* 本人の AI で整える(ai-rewrite.js): 案を待つ1行。 */
.ai-wait {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--frame-radius);
  background: var(--soft);
  font-size: var(--text-caption);
}
.ai-wait p {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.ai-wait-spinner {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: ai-wait-spin 0.9s linear infinite;
}
@keyframes ai-wait-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ai-wait-spinner {
    animation: none;
  }
}
.proposal-strip {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: var(--frame-radius);
  background: var(--soft);
}
.proposal-who {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}
.proposal-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.6;
}
.proposal-actions {
  justify-content: space-between;
  margin-top: 8px;
}
.proposal-reject {
  margin-left: auto;
}
.quote-source-fields {
  margin-top: 20px;
}
.source-combobox {
  position: relative;
  min-width: 0;
}
.source-candidates {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--paper);
  box-shadow: none;
}
.source-option {
  display: block;
  width: 100%;
  border: 0;
  padding: 9px 11px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}
.source-option:hover,
.source-option[aria-selected="true"] {
  background: var(--soft);
}
.add-source,
.source-summary,
.source-toggle {
  padding-left: 0;
  font-size: var(--text-caption);
  color: var(--muted);
}
.source-summary {
  max-width: 100%;
  text-align: left;
  overflow-wrap: anywhere;
}
.source-toggle svg {
  transform: rotate(180deg);
}
/* 名言のコメント(本人の言葉)。日記の本文と同じ編集の部品で、名言の文より小さく。 */
.entry-body.entry-comment {
  min-height: 3lh;
  margin-top: 18px;
}

/* AI とつなぐの窓 */
.ai-url {
  display: flex;
  gap: 8px;
  margin: 14px 0 6px;
}
.ai-url .input {
  flex: 1;
  min-width: 0;
}
.ai-url .button {
  flex: none;
}
.ai-service {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.ai-service h3 {
  font-size: var(--text-body);
  font-weight: 600;
}
.ai-steps {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.9;
}

/* claim:web-ui-review-against-ui-principles: shared type and interaction sizes. */
button,
select {
  min-width: 24px;
  min-height: 24px;
}
button {
  overflow-wrap: anywhere;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}
.search-wrap input {
  min-height: 24px;
}
.entry-body,
.reading-body {
  font-size: var(--text-body);
}
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
#list-tags {
  margin-top: 16px;
}
.filter-tag,
.tag-filter-add {
  border: 1px solid var(--field-line);
  background: var(--soft);
  color: var(--ink);
  border-radius: var(--frame-radius);
  padding: 8px;
  font-size: var(--text-caption);
  max-width: 100%;
}
.filter-tag {
  white-space: normal;
  text-align: left;
}
.tag-filter-add {
  min-width: 88px;
}
.list-header {
  padding: 24px;
}
.record-card {
  padding: 16px;
}
.record-card h2 {
  font-size: var(--text-body);
}
@media (max-width: 700px) {
  #app button,
  #app select,
  dialog button,
  dialog select,
  dialog .button,
  dialog .input {
    min-height: 44px;
    min-width: 44px;
  }
  #app .icon-button,
  dialog .icon-button {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  #app .sort-filter {
    min-width: 44px;
    min-height: 44px;
    height: auto;
  }
  .search-wrap {
    padding: 0 8px;
  }
  .search-wrap input {
    min-height: 44px;
  }
  .detail-toolbar {
    gap: 4px;
    padding: 0 8px;
  }
  .detail-toolbar > .row {
    gap: 4px;
  }
  .list-header {
    padding: 16px;
  }
  .input,
  .search-wrap input,
  .tag-filter-add {
    font-size: var(--text-body);
  }
}

/* Nested Obsidian tags share the existing navigation selection and URL. */
.tag-nav-row {
  display: flex;
  align-items: center;
  min-width: 0;
}
.tag-nav-row .tag-nav {
  flex: 1;
  min-width: 0;
  gap: 6px;
  padding-inline: 6px;
}
.tag-toggle,
.tag-toggle-spacer {
  flex: 0 0 24px;
  width: 24px;
}
.tag-toggle {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  min-height: 36px;
}
.tag-children {
  margin-left: 14px;
  min-width: 0;
}

.tag-nav-row .tag-nav > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-nav-row .tag-hash {
  flex: 0 0 14px;
}

.tag-menu-button {
  flex: 0 0 30px;
  border: 0;
  background: transparent;
  color: inherit;
  border-radius: var(--frame-radius);
  min-height: 32px;
  cursor: pointer;
}
.tag-menu-button:hover,
.tag-menu-button:focus-visible {
  background: var(--soft);
}
.tag-menu {
  position: fixed;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--white);
  color: var(--ink);
}
.tag-rename-form {
  display: grid;
  gap: 12px;
}
.tag-rename-form input {
  width: 100%;
  min-width: 0;
}

/* 件数は折り返さない。「…」は件数の右にいつも場所を取り、ポインターの端末では行に乗せたときだけ見せる(件数を隠さず、乗せても動かさない)。 */
.tag-nav-row .tag-nav > span:last-child {
  flex: 0 0 auto;
  white-space: nowrap;
}
@media (hover: hover) {
  .tag-nav-row .tag-menu-button {
    opacity: 0;
  }
  .tag-nav-row:hover .tag-menu-button,
  .tag-nav-row .tag-menu-button:focus-visible,
  .tag-nav-row .tag-menu-button[aria-expanded="true"] {
    opacity: 1;
  }
}

/* 左上の「リスト|カレンダー|グラフビュー」(iPhone の記号の切り替えと同じ形) */
.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--frame-radius);
  background: var(--paper);
  border: 1px solid var(--line);
  flex: none;
}
.view-switch button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 36px;
  border: 0;
  border-radius: var(--frame-radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.view-switch button.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
}
.view-switch button:hover:not(.active) {
  color: var(--ink);
}
.view-switch button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.view-switch .icon {
  width: 18px;
  height: 18px;
}
#view-switch-list {
  display: contents;
}

/* 一覧の石垣(PC)。記録を開いていない間は一覧が右まで広がり、開くと右に記録が出て一覧はその分詰まる
   (claim:quote-browse-pc-masonry-good-open-detail-keep-tool-ops・claim:diary-and-quote-list-views-consistent-under-filter)。
   列の切り替えは list.js の renderLayout が 700px より広いときだけ付ける。 */
.app {
  /* 左の帯は、入れ子の題が読める幅(CD 10/17 の試作は 272)。狭い窓では下の段で詰める。 */
  --side-w: 244px;
}
@media (min-width: 1550px) {
  .app {
    --side-w: 264px;
  }
}
@media (max-width: 1100px) {
  .app {
    --side-w: 240px;
  }
}
@media (max-width: 820px) {
  .app {
    --side-w: 170px;
  }
}
.app.browse {
  grid-template-columns: var(--side-w) minmax(0, 1fr) 0;
}
.app.browse:not(.calendar-reading) .detail-panel {
  display: none;
}
.app.reading {
  grid-template-columns: var(--side-w) var(--list-pane-width, 399px) minmax(0, 1fr);
}
.app.browse .list-panel,
.app.reading .list-panel {
  border-right: 1px solid var(--line);
}
.detail-close {
  margin-left: 4px;
}
.app:not(.reading) .detail-close {
  display: none;
}
.record-card {
  cursor: pointer;
}
.record-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.app.browse .date-group,
.app.reading .date-group {
  padding-left: 2px;
  padding-right: 2px;
}
.masonry {
  position: relative;
  margin: 0 1px 4px;
}
.masonry .record-card {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  padding: 13px 15px 10px;
  background: var(--white);
  cursor: pointer;
}
.masonry .record-card:hover {
  background: var(--white);
  border-radius: var(--frame-radius);
  border-color: var(--field-line);
}
.masonry .record-card.selected {
  border-color: var(--ink);
  box-shadow: none;
  background: var(--white);
  border-radius: var(--frame-radius);
}
.masonry .record-card h2 {
  white-space: normal;
  font-size: var(--text-caption);
  line-height: 1.6;
}
.masonry .record-card .preview {
  font-size: var(--text-caption);
  line-height: 1.75;
  color: var(--muted);
  white-space: pre-line;
}
.masonry .record-card .preview:not(.quote) {
  -webkit-line-clamp: var(--card-lines-masonry-diary);
}
.masonry .quote-card .preview:not(.quote) {
  -webkit-line-clamp: var(--card-lines-masonry-note);
}
.masonry .record-card .preview.quote {
  color: var(--ink);
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.record-card .card-meta {
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 8px;
  line-height: 1.6;
}
.record-card .card-meta time {
  margin-left: 0;
  font-variant-numeric: tabular-nums;
}
.card-source {
  min-width: 0;
  overflow-wrap: anywhere;
}
.card-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.card-link:hover {
  text-decoration: underline;
}
.card-link.tag {
  color: var(--blue);
}
.card-tags {
  max-width: none;
  white-space: normal;
}
.card-meta .card-pin {
  margin-left: auto;
}

/* カレンダーで開いた記録: 一覧の矩形の上に重ねる(位置と大きさは placeCalendarRecord)。暦と一覧は下にそのまま残る */
.app.calendar-reading .detail-panel {
  position: fixed;
  z-index: 20;
  border-left: 1px solid var(--line);
  box-shadow: none;
  overflow: hidden;
}
@media (max-width: 700px) {
  .app.calendar-reading .detail-panel {
    inset: 0;
    border-left: 0;
    box-shadow: none;
  }
}
/* 重ねた記録の欄が狭い(月・年の右の列)ときは、狭い幅と同じ帯にする(Aa・キラキラ・リンク・ピンと「その他」) */
.app.calendar-reading .detail-panel {
  container: record / inline-size;
}
@container record (max-width: 700px) {
  .detail-toolbar {
    padding: 0 12px;
  }
  .detail-toolbar :is(.toolbar-secondary, .toolbar-narrow-secondary) {
    display: none;
  }
  .detail-toolbar .mobile-only {
    display: inline-flex;
  }
  .detail-content {
    padding: 16px 20px 50px;
  }
}

.save-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* 種類は既存filterを共有し、一覧の幅に合わせて3択からMenuへ変える。 */
.list-heading {
  display: contents;
}
.kind-filter-row {
  gap: 12px;
}
.kind-filter-row .list-heading {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  min-width: 0;
}
.kind-filter-row #list-title {
  flex: none;
  white-space: nowrap;
}
/* 題と、その横の件数(今の条件すべての AND の数)。数の桁が変わっても横の部品を動かさないよう幅を先に取る。 */
.list-title-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex: none;
  min-width: 0;
}
.list-count {
  min-width: 8em;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.list-count[hidden] {
  display: none;
}
.kind-filter:not([hidden]) {
  display: flex;
  flex: none;
}
.kind-filter-choice,
.kind-filter-menu summary {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0 6px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}
.kind-filter-choice[aria-pressed="true"] {
  font-weight: 600;
  background: var(--soft);
  color: var(--ink);
}
.kind-filter-menu {
  position: relative;
}
.kind-filter-menu summary {
  display: flex;
  align-items: center;
  list-style: none;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  border-radius: var(--frame-radius);
  padding: 0 10px;
  white-space: nowrap;
}
.kind-filter-menu summary::-webkit-details-marker {
  display: none;
}
.kind-filter-options {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 20;
  min-width: 140px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
  display: grid;
}
.kind-filter-row .add-mobile {
  margin-left: 0;
}
.list-panel:has(.kind-filter-row) {
  container-type: inline-size;
  container-name: record-list;
}
.kind-filter-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--frame-radius);
  background: var(--soft);
}
.kind-filter-choice:hover {
  background: var(--wash);
}
.kind-filter-choice:focus-visible,
.kind-filter summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.kind-filter-popup {
  display: none;
  padding: 2px;
}
@container record-list (max-width: 620px) {
  .kind-filter-tabs {
    display: none;
  }
  .kind-filter-popup {
    display: block;
  }
  .kind-filter-row .list-heading {
    gap: 16px;
  }
}
.kind-filter-calendar .kind-filter {
  margin-left: 16px;
}
.kind-filter-calendar .calendar-title-row h1 {
  margin-right: 0;
}
.kind-filter-calendar .calendar-segments {
  margin-left: auto;
}
.kind-filter-tabs .kind-filter-choice {
  background: transparent;
  border-radius: var(--frame-radius);
  padding: 0 10px;
  font-size: var(--text-caption);
}
.kind-filter-tabs .kind-filter-choice[aria-pressed="true"] {
  background: var(--white);
  color: var(--ink);
  box-shadow: none;
}
.kind-filter-tabs .kind-filter-choice:active {
  background: var(--line);
}
@media (max-width: 700px) {
  .kind-filter-row {
    gap: 8px;
  }
  .search-row:has(.kind-filter) {
    gap: 6px;
  }
  .search-row .kind-filter {
    order: 1;
  }
  .search-row:has(.kind-filter) .search-wrap {
    min-width: 0;
  }
  .kind-filter-calendar .kind-filter {
    margin-left: 0;
  }
  .kind-filter-calendar .kind-filter-tabs {
    display: none;
  }
  .kind-filter-calendar .kind-filter-popup {
    display: block;
  }
  .kind-filter-calendar .calendar-title-row {
    gap: 6px;
  }
  .kind-filter-calendar .calendar-segments {
    margin-left: 0;
  }
}

.record-mark-controls,
.mark-filters {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  align-items: center;
}
.record-mark-controls {
  justify-content: flex-end;
}
.card-date-row {
  display: flex;
  flex: 0 0 100%;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}
.card-date-info {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
}
.card-date-row .record-mark .icon {
  width: 20px;
  height: 20px;
}
.record-mark {
  min-width: 44px;
  min-height: 44px;
}
.record-mark[aria-pressed="true"] svg {
  fill: currentColor;
}
.mark-filters {
  margin-inline-start: auto;
}
.calendar-mark-row {
  min-width: 0;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.calendar-mark-row > .calendar-entry,
.calendar-mark-row > .calendar-item,
.calendar-mark-row > .calendar-cluster-title {
  width: 100%;
  min-width: 0;
  border-bottom: 0;
}
.calendar-entry-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px 4px;
}
.calendar-entry-footer .calendar-entry-tags {
  flex: 1;
  min-width: 0;
}
.calendar-entry-footer .record-mark-controls {
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 700px) {
  .search-row:has(.mark-filters) .sort-filter > span {
    display: none;
  }
  .search-row:has(.mark-filters) .sort-filter {
    flex-shrink: 0;
  }
}

/* 左の列だけを選べる一覧。送りの高さと画面に入る行は分ける。 */
.catalog-panel {
  overflow-anchor: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 24px 20px;
  --catalog-head-height: 64px;
}
.catalog-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--catalog-head-height);
  background: var(--white);
  padding: 12px 0;
  border-bottom: 0.5px solid var(--line);
}
.catalog-types,
.catalog-layouts {
  flex-shrink: 0;
}
.catalog-head .catalog-types button {
  padding: 6px 10px;
  width: auto;
  min-width: 40px;
  white-space: nowrap;
}
.catalog-layouts button {
  width: 40px;
  height: 36px;
}
.catalog-layouts svg {
  width: 18px;
  height: 18px;
}
.catalog-head .search-wrap {
  height: 36px;
  padding: 0 10px;
  flex: 1;
  min-width: 100px;
  max-width: 380px;
  background: color-mix(in srgb, var(--ink) 6%, var(--white));
  border: 0.5px solid var(--line);
  border-radius: 2px;
}
.catalog-head .search-wrap input {
  height: 100%;
  min-height: 0;
}
.catalog-head .search-wrap:focus-within {
  outline: 1.5px solid var(--ink);
  outline-offset: -1.5px;
}
.catalog-sort {
  max-width: 160px;
  background: var(--white);
  color: var(--ink);
  border: 0.5px solid var(--line);
  border-radius: 2px;
  padding: 7px 4px;
  font: inherit;
  font-size: var(--text-caption);
}
.catalog-summary {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
#catalog-status {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.catalog-body {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 20px;
  padding-top: 14px;
}
.catalog-scroll {
  width: 420px;
  max-width: 42%;
  flex-shrink: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  min-height: 0;
  padding: 1px;
}
.catalog-rows {
  position: relative;
  width: 100%;
}
.catalog-row {
  position: absolute;
  display: flex;
}
.catalog-item {
  appearance: none;
  border: 0;
  border-bottom: 0.5px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: var(--text-caption);
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px 74px;
  gap: 10px;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 6px 10px;
  padding-right: 30px;
  text-align: left;
}
/* 携帯の汎用ボタン(44px)より、一覧の40pxの行を優先する。 */
#catalog-rows .catalog-item,
#catalog-rows .tag-menu-button {
  min-height: 0;
  min-width: 0;
}
.catalog-item:hover {
  background: color-mix(in srgb, var(--ink) 6%, var(--white));
}
.catalog-item[aria-pressed="true"] {
  outline: 1.5px solid var(--ink);
  outline-offset: -1.5px;
}
.catalog-item strong {
  font-size: inherit;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catalog-count,
.catalog-date {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: var(--text-caption);
}
.catalog-date {
  font-size: 10px;
  white-space: nowrap;
}
.catalog-row > .tag-menu-button {
  position: absolute;
  right: 0;
  top: 0;
  width: 26px;
  min-width: 0;
  height: 40px;
  padding: 0;
}
.catalog-representatives {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 20px;
}
/* border は Chromium が1pxに丸めるため、幅を持つ罫で半ピクセルを保つ。 */
.catalog-representatives::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0.5px;
  background: var(--line);
}
.catalog-records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  padding-bottom: 14px;
}
.catalog-open {
  align-self: flex-start;
  margin-bottom: 0;
  text-align: left;
  white-space: normal;
}
.catalog-records {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  min-height: 0;
  padding: 0 1px 20px;
}
/* 送りバーの場所を保ち、載せた区画だけに細い親指を出す。 */
.catalog-scroll,
.catalog-records {
  scrollbar-gutter: stable;
  --pane-scroll-thumb: transparent;
}
.catalog-scroll:hover,
.catalog-records:hover {
  --pane-scroll-thumb: var(--line);
}
/* Chromium の標準 scrollbar-width は WebKit の親指指定を無効にする。 */
@supports (-moz-appearance: none) {
  .catalog-scroll,
  .catalog-records {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }
  .catalog-scroll:hover,
  .catalog-records:hover {
    scrollbar-color: var(--line) transparent;
  }
}
.catalog-scroll::-webkit-scrollbar,
.catalog-records::-webkit-scrollbar {
  width: 6px;
}
.catalog-scroll::-webkit-scrollbar-thumb,
.catalog-records::-webkit-scrollbar-thumb {
  background: var(--pane-scroll-thumb);
  border-radius: 3px;
}
.catalog-records .masonry {
  position: relative;
}
.catalog-masonry .catalog-scroll {
  width: 100%;
  max-width: none;
}
.catalog-masonry .catalog-representatives {
  display: none;
}
.catalog-masonry .catalog-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  border: 0.5px solid var(--line);
  padding: 14px;
  column-gap: 8px;
  row-gap: 4px;
}
.catalog-masonry .catalog-item strong {
  white-space: normal;
  font-family: var(--frame-serif);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}
.catalog-masonry .catalog-date {
  display: none;
}
.catalog-examples {
  grid-column: 1 / -1;
  font-family: var(--frame-serif);
  line-height: 24px;
  margin-top: 8px;
  overflow: hidden;
}
.catalog-examples span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
@media (max-width: 1000px) {
  .catalog-head {
    flex-wrap: wrap;
    --catalog-head-height: 108px;
  }
  .catalog-panel {
    --catalog-head-height: 108px;
  }
}
@media (max-width: 700px) {
  .catalog-head {
    gap: 8px;
  }
  .catalog-head .search-wrap {
    height: 36px;
    padding: 0 10px;
    order: 4;
    max-width: none;
    flex-basis: 100%;
  }
  .catalog-sort {
    flex: 1;
    max-width: 130px;
  }
  .catalog-head .catalog-types button {
    padding: 6px;
  }
  .catalog-layouts button {
    width: 32px;
  }
  .catalog-summary {
    order: 5;
    width: 100%;
    justify-content: flex-end;
  }
  .catalog-panel {
    --catalog-head-height: 150px;
  }
  .catalog-scroll {
    width: 100%;
    max-width: none;
  }
  .catalog-representatives {
    display: none;
  }
}
.catalog-loading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.tag-filters input {
  min-width: 0;
  width: 12em;
  max-width: 100%;
}
@media (max-width: 700px) {
  .catalog-panel {
    padding: 0 16px 100px;
  }
}

.catalog-note {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.record-card .card-quote-mark {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-inline-end: 0.4em;
  vertical-align: calc(1em - 13px);
  color: var(--muted);
}

.sidebar-tag-search {
  display: block;
  padding: 4px 8px 8px;
}
.sidebar-tag-search input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  padding: 8px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
}
.search-wrap:has(.tag-suggestions) {
  position: relative;
}
.tag-suggestions {
  position: absolute;
  z-index: 45;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}
.tag-suggestion {
  padding: 10px 12px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.tag-suggestion:hover,
.tag-suggestion[aria-selected="true"] {
  background: var(--wash);
  color: var(--blue);
}

/* The image occupies its place in the body; the one-character marker preserves caret positions. */
.md-image {
  display: inline-block;
  vertical-align: middle;
  max-width: 100%;
  margin: 0.4em 0.15em;
}
.md-image img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  border-radius: var(--frame-radius);
  object-fit: contain;
}
.photo-info {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.6;
  user-select: none;
  -webkit-user-select: none;
}
.photo-info {
  /* 1行の中で書体を混ぜない(日付も本文の注記と同じ書体)。数字の幅だけ揃える。 */
  font-variant-numeric: tabular-nums;
}
.photo-info time {
  font-family: inherit;
}
.photo-info a {
  color: inherit;
  text-underline-offset: 3px;
}
.photo-info a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.md-image-marker {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* 本文の幅を変えず、出典と印は日付の一行に収める。 */
.record-card .card-meta {
  flex-wrap: nowrap;
}
.card-date-info {
  flex-wrap: nowrap;
  overflow: hidden;
}
.card-date-info time {
  flex: 0 0 auto;
}
.card-link-count {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.card-link-count[hidden] {
  display: none;
}
.card-link-count svg {
  width: 12px;
  height: 12px;
}
.card-date-info .card-source,
.card-date-info .card-tags {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-date-info .card-source {
  flex: 0 1 auto;
}
.card-source-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-source-page,
.card-date-info .card-tags .card-link {
  flex: 0 0 auto;
}
.card-date-info .card-tags {
  flex: 0 0 auto;
  max-width: none;
}
.card-date-row .record-mark-controls {
  flex-shrink: 0;
}
.entry-meta {
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 8px;
}
.entry-date {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.entry-date time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entry-date .mono {
  flex-shrink: 0;
}
#record-detail-toolbar .toolbar-secondary {
  display: none;
}
#record-detail-toolbar #toolbar-more {
  display: inline-flex;
}

.record-mark:is([data-mark="favorite"], [data-mark-filter="favorite"])[aria-pressed="true"] {
  color: var(--frame-favorite);
}
.record-mark:is([data-mark="bookmark"], [data-mark-filter="bookmark"])[aria-pressed="true"] {
  color: var(--frame-bookmark);
}

/* 探す条件は一覧の同じ帯へ。読むときだけ一覧を細くし、本文に幅を渡す。 */
.search-row {
  flex-wrap: wrap;
}
.search-row .search-wrap {
  /* 検索と条件を別の行に保ち、記録の開閉で帯の高さを変えない。 */
  flex: 1 1 100%;
}
.search-row .kind-filter {
  order: 0;
  flex: 0 0 auto;
}
.app.reading .list-header {
  padding: 20px 14px 14px;
}
.app.reading .list-title-row {
  margin-bottom: 12px;
}
.app.reading .record-card.selected {
  background: var(--wash);
  box-shadow: none;
}
@container record-list (max-width: 400px) {
  .search-row .search-wrap {
    flex-basis: 100%;
  }
  .search-row .kind-filter {
    margin-right: auto;
  }
}

/* 開閉時の位置は記録一覧が復元する。ブラウザーの二重補正を避ける。 */
.record-list {
  overflow-anchor: none;
}

/* 画像を持っている間だけ受付範囲を示す。outlineは本文の幅や高さを変えない。 */
.image-file-dragging .entry-body[contenteditable="true"] {
  outline: 2px dashed var(--blue);
  outline-offset: 6px;
  border-radius: var(--frame-radius);
}
.image-drop-hint {
  position: fixed;
  width: max-content;
  transform: translate(-50%, -50%);
  z-index: 1000;
  max-width: calc(100vw - 32px);
  padding: 8px 16px;
  border: var(--frame-hair) solid var(--line);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
  pointer-events: none;
  font-size: var(--text-caption);
}

/* 共通サイドバーと可動境界。本文 DOM は幅の変更でも保持する。 */
.sidebar-toggle {
  position: fixed;
  top: 15px;
  left: 8px;
  z-index: 40;
  width: 44px;
  height: 44px;
  background: var(--paper);
}
.sidebar .brand {
  padding-left: 40px;
}
.app.reading {
  grid-template-columns: var(--side-w) var(--list-pane-width, 399px) minmax(0, 1fr);
}
.pane-resizer {
  position: fixed;
  z-index: 30;
  width: 12px;
  cursor: col-resize;
  touch-action: none;
}
.pane-resizer::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}
.pane-resizer:hover::after,
.pane-resizer:focus-visible::after,
.pane-resizer.dragging::after {
  background: var(--blue);
  width: 3px;
}
.pane-resizer:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
@media (min-width: 701px) {
  .app:not(.nav-collapsed) > .sidebar-toggle {
    left: calc(var(--side-w) - 52px);
  }
  .sidebar .brand {
    padding-left: 9px;
    padding-right: 36px;
  }
  .app.nav-collapsed {
    --side-w: 0px;
    grid-template-columns: 0 var(--list-pane-width, 399px) minmax(0, 1fr);
  }
  .app.nav-collapsed.browse {
    grid-template-columns: 0 minmax(0, 1fr) 0;
  }
  .app.nav-collapsed > .sidebar {
    display: none;
  }
  .app > .list-panel {
    grid-column: 2;
  }
  .app > .detail-panel {
    grid-column: 3;
  }
  .app.nav-collapsed .list-title-row,
  .app.nav-collapsed .calendar-title-row,
  .app.nav-collapsed .analysis-header {
    padding-left: 40px;
  }
  .app.layout-single > .list-panel {
    display: none;
  }
  .app.layout-single > .detail-panel {
    grid-column: 2 / -1;
  }
  .app.layout-single.nav-collapsed .detail-toolbar {
    padding-left: 60px;
  }
}
@media (max-width: 700px) {
  .list-title-row,
  .calendar-title-row,
  .analysis-header {
    padding-left: 40px;
  }
  .detail-toolbar {
    padding-left: 60px;
  }
}
@media (max-width: 700px) {
  .sidebar {
    z-index: 50;
  }
  .sidebar-shade {
    z-index: 45;
  }
  .sidebar-toggle {
    z-index: 60;
  }
}
.pane-resizer::before {
  content: "";
  position: absolute;
  left: 4px;
  top: calc(50% - 16px);
  width: 4px;
  height: 32px;
  border-radius: var(--frame-radius);
  background: var(--muted);
}
.pane-resizer:hover::before,
.pane-resizer:focus-visible::before,
.pane-resizer.dragging::before {
  background: var(--blue);
}

/* 執筆先は読む記録から独立。帯は上に重ね、画面の高さを変えない(現れる部品で本文と一覧を押し動かさない。見た目の決まり9章)。
   一覧と本文の下には帯の分の余白を先に空けてある。 */
.writing-status {
  font-size: var(--text-body);
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  z-index: 35;
}
.writing-status[hidden] {
  display: none;
}
.writing-return {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.writing-return svg {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}
.writing-label {
  flex-shrink: 0;
  color: var(--muted);
  font-size: var(--text-caption);
}
.writing-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.writing-status > .icon-button {
  flex-shrink: 0;
}
/* 下書きへ添える時に飛ぶ像。見た目はドラッグの像と同じ(.link-flight と .link-ghost-card)。 */
.writing-flight {
  z-index: 100;
}
@media (max-width: 700px) {
  .writing-status {
    height: calc(48px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.writing-reference[aria-pressed="true"] svg {
  fill: none;
  stroke-width: 2.4;
}

/* 原稿が2つ以上のときは、名前を選ぶ欄の1つだけで出す(名前を2回出さない。選ぶ欄に幅を渡す)。 */
.writing-status.has-picker .writing-name {
  display: none;
}
.writing-status.has-picker .writing-return {
  flex: 0 0 auto;
}
.writing-status.has-picker .writing-picker {
  flex: 1 1 auto;
  max-width: none;
}
.writing-picker {
  max-width: min(34vw, 240px);
  min-width: 70px;
  height: 36px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
}

/* 宛先欄と通知を重ねない。通常時の通知位置に、表示中の欄の高さを足す。 */
body.has-writing .toast {
  bottom: 72px;
}
@media (max-width: 700px) {
  body.has-writing .toast {
    bottom: calc(72px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 701px) {
  .app.reading .card-date-row {
    flex-wrap: wrap;
  }
  .app.reading .card-date-info {
    min-width: 5ch;
  }
  .app.reading .card-date-row .record-mark-controls {
    margin-left: auto;
  }
  .app.reading .detail-content {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 700px) {
  .app[data-mobile="detail"] > #open-nav {
    display: none;
  }
  .app[data-mobile="detail"] .detail-toolbar {
    padding-left: 6px;
  }
}

/* 一覧の外に浮かべ、カードの並びや送り位置には参加させない。 */
.pane-top-notice {
  position: fixed;
  height: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms;
}
.pane-top-notice[data-visible="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.pane-top-pill {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--frame-radius, 999px);
  background: var(--blue);
  color: var(--paper);
  font-family: var(--frame-sans);
  font-size: var(--text-caption);
  white-space: nowrap;
  box-shadow: none;
  pointer-events: none;
}
.pane-top-notice[data-visible="true"] .pane-top-pill {
  pointer-events: auto;
}
.pane-top-pill:not(.new-records-pill) {
  width: 44px;
  padding: 8px;
}
.pane-top-arrow {
  font-size: 20px;
  line-height: 1;
}
.pane-top-pill .icon {
  width: 16px;
  height: 16px;
}
@media (prefers-reduced-motion: reduce) {
  .pane-top-notice {
    transform: none;
    transition:
      opacity 160ms ease,
      visibility 160ms;
  }
}
.list-top-heading {
  cursor: pointer;
}

.text-size-section {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.text-size-section .text-size-sample {
  font-size: var(--text-body);
  line-height: 1.8;
}
.text-size-section fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}
.text-size-section legend {
  margin-bottom: 12px;
  font-size: var(--text-heading);
}
.text-size-section .input-kind-options {
  display: flex;
  padding: 2px;
  border-radius: var(--frame-radius);
  background: var(--frame-segment);
}
.text-size-section .input-kind-option {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--frame-radius);
  cursor: pointer;
}
.text-size-section .input-kind-option:has(:checked) {
  background: var(--frame-thumb);
  box-shadow: none;
}
.text-size-section .input-kind-option:has(:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}
.text-size-section input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* 執筆中の本文を保ち、資料の札だけを横へ送る。 */
#writing-window-toggle {
  width: 44px;
  height: 44px;
}
.writing-window {
  position: fixed;
  right: 12px;
  bottom: 0;
  width: min(480px, 42vw);
  height: min(360px, 44vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: none;
  z-index: 35;
}
.writing-window[hidden] {
  display: none;
}
.writing-window-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.writing-window-title {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--text-body);
  font-weight: 600;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
}
::highlight(excerpt-selection) {
  background: var(--soft);
}
.writing-window-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.writing-window-content:has(.quote-source-fields) {
  padding: 16px;
}
.writing-window-body {
  height: 100%;
  min-height: 0;
  width: 100%;
  padding: 16px;
  border: 0;
  border-radius: 0;
  resize: none;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-body);
  line-height: 1.8;
}
.writing-window-content:has(.quote-source-fields) .writing-window-body {
  padding: 0;
  height: auto;
  field-sizing: content;
}
.writing-window-body:focus {
  outline: none;
  box-shadow: none;
}
.writing-window-links {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  gap: 6px 8px;
  flex: 0 0 auto;
  max-height: 112px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
}
.writing-window-link {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--paper);
}
.writing-window-link-name {
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--text-caption);
}
.writing-window-link > .icon-button {
  flex-shrink: 0;
}
@media (max-width: 700px) {
  .writing-window {
    left: 0;
    right: 0;
    width: 100%;
    height: 50vh;
    bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  body.has-writing-window .detail-content {
    padding-bottom: calc(65px + 50vh + 16px);
  }
}

/* AI は帯の記号と同じ色。名前だけを添え、未連携は小さな点で示す。 */
.icon-button.ai-button {
  position: relative;
  width: auto;
  white-space: nowrap;
  height: 44px;
  flex-shrink: 0;
  gap: 4px;
  padding: 0 8px;
}
.ai-button.ai-unconnected::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
}
@media (max-width: 390px) {
  /* 帯に横の余白が無いので、記号の下に小さく「AI」を置いて 44×44 に収める(記号だけにしない)。 */
  #app #record-detail-toolbar .ai-button {
    width: 44px;
    padding: 0;
    flex-direction: column;
    gap: 1px;
  }
  #record-detail-toolbar .ai-button svg {
    width: 18px;
    height: 18px;
  }
  #record-detail-toolbar .ai-button-label {
    font-size: 10px;
    line-height: 1;
  }
}

/* 連携の画面と続ける行: ボタンの字を途中で折らない。狭い幅では文・見出しの下にボタンを回す。 */
.ai-service .button,
.ai-connected .button {
  white-space: nowrap;
}
@media (max-width: 700px) {
  .ai-service > .row.spread {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .ai-service > .row.spread .button {
    width: 100%;
    justify-content: center;
  }
  .ai-connected {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (min-width: 701px) {
  body.has-writing-window .detail-content {
    padding-bottom: calc(65px + min(360px, 44vh) + 16px);
  }
}

/* 窓の操作は × の隣。狭い帯では「その他」から同じ操作を呼ぶ。 */
#record-detail-toolbar .detail-shrink,
.writing-window-expand,
.writing-window-control {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
}
#record-detail-toolbar .detail-shrink {
  margin-right: -8px;
}
.writing-window-transition {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  transform-origin: top left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}
@media (max-width: 390px) {
  #record-detail-toolbar .detail-shrink {
    display: none;
  }
}

/* 出口だけを追加する。既存の窓・メニューの配置は保つ。 */
.sidebar-exit {
  margin-left: auto;
}
.surface-close {
  display: block;
  margin-left: auto;
}

.writing-reference[aria-disabled="true"] {
  cursor: default;
  opacity: 0.42;
}
.detail-toolbar .writing-reference[aria-disabled="true"] {
  opacity: 0.35;
}

/* プロフィールの芝生と、累計から開く統計。 */
.settings-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0 20px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
}
.settings-profile .avatar {
  width: 48px;
  height: 48px;
  font-size: var(--text-heading);
}
.settings-profile-info {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 5px;
}
.settings-profile-info span {
  color: var(--muted);
  font-size: var(--text-minimum);
  overflow-wrap: anywhere;
}
.settings-grass {
  width: 100%;
  padding: 20px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 24px;
}
.stats-big {
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
}
.stats-big small {
  font-size: var(--text-body);
  font-weight: 400;
  color: var(--muted);
  margin-left: 5px;
}
.stats-grass-meta {
  margin-top: 12px;
  font-size: var(--text-body);
  color: var(--muted);
}
.stats-grass {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 12px;
}
.app.stats-open {
  grid-template-rows: minmax(0, 1fr);
  grid-template-columns: var(--side-w) minmax(0, 1fr) !important;
}
.app.stats-open .pane-resizer {
  display: none;
}
.stats-view {
  height: 100%;
  min-height: 0;
  grid-column: 2 / -1;
  grid-row: 1;
  padding: 26px 28px 36px;
  overflow-y: auto;
  min-width: 0;
  background: var(--paper);
  font-variant-numeric: tabular-nums;
}
.stats-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.stats-head h1 {
  font-size: var(--text-title);
  margin: 0;
}
.stats-head .stats-segments {
  margin-left: auto;
  min-width: 320px;
}
.stats-head .stats-segments button {
  flex: 1;
}
.stats-segments {
  display: inline-flex;
  padding: 3px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
}
.stats-segments button {
  border: 0;
  background: transparent;
  padding: 7px 15px;
  border-radius: var(--frame-radius);
  color: var(--muted);
  font-size: var(--text-minimum);
  min-height: 34px;
}
.stats-segments button[aria-pressed="true"] {
  background: var(--white);
  color: var(--ink);
  box-shadow: none;
}
.stats-assets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stats-asset {
  min-height: max(110px, calc(42px + 1.25 * (var(--text-minimum) + 2rem)));
  padding: 16px 20px;
  border-radius: var(--frame-radius);
  background: var(--white);
  border: 1px solid var(--line);
  min-width: 0;
}
.stats-asset-label {
  line-height: 1.25;
  min-height: calc(var(--stats-label-lines, 1) * 1.25 * var(--text-minimum));
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-minimum);
}
.stats-asset-value {
  line-height: 1.25;
  font-size: 2rem;
  font-weight: 700;
  margin-top: 8px;
  white-space: nowrap;
}
.stats-asset-value small {
  font-size: var(--text-minimum);
  font-weight: 400;
  color: var(--muted);
  margin-left: 3px;
}
@media (max-width: 1000px) {
  .stats-assets {
    gap: 8px;
  }
  .stats-asset {
    min-height: max(110px, calc(34px + 1.25 * ((var(--stats-label-lines, 1) + 1) * var(--text-minimum) + 1.55rem)));
    padding: 12px 10px;
  }
  .stats-asset-value {
    font-size: 1.55rem;
  }
  .stats-asset-value.compact {
    font-size: 1.1875rem;
  }
  .stats-asset-value small {
    display: block;
    margin-left: 0;
  }
}
@media (max-width: 700px) {
  :root[data-text-size="large"] .stats-asset,
  :root[data-text-size="extra-large"] .stats-asset {
    --stats-label-lines: 2;
  }
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.stats-grid > div {
  min-width: 0;
}
.stats-card {
  border: 1px solid var(--line);
  background: var(--white);
  padding: 18px 20px;
  border-radius: var(--frame-radius);
  margin-bottom: 20px;
  min-width: 0;
}
.stats-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.stats-card h3 {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  font-size: var(--text-minimum);
  font-weight: 600;
}
.stats-current {
  font-size: var(--text-heading);
  font-weight: 600;
}
.stats-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  margin-top: 12px;
}
.stats-chart text,
.stats-period-grass text {
  font-family: inherit;
}
.stats-year-label {
  color: var(--muted);
  font-size: var(--text-minimum);
  line-height: 1.5;
  min-height: 1.5em;
  margin-top: 18px;
}
#stats-view .stats-year-bands {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.stats-year-feedback {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 1;
  color: var(--blue);
  background: var(--white);
  pointer-events: none;
}
.stats-year-canvas {
  position: absolute;
  right: 0;
  top: 0;
  width: calc(100% - 48px);
  height: 100%;
  pointer-events: auto;
}
#stats-view .stats-year-band {
  border: 0;
  display: block;
  font-size: var(--text-minimum);
  line-height: 18px;
  color: var(--muted);
  background: transparent;
  padding: 0;
  width: 100%;
  height: 18px;
  min-height: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
}
.stats-year-band span {
  display: inline-block;
  width: 40px;
}
.stats-period-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 10px;
}
.stats-period-nav .button {
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: var(--text-heading);
}
.stats-period-title {
  font-size: var(--text-heading);
  font-weight: 500;
  text-align: center;
}
.stats-period-grass {
  display: block;
  margin: 12px auto 0;
  width: min(100%, 350px);
  height: auto;
}
.stats-main-bars [role="button"] {
  pointer-events: all;
  cursor: pointer;
}
.stats-main-bars [role="button"]:focus {
  outline: none;
}
.stats-main-bars [role="button"]:focus > rect:first-child {
  stroke: var(--blue);
  stroke-width: 2px;
}
.stats-shelf-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 0;
}
.stats-shelf-row + .stats-shelf-row {
  border-top: 1px solid var(--line);
}
.stats-shelf-row > svg {
  flex: none;
  margin-top: 22px;
  color: var(--muted);
}
.stats-stamps {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}
.stats-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}
.stats-stamp-circle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  font-size: var(--text-body);
  font-weight: 700;
}
.stats-stamp-circle small {
  font-size: var(--text-minimum);
  font-weight: 500;
}
.stats-stamp-date {
  display: flex;
  flex-direction: column;
  font-size: var(--text-minimum);
  color: var(--muted);
  text-align: center;
  line-height: 1.25;
}
.stats-stamp.next .stats-stamp-circle {
  background: transparent;
  border: 1.5px dashed var(--field-line);
  color: var(--muted);
}
.stats-toast .stats-stamp-circle.mini {
  width: 38px;
  height: 38px;
  font-size: var(--text-minimum);
  flex: none;
}
.stats-toast .stats-stamp-circle.mini small {
  display: none;
}
@media (max-width: 1000px) {
  .stats-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .app.stats-open {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .stats-view {
    grid-column: 1 / -1;
    padding: 18px 16px 30px;
  }
  .stats-head {
    gap: 8px;
  }
  .stats-head .stats-segments {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }
  .stats-head .stats-segments button {
    flex: 1;
  }
  .stats-segments button {
    padding: 7px 12px;
  }
  .app.stats-open > #open-nav {
    display: none;
  }
  .stats-card {
    padding: 16px;
  }
}

.stats-card[data-key="hours"] .stats-current,
.stats-card[data-key="length"] .stats-current {
  font-size: var(--text-minimum);
  color: var(--muted);
  font-weight: 400;
}

.stats-stamp .stats-stamp-circle.tight {
  font-size: var(--text-minimum);
}
.stats-toast .stats-stamp-circle.mini.tight {
  width: 52px;
  height: 52px;
}

#stats-share {
  container-type: inline-size;
}
.stats-share-card {
  width: min(100%, 400px);
  height: min(100cqw, 400px);
  margin: 0 auto;
  border-radius: var(--frame-radius);
  overflow: hidden;
  box-shadow: none;
}
.stats-share-card.tall {
  height: calc(min(100cqw, 400px) * 16 / 9);
}
.stats-share-art {
  display: block;
  width: 100%;
  height: 100%;
}
.stats-share-message {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.stats-share-message input {
  min-width: 0;
  flex: 1;
}
.stats-share-message span {
  color: var(--muted);
  font-size: var(--text-minimum);
}
.stats-share-text {
  font-size: var(--text-minimum);
  white-space: pre-wrap;
  margin-top: 12px;
  overflow-wrap: anywhere;
  color: var(--muted);
}
.stats-share-formats {
  display: flex;
  width: fit-content;
  margin: 18px auto 0;
}
.stats-share-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}
.stats-share-actions .button {
  flex: 1;
}

/* Keep totals and deferred charts in their allocated space. */
.stats-assets {
  min-height: 110px;
}
.stats-grid > div {
  min-width: 0;
}
.settings-grass {
  min-height: 260px;
}

.stats-card .stats-card-head {
  align-items: center;
  line-height: 1.4;
  min-height: max(2rem, calc(var(--text-heading) * 1.4));
}

/* テーマの選び方は iOS の「画面表示と明るさ」の外観と同じ型: 見本の絵・名前・印。 */
.theme-section fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}
.theme-section legend {
  margin-bottom: 12px;
  font-size: var(--text-heading);
}
.theme-options {
  display: flex;
  justify-content: center;
  gap: 40px;
}
.theme-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.theme-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 64px;
  height: 96px;
  padding: 8px 4px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--paper);
  color: var(--ink);
}
.theme-option:has(:focus-visible) .theme-swatch {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.theme-swatch-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 2px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--white);
}
.theme-swatch-title {
  font-family: var(--font-reading, "Ubuntu Sans", "Noto Sans JP", sans-serif);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.theme-swatch-line {
  display: block;
  height: 3px;
  border-radius: var(--frame-radius);
  background: var(--muted);
  opacity: 0.6;
}
.theme-swatch-line.short {
  width: 60%;
}
.theme-swatch-grass {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: auto;
}
.theme-swatch-grass i {
  aspect-ratio: 1;
  border-radius: var(--frame-radius);
  background: var(--grass-3);
}
.theme-swatch-grass i:nth-child(3n) {
  background: var(--grass-1);
}
.theme-swatch-grass i:nth-child(3n + 1) {
  background: var(--grass-2);
}
.theme-swatch-grass i.today {
  /* 芝の見本の升は 10px 未満なので、縁に 1px の枠と 1px の地の隙間(ECD 10/12)。 */
  border: 1px solid var(--today-frame);
  padding: 1px;
  background-clip: content-box;
}
.theme-option-name {
  font-size: var(--text-body);
}
.theme-option-check {
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border: 1.5px solid var(--field-line);
  border-radius: 50%;
}
.theme-option-check {
  position: relative;
}
.theme-option:has(:checked) .theme-option-check {
  border: 0;
  background: var(--blue);
}
/* 印のチェックは地と逆の色(紙)で描き、ダークでも見える。 */
.theme-option:has(:checked) .theme-option-check::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 5px;
  height: 10px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* 帳面+: 日付の柱と本文、紙・字・現在地。 */
/* ---------- 地と字 ---------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--frame-sans);
  font-kerning: normal;
}
:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}
:is(.entry-body, .entry-title, .md-editor, textarea, input):focus-visible {
  outline: none;
}
.mono,
time {
  font-family: var(--frame-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
a {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: var(--frame-hair);
  text-underline-offset: 0.2em;
}
.muted {
  color: var(--muted);
}
.icon {
  stroke-width: 1.5;
}

/* 押す物の形: 角 2px、面を作らない。主な操作だけ墨の線の枠 */
.button {
  border-radius: var(--frame-radius);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  font-size: calc(14px * var(--text-scale));
  letter-spacing: 0.04em;
  min-height: 40px;
}
.button:hover:not(:disabled, [aria-pressed="true"]) {
  background: var(--soft);
}
.button.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: var(--paper);
}
.button.primary:hover:not(:disabled) {
  background: var(--strong-hover);
}
.button.text {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.button.text:hover:not(:disabled) {
  color: var(--ink);
  background: transparent;
  text-decoration: underline;
  text-decoration-thickness: var(--frame-hair);
}
/* 削除・壊す操作は意味の赤(全テーマ共通。見た目の決まり2章)。 */
.button.danger,
.button.text.destructive {
  color: var(--red);
  border-color: transparent;
}
.icon-button {
  border-radius: var(--frame-radius);
  color: var(--muted);
}
.icon-button:hover:not(:disabled):not([aria-disabled="true"], [aria-pressed="true"]) {
  background: transparent;
  color: var(--ink);
}
.icon-button.active {
  background: transparent;
  color: var(--ink);
}

/* ---------- 左の欄 ---------- */
.sidebar {
  background: var(--paper);
  border-right: var(--frame-hair) solid var(--line);
  padding: 32px 16px 16px;
}
.sidebar .brand {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(17px * var(--text-scale));
  letter-spacing: 0.12em;
  gap: 10px;
  padding-left: 8px;
}

.sidebar .brand-mark {
  width: 24px;
  height: 24px;
}
.sidebar .new-record {
  margin: 32px 0 24px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  font-size: calc(14px * var(--text-scale));
  padding-left: 14px;
}
.sidebar-scroll {
  background: none;
}
.nav-list {
  gap: 0;
}
.nav-item {
  border-radius: 0;
  min-height: 40px;
  padding: 8px 8px;
  font-size: calc(14px * var(--text-scale));
  letter-spacing: 0.04em;
  color: var(--muted);
  gap: 12px;
}
.nav-item .icon {
  width: 18px;
  height: 18px;
}
.nav-item:hover {
  background: transparent;
  color: var(--ink);
}
/* 今いる場所(左の帯の項目)は面と左の線。絞り込みに選んだタグ(.tag-nav.active)は別の意味なので、塗った面と ✓ で示す(タグの和)。 */
#main-nav .nav-item {
  border-left: 2px solid transparent;
}
#main-nav .nav-item.active {
  background: color-mix(in srgb, var(--base-text) 12%, transparent);
  border-left-color: var(--ink);
  color: var(--ink);
  font-weight: 600;
}
.tag-nav.active {
  background: var(--frame-thumb);
  color: var(--on-thumb);
}
.tag-nav.active .tag-hash {
  color: inherit;
}
.tag-nav.active .count {
  color: var(--on-thumb);
}
.nav-item .count {
  font: calc(12px * var(--text-scale)) / 1 var(--frame-sans);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.tags-nav {
  margin-top: 32px;
}
#tag-preview-toggle {
  font-size: calc(12px * var(--text-scale));
  letter-spacing: 0.12em;
  min-height: 32px;
}
.tag-nav {
  min-height: 34px;
}
.tag-hash {
  font: calc(13px * var(--text-scale)) var(--frame-sans);
  color: var(--muted);
  width: 14px;
}
.sidebar-tag-search input {
  border: 0;
  border-bottom: var(--frame-hair) solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: calc(13px * var(--text-scale));
  padding: 6px 0;
}
.account {
  border-top: var(--frame-hair) solid var(--line);
}
.avatar {
  background: transparent;
  border: var(--frame-hair) solid var(--line);
  border-radius: var(--frame-radius);
  font-family: var(--font-reading);
  font-weight: 600;
}
.account-name {
  font-size: calc(14px * var(--text-scale));
}

/* ---------- 一覧(帳面の頁) ---------- */
.list-panel {
  position: relative;
  background: var(--paper);
  border-right: var(--frame-hair) solid var(--line);
}
.list-header,
.app.reading .list-header {
  padding: 20px 24px 0;
}
.list-title-row,
.app.reading .list-title-row {
  margin-bottom: 16px;
}
.list-title-row h1,
.kind-filter-row #list-title {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(28px * var(--text-scale));
  line-height: 1.2;
  letter-spacing: 0.08em;
}
#list-title:focus-visible {
  outline: none;
}

/* リスト/暦の切り替え: 面で塗らず、選んだ方の下に墨の線 */
.view-switch {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  gap: 0;
}
.view-switch button {
  width: 40px;
  height: 44px;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  position: relative;
}
.view-switch button.active {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}
.view-switch button.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 6px;
  height: 1px;
  background: var(--ink);
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ドラッグでつなぐ(設計 5.3)。つなぐ色は --link-color(送る丸と同じテーマの色、墨は字の色)。 */
.link-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  pointer-events: none;
  max-width: 280px;
}
.link-ghost-card {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--white);
  border: 0.5px solid color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: 2px;
  font-size: var(--text-caption);
  color: var(--ink);
}
.link-ghost-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.link-ghost-date {
  color: var(--muted);
  white-space: nowrap;
}
.link-ghost-label {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  background: var(--white);
  border: 0.5px solid color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: 2px;
  font:
    12px / 1.5 system-ui,
    -apple-system,
    "Hiragino Sans",
    sans-serif;
  color: var(--ink);
  white-space: nowrap;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-ghost-label.refuse {
  color: var(--muted);
}
body.link-dragging #detail-panel:not([hidden]),
body.link-dragging #writing-window:not([hidden]),
body.link-dragging #writing-status:not([hidden]) {
  outline: 1px dashed color-mix(in srgb, var(--ink) 40%, transparent);
  outline-offset: -4px;
}
.record-card.link-drag-source {
  opacity: 0.4;
}
/* 指の下の落とし先: つなぐ色の 1.5px の実線を内側に、面は 8%(5.3)。落とし先の子が面を持っても隠れないよう、
   落とし先の矩形に合わせた枠を一番上に重ねる(落とし先の配置は動かさない)。持ち上げた時の点線はこの枠に替わる。 */
.link-drop-frame {
  position: fixed;
  z-index: 998;
  box-sizing: border-box;
  pointer-events: none;
  border: 1.5px solid var(--link-color);
  border-radius: 2px;
  background: color-mix(in srgb, var(--link-color) 8%, transparent);
  transition: opacity 120ms ease-out;
}
.link-drop-frame[hidden] {
  display: block;
  opacity: 0;
}
body.link-dragging .link-drop-over:is(#detail-panel, #writing-window, #writing-status) {
  outline-color: transparent;
}
.link-drop-refuse {
  cursor: not-allowed;
}
.link-flight {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  transform-origin: center;
}
.link-flight > .link-ghost-card {
  height: 100%;
  box-sizing: border-box;
}
@media (prefers-reduced-motion: reduce) {
  .link-drop-frame {
    transition: none;
  }
}
.link-card-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  min-width: 200px;
  max-width: calc(100vw - 8px);
  max-height: calc(100dvh - 8px);
  overflow-y: auto;
  padding: 4px;
  background: var(--paper);
  border: 0.5px solid color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: 8px;
  color: var(--ink);
}
.link-card-menu-item {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 6px;
  color: inherit;
  font: inherit;
}
.link-card-menu-item:hover,
.link-card-menu-item:focus-visible {
  background: var(--soft);
}
.record-card.link-drag-linked {
  position: relative;
}
.record-card.link-drag-linked::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 12px;
  color: var(--blue);
}

.view-switch .icon {
  width: 20px;
  height: 20px;
}

/* 探す: 面の箱をやめ、帳面の罫の上に書く */
.search-wrap {
  background: transparent;
  border: 0;
  border-bottom: var(--frame-hair) solid var(--line);
  border-radius: 0;
  padding: 8px 0;
  color: var(--muted);
}
.search-wrap:focus-within {
  border-color: var(--ink);
}
.search-wrap input {
  font-size: calc(14px * var(--text-scale));
}
.search-row {
  gap: 4px 12px;
}

/* 種類・♡・🔖・並べ替え: 字とアイコンだけ */
.kind-filter-menu summary {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0 4px;
  font-size: calc(14px * var(--text-scale));
  color: var(--ink);
}
.kind-filter-tabs {
  background: transparent;
  padding: 0;
  border-radius: 0;
  gap: 8px;
}
.kind-filter-tabs .kind-filter-choice {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0 4px;
  font-size: calc(14px * var(--text-scale));
  color: var(--muted);
}
.kind-filter-tabs .kind-filter-choice[aria-pressed="true"] {
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-weight: 600;
}
.kind-filter-choice:hover {
  background: transparent;
  color: var(--ink);
}
.kind-filter-options {
  background: var(--paper);
  border: var(--frame-hair) solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}
.kind-filter-options .kind-filter-choice[aria-pressed="true"] {
  background: transparent;
}
.sort-filter {
  background: transparent;
  color: var(--muted);
  border-radius: var(--frame-radius);
  width: 44px;
  height: 44px;
  justify-content: center;
  padding: 0;
}
.sort-filter:hover {
  color: var(--ink);
}
.sort-filter.changed {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
}
.sort-filter .icon {
  width: 20px;
  height: 20px;
}
.record-mark {
  color: var(--muted);
}
.mark-filters .record-mark .icon {
  width: 20px;
  height: 20px;
}
.record-mark:hover {
  color: var(--ink);
}
.record-mark:is([data-mark="favorite"], [data-mark-filter="favorite"])[aria-pressed="true"] {
  color: var(--frame-favorite);
}
.record-mark:is([data-mark="bookmark"], [data-mark-filter="bookmark"])[aria-pressed="true"] {
  color: var(--frame-bookmark);
}

/* 帳面の行: 左に日付の柱、縦の罫1本、右に記事。日付の順を保つ */
.record-list {
  padding: 0 24px calc(68px + env(safe-area-inset-bottom));
}
.date-group,
.app.browse .date-group,
.app.reading .date-group {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  /* 上の空きは見出しの面に含める。貼り付いたとき、条件の行との間の 24px も地の色で覆い、前の行の端をのぞかせない。月と月の間は 8 + 24 = 32px。 */
  margin-top: 8px;
  /* 面は左右に 12px はみ出して、選んだ行の枠(行の外 10px)の上端も覆う。字と罫の位置は変えない。 */
  margin-inline: -12px;
  padding: 24px 12px 12px;
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(15px * var(--text-scale));
  letter-spacing: 0.16em;
  color: var(--ink);
}
#record-list > .date-group:first-of-type {
  /* 条件の行と最初の月の見出しは別の塊(4章: 塊の間 24〜48)。空きは上の padding の 24px。 */
  margin-top: 0;
}
/* 石垣はカードが枠を持つので、見出しの罫を引かない(4章: 二重線を使わない)。 */
.date-group:has(+ .masonry)::after {
  display: none;
}
/* 見出しは罫1本で区切る。 */
.date-group::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 0;
  border-top: var(--frame-hair) solid var(--line);
  border-bottom: 0;
}
.record-card:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}
.record-card h2,
.masonry .record-card h2 {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(17px * var(--text-scale));
  line-height: 1.55;
  letter-spacing: 0.04em;
  white-space: normal;
  color: var(--ink);
}
.record-card .preview,
.masonry .record-card .preview {
  margin-top: 6px;
  font-family: var(--font-reading);
  font-size: calc(14px * var(--text-scale));
  line-height: 1.85;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: normal;
}
.record-card .preview.quote,
.masonry .record-card .preview.quote {
  margin-top: 0;
  font-size: calc(17px * var(--text-scale));
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink);
}
.record-card .card-quote-mark {
  width: 14px;
  height: 14px;
  color: var(--muted);
  margin-right: 6px;
  stroke-width: 1.5;
}
/* 1つの行の書体は明朝と等幅の2つまで: タグと出典も明朝 */
.card-link.tag {
  color: var(--muted);
  font-family: var(--font-reading);
  font-size: calc(12.5px * var(--text-scale));
  letter-spacing: 0.04em;
}
.calendar-entry-tags,
.calendar-entry-tags * {
  font-family: var(--font-reading);
}
.card-link:hover {
  color: var(--ink);
  text-decoration: underline;
}
.card-source {
  color: var(--muted);
  font-family: var(--font-reading);
  font-size: calc(12.5px * var(--text-scale));
}
.card-date-row .record-mark .icon {
  width: 17px;
  height: 17px;
}
.card-date-row .record-mark {
  min-width: 44px;
  min-height: 44px;
}
.card-date-row .record-mark-controls {
  margin-right: -10px;
}

/* 広い幅で記録を開いていないとき: 帳面の頁は読める幅に収める。検索の欄は石垣と同じ一覧の幅いっぱい。 */
.app.browse .record-list > *,
.app.browse .list-header > :not(.search-row) {
  max-width: 880px;
}

/* ---------- 記録の頁 ---------- */
.detail-panel {
  background: var(--paper);
}
.detail-toolbar {
  border-bottom: var(--frame-hair) solid var(--line);
  height: 72px;
}
.detail-toolbar .icon-button .icon {
  width: 20px;
  height: 20px;
}
.input-kind-button {
  background: transparent;
  border: 0;
  border-radius: var(--frame-radius);
  font-size: calc(14px * var(--text-scale));
  letter-spacing: 0.06em;
  color: var(--ink);
}
.icon-button.ai-button {
  color: var(--muted);
  gap: 4px;
  width: auto;
  padding: 0 8px;
}
.ai-button-label {
  font-size: calc(13px * var(--text-scale));
  letter-spacing: 0.04em;
}
.ai-button.ai-unconnected::after {
  background: var(--muted);
}
.entry-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: calc(13px * var(--text-scale));
}
.entry-date {
  gap: 12px;
}
.entry-date time {
  font: calc(13px * var(--text-scale)) / 1.5 var(--frame-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.entry-date .mono {
  font: calc(13px * var(--text-scale)) / 1.5 var(--frame-sans);
  color: var(--muted);
}
.entry-title {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(28px * var(--text-scale));
  line-height: 1.5;
  letter-spacing: 0.06em;
  color: var(--ink);
}
.entry-body {
  font-family: var(--font-reading);
  font-size: calc(17px * var(--text-scale));
  line-height: 1.95;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.reading-width {
  max-width: 36em;
}
/* タグの札と＋: 枠を外し、字とアイコンだけ。 */
.chip,
.tag-chip {
  background: transparent;
  border: 0;
  border-radius: var(--frame-radius);
  color: var(--muted);
  font-family: var(--font-reading);
  font-size: calc(13px * var(--text-scale));
  letter-spacing: 0.04em;
  padding: 0 8px 0 0;
  min-height: 44px;
  align-items: center;
}
#app .record-meta .chip {
  min-width: 0;
  min-height: 32px;
  padding: 0;
}
.tag-chip:hover {
  color: var(--ink);
}
#app .record-meta .tag-add {
  border: 0;
  border-radius: var(--frame-radius);
  background: transparent;
  color: var(--ink);
  width: 24px;
  height: 28px;
  min-width: 24px;
  min-height: 28px;
  padding: 0;
  font-size: 18px;
}
.tag-add:hover {
  background: transparent;
}
.record-links summary,
.inline-section-title {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(14px * var(--text-scale));
  letter-spacing: 0.12em;
  color: var(--ink);
}
.record-links summary {
  position: relative;
  padding-bottom: 10px;
  margin-bottom: 4px;
}
.record-links summary::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  border-top: var(--frame-hair) solid var(--line);
  border-bottom: 0;
}
.record-link,
.record-link-main {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.record-link {
  border-bottom: var(--frame-hair) solid var(--line);
}
.record-link-main strong {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(15px * var(--text-scale));
}
.attachment {
  border: 0;
  border-radius: var(--frame-radius);
  background: transparent;
  box-shadow: none;
}
.attachment img {
  border-radius: var(--frame-radius);
}
.attachment figcaption {
  font-size: calc(12px * var(--text-scale));
  color: var(--muted);
}
/* 保存と衝突はスクロール欄に重ね、表示の切り替えで本文を動かさない。 */
.detail-record-area {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
#save-footer {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0 20px;
  min-height: 44px;
  background: var(--paper);
  border: 0;
  z-index: 1;
}
body.has-writing #save-footer {
  bottom: calc(48px + env(safe-area-inset-bottom));
}
#save-footer [hidden],
.save-conflict-bar[hidden] {
  display: none;
}
#save-status,
#consult-sent,
.save-conflict-message {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#save-status:empty,
#consult-sent:empty {
  display: none;
}
#save-status.error {
  color: var(--danger, var(--red));
}
@media (max-width: 700px) {
  /* 狭い幅では失敗・衝突の文を2行まで出し、次にすることを切らない(重ねる帯なので本文は動かない)。 */
  #save-status,
  .save-conflict-message {
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  #save-status:empty {
    display: none;
  }
}
#save-conflict {
  border: 0;
  background: none;
  color: var(--ink);
  text-decoration: underline;
  padding: 0;
}
#save-button,
#save-conflict {
  flex: none;
  font-size: calc(12px * var(--text-scale));
  min-height: 44px;
}
.save-conflict-bar {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 20px;
  background: var(--paper);
  color: var(--ink);
  font-size: calc(12px * var(--text-scale));
  border-bottom: var(--frame-hair) solid var(--line);
  border-radius: 0;
  z-index: 1;
}
.save-status {
  font-size: calc(12px * var(--text-scale));
  letter-spacing: 0.06em;
  color: var(--muted);
}
.format-bar,
.format-button {
  background: transparent;
  border-radius: var(--frame-radius);
  box-shadow: none;
}
.pane-resizer {
  background: transparent;
}
.md-wikilink {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-thickness: var(--frame-hair);
  text-underline-offset: 0.22em;
}
.entry-body a {
  color: var(--blue);
}

/* 細い幅の書く窓 */
.writing-window {
  background: var(--paper);
  border: var(--frame-hair) solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}

/* ---------- 窓(設定) ---------- */
dialog {
  background: var(--paper);
  border: var(--frame-hair) solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}
dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: none;
}
.dialog-header {
  position: relative;
  border-bottom: 0;
  padding: 24px 28px 16px;
}
.dialog-header::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 0;
  height: 0;
  border-top: var(--frame-hair) solid var(--line);
  border-bottom: 0;
}
.dialog-header h2 {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(21px * var(--text-scale));
  letter-spacing: 0.12em;
}
.dialog-body {
  padding: 24px 28px 32px;
}
.settings-profile .avatar {
  width: 44px;
  height: 44px;
  font-size: calc(18px * var(--text-scale));
}
.settings-profile-info strong {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(17px * var(--text-scale));
  letter-spacing: 0.06em;
}
.settings-profile-info span {
  font-family: var(--frame-sans);
  font-size: calc(12px * var(--text-scale));
}
.settings-grass {
  border: 0;
  border-top: var(--frame-hair) solid var(--line);
  margin-bottom: 0;
  border-radius: 0;
  background: transparent;
}
.settings-grass-main {
  padding: 20px 0;
  border-radius: 0;
  min-height: 0;
}

.settings-grass .stats-card-head {
  margin-bottom: 4px;
}
.stats-big {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(48px * var(--text-scale));
  line-height: 1.1;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.stats-big small {
  font-family: var(--font-reading);
  font-size: calc(17px * var(--text-scale));
  font-weight: 600;
  color: var(--ink);
  margin-left: 4px;
}
.stats-grass-meta {
  font-size: calc(13px * var(--text-scale));
  letter-spacing: 0.04em;
  color: var(--muted);
}
.settings-section {
  border-top: var(--frame-hair) solid var(--line);
  margin-top: 24px;
  padding-top: 24px;
}
.settings-section h3 {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(15px * var(--text-scale));
  letter-spacing: 0.1em;
}
.settings-section > p,
.dialog-body > p {
  font-size: calc(13px * var(--text-scale));
  line-height: 1.8;
}
.input-kind-options {
  background: transparent;
  border: 0;
  border-radius: 0;
  gap: 16px;
}
.input-kind-option {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  font-size: calc(14px * var(--text-scale));
  color: var(--muted);
}
.input-kind-option:has(input:checked) {
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-weight: 600;
}
.input-kind legend {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(15px * var(--text-scale));
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}
.text-size-sample {
  font-family: var(--font-reading);
  color: var(--ink);
}
.device-row {
  border: 0;
  border-radius: 0;
  background: transparent;
}
.device-expiry {
  white-space: nowrap;
}

/* ---------- シェアのカード(基準の1枚。色だけ帳面に) ---------- */
.stats-share-card {
  border-radius: var(--frame-radius);
  box-shadow: none;
  border: var(--frame-hair) solid var(--line);
}

.stats-share-message input {
  background: transparent;
  border: 0;
  border-bottom: var(--frame-hair) solid var(--line);
  border-radius: 0;
  font-family: var(--font-reading);
}
.stats-share-message span {
  font-family: var(--frame-sans);
  font-size: calc(12px * var(--text-scale));
}
.stats-share-text {
  font-size: calc(13px * var(--text-scale));
  color: var(--muted);
}

/* ---------- カレンダー ---------- */
.calendar-panel {
  background: var(--paper);
}
.calendar-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  border-bottom: 0;
  padding: 12px 24px 16px;
}
.calendar-header::after {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 0;
  height: 0;
  border-top: var(--frame-hair) solid var(--line);
  border-bottom: 0;
}
.calendar-title-row h1 {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(28px * var(--text-scale));
  letter-spacing: 0.08em;
}
.calendar-button,
.calendar-arrow,
.calendar-menu {
  background: transparent;
  border-color: transparent;
  border-radius: var(--frame-radius);
  color: var(--ink);
}
.calendar-button {
  border: var(--frame-hair) solid var(--line);
  font-size: calc(13px * var(--text-scale));
}
.calendar-period {
  font-family: var(--font-reading);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.calendar-period-stat {
  font-family: var(--frame-sans);
  font-size: calc(12px * var(--text-scale));
}
.calendar-date-menu {
  background: transparent;
}
.calendar-cell {
  background: transparent;
  border-radius: var(--frame-radius);
  box-shadow: none;
}
.calendar-cell.level-1 {
  background: var(--calendar-1);
  box-shadow: none;
}
.calendar-cell.level-2 {
  background: var(--calendar-2);
  box-shadow: none;
}
.calendar-cell.level-3 {
  background: var(--calendar-3);
  box-shadow: none;
}
.calendar-cell.m {
  border-radius: var(--frame-radius);
}
.calendar-cell.w .calendar-weekday,
.calendar-cell.w .calendar-week-month,
.calendar-cell.w .calendar-mark-count,
.calendar-cell.m .calendar-mark-count {
  color: var(--ink);
  opacity: 1;
}
.calendar-cell.m .calendar-day-number {
  font-family: var(--frame-sans);
  font-weight: 400;
  font-size: calc(14px * var(--text-scale));
}
.calendar-cell.selected {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}
.calendar-weekdays {
  font-size: calc(12px * var(--text-scale));
  letter-spacing: 0.1em;
  color: var(--muted);
}
.calendar-weekdays .sunday,
.calendar-weekday-label.sunday,
.calendar-cell.w.sunday .calendar-weekday {
  color: var(--weekday-sun);
}
.calendar-weekdays .saturday,
.calendar-weekday-label.saturday,
.calendar-cell.w.saturday .calendar-weekday {
  color: var(--weekday-sat);
}
.calendar-mark-title {
  font-family: var(--font-reading);
  font-size: calc(12px * var(--text-scale));
}
.calendar-scope,
.calendar-scope strong,
.calendar-list h2 {
  font-family: var(--font-reading);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.calendar-day-heading {
  font-family: var(--font-reading);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.calendar-entry-time {
  color: var(--ink);
}
.calendar-entry-title {
  font-family: var(--font-reading);
  font-weight: 600;
}
.calendar-entry-preview {
  font-family: var(--font-reading);
  color: var(--muted);
}
.calendar-quote-badge {
  background: transparent;
  border: 0;
  border-radius: var(--frame-radius);
  color: var(--muted);
}
.list-top-button {
  background: var(--paper);
  border-radius: var(--frame-radius);
  box-shadow: none;
}

/* ---------- 共通の細部 ---------- */
.tag-suggestions,
.list-menu,
[role="menu"] {
  background: var(--paper);
  border: var(--frame-hair) solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
}
.toast {
  border-radius: var(--frame-radius);
  box-shadow: none;
}
*,
*::before,
*::after {
  transition-timing-function: ease-out;
}

/* ---------- 細い幅 ---------- */
@media (max-width: 760px) {
  :root {
    --frame-pillar: 56px;
  }
  .entry-title {
    font-size: calc(24px * var(--text-scale));
  }
  .calendar-title-row h1,
  .list-title-row h1,
  .kind-filter-row #list-title {
    font-size: calc(26px * var(--text-scale));
    letter-spacing: 0.04em;
  }
  .calendar-header {
    padding: 15px 16px 12px;
  }
  .list-header,
  .app.reading .list-header {
    padding-top: 15px;
  }
  .calendar-header::after {
    left: 16px;
    right: 16px;
  }
  .stats-view {
    padding: 24px 20px 40px;
  }
  /* 累計は帳面の行: 題は左、数は右揃え */
  .stats-assets {
    grid-template-columns: 1fr;
    margin-bottom: 32px;
  }
  .stats-asset,
  .stats-asset + .stats-asset {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 14px 0;
    border-right: 0;
    border-bottom: var(--frame-hair) solid var(--line);
  }
  .stats-asset:last-child {
    border-bottom: 0;
  }
  .stats-asset-value {
    margin-top: 0;
    font-size: calc(28px * var(--text-scale));
  }
  .stats-asset:first-child {
    padding: 20px 0 16px;
  }
  .stats-asset:first-child .stats-asset-value {
    font-size: calc(56px * var(--text-scale));
  }
  .stats-asset-value small {
    display: inline;
    margin-left: 4px;
  }
  .stats-head .stats-segments {
    min-width: 0;
    width: 100%;
  }
}

/* ---------- 切り替え(ECD の決めごと 6): OS の札の形に統一し、色だけ帳面 ----------
   札の地 = 字の 6%、選んだ札 = 地の色、影なし。対象: リスト/暦・種類・年月週日・週月年全部・文字の大きさ・正方形/縦長 */
:is(.view-switch, .stats-segments, .calendar-segments, .input-kind-options, .stats-share-formats) {
  display: inline-flex;
}
/* 種類の札は、本番が幅で札と「すべて ▾」を出し分けるので display を触らない(触ると両方が出た。6回目の後に直した) */
:is(.view-switch, .kind-filter-tabs, .stats-segments, .calendar-segments, .input-kind-options, .stats-share-formats) {
  gap: 0;
  padding: 2px;
  border: 0;
  border-radius: var(--frame-radius);
  background: var(--frame-segment);
}
:is(.view-switch, .kind-filter-tabs, .stats-segments, .calendar-segments, .stats-share-formats) button,
.stats-segments button.button,
.calendar-segments .calendar-button,
.kind-filter-tabs .kind-filter-choice,
.input-kind-option {
  border: 0;
  border-radius: var(--frame-radius);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-weight: 500;
  min-height: 36px;
}
.view-switch button.active,
.kind-filter-tabs .kind-filter-choice[aria-pressed="true"],
.stats-segments button[aria-pressed="true"],
.stats-segments button.button[aria-pressed="true"],
.calendar-segments button.active,
.stats-share-formats button[aria-pressed="true"],
.input-kind-option:has(input:checked) {
  background: var(--paper);
  box-shadow: none;
  color: var(--ink);
  font-weight: 600;
}
.view-switch button.active::after {
  content: none;
}
.view-switch button {
  width: 40px;
  height: 36px;
  color: var(--muted);
}
.view-switch .icon {
  width: 18px;
  height: 18px;
}
.input-kind-options {
  display: flex;
}
.input-kind-option {
  flex: 1;
  justify-content: center;
}
.stats-head .stats-segments button {
  flex: 1;
}

/* ---------- 6回目(ECD の指摘) ---------- */
/* 設定の窓の律動: 節の間 48(罫の上下 24+24)、節の中 12〜16 の2段に決める */
.dialog-body .settings-section,
.dialog-body > .button,
.dialog-body > a.button {
  margin-top: 24px;
  padding-top: 24px;
}
.settings-section h3,
.input-kind legend {
  margin: 0 0 12px;
}
.settings-section > p {
  margin: 0 0 12px;
}
.settings-section > p.text-size-sample {
  margin: 16px 0 0;
}
.settings-profile {
  padding: 0 0 24px;
}
.settings-grass-main {
  padding: 24px 0;
}
.settings-grass .stats-grass {
  margin-top: 16px;
}
.settings-grass .stats-grass-meta {
  margin-top: 12px;
}
.settings-grass + .settings-section {
  margin-top: 0;
  border-top: var(--frame-hair) solid var(--line);
}

/* 頭の絵は丸(iOS の定石。全案共通) */
.avatar {
  border-radius: 50%;
}

/* 281 の行: 共有は数のすぐ右、› は右端の縦の中央 */

/* 枠のボタンは字のボタンに(字の色と下線)。塗りの主ボタンだけはそのまま */
.dialog-body .button:not(.primary),
.stats-share-actions .button:not(.primary) {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  padding: 0 4px;
  min-height: 44px;
  text-decoration: underline;
  text-decoration-thickness: var(--frame-hair);
  text-underline-offset: 0.3em;
}
.dialog-body .button.text:not(.primary) {
  color: var(--muted);
}
.dialog-body .button:not(.primary):hover:not(:disabled) {
  background: transparent;
  color: var(--ink);
}
/* 削除・壊す操作は窓の中でも意味の赤(見た目の決まり2章)。上の添えの字の規則より後に置く。 */
.dialog-body .button.text.destructive,
.dialog-body .button.text.destructive:hover:not(:disabled) {
  color: var(--red);
}

/* ---- 1. 記録の頁の上の帯 ---- */
.detail-toolbar {
  padding: 0 16px;
  gap: 4px;
}
/* 狭い幅では記号の間を詰めて、鎖(他の記録につなぐ)まで帯に収める(390px で横にはみ出さない)。 */
@container record (max-width: 420px) {
  .detail-toolbar {
    padding: 0 8px;
    gap: 0;
  }
  .detail-toolbar :is(.record-mark-controls, .detail-marks) {
    gap: 0;
  }
}
.detail-toolbar .icon-button,
.detail-toolbar .record-mark,
.detail-toolbar .record-mark:not([aria-pressed="true"]) {
  color: var(--ink);
  min-width: 44px;
  min-height: 44px;
}
.detail-toolbar .icon-button .icon,
.detail-toolbar .record-mark .icon {
  width: 20px;
  height: 20px;
  stroke-width: 1.5;
}
.detail-toolbar .writing-reference[aria-disabled="true"] {
  color: var(--ink);
  opacity: 1;
}
.detail-toolbar .icon-button.ai-button,
#app #record-detail-toolbar .ai-button {
  width: auto;
  min-width: 56px;
  height: 44px;
  padding: 0 8px;
  flex-direction: row;
  gap: 4px;
  color: var(--ink);
}
#app #record-detail-toolbar .ai-button svg,
.detail-toolbar .ai-button .icon {
  width: 20px;
  height: 20px;
}
#app #record-detail-toolbar .ai-button-label,
.detail-toolbar .ai-button-label {
  font-family: var(--frame-sans);
  font-size: calc(14px * var(--text-scale));
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.detail-toolbar .ai-button.ai-unconnected::after {
  top: 8px;
  right: 4px;
  width: 5px;
  height: 5px;
  background: var(--ink);
}
.input-kind-button {
  min-height: 44px;
  color: var(--ink);
}
@media (max-width: 760px) {
  .detail-toolbar {
    padding: 0 6px;
    gap: 0;
  }
  .detail-toolbar .record-mark-controls {
    gap: 0;
  }
  #app #record-detail-toolbar .ai-button {
    min-width: 52px;
    padding: 0 4px;
  }
}

/* ---------- 統計 ---------- */
.stats-view {
  padding: 32px 48px 64px;
}
.stats-head {
  margin-bottom: 48px;
  gap: 16px;
}
.stats-head h1 {
  font-family: var(--font-reading);
  font-size: var(--text-title);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.stats-head .button {
  text-decoration: none;
  color: var(--muted);
  font-weight: 400;
}
.stats-segments {
  background: transparent;
  border: 0;
  padding: 0;
  gap: 4px;
}
.stats-head .stats-segments {
  min-width: 0;
}
.stats-segments button {
  position: relative;
  border-radius: 0;
  color: var(--muted);
  font-size: calc(13px * var(--text-scale));
  padding: 0 12px;
  min-height: 44px;
}
.stats-segments button[aria-pressed="true"] {
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  font-weight: 600;
}

/* 上の数: 主役は「書いた日」1つ。ほかは添えの大きさ */
.stats-assets {
  gap: 24px 32px;
  margin-bottom: 64px;
  align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-bottom: 32px;
  border-bottom: var(--frame-hair) solid var(--line);
}
.stats-asset {
  border: 0;
  background: transparent;
  padding: 0;
  min-height: 0;
}
.stats-asset:first-child {
  grid-column: 1 / -1;
}
.stats-asset-label {
  color: var(--muted);
  gap: 8px;
}
.stats-asset-label > .icon,
.stats-asset-label > svg,
.stats-card h3 > .icon,
.stats-card h3 > svg {
  display: none;
}
.stats-asset-value {
  font-family: var(--font-reading);
  font-weight: 600;
  font-size: calc(34px * var(--text-scale));
  line-height: 1.15;
  margin-top: 8px;
  letter-spacing: 0.01em;
}
.stats-asset:first-child .stats-asset-value {
  font-size: calc(72px * var(--text-scale));
  line-height: 1;
}
.stats-asset-value small {
  display: inline;
  font-family: var(--font-reading);
  font-size: calc(15px * var(--text-scale));
  font-weight: 600;
  color: var(--ink);
  margin-left: 2px;
}
.stats-asset:first-child .stats-asset-value small {
  font-size: calc(24px * var(--text-scale));
}
.stats-grid {
  gap: 32px 64px;
}
.stats-card {
  border: 0;
  background: transparent;
  padding: 0;
  margin-bottom: 64px;
}
.stats-card-head {
  margin-bottom: 12px;
}
.stats-card h3 {
  font-size: calc(12px * var(--text-scale));
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.12em;
  gap: 8px;
}
.stats-current {
  font-family: var(--font-reading);
  font-size: calc(17px * var(--text-scale));
  font-weight: 600;
}
.stats-card[data-key="hours"] .stats-current,
.stats-card[data-key="length"] .stats-current {
  font-family: var(--frame-sans);
  font-size: calc(12px * var(--text-scale));
}
.stats-year-label {
  font-size: calc(12px * var(--text-scale));
  margin-top: 16px;
}
.stats-chart text {
  /* 大きさは stats.js が幅に合わせて属性で渡す(viewBox で縮んでも読める大きさ)。ここで上書きしない。 */
  fill: var(--muted);
}
.stats-period-grass text.sunday {
  fill: var(--weekday-sun);
}
.stats-period-grass text.saturday {
  fill: var(--weekday-sat);
}
.stats-chart line {
  stroke: var(--line);
}
.stats-chart path[stroke],
.stats-chart polyline {
  stroke-width: 1.5px;
}
.stats-period-title {
  font-size: calc(20px * var(--text-scale));
  font-weight: 600;
  letter-spacing: 0.06em;
}
.stats-period-nav .button {
  border-radius: 0;
  text-decoration: none;
  color: var(--muted);
  font-weight: 400;
}
.stats-shelf-row + .stats-shelf-row {
  border-top: 0;
}
.stats-shelf-row > svg {
  color: var(--muted);
}
/* 節目の印: 墨の角印。次の印は点線の升 */
.stats-stamp-circle {
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-reading);
  font-weight: 600;
  width: 60px;
  height: 60px;
}
.stats-stamp-circle small {
  font-family: var(--font-reading);
  font-weight: 400;
}
.stats-stamp.next .stats-stamp-circle {
  border: 1px dashed var(--frame-faint);
  color: var(--muted);
  background: transparent;
}
.stats-stamp-date {
  font-size: calc(11px * var(--text-scale));
  font-family: "SFMono-Regular", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}
.stats-year-feedback {
  color: var(--ink);
  background: var(--paper);
}
/* シェアのカード: 絵そのものは案A。窓の地と同じ紙なので、外形を 0.5px で示す */
.stats-share-card {
  border-radius: 0;
  border: var(--frame-hair) solid var(--line);
  box-shadow: none;
}
.stats-share-text {
  font-family: var(--font-reading);
  font-size: calc(13px * var(--text-scale));
  color: var(--muted);
}
.stats-share-formats {
  gap: 16px;
  background: transparent;
}
.stats-share-actions {
  gap: 16px;
  margin-top: 24px;
}
/* DOM順を保ち、本文は全幅、日付とタグは下の1行に置く。 */
.record-rows .record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  position: relative;
  margin: 0;
  padding: 18px 0 4px;
  border: 0;
  border-bottom: var(--frame-hair) solid var(--line);
  border-radius: var(--frame-radius);
  box-shadow: none;
  background: transparent;
}
.record-rows .record-card:hover {
  border-color: var(--line);
  background-color: transparent;
  box-shadow: none;
}
.record-rows .record-card.selected {
  border: 0;
  border-bottom: var(--frame-hair) solid var(--line);
  background-color: transparent;
  box-shadow: none;
}
.record-rows .record-card > :not(.card-meta) {
  grid-column: 1 / -1;
  min-width: 0;
}
.record-card .card-meta,
.record-card .card-date-row,
.record-card .card-date-info {
  display: contents;
}
.record-rows .record-card .card-date-info {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.record-rows .record-card .card-date-info time {
  flex: 0 0 auto;
  padding: 0;
  white-space: nowrap;
  font-family: "SFMono-Regular", Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: calc(12px * var(--text-scale));
  color: var(--muted);
}
.record-rows .record-card .card-details {
  flex: 1;
}
.record-rows .record-card .preview:not(.quote) {
  -webkit-line-clamp: var(--card-lines-row-diary);
}
.record-rows .quote-card .preview:not(.quote) {
  -webkit-line-clamp: var(--card-lines-row-note);
}
.card-details {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.record-card .card-date-row .record-mark-controls {
  grid-column: 2;
  grid-row: 2;
  margin-right: 0;
  align-self: center;
}
/* 石垣では日付の柱を使わず、日付・本文・下の行を枠1つに収める。 */
.masonry .record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 0;
  padding: 14px 12px 10px;
  border: var(--frame-hair) solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--paper);
  box-shadow: none;
}
.masonry .record-card:hover {
  border-color: var(--line);
  background: var(--paper);
  box-shadow: none;
}
.masonry .record-card.selected,
.app.reading .masonry .record-card.selected {
  border: 1.5px solid var(--ink);
  background: var(--paper);
  box-shadow: none;
}
.masonry .record-card .card-date-info time {
  grid-column: 1 / -1;
  grid-row: 1;
  padding: 0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: calc(12px * var(--text-scale));
  color: var(--muted);
}
.masonry .record-card .card-main {
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
}
.masonry .card-details {
  grid-column: 1 / -1;
  grid-row: 3;
  min-width: 0;
}
.masonry .record-card .card-date-row .record-mark-controls {
  grid-column: 1 / -1;
  grid-row: 4;
  justify-self: end;
}
.card-link.tag,
.card-source,
.chip,
.tag-chip,
.calendar-entry-tags,
.calendar-entry-tags * {
  font-family: var(--frame-sans);
}
.record-card .card-meta time {
  flex: none;
}
.brand {
  font-family: var(--font-reading);
  gap: 10px;
}
.brand-mark {
  color: var(--ink);
  width: 24px;
  height: 24px;
  flex: none;
}
/* 全ての分段に同じ溝と札。選択の地はダークで明るくする。 */
:is(
  .view-switch,
  .kind-filter-tabs,
  .stats-segments,
  .calendar-segments,
  .input-kind-options,
  .stats-share-formats,
  .theme-options
) {
  gap: 0;
  padding: 2px;
  border: 0;
  border-radius: var(--frame-radius);
  background: var(--frame-segment);
  box-shadow: none;
}
:is(.view-switch, .kind-filter-tabs, .stats-segments, .calendar-segments, .stats-share-formats) button,
.stats-segments button.button,
.calendar-segments .calendar-button,
.kind-filter-tabs .kind-filter-choice,
.input-kind-option {
  border: 0;
  border-radius: var(--frame-radius);
  box-shadow: none;
  background: transparent;
  min-height: 44px;
  color: var(--muted);
  font-family: var(--frame-sans);
}
.view-switch button.active,
.kind-filter-tabs .kind-filter-choice[aria-pressed="true"],
.stats-segments button[aria-pressed="true"],
.stats-segments button.button[aria-pressed="true"],
.calendar-segments button.active,
.stats-share-formats button[aria-pressed="true"],
.input-kind-option:has(input:checked) {
  background: var(--frame-thumb);
  color: var(--on-thumb);
  box-shadow: none;
}
:is(
  .view-switch button.active,
  .kind-filter-choice[aria-pressed="true"],
  .stats-segments button[aria-pressed="true"],
  .calendar-segments button.active,
  .stats-share-formats button[aria-pressed="true"]
)::after {
  content: none;
}
.theme-options {
  align-items: stretch;
}
.theme-option {
  flex: 1;
  min-width: 0;
  padding: 8px 4px;
  border-radius: var(--frame-radius);
}
.theme-swatch,
.theme-swatch-card {
  border-radius: var(--frame-radius);
}
.theme-swatch {
  width: min(64px, 100%);
}
.theme-section legend {
  font-family: var(--font-reading);
}
.stats-head::after {
  content: none;
}
.stats-card h3 {
  font-family: var(--frame-sans);
}
.stats-asset {
  text-align: left;
  border-right: 0;
}
.stats-asset:last-child {
  padding: 0;
}
.stats-asset-label {
  justify-content: flex-start;
}
.stats-card {
  padding-bottom: 24px;
  border-bottom: var(--frame-hair) solid var(--line);
}
.stats-stamp-circle {
  border-color: var(--line);
  border-radius: var(--frame-radius);
}
.stats-chart rect,
.stats-period-grass rect {
  rx: 2px;
  ry: 2px;
}
.stats-main-bars rect[fill="var(--blue)"] {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scaleX(0.42);
}
.stats-share-card {
  box-shadow: none;
}
.settings-grass .stats-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* 影と箱の中の箱を作らず、区切りは罫1本。 */
:is(
  .input,
  .chip,
  .record-link,
  .attachment,
  .stats-card,
  .stats-asset,
  .settings-grass,
  .calendar-segments,
  .view-switch,
  .stats-segments,
  .search-wrap,
  .format-bar,
  .format-button,
  .list-menu,
  .tag-suggestions,
  .calendar-menu,
  .calendar-popover,
  .proposal-switch,
  .proposal-switch-option
) {
  border-radius: var(--frame-radius);
  box-shadow: none;
}
.record-mark:is([data-mark="favorite"], [data-mark-filter="favorite"])[aria-pressed="true"],
.detail-toolbar .record-mark[data-mark="favorite"][aria-pressed="true"] {
  color: var(--frame-favorite);
}
.record-mark:is([data-mark="bookmark"], [data-mark-filter="bookmark"])[aria-pressed="true"],
.detail-toolbar .record-mark[data-mark="bookmark"][aria-pressed="true"] {
  color: var(--frame-bookmark);
}
@media (max-width: 760px) {
  .stats-view {
    padding: 20px 24px 48px;
  }
  .stats-head {
    margin-bottom: 32px;
  }
  .stats-assets {
    grid-template-columns: 1fr 1fr;
    gap: 24px 16px;
    margin-bottom: 48px;
  }
  .stats-asset,
  .stats-asset + .stats-asset {
    display: block;
    padding: 0;
    border: 0;
  }
  .stats-asset:first-child {
    grid-column: 1 / -1;
    padding: 0;
  }
  .stats-asset:first-child .stats-asset-value {
    font-size: calc(64px * var(--text-scale));
  }
  .stats-card {
    padding: 0;
    margin-bottom: 48px;
  }
  .record-list {
    padding-left: 16px;
    padding-right: 16px;
  }
  .list-header,
  .app.reading .list-header {
    padding-left: 16px;
    padding-right: 16px;
  }
}

h1,
h2 {
  font-family: var(--font-reading);
}
.detail-toolbar .icon-button.active {
  color: var(--ink);
}
.entry-body a,
.md-wikilink {
  color: var(--blue);
}
.stats-segments button,
.stats-share-formats button,
.calendar-segments button {
  white-space: nowrap;
  flex-shrink: 0;
}
.record-rows .record-card.selected,
.app.reading .record-rows .record-card.selected {
  background: transparent;
}
/* 選んだ行は、選んだカードと同じ 1.5px の字の色の枠(5章)。行の幅・罫・字を動かさず、字から 10px 外に重ねる。 */
.record-rows .record-card.selected::before {
  content: "";
  position: absolute;
  inset: 8px -10px 0;
  border: 1.5px solid var(--ink);
  border-radius: var(--frame-radius);
  pointer-events: none;
}

.record-rows .record-card .card-main {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
}

/* 焦点の枠はキーボードで動かしている間だけ(boot.js の data-input-modality)。読み込み直後・押した後・作りが焦点を移した時は出さない。 */
:root:not([data-input-modality="keyboard"]) :focus-visible,
:root:not([data-input-modality="keyboard"]) :has(> :focus-visible),
:root:not([data-input-modality="keyboard"]) .theme-option:has(:focus-visible) .theme-swatch {
  outline: none !important;
}
:root:not([data-input-modality="keyboard"]) .pane-resizer:focus-visible:not(:hover, .dragging)::after {
  background: var(--line);
  width: 2px;
}
:root:not([data-input-modality="keyboard"]) .pane-resizer:focus-visible:not(:hover, .dragging)::before {
  background: var(--muted);
}
/* 正方形/縦長は、ほかの切り替えと同じ分段の札(5章)。下線と詰まりを消す。 */
#stats-share .stats-share-formats button {
  min-height: 36px;
  padding: 0 16px;
  text-decoration: none;
}
.tag-sort-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tag-sort-heading > :first-child {
  flex: 1;
}
.tag-sort-control {
  width: auto;
  min-width: 44px;
  gap: 4px;
  white-space: nowrap;
  color: var(--ink);
  font-size: calc(14px * var(--text-scale));
  font-weight: 500;
}

.tag-sort-menu {
  min-width: 180px;
  border-width: var(--frame-hair);
}

.tag-sort-control .icon {
  width: 18px;
  height: 18px;
}
#sidebar-tag-sort .tag-sort-control {
  color: var(--muted);
  font-size: calc(12px * var(--text-scale));
  font-weight: 400;
}
#sidebar-tag-sort .icon {
  width: 16px;
  height: 16px;
}
.tag-sort-menu:focus {
  outline: none;
}
.tag-sort-menu .list-menu-item:focus:not(:focus-visible) {
  outline: none;
}

/* 切り替えの選んだ札の正本(機能が先): 字の色の面に地の色の字、太さ 600。押す前・ホバーでも選んだ見え方を崩さない。
   scripts/contrast-smoke.mjs が、選んだ札と溝・字と札の対比を4テーマ×明暗で測る。 */
:is(
  .view-switch button.active,
  .kind-filter-tabs .kind-filter-choice[aria-pressed="true"],
  .stats-segments button[aria-pressed="true"],
  .calendar-segments button.active,
  .stats-share-formats button[aria-pressed="true"],
  .input-kind-option:has(input:checked)
),
:is(
  .view-switch button.active,
  .kind-filter-tabs .kind-filter-choice[aria-pressed="true"],
  .stats-segments button[aria-pressed="true"],
  .calendar-segments button.active,
  .stats-share-formats button[aria-pressed="true"],
  .input-kind-option:has(input:checked)
):hover {
  background: var(--frame-thumb);
  color: var(--on-thumb);
  font-weight: 600;
}
.input-kind-option:has(input:checked) * {
  color: var(--on-thumb);
}
/* テーマの見本は面で塗らず、選んだ物の字の色の 1.5px の枠で示す(見本の色と配置を保つ。影でなく内側の枠)。 */
.theme-option:has(:checked) {
  background: transparent;
  outline: 1.5px solid var(--ink);
  outline-offset: -1.5px;
}

/* リンクボタン(クリップ)の3つの状態。一覧のカードと記録の帯で同じ(draftRelation の1つから。設計 6.2・見た目の決まり2章・
   claim:draft-link-button-state-from-single-source)。
   休み(執筆中の下書きが無い)= 字の 40% / 誘い・集める(下書きがあり押せる)= 字の色 /
   添えている = つなぐ色(テーマの色、墨は字の色)の記号の後ろに、つなぐ色の 12% の丸。光らせ続けない(止まった色)。 */
.writing-reference.record-mark[data-draft-relation="rest"] {
  color: var(--frame-faint);
}
.writing-reference.record-mark:is([data-draft-relation="invite"], [data-draft-relation="gather"]) {
  color: var(--ink);
}
.writing-reference.record-mark[data-draft-relation="attached"] {
  color: var(--link-color);
  background: color-mix(in srgb, var(--link-color) 12%, transparent);
  border-radius: 50%;
}
/* 青の丸い角は箱の部品だけ。下線だけの行・欄(1列の行・検索・入力)は角を付けない(線の端を曲げない)。 */
:root[data-theme="blue"]
:is(
  .record-rows .record-card,
  .search-wrap,
  .sidebar-tag-search,
  .entry-tags input,
  .md-editor,
  input:not([type]),
  input[type="text"],
  input[type="search"],
  textarea
) {
  border-radius: 0;
}

/* タグ選択は帯の行、上は状態の1行。帯を畳んだときだけ名前を開く。 */
.tag-filter-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font: var(--text-caption) var(--frame-sans);
  flex-wrap: wrap;
}
.selected-tags-toggle {
  display: none;
}
.app.nav-collapsed .selected-tags-toggle {
  display: inline-flex;
}
#sidebar-tags-clear {
  font-size: var(--text-caption);
  white-space: nowrap;
  padding: 4px;
}
.selected-tags-menu {
  max-width: min(320px, calc(100vw - 16px));
  max-height: 60vh;
  overflow: auto;
}
.selected-tags-menu .list-menu-item {
  white-space: normal;
  overflow-wrap: anywhere;
}
@media (max-width: 700px) {
  .app:not(.nav-open) .selected-tags-toggle {
    display: inline-flex;
  }
}

.tag-filter-status .button {
  padding: 4px;
  min-height: 32px;
  font: inherit;
}
.tag-sort-heading {
  gap: 4px;
}
#tag-preview-toggle {
  white-space: nowrap;
  flex-shrink: 0;
}

/* 行の選択面は帯の内側いっぱい。メニューも同じ行の中に置く。 */
.tag-nav-row {
  position: relative;
  margin-bottom: 2px;
}
.tag-nav-row .tag-nav {
  padding-left: 6px;
  padding-right: 36px;
  /* 親の選択面は即時に変わるので、字と面の切り替えも同時にする。 */
  transition: none;
}
.tag-nav-row .tag-toggle,
.tag-nav-row .tag-toggle-spacer {
  position: relative;
  z-index: 1;
}
.tag-nav-row:has(.tag-nav.active) .tag-toggle {
  color: var(--on-thumb);
}
.tag-nav-row .tag-menu-button {
  position: absolute;
  right: 0;
  width: 30px;
}
.tag-nav-row:has(.tag-nav.active) .tag-menu-button {
  color: var(--on-thumb);
}
.tag-nav.active:is(:hover, :focus-visible) {
  background: color-mix(in srgb, var(--frame-thumb) 70%, var(--on-thumb));
  color: var(--on-thumb);
}
.tag-nav.active:is(:hover, :focus-visible) .tag-hash {
  font-size: 0;
}
.tag-nav.active:is(:hover, :focus-visible) .tag-hash::after {
  content: "×";
  font: var(--text-caption) var(--frame-sans);
}
.tag-nav.active:is(:hover, :focus-visible) .count {
  font-size: 0;
}
.tag-nav.active:is(:hover, :focus-visible) .count::after {
  content: "外す";
  font: 12px var(--frame-sans);
}
#sidebar-tags-clear {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}
.selected-tags-menu {
  width: max-content;
  min-width: 0;
}
.selected-tags-menu .list-menu-item {
  display: flex;
  width: 100%;
  min-height: 36px;
  text-align: left;
  justify-content: flex-start;
  gap: 8px;
}
.selected-tags-menu .selected-tag-check {
  width: 14px;
  flex-shrink: 0;
}
.record-tag-actions {
  display: inline-flex;
  align-items: center;
}
#app .record-tag-actions .tag-remove {
  flex: none;
  margin-left: 4px;
  width: 16px;
  height: 28px;
  min-width: 16px;
  min-height: 28px;
  padding: 0;
  cursor: pointer;
}
.record-tag-actions:is(:hover, :focus-within) .tag-remove {
  color: var(--ink);
}

.selected-tags-menu .list-menu-item {
  padding-left: 10px;
}
@media (max-width: 700px) {
  .tag-nav-row .tag-nav {
    padding-right: 50px;
  }
  .tag-nav-row .tag-menu-button {
    width: 44px;
  }
}
/* 親タグの展開ボタンが44pxになる幅でも、選択面の左端は行の左端。 */
.tag-nav-row:has(.tag-nav.active) {
  background: var(--frame-thumb);
}
.tag-nav-row:has(.tag-nav.active:is(:hover, :focus-visible)) {
  background: color-mix(in srgb, var(--frame-thumb) 70%, var(--on-thumb));
}
body.link-dragging #toast {
  pointer-events: none;
}

/* 二つの検索結果も、仮想化した一覧の高さの中に置く。 */
.catalog-section {
  position: absolute;
  left: 0;
  margin: 0;
  padding: 12px 10px;
  font-size: var(--text-caption);
  font-weight: 500;
  line-height: 20px;
}
.catalog-empty {
  padding: 0 10px;
}
.catalog-empty p {
  margin: 0 0 12px;
}
.catalog-empty-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.catalog-related-item {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.catalog-related-item .catalog-count {
  font-size: 11px;
  white-space: nowrap;
}

/* 合意した帯1本・中央俯瞰・記録別タブ。本文の保存状態から独立した配置。 */
.workspace-section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
}
.workspace-section-heading span {
  flex: 1;
}
.workspace-section-heading button {
  padding: 3px 6px;
}
.index-types {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 7px;
  margin: 4px 10px 8px;
  overflow: hidden;
}
.index-types button {
  flex: 1;
  padding: 5px 3px;
  border: 0;
  background: transparent;
  color: inherit;
}
.index-types .active {
  background: var(--ink);
  color: var(--paper);
}
.index-rows {
  overflow: auto;
  max-height: calc(100vh - 380px);
  min-height: 120px;
}
.workspace-index-row {
  height: 36px;
  gap: 5px;
  transition: none;
}
/* 絞り込みの選択は既存の選択面と ✓。現在地の左線とは区別する。
   面・字・印を同じ描画で切り替え、旧色の補間中に選択だけが消えないようにする。 */
.workspace-index-check {
  width: 14px;
  flex-shrink: 0;
  text-align: center;
}
.workspace-index-row.active {
  background: var(--frame-thumb);
  color: var(--on-thumb);
}
.workspace-index-row.active .count {
  color: inherit;
}
/* 格子の間の種類は場所を残して薄く押せない(web.catalog-grid#CG5)。 */
.kind-filter .is-disabled {
  opacity: 0.45;
}
/* 絞っている間、当たりの無い行は消さずに薄く下へ(表 §3-4)。 */
.workspace-index-row.zero {
  opacity: 0.45;
}
.workspace-index-row .count {
  font-variant-numeric: tabular-nums;
}
.workspace-index-name {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.project-condition {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  text-align: left;
  /* 名前は左から並べ、長い名前は末尾を省く(.button の中央寄せと左右 15px の余白のままだと、狭い帯で両端が欠ける)。高さは .button のまま。 */
  display: block;
  padding-inline: 0;
  line-height: 23px;
}
/* 絞り込みに選んだプロジェクトは、索引の行と同じ選択面と ✓(web.left-bar#L3)。
   ✓ の場所は選んでいない行にも空けておき、選んでも名前と件数の位置を動かさない。✓ は読み上げない(aria-pressed が伝える)。 */
.project-condition::before {
  content: "";
  display: inline-block;
  width: 14px;
  margin-right: 4px;
  text-align: center;
}
#project-entry details.active > .project-row .project-condition::before {
  content: "✓";
}
/* 代替文の書き方を解す版では ✓ を読み上げない。解さない古い版は上の ✓ のまま。 */
@supports (content: "a" / "") {
  #project-entry details.active > .project-row .project-condition::before {
    content: "✓" / "";
  }
}
#project-entry summary {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 4px 8px;
}
#project-entry summary::marker {
  content: "";
}
#project-entry summary > svg {
  width: 16px;
  height: 16px;
  flex: none;
}
#project-entry-rows {
  grid-template-columns: minmax(0, 1fr);
  max-height: 260px;
  overflow: auto;
}
#project-entry-rows > details > nav > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
}
#project-entry-rows > details > nav .nav-item {
  /* 帯の幅(右を開いても変えない)の中で題を省略し、行の「…」を押せる所に残す。 */
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
}
.project-row-menu,
.project-member-menu {
  padding: 3px 5px;
  background: transparent;
  border: 0;
  color: inherit;
  flex: none;
}
.record-workspace {
  flex: none;
  border-bottom: 1px solid var(--line);
}
.record-tabs {
  display: flex;
  gap: 3px;
  height: 36px;
  min-height: 36px;
  flex: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 6px 0;
  background: var(--soft);
}
.record-tab {
  display: flex;
  align-items: center;
  min-width: 130px;
  max-width: 240px;
  flex: none;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}
.record-tab.active {
  background: var(--paper);
  box-shadow: inset 0 -2px var(--accent);
}
.record-tab-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 7px;
  border: 0;
  background: transparent;
  color: inherit;
}
.record-tab .icon-button {
  width: 24px;
  height: 24px;
}
.record-tab-navigation {
  display: flex;
  gap: 2px;
  height: 32px;
  align-items: center;
  padding: 0 7px;
}
.record-tab-navigation .icon-button {
  width: 27px;
  height: 27px;
}
.record-project-chips {
  position: relative;
  display: flex;
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
  height: 32px;
  padding-left: 16px;
  margin: 0;
  color: var(--muted);
}
.record-project-chips::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  width: 1px;
  background: var(--line);
}
.record-project-chips > .chip {
  min-width: 0;
  gap: 4px;
  font-size: calc(13px * var(--text-scale));
  letter-spacing: 0.04em;
}
.record-project-chips > .chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-project-chips > .chip > .icon {
  width: 15px;
  height: 15px;
  stroke-width: 1.65;
}
#app .record-project-chips .icon-button {
  width: 16px;
  height: 28px;
  min-width: 16px;
  min-height: 28px;
  padding: 0;
}
.record-project-chips .icon-button .icon {
  width: 9px;
  height: 9px;
  stroke-width: 2;
}
@media (max-width: 700px) {
  /* 狭い幅はプロジェクトをいつも2行目に置く(タグの数で行が増えたり減ったりしない)。 */
  .record-meta {
    flex-wrap: wrap;
  }
  .record-project-chips {
    flex-basis: 100%;
    padding-left: 0;
  }
  .record-project-chips::before {
    display: none;
  }
}
.workspace-record-layout {
  display: flex;
  gap: 2px;
}
.workspace-record-layout button {
  padding: 3px 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  border-radius: 5px;
  font-size: 11px;
}
.workspace-record-layout .active {
  background: var(--soft);
  border-color: var(--accent);
}
.catalog-types {
  display: none;
}
#sidebar-tag-search-wrap[hidden],
#all-tags[hidden],
#project-entry-refresh[hidden] {
  display: none;
}
@media (min-width: 701px) {
  /* 右を開いても左の幅は変えない(表 §3-2、監査 #12)。 */
  .app.reading:not(.layout-single) {
    grid-template-columns: var(--side-w) minmax(320px, var(--list-pane-width, 1fr)) minmax(400px, 1fr);
  }
  .app.nav-collapsed.reading:not(.layout-single) {
    grid-template-columns: 44px minmax(320px, var(--list-pane-width, 1fr)) minmax(400px, 1fr);
  }
  .app.reading .record-card {
    height: auto;
    min-height: 0;
  }
  .sidebar-scroll {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .sidebar-scroll > .index-section {
    flex: 1;
    min-height: 0;
  }
}

.sharing-modes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.sharing-modes label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sharing-modes input {
  width: auto;
}
.sharing-link {
  width: 100%;
  font-size: 12px;
}
.sharing-preview {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.sharing-preview-body {
  padding: 12px;
  background: var(--soft);
  line-height: 1.75;
  max-height: 240px;
  overflow: auto;
}
.sharing-actions {
  justify-content: flex-end;
  margin-top: 16px;
}
#shared-title,
#shared-body,
#shared-status {
  max-width: 760px;
  margin: 24px auto;
  padding: 0 20px;
}
#shared-body {
  line-height: 1.8;
}
#shared-status {
  color: var(--muted);
}

/* 真ん中の上の帯は末尾の「案C」の層が持つ(10/17 に前の2行の層を置き換えた)。 */
#list-tags {
  flex: none;
  min-width: 0;
  max-width: 65%;
  overflow-x: auto;
  margin: 0;
  padding: 0;
}
#list-tags .tag-filters {
  flex-wrap: nowrap;
  gap: 3px;
  margin: 0;
}
#list-tags .chip {
  white-space: nowrap;
  font-size: 12px;
}
.record-list {
  padding: 10px 12px;
}
.app[data-record-layout="masonry"] #record-list p.date-group {
  display: none;
}
.catalog-head .search-wrap {
  display: none;
}

/* 細い幅では見出しと追加ボタンに別の領域を割り当て、指の当たりを重ねない。 */
@media (max-width: 700px) {
  /* 下端の記録も、固定された執筆の帯より上まで送れるようにする。 */
  .record-list {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .sidebar-toggle {
    top: 9px;
  }
  /* 左上の ☰(sidebar-toggle)の場所を題の段に空ける。 */
  #app .list-title-row {
    padding-left: 44px;
  }
}

/* ---------- 真ん中の上の帯(案C。CD 10/17、claim:web-header-group-like-controls-distinct-view-icons) ----------
   1段目 題・件数・見方 / 2段目 検索 / 3段目 左に種類・印・条件を外す、右端に並べ替え。
   どの段も、条件・見方・右を開く で部品を出し入れせず動かさない(web.center-bar#B1)。前の層の帯の決まりより後に置いて勝たせる。 */
.list-panel {
  container-type: inline-size;
  container-name: record-list;
}
#app .list-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 20px 10px;
  border-bottom: var(--frame-hair) solid var(--line);
}
#app .list-header > * {
  max-width: none;
  margin: 0;
}
#app .list-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  margin: 0;
}
#app .list-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
#app .list-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: none;
  min-width: 0;
}
#app #list-title {
  margin: 0;
  font-family: var(--font-reading);
  font-size: calc(21px * var(--text-scale));
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
/* 件数: 桁が変わってもほかを動かさない幅を先に取る。条件ありの当たりの数だけ字の色。 */
#app .list-count {
  /* 6桁までは同じ幅。7桁以上は list.js の --count-ch で広げる。 */
  min-width: max(6.5em, calc(var(--count-ch, 21) * 1ch));
  color: var(--muted);
  font-size: calc(14px * var(--text-scale));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#app .list-count .list-count-hit {
  color: var(--ink);
  font-weight: 600;
}
#app #view-switch-list {
  display: inline-flex;
  flex: none;
}
#app .list-title-row .view-switch {
  gap: 2px;
  padding: 2px;
  border-radius: calc(var(--frame-radius) - 1px);
}
#app .list-title-row .view-switch button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 40px;
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: calc(var(--frame-radius) - 3px);
  font-size: calc(14px * var(--text-scale));
  white-space: nowrap;
}
#app .list-refresh,
#app .list-title-row .add-mobile {
  margin-left: auto;
}
/* 2段目: 検索の欄は全幅、枠なしの面。札(#タグ・プロジェクト)は欄の中。 */
#app .list-header .search-row {
  display: flex;
  gap: 0;
}
#app .list-header .search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--frame-radius);
  background: var(--field);
  color: var(--muted);
}
#app .list-header .search-wrap:focus-within {
  box-shadow: 0 0 0 2px var(--accent);
}
#app .list-header .search-wrap > .icon {
  width: 16px;
  height: 16px;
  flex: none;
}
#app .list-header .search-wrap input {
  flex: 1;
  min-width: 80px;
  border: 0;
  background: none;
  font-size: calc(15px * var(--text-scale));
  color: var(--ink);
}
#app .list-header .search-wrap input::placeholder {
  color: var(--frame-faint);
}
#app .search-key {
  flex: none;
  padding: 1px 5px;
  border: var(--frame-hair) solid var(--line);
  border-radius: 4px;
  color: var(--frame-faint);
  font:
    11px ui-monospace,
    "SF Mono",
    Menlo,
    monospace;
}
/* 3段目: 左は絞り込み(押すと入・切の札)、右端は並べ替え(押すとメニュー)。形と場所で役割を分ける。 */
#app .filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-height: 36px;
}
#app .filter-row .kind-filter:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin: 0;
}
#app .filter-row .kind-filter-tabs {
  gap: 2px;
  padding: 2px;
  border-radius: calc(var(--frame-radius) - 1px);
  background: var(--frame-segment);
}
#app .filter-row .kind-filter-tabs .kind-filter-choice {
  min-width: 32px;
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: calc(var(--frame-radius) - 3px);
  font-size: calc(14px * var(--text-scale));
}
#app .filter-row .mark-filters {
  gap: 2px;
  margin: 0;
  padding: 2px;
  border-radius: calc(var(--frame-radius) - 1px);
  background: var(--frame-segment);
}
#app .filter-row .mark-filters .record-mark {
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: calc(var(--frame-radius) - 3px);
  color: var(--muted);
}
#app .filter-row .mark-filters .record-mark:hover {
  color: var(--ink);
}
#app .filter-row .mark-filters .record-mark .icon {
  width: 18px;
  height: 18px;
}
#app .filter-row .mark-filters .record-mark[aria-pressed="true"] {
  background: var(--paper);
  box-shadow: 0 0 0 var(--frame-hair) var(--line);
}
#app .filter-row .mark-filters .record-mark[data-mark-filter="favorite"][aria-pressed="true"] {
  color: var(--frame-favorite);
}
#app .filter-row .mark-filters .record-mark[data-mark-filter="bookmark"][aria-pressed="true"] {
  color: var(--frame-bookmark);
}
#app .list-menu-clear {
  width: auto;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: calc(var(--frame-radius) - 3px);
  background: transparent;
  color: var(--accent);
  font-size: calc(14px * var(--text-scale));
  font-weight: 500;
  white-space: nowrap;
}
#app .list-menu-clear:hover {
  background: var(--soft);
}
/* 条件が無い間は場所を取ったまま隠す(出入りで並べ替えや札を動かさない)。 */
#app .list-menu-clear:disabled {
  visibility: hidden;
}
#app .list-menu-clear[hidden] {
  display: none;
}
#app .sort-slot {
  position: relative;
  margin-left: auto;
  flex: none;
}
/* 並べ替え: 枠なしの記号。古い順の間だけ溝の面に「古い順」。押せる範囲は外へ 4px 広げて 44。 */
#app .sort-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: calc(var(--frame-radius) - 2px);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}
#app .sort-filter::after {
  content: "";
  position: absolute;
  inset: -4px;
}
#app .sort-filter .icon {
  width: 18px;
  height: 18px;
}
#app .sort-filter:hover,
#app .sort-filter[aria-expanded="true"] {
  background: var(--soft);
}
#app .sort-filter.changed {
  background: var(--frame-segment);
}
#app .sort-filter > span {
  display: inline;
}
@container record-list (max-width: 420px) {
  #app .list-header {
    padding: 10px 16px;
  }
  #app .list-title-row,
  #app .list-heading,
  #app .filter-row,
  #app .filter-row .kind-filter:not([hidden]) {
    gap: 6px;
  }
  #app .filter-row .kind-filter-tabs .kind-filter-choice {
    padding: 0 8px;
  }
  #app .list-menu-clear {
    padding: 0 4px;
  }
  #app .search-key {
    display: none;
  }
  /* 狭い幅では並べ替えは記号だけ(今の順はメニューの ✓ で分かる)。文字を大きくしても帯からはみ出さず、
     収まらないときだけ並べ替えが次の行の右端へ回る(web.center-bar#B1)。 */
  #app .sort-filter > span {
    display: none;
  }
}
@container record-list (max-width: 560px) {
  /* 件数の予約幅は保ち、見方の操作を次の段へ送る。大きな字なら題と件数も折り返す。 */
  #app .list-heading {
    flex-wrap: wrap;
  }
  #app .list-title-group {
    max-width: 100%;
    flex-wrap: wrap;
  }
  #app .list-count {
    min-width: max(4.5em, calc(var(--count-ch, 21) * 1ch));
  }
}
/* 種類の札は3段目に1行で収まるので、メニュー(「すべて ▾」)にするのはごく狭い幅だけ。 */
@container record-list (max-width: 620px) {
  #app .filter-row .kind-filter-tabs {
    display: flex;
  }
  #app .filter-row .kind-filter-popup {
    display: none;
  }
}
@container record-list (max-width: 330px) {
  #app .filter-row .kind-filter-tabs {
    display: none;
  }
  #app .filter-row .kind-filter-popup {
    display: block;
  }
}

/* ---------- 左の帯のプロジェクト(CD 10/17 案1、claim:web-project-rail-and-create-dialog-redesign・
   claim:web-project-tree-reads-as-hierarchy-indent-tight-grouping) ----------
   行は「開閉 16・記号と題・右の場所 64」。子は親の題の書き出しの真下(左 48)から、親と子の間 0、子の行 28 で詰めて並べ、
   親の記号の中心(左 34)から縦線 1px でひとまとまりに見せる。 */
/* 帯の行は折り返さない(狭い窓では題を省略する)。 */
#main-nav .nav-item {
  white-space: nowrap;
}
#app .workspace-section-heading,
#app .tag-sort-heading {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  padding: 0 4px 0 6px;
  color: var(--muted);
  font-size: calc(12px * var(--text-scale));
  font-weight: 600;
  letter-spacing: 0.04em;
}
#app .section-toggle,
#app #tag-preview-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  min-height: 24px;
  margin-right: auto;
  padding: 0 4px 0 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
}
#app .section-toggle:hover,
#app #tag-preview-toggle:hover {
  color: var(--ink);
}
#app .section-toggle .icon,
#app #tag-preview-toggle .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
  transition: transform 0.15s;
}
#app .section-toggle[aria-expanded="false"] .icon,
#app #tag-preview-toggle[aria-expanded="false"] .icon {
  transform: rotate(-90deg);
}
#app .section-count {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
#app .workspace-section-heading .section-tool {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
#app .workspace-section-heading .section-tool:hover,
#app .workspace-section-heading .section-tool[aria-expanded="true"] {
  background: var(--soft);
  color: var(--ink);
}
#app .workspace-section-heading .section-tool .icon {
  width: 18px;
  height: 18px;
}
#app #project-entry-rows {
  display: block;
  /* 少なければ中身の高さ、多ければ6行分で区画の中を送る(web.left-bar#L6)。索引の行が下に見えるように。 */
  max-height: calc(6 * 32px + 20px);
  /* 下端 16px を地の色へぼかし、続きがあると見せる(CD 10/17)。送り切ると余白なので最後の行はぼけない。 */
  padding-bottom: 16px;
  /* ぼかしの余白の分だけ詰め、区画の間はほかと同じ 32px に保つ。 */
  margin-bottom: -16px;
  mask-image: linear-gradient(to bottom, currentColor calc(100% - 16px), transparent);
  overflow: auto;
}
#app #project-entry-rows[hidden] {
  display: none;
}
#app #project-entry .project-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  min-height: 32px;
  padding: 0 4px;
  border-radius: calc(var(--frame-radius) - 2px);
  list-style: none;
  cursor: default;
}
#app #project-entry .project-row::-webkit-details-marker {
  display: none;
}
#app #project-entry .project-row:hover {
  background: var(--soft);
}
#app #project-entry details.active > .project-row {
  background: var(--frame-thumb);
  color: var(--on-thumb);
  font-weight: 600;
}
#app
  #project-entry
  details.active
  > .project-row
  :is(.project-condition, .project-disclosure, .project-count, .count-hit, .icon, .icon-button) {
  color: var(--on-thumb);
}
#app #project-entry .project-disclosure {
  display: grid;
  place-items: center;
  width: 16px;
  height: 24px;
  flex: none;
  color: var(--frame-faint);
  cursor: pointer;
}
#app #project-entry .project-disclosure .icon {
  width: 12px;
  height: 12px;
  stroke-width: 2.4;
  transition: transform 0.15s;
}
#app #project-entry details[open] > .project-row .project-disclosure .icon {
  transform: rotate(90deg);
}
#app #project-entry .project-condition {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: calc(14px * var(--text-scale));
  text-align: left;
}
#app #project-entry .project-condition .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}
#app #project-entry .project-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#app #project-entry details.zero:not(.active) > .project-row .project-condition {
  opacity: 0.45;
}
/* 右の場所: 少なくとも「+」「…」の 56px。数が長いときは数の分だけ広がり、題の方が縮む(数を題に重ねない)。 */
#app #project-entry .project-slot {
  position: relative;
  display: flex;
  justify-content: flex-end;
  min-width: 56px;
  height: 28px;
  flex: none;
}
#app #project-entry .project-count {
  padding-right: 4px;
  line-height: 28px;
  white-space: nowrap;
  color: var(--muted);
  font-size: calc(13px * var(--text-scale));
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
#app #project-entry .count-hit,
#app .workspace-index-row .count-hit {
  color: var(--ink);
  font-weight: 600;
}
/* 選んだ索引の行は字の色の面なので、当たりの数も行の字の色(地の色)で読む。 */
#app .workspace-index-row.active .count-hit {
  color: inherit;
}
#app #project-entry .project-tools {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
}
#app #project-entry .project-tools .icon-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
#app #project-entry details:not(.active) > .project-row .project-tools .icon-button:hover,
#app #project-entry details:not(.active) > .project-row .project-tools .icon-button[aria-expanded="true"] {
  background: var(--frame-segment);
  color: var(--ink);
}
#app #project-entry .project-tools .icon {
  width: 16px;
  height: 16px;
}
#app #project-entry .project-row:is(:hover, :has(:focus-visible), :has([aria-expanded="true"])) .project-tools {
  opacity: 1;
}
#app #project-entry .project-row:is(:hover, :has(:focus-visible), :has([aria-expanded="true"])) .project-count {
  opacity: 0;
}
/* 触れる手段の無い端末: 数は出したまま「…」だけをいつも出す。「+」は「…」の先頭の項目へ(CD 10/17)。 */
@media (hover: none) {
  #app #project-entry .project-tools {
    opacity: 1;
  }
  #app #project-entry .project-tools .icon-button:not(.project-row-menu) {
    display: none;
  }
  #app #project-entry .project-tools {
    position: static;
  }
  #app #project-entry .project-count,
  #app #project-entry .project-row:is(:hover, :has(:focus-visible), :has([aria-expanded="true"])) .project-count {
    opacity: 1;
  }
}
#app #project-entry details:not(.active) > .project-row.fresh {
  animation: project-fresh 1.2s ease-out;
}
@keyframes project-fresh {
  from {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
  }
  to {
    background: transparent;
  }
}
/* 入れ子 */
#app #project-entry details > nav {
  position: relative;
  display: block;
  margin: 0 0 2px;
  padding: 0;
}
#app #project-entry details > nav::before {
  content: "";
  position: absolute;
  left: 34px;
  top: 0;
  bottom: 6px;
  border-left: 1px solid var(--line);
}
#app #project-entry .project-member {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  min-width: 0;
  padding: 0 4px 0 48px;
  border-radius: 6px;
}
#app #project-entry .project-member:hover,
#app #project-entry .project-member.active {
  background: var(--soft);
}
#app #project-entry .project-member-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: calc(14px * var(--text-scale));
  font-weight: 400;
  text-align: left;
}
#app #project-entry .project-member-title > .icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}
#app #project-entry .project-member-name {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#app #project-entry .project-member-title > .project-member-pin {
  width: 12px;
  height: 12px;
}
#app #project-entry .project-member-menu {
  position: absolute;
  top: 0;
  right: 4px;
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  opacity: 0;
}
#app
  #project-entry
  .project-member:is(:hover, :has(:focus-visible), :has([aria-expanded="true"]))
  .project-member-menu {
  opacity: 1;
}
@media (hover: none) {
  #app #project-entry .project-member-menu {
    opacity: 1;
  }
}
#app #project-entry .project-member-menu .icon {
  width: 16px;
  height: 16px;
}
#app #project-entry .project-member-more,
#app #project-entry details > nav > .empty-note,
#app #project-entry details > nav > p {
  display: flex;
  align-items: center;
  width: 100%;
  height: 28px;
  min-height: 28px;
  margin: 0;
  padding: 0 4px 0 48px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: calc(13px * var(--text-scale));
  text-align: left;
}
#app #project-entry .project-member-more:hover {
  background: var(--soft);
  color: var(--ink);
}
#app #project-entry .project-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 8px 0 26px;
  border: 0;
  border-radius: calc(var(--frame-radius) - 2px);
  background: transparent;
  color: var(--muted);
  font-size: calc(14px * var(--text-scale));
}
#app #project-entry .project-add-row:hover {
  background: var(--soft);
  color: var(--ink);
}
#app #project-entry .project-add-row .icon {
  width: 16px;
  height: 16px;
}

/* 作る窓: 「+」の下 10px に出るポップオーバー(600px 未満は下からのシート)。OS の浮く部品の形。 */
.project-create {
  position: fixed;
  inset: auto;
  margin: 0;
  width: 320px;
  padding: 14px;
  overflow: visible;
  border: var(--frame-hair) solid var(--line);
  border-radius: 12px;
  background: var(--raised);
  color: var(--ink);
  box-shadow: 0 12px 36px var(--raised-shadow);
}
.project-create::before {
  content: "";
  position: absolute;
  top: -6.5px;
  left: var(--arrow-x, 20px);
  width: 12px;
  height: 12px;
  background: var(--raised);
  border-left: var(--frame-hair) solid var(--line);
  border-top: var(--frame-hair) solid var(--line);
  transform: rotate(45deg);
}
.project-create.is-sheet {
  max-height: calc(100dvh - 16px);
  overflow: auto;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: auto;
  max-width: none;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
  border-radius: 14px 14px 0 0;
}
.project-create.is-sheet::before,
.project-create.no-arrow::before {
  content: none;
}
/* 縦が足りない窓では矢印を出さず、窓の中で送る(矢印は外へはみ出すので、送るときだけ overflow を付ける)。 */
.project-create.no-arrow {
  max-height: calc(100dvh - 16px);
  overflow: auto;
}
.project-create.is-sheet::backdrop {
  background: var(--overlay);
}
.project-create h3 {
  margin: 0 0 10px;
  font-size: calc(15px * var(--text-scale));
  font-weight: 600;
}
form.project-form .project-field {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: calc(15px * var(--text-scale));
  resize: none;
  outline: none;
}
.project-form .project-field + .project-field {
  margin-top: 8px;
}
.project-form .project-field::placeholder {
  color: var(--frame-faint);
}
.project-form .project-field:focus {
  box-shadow: 0 0 0 2px var(--accent);
}
.project-form-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: calc(12px * var(--text-scale));
}
.project-form .empty-note:empty {
  display: none;
}
.project-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.project-form-actions .button {
  min-height: 30px;
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: var(--frame-segment);
  color: var(--ink);
  font-weight: 500;
}
.project-form-actions .button.primary {
  background: var(--accent);
  color: var(--base-bg);
}
.project-form-actions .button.primary:disabled {
  opacity: 0.4;
}

/* 並べ替えの初回の吹き出し: 並べ替えの下、右端にそろえる。押しを奪わない(OK だけが押せる)。 */
#app .sort-tip {
  position: absolute;
  top: 44px;
  right: 0;
  z-index: 30;
  width: 220px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  font-size: calc(13px * var(--text-scale));
  line-height: 1.5;
  pointer-events: none;
}
#app .sort-tip::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 14px;
  width: 10px;
  height: 10px;
  background: var(--toast-bg);
  transform: rotate(45deg);
}
#app .sort-tip p {
  margin: 0;
}
#app .sort-tip-ok {
  display: block;
  margin: 6px 0 0 auto;
  padding: 2px 6px;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 600;
  pointer-events: auto;
}

/* CD 10/17 の見直し: 欄の札・左の帯の行・390 の重なり */
#app #list-tags .chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  min-height: 24px;
  padding: 0 6px 0 8px;
  border: var(--frame-hair) solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: calc(13px * var(--text-scale));
  white-space: nowrap;
}
#app #list-tags .chip-label,
#app #list-tags .chip-remove {
  color: var(--muted);
}
#app #list-tags .chip:hover .chip-remove {
  color: var(--ink);
}
/* 子の行の「…」は場所を取らず、触れたときに題の末尾の上に重ねる(押し動かさない)。 */
#app #project-entry .project-member-menu {
  background: var(--soft);
  border-radius: 6px;
}
/* 帯の中の字は1行。末尾を … にする。 */
#app .sidebar :is(.nav-item, .account-name, .connect-ai) {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#app #main-nav .nav-item .count {
  flex: none;
}
/* 索引の行は少なくとも3行見える(区画の中で送る)。 */
#app .index-rows {
  min-height: calc(3 * 36px);
}
/* 重ねて出す帯(狭い幅)では、左上の開閉の記号を出さない。閉じるは帯の × だけ。 */
@media (max-width: 700px) {
  #app.nav-open .sidebar-toggle {
    display: none;
  }
}

/* メニューの選んだ行(触れている・キーで選んでいる行): 字の色の面に地の色の字(CD 10/17 §7。テーマの色の面に白は
   ライトで 4.0:1 と足りない)。色の正本は先頭の --frame-thumb・--on-thumb の1組で、候補の一覧(束6、.source-option)も同じ組を使う(束6と合意)。 */
#list-menu .list-menu-item:is(:hover, :focus-visible),
:is(#project-section-options, #project-row-actions, #project-member-actions)
  [role="menuitem"]:is(:hover, :focus-visible) {
  background: var(--frame-thumb);
  color: var(--on-thumb);
  font-weight: 600;
  outline: none;
}
:is(#project-section-options, #project-row-actions, #project-member-actions) [role="menuitem"] {
  border-radius: 6px;
}

/* 一覧の表示(開発用)の窓。CD の作る窓(7.3)と同じ浮いた面の作り。インスペクターの定石どおり右下に重ね、一覧を見ながら変える。
   値の正本は display-limits.js。浮いた面と欄の色は束2+3 のトークン(--raised・--field)を使い、無ければ紙と淡い面。 */
.display-limits-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 14px;
  background: var(--raised, var(--paper));
  color: var(--ink);
  border: var(--frame-hair) solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 36px var(--raised-shadow, transparent);
  font-size: var(--text-caption);
}
.display-limits-panel[hidden] {
  display: none;
}
.display-limits-title {
  margin: 0 0 10px;
  font-size: calc(15px * var(--text-scale));
  font-weight: 600;
}
/* 欄の並びだけを送る。題と下のボタンはいつも見える。下端 16px をぼかし、続きがあると見せる(CD 10/17)。 */
.display-limits-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 16px;
  mask-image: linear-gradient(to bottom, currentColor calc(100% - 16px), transparent);
}
.display-limits-group {
  margin: 0 0 10px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--field, var(--soft));
}
.display-limits-group legend {
  float: left;
  width: 100%;
  margin: 4px 0 2px;
  color: var(--muted);
  font-size: calc(12px * var(--text-scale));
}
.display-limits-row {
  clear: both;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0 8px;
  padding: 4px 0;
}
.display-limits-row output {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.display-limits-row input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 28px;
  accent-color: var(--accent);
}
.display-limits-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}
.display-limits-actions .button {
  min-height: 30px;
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: var(--frame-segment);
  color: var(--ink);
  font-weight: 500;
}
.display-limits-actions .button.primary {
  background: var(--accent);
  color: var(--base-bg);
}
/* 既定に戻すは左に離して置く(キャンセルと主ボタンの組と混ぜない)。 */
.display-limits-actions .display-limits-reset {
  margin-right: auto;
  background: none;
  padding: 0 4px;
  color: var(--muted);
}

/* 期間は印と同じ札の中。長い日付は省略して、条件の行を増やさない。 */
#app .filter-row .kind-filter:not([hidden]) {
  flex: 1 1 0;
  min-width: 0;
}
#app .filter-row .mark-filters {
  display: flex;
  flex: 0 1 auto;
  min-width: 0;
}
.period-filter {
  display: flex;
  align-items: center;
  min-width: 0;
  color: var(--muted);
}
.period-filter-menu {
  position: relative;
  min-width: 0;
}
.period-filter-menu > summary {
  display: block;
  height: 28px;
  padding: 0 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 28px;
  cursor: pointer;
  list-style: none;
  font-size: calc(14px * var(--text-scale));
  color: var(--frame-faint);
}
.period-filter-menu > summary::-webkit-details-marker {
  display: none;
}
.period-filter.is-active summary {
  color: var(--muted);
}
.period-filter-clear {
  flex: none;
  min-height: 28px;
  padding: 0 6px 0 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.period-filter-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  right: 0;
  width: 200px;
  max-height: calc(100dvh - 160px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--frame-radius);
  background: var(--paper);
  box-shadow: 0 8px 24px var(--shadow);
}
.period-filter-options > button,
.period-filter-dates > button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: calc(14px * var(--text-scale));
}
.period-filter-options button:hover {
  background: var(--frame-segment);
}
.period-filter-dates label {
  display: grid;
  gap: 4px;
  padding: 6px;
  color: var(--muted);
  font-size: calc(14px * var(--text-scale));
}
.period-filter-dates input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@container record-list (max-width: 420px) {
  .period-filter-menu > summary {
    max-width: 82px;
    padding: 0 6px;
  }
}
/* 索引のピン。名前と件数は動かさない。 */
.index-pin {
  width: 13px;
  height: 13px;
  margin-left: 4px;
  color: var(--muted);
  vertical-align: middle;
}
.index-pin-heading {
  height: 36px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  color: var(--muted);
}
.stats-ai-input {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 44px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  cursor: pointer;
}
.stats-ai-input input {
  width: 18px;
  height: 18px;
  flex: none;
  margin: 0;
  accent-color: var(--accent);
}

.tag-page-band {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 88px;
  flex: none;
  padding: 8px 16px;
  margin-bottom: 8px;
  color: var(--ink);
}
.tag-page-preview {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 24px;
  margin: 0;
  min-width: 0;
  flex: 1;
}
.tag-page-open {
  flex: none;
}

/* 中央の帯の戻る・進む(1段目の先頭、題の前。案C の帯に合わせ、枠なしの 28×28 の記号。字は弱い色、触れると面)。
   押せない間は薄くして場所と焦点を残す(web.center-bar#back・forward)。 */
#app .history-nav {
  display: inline-flex;
  flex: none;
  gap: 2px;
}
#app .history-nav[hidden] {
  display: none;
}
#app .history-nav .icon-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: calc(var(--frame-radius) - 3px);
  background: none;
  color: var(--muted);
}
#app .history-nav .icon-button:hover:not([aria-disabled="true"]) {
  background: var(--soft);
}
#app .history-nav .icon-button[aria-disabled="true"] {
  opacity: 0.35;
  cursor: default;
}
/* 真ん中が 560px 以下は帯が折り返す幅(束2+3 の帯)なので、戻る・進むは置かない。ブラウザーと OS の戻る・進むが担う。 */
@container record-list (max-width: 560px) {
  #app .history-nav {
    display: none;
  }
}
