/* =========================================================
   SeNSe+
   基本画面は「記録」。つくる・メニューは上に重なるシート。
   明るい地に濃い文字。暗い面に薄い文字は置かない。
   ========================================================= */

:root {
  color-scheme: light;

  /* 地は白。沈めたい面だけ薄いグレー */
  --bg:         #ffffff;
  --bg-2:       #f7f8fa;
  --surface:    #ffffff;
  --surface-2:  #f0f2f6;
  --ink:        #14161c;
  --ink-2:      #4a5160;
  --ink-3:      #666c78;   /* 白・コーラル地・薄灰地のどれでも 4.5:1 以上。これ以上薄い文字は作らない */
  --line:       #e8eaf0;
  --line-soft:  #f0f2f6;

  --accent:     #f2542d;
  --accent-ink: #c93c1c;
  --accent-bg:  #fff1ec;
  /* 白文字を載せる面。両端とも 4.5:1 以上（いちばん薄いところで 4.59） */
  --accent-grad: linear-gradient(100deg, #ce4726 0%, #d7336a 100%);
  --good:       #0f8a5f;
  --focus:      #2970ff;

  --band-peak:    #f2542d;
  --band-ahead:   #f0a12d;
  --band-offpeak: #a8b0be;

  --font: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;

  --t-display: clamp(1.22rem, 4.4vw, 1.45rem);
  --t-title:   1.05rem;
  --t-body:    0.95rem;
  --t-meta:    0.8rem;

  --tap: 44px;
  --col: 560px;
  --appbar: 60px;
  --r:    18px;
  --r-sm: 12px;

  --shadow-1: 0 1px 3px rgba(20, 22, 28, 0.06);
  --shadow-2: 0 10px 30px rgba(20, 22, 28, 0.12);
  --shadow-3: 0 -8px 34px rgba(20, 22, 28, 0.14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-body);
  line-height: 1.75;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
}

p, h1, h2, h3, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }

:where(a, button, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 8px;
}

.skip-link {
  position: absolute;
  left: -9999px; top: 8px;
  z-index: 60;
  padding: 12px 18px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
}
.skip-link:focus { left: 16px; }

.hint {
  font-size: var(--t-meta);
  line-height: 1.65;
  color: var(--ink-3);
}
.hint.center { text-align: center; margin-top: 24px; }

.label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--t-meta);
  font-weight: 700;
  color: var(--ink-2);
}

.field + .field { margin-top: 20px; }
.field .hint { margin-top: 6px; }

/* ── 殻: 上の帯 ───────────────────────── */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--appbar);
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}

.brand-plus { color: var(--accent); }

.appbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--tap);
  padding: 0 16px;
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.pill:hover { border-color: var(--ink-3); }
.pill[disabled] { opacity: 0.55; cursor: progress; }

.spin {
  width: 13px; height: 13px;
  border: 2px solid var(--ink-3);
  border-top-color: transparent;
  border-radius: 50%;
}
.pill.is-busy .spin { animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap); height: var(--tap);
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; display: block; }

/* ── 基本画面 ─────────────────────────── */

.screen {
  max-width: var(--col);
  margin: 0 auto;
  padding: 14px 16px calc(120px + env(safe-area-inset-bottom));
}

/* 初回の入口 */
.gate {
  padding: 48px 8px 24px;
  text-align: center;
}
.gate-title {
  margin-bottom: 14px;
  font-size: var(--t-display);
  font-weight: 700;
  line-height: 1.65;
}
.gate-lead {
  margin-bottom: 28px;
  color: var(--ink-2);
  line-height: 1.9;
}

/* ── 今日わかったこと ─────────────────── */

.insight {
  background: var(--accent-bg);
  border-radius: var(--r);
  overflow: hidden;
}

.insight-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.insight-head::-webkit-details-marker { display: none; }

.insight-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px; height: 30px;
  color: #fff;
  background: var(--accent-grad);
  border-radius: 50%;
}
.insight-icon svg { width: 17px; height: 17px; }

.insight-main { flex: 1; min-width: 0; }

.insight-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-ink);
}

.insight-line {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 1px;
  font-weight: 700;
  line-height: 1.6;
}

.chev {
  flex-shrink: 0;
  width: 8px; height: 8px;
  margin-top: 10px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.2s;
}
.chev.right { transform: rotate(-45deg) translate(-1px, 1px); }
details[open] > .insight-head .chev,
details[open] > .fold-head .chev { transform: rotate(-135deg) translate(-3px, -3px); }
.fold-head .chev { margin-top: 0; }

.insight-body {
  margin: 0 8px 8px;
  padding: 4px 14px 8px;
  background: var(--surface);
  border-radius: var(--r-sm);
}

.insight-date {
  padding: 10px 0 2px;
  font-size: var(--t-meta);
  letter-spacing: 0.08em;
  color: var(--ink-3);
}

/* 本文・数え方・採用を縦に積む。
   横に3つ並べていたときは、狭い画面で折り返しだらけで読めなかった */
.insight-item { padding: 12px 0; }

.insight-how {
  margin: 4px 0 0;
  font-size: var(--t-meta);
  color: var(--ink-3);
}

.insight-act {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.insight-item + .insight-item { border-top: 1px solid var(--line-soft); }

.insight-text { line-height: 1.7; }

.btn-adopt {
  flex-shrink: 0;
  height: var(--tap);
  padding: 0 16px;
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent-bg);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-adopt:hover { background: #ffe2d8; }
.btn-adopt.done {
  color: var(--ink-3);
  background: var(--surface-2);
  cursor: default;
}

.insight-empty { padding: 10px 0 4px; line-height: 1.8; }

/* ── 知らせ ───────────────────────────── */

.notice {
  margin-top: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-2);
  border-radius: var(--r);
}
.notice-text { font-weight: 500; }
.notice-sub { margin-top: 2px; font-size: var(--t-meta); color: var(--ink-3); }

/* ── 一覧の上の1行（並べ方は常時表示）───── */

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

.listbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 16px 0 4px;
}

.listbar select {
  width: auto;
  min-height: var(--tap);
  padding: 0 34px 0 14px;
  font-size: var(--t-meta);
  font-weight: 500;
  background: var(--bg-2);
  border-color: transparent;
  border-radius: 999px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 14px;
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--ink-2);
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.filter-btn svg { width: 16px; height: 16px; }
.filter-btn:hover { color: var(--ink); }
.filter-btn.on {
  color: var(--accent-ink);
  background: var(--accent-bg);
  border-color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  /* 小さい白文字を載せるので、--accent より濃い側を使う（5.06:1） */
  background: var(--accent-ink);
  border-radius: 999px;
}

/* 件数が4桁になると、なりゆき幅では横にはみ出す（1624件で実測）。
   縮められるようにして、それでも足りなければ下の行へ回す */
.list-count {
  flex: 0 1 auto;
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  font-size: var(--t-meta);
  color: var(--ink-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 取り込む範囲のメニュー ───────────── */

.range-wrap { position: relative; }

.range-menu {
  position: absolute;
  top: calc(var(--appbar) / 2 + 14px);
  right: 0;
  z-index: 40;
  width: max(220px, 60vw);
  max-width: 260px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-2);
  animation: lift 0.16s ease;
}

.range-menu button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: var(--tap);
  padding: 9px 12px;
  font: inherit;
  font-size: var(--t-body);
  font-weight: 500;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.range-menu button:hover { background: var(--bg-2); }
.range-menu button.on { color: var(--accent-ink); background: var(--accent-bg); }
.range-menu small { font-size: var(--t-meta); color: var(--ink-3); font-weight: 400; }
.range-menu button.on small { color: var(--accent-ink); opacity: 0.8; }

/* ── 選んだ投稿のバー ─────────────────── */

.pickbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(calc(100vw - 32px), var(--col));
  padding: 10px 12px 10px 18px;
  background: var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  animation: lift 0.2s ease;
}

.pickbar-count {
  flex: 1;
  font-size: var(--t-meta);
  font-weight: 700;
  color: #fff;
}
.pickbar .btn-quiet {
  color: #fff;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
}
.pickbar .btn-quiet:hover { border-color: #fff; color: #fff; }

/* 投稿の選択 */
.post { position: relative; }
.post.picked { background: var(--accent-bg); }

.pick {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--tap); height: var(--tap);
  margin: -10px 0 0 -12px;
  float: left;
  cursor: pointer;
}
.pick input {
  width: 20px; height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── 最低値の行 ───────────────────────── */

.minrow {
  display: flex;
  align-items: center;
  gap: 8px;
}
.minrow select { width: auto; flex: 0 0 auto; }
.minrow input { flex: 1; min-width: 0; min-height: var(--tap); }
.minrow-gap { font-size: var(--t-meta); color: var(--ink-3); white-space: nowrap; }

.head-right { margin-left: auto; }

input[type="search"], input[type="number"] {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
input[type="search"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* 参考にする投稿の中の探し口 */
.picker-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.picker-tools input { flex: 1; min-width: 0; }
.picker-tools select { width: auto; flex: 0 0 auto; font-size: var(--t-meta); }


.post-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  font-size: var(--t-meta);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.fact { display: inline-flex; align-items: center; gap: 4px; }

/* 自分の全投稿の中での位置。公式は直近5件としか比べられない */
.rankbadge {
  padding: 1px 7px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  border-radius: 999px;
}
.rankbadge.top { color: var(--accent-ink); background: var(--accent-bg); }
.fact svg { width: 14px; height: 14px; flex-shrink: 0; }

/* 採用したときに「何が変わったか」を出す。押しても分からない状態にしない */
.adopt-status {
  margin-top: 8px;
  padding: 0 14px 12px;
  font-size: var(--t-meta);
  font-weight: 700;
  color: var(--accent-ink);
}
/* 採用ボタンの右に置く。入り切らなければ下へ回る */
.insight-rule {
  flex: 1 1 12em;
  margin: 0;
  font-size: var(--t-meta);
  color: var(--ink-2);
}

/* ── 投稿ごとの伸び方（折れ線）───────────── */

.sbox { margin-top: 10px; }
.sbox-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.sbox-metric { width: auto; font-size: var(--t-meta); }
.sbox-note { font-size: var(--t-meta); color: var(--ink-3); }
/* 凡例を下に置くので、そのぶん高さを足す */
.sbox-canvas { position: relative; height: 164px; }

/* とくに速く伸びている投稿の印 */
.fastmark {
  display: inline-flex;
  align-items: center;
  color: var(--accent-ink);
}
.fastmark svg { width: 15px; height: 15px; }

/* ── いつ出すと届くか（曜日 × 時間帯）───────── */

.heat { margin-bottom: 10px; }
.heat-canvas { position: relative; height: 210px; }
.heat-note {
  margin-top: 6px;
  font-size: var(--t-meta);
  font-weight: 700;
  color: var(--accent-ink);
}
.heat-thin { margin-top: 4px; font-size: var(--t-meta); color: var(--ink-3); }

/* ── 投稿案の比較（Threads の投稿画面に似せる）───── */

.pattern-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.pattern-no { flex: 1; font-size: var(--t-meta); color: var(--ink-3); font-variant-numeric: tabular-nums; }

.starbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap); height: var(--tap);
  margin: -10px -6px -10px 0;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-3);
  background: none;
  border: 0;
  cursor: pointer;
}
.starbtn[aria-pressed="true"] { color: #e8a800; }

/* ひとつ戻す／最初に戻す。押せる的は 44px を保つ */
.icon-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap); height: var(--tap);
  margin: -10px 0;
  color: var(--ink-3);
  background: none;
  border: 0;
  cursor: pointer;
}
.icon-mini svg { width: 19px; height: 19px; }
.icon-mini:hover:not(:disabled) { color: var(--accent-ink); }
.icon-mini:disabled { opacity: 0.3; cursor: default; }

.pattern.starred { border-color: #f0d48a; box-shadow: 0 0 0 1px #f0d48a inset; }

/* Threads の投稿の見え方。1行に入る文字数をそろえるのが要点。
   全角1文字 = 1em なので、幅を em で決めれば行あたりの字数が決まる */
.tprev {
  /* Threads の投稿画面にスクロールバーは出ない。カードの側を広げて避ける */
  --tprev-size: 15px;      /* Threads 本文の文字の大きさ */
  --tprev-cols: 20;        /* 1行に入る全角の文字数。ここを変えれば折り返しが変わる */
  /* 見え方を合わせるには字体もそろえる必要がある。Threads は端末の標準の字体 */
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.tprev-avatar {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(140deg, #d9dde5, #eef0f4);
}
.tprev-body {
  /* 1行の字数を守るため縮ませない。入り切らないぶんは .tprev が横に流す */
  flex: 0 0 auto;
  /* 既定は em ぶん。字体によって全角の幅は 1em ちょうどではないので、
     実際の幅を測って --tprev-em を入れ直す（fitPreviewWidth） */
  width: calc(var(--tprev-cols) * var(--tprev-em, 1em));
  font-size: var(--tprev-size);
}
.tprev-name {
  font-size: var(--tprev-size);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}
.tprev-time { margin-left: 8px; font-weight: 400; color: var(--ink-3); }
.tprev-text {
  display: block;
  width: 100%;
  margin-top: 2px;
  padding: 0;
  font: inherit;
  font-size: var(--tprev-size);
  line-height: 1.4;                 /* Threads と同じ行間 */
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 0;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}
.tprev-text:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.tprev-acts { display: flex; gap: 16px; margin-top: 10px; color: var(--ink-3); }
.tprev-acts svg { width: 18px; height: 18px; }

/* 作り物で動かしているときの帯。実データと取り違えないように */
.mockbar {
  margin-bottom: 10px;
  padding: 8px 14px;
  font-size: var(--t-meta);
  font-weight: 700;
  color: #6b4a00;
  background: #fff3cd;
  border: 1px solid #ffe08a;
  border-radius: var(--r);
}

/* ── 日ごとの推移 ─────────────────────── */

.trend {
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.trend-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 14px;
  font-size: var(--t-meta);
  cursor: pointer;
  list-style: none;
}
.trend-head::-webkit-details-marker { display: none; }
.trend-title { font-weight: 700; color: var(--ink-2); }
.trend-sub { margin-left: auto; color: var(--ink-3); }
.trend-body { padding: 0 14px 12px; }
.trend-tools { margin-bottom: 6px; }
.trend-tools select { width: auto; font-size: var(--t-meta); }

.chart-wrap { overflow-x: auto; }
/* 点が多い日は横に伸びる。枠の中だけで流す（ページは横に動かさない） */
.chart { display: block; height: 132px; }
.chart-line {
  fill: none;
  stroke: var(--accent-ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart-zero { stroke: var(--line); stroke-width: 1; }
.chart-axis {
  fill: var(--ink-3);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
/* 投稿した日は塗りつぶし、出していない日は白抜き */
.chart-dot {
  fill: var(--surface);
  stroke: var(--accent-ink);
  stroke-width: 2;
}
.chart-dot.posted { fill: var(--accent-ink); }
.chart-dot.on { fill: var(--ink); stroke: var(--ink); }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-hit:focus { outline: 2px solid var(--focus); outline-offset: 1px; }

.cta .btn-quiet { width: 100%; }
.cta .btn-primary { width: 100%; margin-top: 8px; }

#trend-note {
  min-height: 2.6em;
  margin-top: 6px;
  white-space: pre-line;
}

/* ── 日ごとの見出し ───────────────────── */

/* プロフィールが見られた回数もフォローも、どの投稿から来たかは取れない。
   投稿の行ではなく日の側に置く */
.day-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 12px 16px 8px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.posts > .day-head:first-child { border-top: 0; }
.day-date {
  font-size: var(--t-meta);
  font-weight: 700;
  color: var(--ink-2);
}
.day-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-left: auto;
  font-size: var(--t-meta);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ── 投稿のならび（カードではなく区切り線）───── */

.posts { margin: 0 -16px; }

.post {
  padding: 14px 16px 10px;
  border-top: 1px solid var(--line);
}
.post:first-child { border-top: 0; }
.day-head + .post { border-top: 0; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  font-size: var(--t-meta);
  color: var(--ink-3);
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--band-offpeak);
  flex-shrink: 0;
}
.dot.peak  { background: var(--band-peak); }
.dot.ahead { background: var(--band-ahead); }

.post-kind {
  margin-bottom: 4px;
  font-size: var(--t-meta);
  font-weight: 700;
  color: var(--accent-ink);
}

.post-text {
  font-size: 1rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  /* 長い投稿で一覧が流れないよう4行で畳む。開くと全部出る */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}
.post-text.open {
  display: block;
  overflow: visible;
}

.text-more {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  margin-left: -4px;
  padding: 0 4px;
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 700;
  color: var(--accent-ink);
  background: none;
  border: 0;
  cursor: pointer;
}
.text-more:hover { text-decoration: underline; }

.post-thumb {
  width: 100%;
  max-width: 220px;
  margin-top: 10px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}

/* Threads と同じ並び: いいね・返信・リポスト・引用、最後に表示 */
.post-stats {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0 0 -8px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 52px;
  /* 押せない表示なので、的の大きさ（44px）は要らない */
  height: 28px;
  padding: 0 8px;
  font-size: var(--t-meta);
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.stat svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--ink-3);
}
.stat.views { margin-left: auto; min-width: 0; }
.stat.zero { color: var(--ink-3); }

.post-wait {
  margin-top: 8px;
  font-size: var(--t-meta);
  color: var(--ink-3);
}

.post-more {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 18px;
  padding: 8px 0 4px;
  font-size: var(--t-meta);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.post-more .pair { display: inline-flex; gap: 6px; }
.post-more dd { color: var(--ink-2); font-weight: 500; }

.post-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 12px;
  margin-top: 6px;
}
.post-tools .fold { flex: 0 0 auto; }
/* 気づきを開いたら、いちばん下に回して幅いっぱいに使う */
.post-tools .fold[open] { flex-basis: 100%; order: 9; }

.post-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap); height: var(--tap);
  margin-left: auto;
  margin-right: -10px;
  color: var(--ink-3);
  text-decoration: none;
}
.post-open svg { width: 19px; height: 19px; }
.post-open:hover { color: var(--accent-ink); }

.empty {
  margin: 24px 0;
  padding: 30px 20px;
  text-align: center;
  font-size: var(--t-meta);
  color: var(--ink-3);
  background: var(--bg-2);
  border-radius: var(--r);
}

/* ── 気づき ───────────────────────────── */

.memo { padding: 4px 0 10px; }

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 999px;
}

.seg, .tone {
  min-height: var(--tap);
  padding: 0 16px;
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.seg.on, .tone.on {
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow-1);
}
.tone.on[data-tone="flat"] { background: var(--ink-2); }
.tone.on[data-tone="note"] { background: var(--good); }

.tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0; }

.tag {
  min-height: var(--tap);
  padding: 0 14px;
  font: inherit;
  font-size: var(--t-meta);
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.tag.on {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent-bg);
}

.saved { font-size: var(--t-meta); color: var(--good); }

/* ── FAB ──────────────────────────────── */

.fab {
  position: fixed;
  right: max(16px, calc(50vw - var(--col) / 2 + 16px));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 56px;
  padding: 0 26px 0 22px;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(206, 71, 38, 0.34);
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.2s, filter 0.15s;
}
.fab:hover { filter: brightness(1.06); box-shadow: 0 12px 32px rgba(226, 66, 74, 0.46); }
.fab:active { transform: scale(0.97); }

.fab-plus {
  position: relative;
  width: 16px; height: 16px;
}
.fab-plus::before, .fab-plus::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: #fff;
  border-radius: 2px;
}
.fab-plus::before { width: 16px; height: 2.5px; }
.fab-plus::after  { width: 2.5px; height: 16px; }

/* ── シート ───────────────────────────── */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(18, 20, 28, 0.42);
  animation: veil 0.2s ease;
}

@keyframes veil { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } }

.sheet-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--col);
  height: 100dvh;
  background: var(--bg-2);
  animation: rise 0.24s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.sheet-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--appbar);
  padding: 0 10px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.sheet-title {
  font-size: var(--t-title);
  font-weight: 700;
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px calc(40px + env(safe-area-inset-bottom));
}

@media (min-width: 600px) {
  .sheet { align-items: center; padding: 24px; }
  .sheet-panel {
    height: min(88dvh, 780px);
    border-radius: 20px;
    box-shadow: var(--shadow-3);
    overflow: hidden;
  }
  .sheet-panel.short { height: auto; max-height: 88dvh; }
}

/* 手順 */
.steps {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.step {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap);
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.step i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  border-radius: 999px;
}
.step.on {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent-bg);
}
.step.on i { color: #fff; background: var(--accent-ink); }
.step.done i { color: #fff; background: var(--good); }

/* ── 部品 ─────────────────────────────── */

textarea, select {
  display: block;
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.8;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
textarea { resize: vertical; }
select { min-height: var(--tap); }

textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 30px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent-grad);
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(226, 66, 74, 0.28);
  transition: filter 0.15s, transform 0.12s, box-shadow 0.2s;
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 8px 22px rgba(226, 66, 74, 0.36); }
.btn-primary:active { transform: scale(0.985); }
.btn-primary[disabled] { opacity: 0.45; cursor: default; }
.btn-primary.small { min-height: var(--tap); padding: 0 22px; font-size: var(--t-body); }

.btn-ghost, .btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 18px;
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost { margin-top: 12px; }
.btn-quiet:hover, .btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }

.btn-next {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-top: 26px;
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.btn-next:hover { border-color: var(--ink-3); color: var(--ink); }

.cta { margin-top: 26px; text-align: center; }
.cta-status {
  margin-top: 10px;
  min-height: 1.3em;
  font-size: var(--t-meta);
  color: var(--good);
}
.cta .hint { margin-top: 10px; }

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.row .cta-status { margin-top: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  min-height: var(--tap);
  padding: 0 16px;
  font: inherit;
  font-size: var(--t-meta);
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.chip:hover { border-color: var(--ink-3); }
.chip.on {
  color: var(--accent-ink);
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* 折りたたみ */
.fold {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.fold + .field, .field + .fold, .fold + .fold { margin-top: 20px; }
.fold.quiet { background: transparent; border-color: transparent; }

.fold-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  padding: 0 14px;
  cursor: pointer;
  list-style: none;
  font-size: var(--t-meta);
}
.fold-head::-webkit-details-marker { display: none; }
.fold.quiet .fold-head { padding: 0 4px; }

.fold-name { flex: 1; font-weight: 700; color: var(--ink-2); }
.fold.quiet .fold-name { font-weight: 500; color: var(--ink-3); }
.fold-note { color: var(--ink-3); white-space: nowrap; }
.fold-body { padding: 2px 14px 14px; }
.fold.quiet .fold-body { padding: 4px 4px 10px; }

/* 参考にする投稿 */
.source-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.source-item {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.source-item:hover { border-color: var(--ink-3); }
.source-item.on { border-color: var(--accent); background: var(--accent-bg); }
.source-item[disabled] { opacity: 0.42; cursor: default; }

.src-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
}
.src-meta { margin-top: 2px; font-size: var(--t-meta); color: var(--ink-2); }

.prompt, .quote {
  margin: 0;
  padding: 14px 16px;
  max-height: 320px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--font);
  font-size: var(--t-meta);
  line-height: 1.8;
  color: var(--ink-2);
  white-space: pre-wrap;
}

/* ならんだ案 */
/* 案をならべる帯。シートの余白ぶん外に広げて、1枚が画面いっぱいに収まるようにする */
.rail {
  display: flex;
  gap: 10px;
  margin: 0 -16px;
  padding: 0 16px 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.pattern {
  /* 中身（Threads の見え方）が入り切る幅にする。
     ここを画面幅に合わせると本文に横スクロールバーが出てしまう。
     入り切らないぶんは、カルーセルごと横に流して見る */
  flex: 0 0 auto;
  width: max-content;
  max-width: none;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.pattern-no { font-size: var(--t-meta); color: var(--ink-3); }
.pattern-text {
  flex: 1;
  max-height: 160px;
  overflow: auto;
  line-height: 1.8;
  white-space: pre-wrap;
}
.pattern-actions { display: flex; gap: 8px; }

.draft-pane.is-hidden { display: none; }
.draft-pane { margin-top: 16px; }
.draft-pane label {
  display: block;
  margin: 14px 0 4px;
  font-size: var(--t-meta);
  color: var(--ink-3);
}
.meter {
  margin-top: 10px;
  font-size: var(--t-meta);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* メニュー */
.menu {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.menu + .menu, .menu + .hint { margin-top: 18px; }
.menu.quiet { background: transparent; border-color: var(--line-soft); }

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 16px;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.15s;
}
.menu-item + .menu-item { border-top: 1px solid var(--line-soft); }
.menu-item:hover { background: var(--surface-2); }
.menu-name { flex: 1; font-weight: 500; }
.menu.quiet .menu-name { font-weight: 400; color: var(--ink-2); font-size: var(--t-meta); }
.menu-note { font-size: var(--t-meta); color: var(--ink-3); }

/* 採用したこと */
.adopted {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.adopted li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  line-height: 1.65;
}
.adopted li + li { border-top: 1px solid var(--line-soft); }
.adopted span { flex: 1; }

.btn-drop {
  flex-shrink: 0;
  width: var(--tap); height: var(--tap);
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.btn-drop:hover { color: var(--ink); background: var(--surface-2); }

/* 接続の事実 */
.facts {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 16px;
}
.facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 16px;
  font-size: var(--t-meta);
}
.facts > div + div { border-top: 1px solid var(--line-soft); }
.facts dt { color: var(--ink-3); white-space: nowrap; }
.facts dd { font-weight: 500; text-align: right; }

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  font-size: var(--t-body);
  color: var(--ink);
  cursor: pointer;
}
.switch input {
  width: 22px; height: 22px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ai-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 4px;
  margin-top: 14px;
  font-size: var(--t-meta);
  color: var(--ink-3);
}
.ai-links-label { flex-basis: 100%; }
.ai-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 12px;
  color: var(--ink-2);
  font-weight: 500;
  text-underline-offset: 3px;
}

/* ── 立ち上がり ───────────────────────── */

@keyframes lift { from { opacity: 0; transform: translateY(7px); } }

.is-entering .insight,
.is-entering .gate,
.is-entering .listbar,
.is-entering .post,
.is-entering .fab {
  animation: lift 0.32s cubic-bezier(0.22, 0.8, 0.3, 1) backwards;
}
.is-entering .insight { animation-delay: 0.03s; }
.is-entering .listbar { animation-delay: 0.09s; }
.is-entering .post:nth-child(1) { animation-delay: 0.12s; }
.is-entering .post:nth-child(2) { animation-delay: 0.17s; }
.is-entering .post:nth-child(3) { animation-delay: 0.21s; }
.is-entering .fab { animation-delay: 0.26s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 参考にする投稿：件数の断り書きと、範囲を広げるボタン */
.src-foot,
.src-widen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
}
.src-foot .hint,
.src-widen .hint { margin: 0; flex: 1 1 auto; }
.src-widen { border-top: 1px solid var(--line); padding-top: 10px; }

/* 選んだ案。カルーセルの中で1つだけ */
.pattern.chosen {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}

/* ── 取り込み中の覆い ─────────────────── */

.busy {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
}

.busy-panel {
  width: 100%;
  max-width: 340px;
  padding: 28px 22px 20px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.busy-spin {
  display: block;
  width: 30px; height: 30px;
  margin: 0 auto 16px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.busy-title { margin: 0; font-size: var(--t-lead); font-weight: 700; }

/* 件数。数字が増えるので、幅で揺れない字送りにする */
.busy-sub {
  margin: 6px 0 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}

.busy-hint { margin: 14px 0 12px; font-size: var(--t-meta); color: var(--ink-3); }

/* 動きを減らす設定なら、回さずに濃さで知らせる */
@media (prefers-reduced-motion: reduce) {
  .busy-spin { animation: none; border-top-color: var(--accent); opacity: 0.6; }
}

/* ── 日ごとの推移：その日に出した投稿 ───── */

/* 月のはじめは濃くして、月の切れ目が目で追えるようにする */
.chart-axis.month { fill: var(--ink-2); font-weight: 600; }
.chart-tick { stroke: var(--line); stroke-width: 1; }

.trend-head {
  margin: 8px 0 0;
  font-size: var(--t-meta);
  font-weight: 600;
  color: var(--ink-2);
}

/* 1件1行で縦に積む。横に並べると、1日に何件も出した日が折り返しだらけになる */
.trend-posts {
  --trend-row: var(--tap);
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

/* 8件ぶんを超えたら、枠の中で流す（ページは伸ばさない） */
.trend-posts.scrolls {
  max-height: calc(var(--trend-row) * 8);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.trend-post {
  display: flex;
  gap: 8px;
  align-items: baseline;
  min-height: var(--trend-row);
  padding: 3px 0;
  font-size: var(--t-meta);
  line-height: 1.5;
}
.trend-post + .trend-post { border-top: 1px solid var(--line-soft); }

.trend-post-time {
  flex: 0 0 auto;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* 長い本文で行がふくらまないよう、1行に収める */
.trend-post-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 投稿ごとの伸び方。既定は閉じたまま、開いたその投稿だけ描く */
.sbox { margin-top: 8px; }

.sbox-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  font-size: var(--t-meta);
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}
.sbox-summary::-webkit-details-marker { display: none; }
.sbox-summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── どのリンクが押されたか（実測）─────── */

.link-list { margin: 4px 0 10px; padding: 0; list-style: none; }

.link-row { padding: 10px 0; }
.link-row + .link-row { border-top: 1px solid var(--line-soft); }

/* URL は長い。折り返さず、はみ出したぶんは畳む */
.link-url {
  margin: 0;
  overflow: hidden;
  font-size: var(--t-meta);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-meta {
  margin: 3px 0 6px;
  font-size: var(--t-meta);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ── その日の24時間 ─────────────────────── */

.day-detail { margin-top: 8px; }
.day-detail .hint { white-space: pre-line; }
.day-detail .btn-quiet { width: 100%; margin-top: 8px; }

/* 上位3件だけ濃く。全部濃いと線が読めない */
.chart-line.day-0 { stroke: var(--accent-ink); }
.chart-line.day-1 { stroke: color-mix(in srgb, var(--accent-ink) 65%, var(--ink-3)); }
.chart-line.day-2 { stroke: color-mix(in srgb, var(--accent-ink) 40%, var(--ink-3)); }
.chart-line.day-rest { stroke: var(--line); stroke-width: 1.5; }

/* ── その日の投稿から、実物へ飛ぶ ─────── */

.trend-post-go {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: var(--trend-row);
  padding: 0;
  font: inherit;
  font-size: var(--t-meta);
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.trend-post-go:hover .trend-post-text { color: var(--ink); }
.trend-post-go:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── 先頭へ戻る（左下）───────────────── */

.totop {
  position: fixed;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap); height: var(--tap);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
  cursor: pointer;
}
.totop svg { width: 22px; height: 22px; }
.totop:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── とっておき ─────────────────────── */

.keeps { margin: 4px 0 12px; }

.keeps-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  font-size: var(--t-meta);
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}
.keeps-head::-webkit-details-marker { display: none; }
.keeps-head:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.keeps-sub { margin-left: auto; font-weight: 400; color: var(--ink-3); }

.keeps-list { margin: 4px 0 0; padding: 0; list-style: none; }

.keep { padding: 10px 0; }
.keep + .keep { border-top: 1px solid var(--line-soft); }

.keep-when { margin: 0 0 4px; font-size: var(--t-meta); color: var(--ink-3); }

/* 長い案でカードが伸びないよう、4行で畳む */
.keep-text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  line-height: 1.7;
  white-space: pre-wrap;
}

.keep-acts { display: flex; gap: 8px; margin: 6px 0 0; }

/* ── はじめての取り込み ─────────────────── */

.firstrun {
  margin: 20px 0;
  padding: 22px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.firstrun-title { margin: 0; font-size: var(--t-lead); font-weight: 700; line-height: 1.6; }
.firstrun-lead { margin: 8px 0 0; color: var(--ink-2); line-height: 1.8; }

.firstrun-why {
  margin: 14px 0 18px;
  font-size: var(--t-meta);
  color: var(--ink-3);
  line-height: 1.8;
}

.firstrun .btn-primary { width: 100%; }

/* ── その日の24時間：色を序数とそろえる ─── */

/* 5色。6件目からは薄いグレーにまとめる（色を増やしても見分けられない） */
:root {
  --day-0: #d64525;
  --day-1: #1f6f8b;
  --day-2: #b3762b;
  --day-3: #4a7c59;
  --day-4: #7a5aa0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --day-0: #ff7a5c;
    --day-1: #6bb6cf;
    --day-2: #e0a955;
    --day-3: #85bd94;
    --day-4: #b294d6;
  }
}
:root[data-theme="dark"] {
  --day-0: #ff7a5c;
  --day-1: #6bb6cf;
  --day-2: #e0a955;
  --day-3: #85bd94;
  --day-4: #b294d6;
}

.chart-line.day-0 { stroke: var(--day-0); }
.chart-line.day-1 { stroke: var(--day-1); }
.chart-line.day-2 { stroke: var(--day-2); }
.chart-line.day-3 { stroke: var(--day-3); }
.chart-line.day-4 { stroke: var(--day-4); }
.chart-line.day-rest { stroke: var(--line); stroke-width: 1.5; }

.day-dot { stroke: none; }
.day-dot.day-0 { fill: var(--day-0); }
.day-dot.day-1 { fill: var(--day-1); }
.day-dot.day-2 { fill: var(--day-2); }
.day-dot.day-3 { fill: var(--day-3); }
.day-dot.day-4 { fill: var(--day-4); }
.day-dot.day-rest { fill: var(--ink-3); opacity: 0.5; }

/* 押した点の中身。高さを決めておき、出入りで下が動かないようにする */
.day-tip {
  min-height: 1.7em;
  margin: 6px 0 0;
  font-size: var(--t-meta);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.day-list { margin-top: 6px; }
.day-post { min-height: var(--trend-row); }
.day-post + .day-post { border-top: 1px solid var(--line-soft); }

/* リストの序数。グラフの線と同じ色にして、目で追えるようにする */
.day-no {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
}
.day-no.day-0 { background: var(--day-0); }
.day-no.day-1 { background: var(--day-1); }
.day-no.day-2 { background: var(--day-2); }
.day-no.day-3 { background: var(--day-3); }
.day-no.day-4 { background: var(--day-4); }
.day-no.day-rest { color: var(--ink-2); background: var(--bg-2); }

.day-peak {
  flex: 0 0 auto;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* 指標ごとの色。実数と平均は同じ色で、濃さと点線で分ける */
:root {
  --m-views: #1f6f8b;
  --m-likes: #d64525;
  --m-replies: #3f7d55;
  --m-reposts: #7a5aa0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --m-views: #6bb6cf;
    --m-likes: #ff7a5c;
    --m-replies: #85bd94;
    --m-reposts: #b294d6;
  }
}
:root[data-theme="dark"] {
  --m-views: #6bb6cf;
  --m-likes: #ff7a5c;
  --m-replies: #85bd94;
  --m-reposts: #b294d6;
}

/* 推移のリストから名指しで来たときの断り書き */
.picked-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
  padding: 10px 14px;
  font-size: var(--t-meta);
  color: var(--ink-2);
  background: var(--accent-bg);
  border-radius: var(--r-sm);
}
.picked-note span { flex: 1 1 auto; }

/* 返信で誘導しているリンク。本文に貼ったものと見分ける */
.fact.via-reply { color: var(--accent-ink); }
