/* ---------- デザイントークン ---------- */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f3;
  --line: rgba(0, 0, 0, 0.08);
  --text: #1d1d1f;
  --text-2: #424245;
  --muted: #86868b;
  --accent: #0a66ff;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.05), 0 10px 28px rgba(0, 0, 0, 0.1);
  --appbar-bg: rgba(245, 245, 247, 0.82);
  --skeleton: #e8e8ed;
  --skeleton-shine: #f4f4f7;
  --ai-bg: linear-gradient(135deg, #f3f0ff 0%, #eef5ff 100%);
  --ai-line: rgba(110, 86, 207, 0.22);
  --ai-text: #5b45c4;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --cat-政治: #e5484d;
  --cat-経済: #0b7bea;
  --cat-投資: #12a594;
  --cat-社会: #f2700f;
  --cat-国際: #8e4ec6;
  --cat-テクノロジー: #3e63dd;
  --cat-生成AI: #d6409f;
  --cat-サイエンス: #c2410c;
  --cat-安全保障: #475569;
  --cat-文化・芸術: #a21caf;
  --cat-イベント: #ca8a04;
  --cat-default: #6e6e73;
  --foryou: linear-gradient(135deg, #5b5bd6 0%, #d6409f 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --line: rgba(255, 255, 255, 0.1);
    --text: #f5f5f7;
    --text-2: #d1d1d6;
    --muted: #8e8e93;
    --accent: #4c94ff;
    --on-accent: #ffffff;
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-hover: 0 0 0 1px rgba(255, 255, 255, 0.14);
    --appbar-bg: rgba(0, 0, 0, 0.78);
    --skeleton: #2c2c2e;
    --skeleton-shine: #3a3a3c;
    --ai-bg: linear-gradient(135deg, #1f1a33 0%, #15213a 100%);
    --ai-line: rgba(167, 139, 250, 0.3);
    --ai-text: #b9a8ff;

    --cat-政治: #ff6369;
    --cat-経済: #52a9ff;
    --cat-投資: #3dd9c1;
    --cat-社会: #ff9a4d;
    --cat-国際: #bf7af0;
    --cat-テクノロジー: #849dff;
    --cat-生成AI: #f17ec6;
    --cat-サイエンス: #fb923c;
    --cat-安全保障: #94a3b8;
    --cat-文化・芸術: #e879f9;
    --cat-イベント: #facc15;
    --cat-default: #98989d;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5f5f7;
  --text-2: #d1d1d6;
  --muted: #8e8e93;
  --accent: #4c94ff;
  --on-accent: #ffffff;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-hover: 0 0 0 1px rgba(255, 255, 255, 0.14);
  --appbar-bg: rgba(0, 0, 0, 0.78);
  --skeleton: #2c2c2e;
  --skeleton-shine: #3a3a3c;
  --ai-bg: linear-gradient(135deg, #1f1a33 0%, #15213a 100%);
  --ai-line: rgba(167, 139, 250, 0.3);
  --ai-text: #b9a8ff;

  --cat-政治: #ff6369;
  --cat-経済: #52a9ff;
  --cat-投資: #3dd9c1;
  --cat-社会: #ff9a4d;
  --cat-国際: #bf7af0;
  --cat-テクノロジー: #849dff;
  --cat-生成AI: #f17ec6;
  --cat-サイエンス: #fb923c;
  --cat-安全保障: #94a3b8;
  --cat-文化・芸術: #e879f9;
  --cat-イベント: #facc15;
  --cat-default: #98989d;
}

/* カテゴリごとの色を --cat に割り当てる */
[data-cat] { --cat: var(--cat-default); }
[data-cat="政治"] { --cat: var(--cat-政治); }
[data-cat="経済"] { --cat: var(--cat-経済); }
[data-cat="投資"] { --cat: var(--cat-投資); }
[data-cat="社会"] { --cat: var(--cat-社会); }
[data-cat="国際"] { --cat: var(--cat-国際); }
[data-cat="テクノロジー"] { --cat: var(--cat-テクノロジー); }
[data-cat="生成AI"] { --cat: var(--cat-生成AI); }
[data-cat="サイエンス"] { --cat: var(--cat-サイエンス); }
[data-cat="安全保障"] { --cat: var(--cat-安全保障); }
[data-cat="文化・芸術"] { --cat: var(--cat-文化・芸術); }
[data-cat="イベント"] { --cat: var(--cat-イベント); }

/* ---------- ベース ---------- */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Segoe UI', sans-serif;
  font-feature-settings: 'palt';
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, select, input { font: inherit; color: inherit; }

[hidden] { display: none !important; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- アプリバー ---------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--appbar-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
}

.appbar-row {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 60px;
  padding: 8px 12px 4px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  flex-direction: column;
  margin-right: auto;
  color: inherit;
  text-decoration: none;
  line-height: 1.15;
}

.brand-date {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ロゴ: 括弧と点のシンボル＋大文字の文字（BRAND.md）。文字の中身は「Sivree」のまま、見た目だけを大文字にする */
.brand-title {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-mark {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

.brand-mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 9;
  stroke-linejoin: miter;
}

.brand-mark circle { fill: currentColor; }

.appbar-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.icon-button:hover { background: var(--surface-2); }

.icon-button svg { width: 22px; height: 22px; }

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  margin-left: -10px;
  padding: 0 12px 0 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  font-size: 1.02rem;
  cursor: pointer;
}

.nav-back svg { width: 24px; height: 24px; stroke-width: 2.4; }

.search-bar {
  max-width: 1080px;
  margin: 0 auto;
  padding: 4px 16px 8px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
}

.search-field svg { width: 18px; height: 18px; flex: 0 0 auto; }

.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 0;
  font-size: 16px; /* iOS で入力時に拡大されないよう 16px 以上にする */
  color: var(--text);
  outline: none;
}

/* カテゴリタブ（横スクロールのピル） */
.tabs {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 6px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding: 0 16px;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tab::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--cat);
}

.tab[data-cat="all"]::before { display: none; }

.tab[data-cat="foryou"]::before {
  width: 10px;
  height: 10px;
  background: var(--foryou);
}

.tab[data-cat="foryou"][aria-selected="true"] {
  background: var(--foryou);
  color: #fff;
}

.tab[aria-selected="true"] {
  background: var(--cat, var(--text));
  border-color: transparent;
  color: #fff;
}

.tab[data-cat="all"][aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
}

.tab[aria-selected="true"]::before { background: rgba(255, 255, 255, 0.85); }

body.is-detail .tabs,
body.is-detail .search-bar,
body.is-detail .brand,
body.is-detail #searchToggle,
body.is-detail #savedButton,
body.is-detail #settingsButton { display: none !important; }

body:not(.is-detail) .appbar-row { padding-bottom: 0; }

/* ---------- 一覧 ---------- */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px calc(40px + env(safe-area-inset-bottom));
}

.list-toolbar {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  /* 言語によってフィルターの文言が長いと件数が収まらないため、はみ出す分は次の行に回す */
  gap: 6px 12px;
  padding: 14px 0 10px;
}

.list-toolbar > * { min-width: 0; }

.filters {
  flex: 1 1 auto;
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  /* 影が切れないよう少し余白を持たせる */
  padding: 2px;
  margin: -2px;
}

.filters::-webkit-scrollbar { display: none; }

.region-chip {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  color: var(--text-2);
}

.region-chip svg {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  pointer-events: none;
  color: var(--muted);
}

.region-chip select {
  appearance: none;
  -webkit-appearance: none;
  height: 36px;
  padding: 0 34px 0 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
  white-space: nowrap;
}

.news-list {
  display: grid;
  /* 1fr だと中身の最小幅より縮まず画面からはみ出すため、minmax(0, 1fr) にする */
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

@media (min-width: 900px) {
  .news-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .news-list > .hero,
  .news-list > .briefing,
  .news-list > .day-heading,
  .news-list > .empty-state { grid-column: 1 / -1; }
}

.day-heading {
  margin: 14px 2px 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.day-heading small {
  margin-left: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

/* 記事カード */
.card {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover { box-shadow: var(--shadow-hover); }

.card:active { transform: scale(0.985); }

.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.cat-label {
  color: var(--cat);
  white-space: nowrap;
}

.card-meta .sep::before { content: '·'; }

.source-badge {
  flex: 0 0 auto;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
}

.card-meta .source {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.card-title {
  margin: 6px 0 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.card-summary {
  margin: 6px 0 0;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.ai-mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--ai-bg);
  color: var(--ai-text);
  font-size: 0.7rem;
  font-weight: 700;
  vertical-align: 1px;
}

.card-foot {
  margin-top: auto;
  padding-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* 一致した関心トピック（なぜ表示されているか） */
.card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.match-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.match-chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, #5b5bd6 12%, var(--surface));
  color: #5b5bd6;
  font-size: 0.68rem;
  font-weight: 700;
}

:root[data-theme="dark"] .match-chip { color: #a5a5ff; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .match-chip { color: #a5a5ff; }
}

/* 内容の近さで一致した関心（キーワードは含まない）: 点線の枠と「≈」で区別する */
.match-chip.is-semantic {
  background: transparent;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 45%, transparent);
}

.match-chip.is-semantic::before {
  content: "≈ ";
}

.thumb {
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--skeleton);
}

/* 画像がない記事は、発信元の頭文字をカテゴリ色のタイルで表示する */
.thumb-placeholder {
  flex: 0 0 auto;
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--cat) 30%, transparent), transparent 60%),
    color-mix(in srgb, var(--cat) 14%, var(--surface));
  color: var(--cat);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* 先頭記事（画像あり）は大きなヒーローカードにする */
.hero {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #111;
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 3;
  max-height: 520px;
  width: 100%;
}

@media (min-width: 900px) {
  .hero { aspect-ratio: 21 / 9; }
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.hero:hover img { transform: scale(1.03); }

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.55) 62%, rgba(0, 0, 0, 0.85) 100%);
}

.hero-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 20px;
}

.hero .cat-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--cat);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

.hero-title {
  margin: 10px 0 6px;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.38;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.hero-summary {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.86);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-meta {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
}

.empty-state {
  padding: 56px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: 1rem;
}

.more-button {
  display: block;
  margin: 20px auto 0;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.list-end { height: 1px; }

/* 読み込み中のスケルトン */
.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton-shine) 50%, var(--skeleton) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}

.skeleton-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.skeleton-lines { flex: 1; display: grid; gap: 10px; align-content: start; }
.skeleton-line { height: 12px; }

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---------- 詳細 ---------- */

.detail-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 4px 120px;
  animation: slide-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

.detail-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cat, var(--muted)) 14%, var(--surface));
  color: var(--cat, var(--text-2));
  font-size: 0.75rem;
  font-weight: 700;
}

.chip.is-neutral { --cat: var(--muted); }

.chip.is-sample {
  --cat: #c26a00;
}

.detail-title {
  margin: 12px 0 0;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  line-height: 1.38;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.detail-original {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.byline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.byline-avatar {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--cat) 16%, var(--surface));
  color: var(--cat);
  font-weight: 800;
  font-size: 0.85rem;
}

.byline-text { display: flex; flex-direction: column; line-height: 1.3; }
.byline-text strong { font-size: 0.92rem; }
.byline-text time { font-size: 0.8rem; color: var(--muted); }

.detail-image {
  margin: 20px -4px 0;
}

.detail-image img {
  display: block;
  width: 100%;
  max-height: 440px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--skeleton);
}

/* AI 要約カード */
.ai-card {
  margin-top: 22px;
  padding: 18px 18px 16px;
  border: 1px solid var(--ai-line);
  border-radius: var(--radius-lg);
  background: var(--ai-bg);
}

.ai-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ai-text);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ai-card-head svg { width: 18px; height: 18px; stroke-width: 1.8; }

.ai-summary {
  margin: 10px 0 0;
  font-size: 1.05rem;
  line-height: 1.85;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.ai-points {
  list-style: none;
  margin: 14px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--ai-line);
  display: grid;
  gap: 10px;
}

.ai-points li {
  position: relative;
  padding-left: 22px;
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.ai-points li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--ai-text);
  transform: rotate(45deg);
}

.ai-note {
  margin: 14px 0 0;
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
}

/* 抽出型の要約は、AI 要約と見分けられるよう落ち着いた配色にする */
.ai-card.is-extract {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.ai-card.is-extract .ai-card-head { color: var(--text-2); }
.ai-card.is-extract .ai-points { border-top-color: var(--line); }
.ai-card.is-extract .ai-points li::before { background: var(--muted); }

.ai-mark.is-extract {
  background: var(--surface-2);
  color: var(--text-2);
}

.ai-card.is-loading .ai-summary,
.ai-card.is-info .ai-summary {
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--text-2);
}

.ai-loading { display: grid; gap: 10px; margin-top: 14px; }
.ai-loading .skeleton { height: 13px; }

.retry-button {
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid var(--ai-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ai-text);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

/* 本文（冒頭の抜粋） */
.excerpt {
  margin-top: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.excerpt summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
}

.excerpt summary::-webkit-details-marker { display: none; }

.excerpt summary::after {
  content: '';
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s ease;
}

.excerpt[open] summary::after { transform: rotate(225deg) translateY(-2px); }

.excerpt-body {
  padding: 0 18px 18px;
  font-size: 0.98rem;
  line-height: 1.9;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.excerpt-body p { margin: 0 0 1em; }
.excerpt-body p:last-child { margin-bottom: 0; }

.excerpt-more { color: var(--muted); font-size: 0.85rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.tag {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.tag:hover { border-color: var(--accent); color: var(--accent); }

/* 画面下に固定する「元記事を読む」 */
.read-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 35%);
  pointer-events: none;
}

.read-button {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 720px;
  margin: 0 auto;
  height: 52px;
  border-radius: 16px;
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.read-button svg { width: 18px; height: 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  z-index: 30;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

@media (max-width: 480px) {
  .thumb,
  .thumb-placeholder { width: 80px; height: 80px; border-radius: 12px; }
  .thumb-placeholder { font-size: 1.4rem; }
  .card { padding: 14px; gap: 12px; }
  .region-chip select { padding: 0 28px 0 32px; font-size: 0.85rem; background-position: right 10px center; }
  .region-chip svg { left: 11px; }
}

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

/* ---------- マイニュースの設定 ---------- */

.settings-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 4px 140px;
}

.settings-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
}

.settings-note {
  margin: -6px 0 18px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.settings-note.is-warning { color: #c2410c; }

/* 候補の節の説明文は、見出しと同じ余白に揃える */
.source-candidates .settings-note {
  margin: -2px 0 10px;
  padding: 0 16px;
}

.settings-lead {
  margin: 8px 0 18px;
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.7;
}

.topic-editor {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease;
}

.topic-editor.is-disabled { opacity: 0.55; }

.topic-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topic-label {
  flex: 1;
  min-width: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 4px 2px;
}

.topic-label:focus { outline: none; border-bottom-color: var(--accent); }

.topic-delete { color: var(--muted); }
.topic-delete svg { width: 20px; height: 20px; }

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-2);
  transition: background-color 0.2s ease;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-track { background: #34c759; }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
}

.segment { position: relative; cursor: pointer; }

.segment input {
  position: absolute;
  opacity: 0;
  inset: 0;
}

.segment span {
  display: block;
  padding: 6px 0;
  border-radius: 8px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
}

.segment input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.segment input:focus-visible + span { outline: 2px solid var(--accent); }

.field {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.field textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
}

.topic-conditions {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.6;
  color: var(--muted);
}

.add-topic {
  width: 100%;
  padding: 14px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.settings-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 35%);
}

.primary-action,
.secondary-button {
  height: 50px;
  padding: 0 18px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
}

.primary-action {
  flex: 1;
  max-width: 420px;
  border: 0;
  background: var(--text);
  color: var(--bg);
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
}

/* ---------- 地域・分野の選択（初回の質問と設定） ---------- */

body.is-onboarding .appbar { display: none; }

.onboarding {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(28px + env(safe-area-inset-top)) 16px calc(140px + env(safe-area-inset-bottom));
}

.onb-inner {
  max-width: 720px;
  margin: 0 auto;
}

.onb-progress {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 22px;
}

.onb-progress span {
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.onb-progress span.is-active { background: var(--accent); }

.onb-step {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.onb-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.35;
}

.onb-lead {
  margin: 10px 0 8px;
  color: var(--text-2);
  font-size: 0.92rem;
  line-height: 1.7;
}

.onb-all { margin-bottom: 8px; }

.onb-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 35%);
}

.primary-action:disabled {
  opacity: 0.35;
  cursor: default;
}

.onb-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.settings-subtitle {
  margin: 22px 0 10px;
  font-size: 1rem;
  font-weight: 800;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 10px;
}

.choice {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px 14px 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.choice[data-cat]::before {
  content: '';
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--cat);
}

.choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.choice-text {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 3px;
}

.choice-label {
  font-size: 1rem;
  font-weight: 700;
}

.choice-info {
  color: var(--text-2);
  font-size: 0.78rem;
  line-height: 1.5;
}

.choice-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.choice-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 3px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  fill: none;
  stroke: transparent;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.choice[aria-pressed="true"] .choice-check {
  border-color: var(--accent);
  background: var(--accent);
  stroke: var(--on-accent);
}

/* ---------- 情報源の選択 ---------- */

.settings-tabs {
  grid-template-columns: repeat(3, 1fr);
  margin: 16px 0 12px;
}

.source-summary {
  margin: -6px 0 16px;
  color: var(--text-2);
  font-size: 0.85rem;
}

.source-group {
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.source-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.source-group-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.source-count {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.text-button {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 2px;
  cursor: pointer;
}

.source-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  transition: opacity 0.2s ease;
}

.source-row.is-off .source-meta { opacity: 0.45; }

.source-meta {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.source-name {
  font-size: 0.95rem;
  font-weight: 700;
}

.source-desc {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.source-error {
  color: #c2410c;
  font-size: 0.72rem;
  font-weight: 600;
}

.source-link {
  flex: 0 0 auto;
  color: var(--muted);
}

.source-link svg { width: 18px; height: 18px; }

/* ---------- 話題のまとめ（同じ出来事の発表・報道） ---------- */

.related-line {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 0;
}

.related-line svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.related-count {
  flex: 0 0 auto;
  white-space: nowrap;
}

.related-sources {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.related {
  margin-top: 22px;
  padding: 16px 18px 6px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.related-title {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.related-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-list li + li { border-top: 1px solid var(--line); }

.related-list a {
  display: grid;
  gap: 3px;
  padding: 11px 0;
  color: inherit;
  text-decoration: none;
}

.related-source {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.75rem;
}

.related-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.5;
}

.related-list a:hover .related-item-title { color: var(--accent); }

/* ---------- ブリーフィング（マイニュースの先頭） ---------- */

.briefing {
  position: relative;
  margin-bottom: 8px;
  padding: 20px 18px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.briefing::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--foryou);
}

.briefing-kicker {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  background: var(--foryou);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.briefing-title {
  margin: 2px 0 2px;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}

.briefing-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.briefing-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.briefing-list li + li { border-top: 1px solid var(--line); }

.briefing-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
}

.briefing-num {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 800;
}

.briefing-list li:first-child .briefing-num {
  background: var(--foryou);
  color: #fff;
}

.briefing-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.briefing-item-title {
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
}

.briefing-item:hover .briefing-item-title { color: var(--accent); }

.briefing-line {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-2);
  font-size: 0.84rem;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.briefing-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 0.74rem;
}

.briefing-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.briefing-topic {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.75rem;
}

.briefing-topic b { margin-left: 2px; }

/* ---------- 表示言語の選択 ---------- */

.settings-language .settings-subtitle { margin-top: 8px; }
.settings-language .settings-note { margin: 10px 0 4px; }

.field-note {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

/* ---------- 言語ごとの書体（html の lang に合わせる） ---------- */

/* 'palt' は日本語の字間を詰める設定。他の言語には使わない */
html:not(:lang(ja)) body { font-feature-settings: normal; }
html:lang(zh-CN) body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', 'Segoe UI', sans-serif; }
html:lang(zh-TW) body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', 'Segoe UI', sans-serif; }
html:lang(th) body { font-family: -apple-system, BlinkMacSystemFont, 'Thonburi', 'Sukhumvit Set', 'Noto Sans Thai', 'Leelawadee UI', 'Segoe UI', sans-serif; line-height: 1.65; }
html:lang(vi) body { line-height: 1.6; }
/* 単語の間に空白を入れない言語（タイ語・中国語）でも、長い見出しがはみ出さないようにする */
.card-title, .hero-title, .detail-title, .briefing-item-title, .briefing-line { overflow-wrap: anywhere; }

/* ---------- 言語の選択欄 ---------- */

.language-select {
  width: 100%;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 16px;
}

.onb-language { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.onb-language .language-select { width: auto; max-width: 100%; }

/* ---------- 記事の操作（非表示・発信元）と設定の持ち運び ---------- */

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 96px;
}

.detail-actions .secondary-button {
  height: auto;
  min-height: 40px;
  padding: 8px 14px;
  font-size: 0.85rem;
  text-align: left;
}

.toast-action {
  margin-left: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
  cursor: pointer;
}

.settings-extra {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

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

.extra-actions .secondary-button,
.paste-box .secondary-button {
  display: inline-flex;
  align-items: center;
  height: auto;
  min-height: 44px;
  padding: 8px 16px;
  text-decoration: none;
}

.paste-box { margin-top: 10px; }
.paste-box textarea {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.images-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
  cursor: pointer;
}

.images-toggle input { width: 20px; height: 20px; }

.new-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.02em;
}

.end-note {
  margin: 28px 0 8px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 保存した記事と引用 ---------- */

.icon-button { position: relative; }

.icon-badge {
  position: absolute;
  top: 3px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

.icon-badge[hidden] { display: none; }

svg.is-filled path { fill: currentColor; }

#saveButton.is-on { color: var(--accent); }
#saveButton.is-on svg path { fill: currentColor; }

.saved-mark { display: inline-flex; color: var(--accent); }
.saved-mark svg { width: 13px; height: 13px; }

.detail-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.tool-button svg { width: 18px; height: 18px; stroke-width: 1.8; }
.tool-button.is-on { border-color: var(--accent); color: var(--accent); }

.cite-panel {
  margin: 10px 0 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.cite-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cite-format {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.cite-format[aria-pressed="true"] {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.cite-text {
  max-height: 260px;
  margin: 0 0 10px;
  padding: 12px;
  overflow: auto;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: 0.8rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.cite-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.cite-foot .settings-note { margin: 6px 0 0; }

.cite-foot .secondary-button,
.saved-export .secondary-button {
  height: auto;
  min-height: 44px;
  padding: 8px 16px;
}

.saved-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 4px 140px;
}

.saved-toolbar { margin: 4px 0 16px; }
.saved-search { margin-bottom: 10px; }

.saved-export {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.saved-format {
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.saved-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.saved-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.saved-title {
  margin: 6px 0 8px;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.45;
}

.saved-title a { color: inherit; text-decoration: none; }
.saved-title a:hover { text-decoration: underline; }

.saved-note-box summary {
  padding: 4px 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.saved-note-box textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* iOS で入力時に拡大されないよう 16px 以上にする */
  resize: vertical;
}

.saved-item-actions { display: flex; gap: 16px; margin-top: 6px; }
