/* v2 画面の見た目。styles.css は読み込まないので、ここだけで完結させる。
   訪問者の端末の時刻に合わせて、朝・昼・夕方・夜の4つの配色を1秒かけて滑らかに切り替える。 */

@property --bg { syntax: "<color>"; inherits: true; initial-value: #f5f2ec; }
@property --bg-soft { syntax: "<color>"; inherits: true; initial-value: #efeae1; }
@property --card { syntax: "<color>"; inherits: true; initial-value: #fffdf9; }
@property --ink { syntax: "<color>"; inherits: true; initial-value: #1d1a15; }
@property --muted { syntax: "<color>"; inherits: true; initial-value: #5c554b; }
@property --line { syntax: "<color>"; inherits: true; initial-value: #ded6c8; }
@property --line-soft { syntax: "<color>"; inherits: true; initial-value: #ebe4d8; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #28537d; }
@property --accent-soft { syntax: "<color>"; inherits: true; initial-value: #e5eef7; }
@property --on-accent { syntax: "<color>"; inherits: true; initial-value: #fffdf9; }
@property --tab-active-bg { syntax: "<color>"; inherits: true; initial-value: #1d1a15; }
@property --tab-active-ink { syntax: "<color>"; inherits: true; initial-value: #fffdf9; }
@property --plate-bg { syntax: "<color>"; inherits: true; initial-value: #fffdf9; }
@property --plate-ink { syntax: "<color>"; inherits: true; initial-value: #857d70; }
@property --error-ink { syntax: "<color>"; inherits: true; initial-value: #8a2f20; }
@property --field-history-bg { syntax: "<color>"; inherits: true; initial-value: #f3ead4; }
@property --field-history-ink { syntax: "<color>"; inherits: true; initial-value: #6b4e1e; }
@property --field-science-bg { syntax: "<color>"; inherits: true; initial-value: #e5eef7; }
@property --field-science-ink { syntax: "<color>"; inherits: true; initial-value: #28537d; }
@property --field-geography-bg { syntax: "<color>"; inherits: true; initial-value: #e3eee4; }
@property --field-geography-ink { syntax: "<color>"; inherits: true; initial-value: #315c3b; }
@property --field-society-bg { syntax: "<color>"; inherits: true; initial-value: #ebe4f2; }
@property --field-society-ink { syntax: "<color>"; inherits: true; initial-value: #52406d; }
@property --field-culture-bg { syntax: "<color>"; inherits: true; initial-value: #f3e4dc; }
@property --field-culture-ink { syntax: "<color>"; inherits: true; initial-value: #704430; }
@property --field-technology-bg { syntax: "<color>"; inherits: true; initial-value: #e3eef0; }
@property --field-technology-ink { syntax: "<color>"; inherits: true; initial-value: #265963; }

/* 既定と昼（10:00〜15:59） */
:root,
:root[data-period="day"] {
  color-scheme: light;
  --bg: #f5f2ec;
  --bg-soft: #efeae1;
  --card: #fffdf9;
  --ink: #1d1a15;
  --muted: #5c554b;
  --line: #ded6c8;
  --line-soft: #ebe4d8;
  --accent: #28537d;
  --accent-soft: #e5eef7;
  --on-accent: #fffdf9;
  --tab-active-bg: #1d1a15;
  --tab-active-ink: #fffdf9;
  --plate-bg: #fffdf9;
  --plate-ink: #857d70;
  --error-ink: #8a2f20;
  --field-history-bg: #f3ead4;
  --field-history-ink: #6b4e1e;
  --field-science-bg: #e5eef7;
  --field-science-ink: #28537d;
  --field-geography-bg: #e3eee4;
  --field-geography-ink: #315c3b;
  --field-society-bg: #ebe4f2;
  --field-society-ink: #52406d;
  --field-culture-bg: #f3e4dc;
  --field-culture-ink: #704430;
  --field-technology-bg: #e3eef0;
  --field-technology-ink: #265963;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 6px 20px rgba(29, 26, 21, 0.1);
  --shadow-lg: 0 18px 44px rgba(29, 26, 21, 0.18);
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", system-ui, sans-serif;
  --serif: "Hiragino Mincho ProN", "Yu Mincho", Georgia, "Times New Roman", serif;
  --bar-height: 7.5rem;
}

/* 朝（5:00〜9:59） */
:root[data-period="morning"] {
  color-scheme: light;
  --bg: #edf3f8;
  --bg-soft: #e2ebf3;
  --card: #f8fbfd;
  --ink: #14202b;
  --muted: #48596a;
  --line: #c7d4e1;
  --line-soft: #dae4ee;
  --accent: #1d5384;
  --accent-soft: #d9e8f6;
  --on-accent: #ffffff;
  --tab-active-bg: #14202b;
  --tab-active-ink: #f8fbfd;
  --plate-bg: #f8fbfd;
  --plate-ink: #6d7f90;
  --error-ink: #9e2a1c;
  --field-history-bg: #efe6cf;
  --field-history-ink: #694c1c;
  --field-science-bg: #dce9f6;
  --field-science-ink: #1d5384;
  --field-geography-bg: #dcebe0;
  --field-geography-ink: #2d5c39;
  --field-society-bg: #e6e0f0;
  --field-society-ink: #4f3d6b;
  --field-culture-bg: #f0e0d8;
  --field-culture-ink: #6e412e;
  --field-technology-bg: #daeaee;
  --field-technology-ink: #225863;
  --shadow: 0 6px 20px rgba(20, 32, 43, 0.09);
  --shadow-lg: 0 18px 44px rgba(20, 32, 43, 0.16);
}

/* 夕方（16:00〜18:59） */
:root[data-period="evening"] {
  color-scheme: light;
  --bg: #f2e3d2;
  --bg-soft: #ead7c2;
  --card: #fbf0e3;
  --ink: #26170e;
  --muted: #614939;
  --line: #d4bca3;
  --line-soft: #e3ceb8;
  --accent: #234c78;
  --accent-soft: #dde4ec;
  --on-accent: #fbf4ec;
  --tab-active-bg: #2b1a10;
  --tab-active-ink: #fbf0e3;
  --plate-bg: #fbf0e3;
  --plate-ink: #876e5b;
  --error-ink: #8e2819;
  --field-history-bg: #ebd8b9;
  --field-history-ink: #5f4314;
  --field-science-bg: #dae3ec;
  --field-science-ink: #214b75;
  --field-geography-bg: #d9e4d6;
  --field-geography-ink: #2b5635;
  --field-society-bg: #e5d9e8;
  --field-society-ink: #4e3968;
  --field-culture-bg: #edd4c6;
  --field-culture-ink: #6b3b27;
  --field-technology-bg: #d7e4e4;
  --field-technology-ink: #1f545e;
  --shadow: 0 6px 20px rgba(38, 23, 14, 0.12);
  --shadow-lg: 0 18px 44px rgba(38, 23, 14, 0.2);
}

/* 夜（19:00〜翌4:59） */
:root[data-period="night"] {
  color-scheme: dark;
  --bg: #15171d;
  --bg-soft: #1c1f27;
  --card: #21252f;
  --ink: #eae6dd;
  --muted: #a4a097;
  --line: #363b47;
  --line-soft: #2a2e38;
  --accent: #8fb9e3;
  --accent-soft: #213142;
  --on-accent: #11161d;
  --tab-active-bg: #eae6dd;
  --tab-active-ink: #15171d;
  --plate-bg: #1c1f27;
  --plate-ink: #7e8490;
  --error-ink: #f09486;
  --field-history-bg: #332d20;
  --field-history-ink: #e6d2a6;
  --field-science-bg: #213142;
  --field-science-ink: #97c0e8;
  --field-geography-bg: #223129;
  --field-geography-ink: #b7d8bf;
  --field-society-bg: #2c2838;
  --field-society-ink: #d6c8ea;
  --field-culture-bg: #3a2b26;
  --field-culture-ink: #eabfb0;
  --field-technology-bg: #1d3136;
  --field-technology-ink: #b5d8e0;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.58);
}

/* JavaScript が動かない環境だけは、端末の明暗設定に従う */
@media (prefers-color-scheme: dark) {
  :root:not([data-period]) {
    color-scheme: dark;
    --bg: #15171d;
    --bg-soft: #1c1f27;
    --card: #21252f;
    --ink: #eae6dd;
    --muted: #a4a097;
    --line: #363b47;
    --line-soft: #2a2e38;
    --accent: #8fb9e3;
    --accent-soft: #213142;
    --on-accent: #11161d;
    --tab-active-bg: #eae6dd;
    --tab-active-ink: #15171d;
    --plate-bg: #1c1f27;
    --plate-ink: #7e8490;
    --error-ink: #f09486;
    --field-history-bg: #332d20;
    --field-history-ink: #e6d2a6;
    --field-science-bg: #213142;
    --field-science-ink: #97c0e8;
    --field-geography-bg: #223129;
    --field-geography-ink: #b7d8bf;
    --field-society-bg: #2c2838;
    --field-society-ink: #d6c8ea;
    --field-culture-bg: #3a2b26;
    --field-culture-ink: #eabfb0;
    --field-technology-bg: #1d3136;
    --field-technology-ink: #b5d8e0;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.58);
  }
}

/* 初回描画が終わったあと、時間帯の切り替わりを1秒かけて滑らかにする */
:root.v2-theme-ready {
  transition:
    --bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --bg-soft 1s cubic-bezier(0.8, 0, 0.2, 1),
    --card 1s cubic-bezier(0.8, 0, 0.2, 1),
    --ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --muted 1s cubic-bezier(0.8, 0, 0.2, 1),
    --line 1s cubic-bezier(0.8, 0, 0.2, 1),
    --line-soft 1s cubic-bezier(0.8, 0, 0.2, 1),
    --accent 1s cubic-bezier(0.8, 0, 0.2, 1),
    --accent-soft 1s cubic-bezier(0.8, 0, 0.2, 1),
    --on-accent 1s cubic-bezier(0.8, 0, 0.2, 1),
    --tab-active-bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --tab-active-ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --plate-bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --plate-ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --error-ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-history-bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-history-ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-science-bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-science-ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-geography-bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-geography-ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-society-bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-society-ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-culture-bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-culture-ink 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-technology-bg 1s cubic-bezier(0.8, 0, 0.2, 1),
    --field-technology-ink 1s cubic-bezier(0.8, 0, 0.2, 1);
}

/* @property に未対応の古いブラウザ向けの1秒遷移 */
:root.v2-theme-ready.v2-theme-fallback body.v2,
:root.v2-theme-ready.v2-theme-fallback .privacy-notice,
:root.v2-theme-ready.v2-theme-fallback .privacy-notice button,
:root.v2-theme-ready.v2-theme-fallback .v2-signin,
:root.v2-theme-ready.v2-theme-fallback .v2-menu-btn,
:root.v2-theme-ready.v2-theme-fallback .v2-menu,
:root.v2-theme-ready.v2-theme-fallback .v2-tab,
:root.v2-theme-ready.v2-theme-fallback .v2-search-box,
:root.v2-theme-ready.v2-theme-fallback .v2-search-box input,
:root.v2-theme-ready.v2-theme-fallback .v2-search-page input,
:root.v2-theme-ready.v2-theme-fallback .v2-search-page button,
:root.v2-theme-ready.v2-theme-fallback .v2-tag,
:root.v2-theme-ready.v2-theme-fallback .v2-rank,
:root.v2-theme-ready.v2-theme-fallback .v2-plate,
:root.v2-theme-ready.v2-theme-fallback .v2-field-btn,
:root.v2-theme-ready.v2-theme-fallback .v2-create,
:root.v2-theme-ready.v2-theme-fallback .v2-field-icon,
:root.v2-theme-ready.v2-theme-fallback .v2-article-menu,
:root.v2-theme-ready.v2-theme-fallback .v2-children-toggle,
:root.v2-theme-ready.v2-theme-fallback .v2-agola-input,
:root.v2-theme-ready.v2-theme-fallback .v2-agola-send,
:root.v2-theme-ready.v2-theme-fallback .v2-stack-form input,
:root.v2-theme-ready.v2-theme-fallback .v2-stack-form textarea,
:root.v2-theme-ready.v2-theme-fallback .v2-stack-form button,
:root.v2-theme-ready.v2-theme-fallback .v2-editor input,
:root.v2-theme-ready.v2-theme-fallback .v2-editor textarea,
:root.v2-theme-ready.v2-theme-fallback .v2-editor select,
:root.v2-theme-ready.v2-theme-fallback .v2-write,
:root.v2-theme-ready.v2-theme-fallback .v2-chip,
:root.v2-theme-ready.v2-theme-fallback .v2-section,
:root.v2-theme-ready.v2-theme-fallback .v2-intro,
:root.v2-theme-ready.v2-theme-fallback .v2-table td,
:root.v2-theme-ready.v2-theme-fallback .v2-share,
:root.v2-theme-ready.v2-theme-fallback .v2-nudge-card,
:root.v2-theme-ready.v2-theme-fallback .v2-control-actions button {
  transition: background-color 1s cubic-bezier(0.8, 0, 0.2, 1), color 1s cubic-bezier(0.8, 0, 0.2, 1), border-color 1s cubic-bezier(0.8, 0, 0.2, 1);
}

:root.v2-theme-ready.v2-theme-fallback .v2-bar {
  transition: transform 0.22s ease, background-color 1s cubic-bezier(0.8, 0, 0.2, 1), color 1s cubic-bezier(0.8, 0, 0.2, 1);
}

/* 明るい配色と暗い配色が入れ替わる間は、文字と背景が一瞬だけ近い色になる（約0.2秒）。
   曲線を急にしてその時間を短くしている。端末で「視差効果を減らす」が選ばれているときは、遷移をかけずに即座に切り替える。 */
@media (prefers-reduced-motion: reduce) {
  :root.v2-theme-ready,
  :root.v2-theme-ready.v2-theme-fallback * {
    transition-duration: 0s !important;
  }
}

* { box-sizing: border-box; }

.privacy-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background: var(--accent-soft);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.privacy-notice p { margin: 0; }
.privacy-notice a { color: var(--accent); }
.privacy-notice button {
  font: inherit;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

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

body.v2 {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
}

/* :where() は詳細度が 0 なので、下の部品ごとの色指定が必ず勝つ。 */
:where(body.v2) a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

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

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

.v2-skip {
  position: absolute;
  left: -999px;
}

.v2-skip:focus {
  left: 0.5rem;
  top: 0.5rem;
  z-index: 60;
  background: var(--card);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
}

/* ---------- 上部（スクロールで隠れる） ---------- */

.v2-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg);
  padding: 0.6rem 0 0;
  transition: transform 0.22s ease;
  overflow-anchor: none;
}

.v2-article,
.v2-article-page { overflow-anchor: none; }

.v2-head,
.v2-tools-row,
.v2-search-box,
.v2-readbar,
.v2-page,
.v2-footer {
  width: min(72rem, calc(100% - 2 * clamp(0.75rem, 3vw, 1.5rem)));
  margin-left: auto;
  margin-right: auto;
}

.v2-bar-hidden {
  transform: translateY(-100%);
  overflow: hidden;
}

.v2-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.v2-logo {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}

.v2-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  overflow: hidden;
  background: var(--line);
  color: var(--muted);
  flex: none;
}

.v2-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.v2-avatar .v2-glyph {
  width: 1.5rem;
  height: 1.5rem;
}

.v2-signin {
  font-size: 0.82rem;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  background: var(--card);
}

.v2-tools-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.35rem;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 0.5rem;
  min-width: 0;
}

.v2-menu-anchor {
  position: relative;
  flex: none;
}

.v2-glyph {
  width: 1.3rem;
  height: 1.3rem;
  display: block;
}

.v2-menu-btn,
.v2-tool,
.v2-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  padding: 0.35rem;
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

/* 文化タブの左。以前の四角より 1.5 倍。枠線が四角いアイコンになる。 */
.v2-menu-btn {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 2.85rem;
  height: 2.85rem;
  padding: 0;
  background: var(--card);
}

.v2-menu-btn .v2-glyph {
  width: 1.7rem;
  height: 1.7rem;
}

.v2-menu-btn:hover,
.v2-tool:hover { background: var(--accent-soft); }

/* ---------- 本マークのメニュー ---------- */

.v2-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.3rem);
  min-width: 13rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  z-index: 50;
}

.v2-menu[hidden] { display: none; }

.v2-menu-list {
  display: flex;
  flex-direction: column;
}

.v2-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.95rem;
  background: none;
  border: 0;
  color: var(--ink);
  text-decoration: none;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.v2-menu-item:hover { background: var(--bg-soft); }

.v2-menu-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.v2-menu-list > .v2-menu-item { align-self: stretch; }

.v2-menu-row .v2-menu-item { flex: 1; width: auto; }

.v2-policy-sub {
  display: inline-flex;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.v2-policy-sub[hidden] { display: none; }

.v2-menu-sign {
  margin: 1.1rem 0 0.3rem;
  padding: 0 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- 分野タブ ---------- */

.v2-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.v2-tab-scroll {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.v2-tab {
  flex: none;
  font-size: 0.92rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  background: var(--bg);
  white-space: nowrap;
}

.v2-tab:hover { background: var(--bg-soft); }

.v2-tab-active {
  background: var(--tab-active-bg);
  color: var(--tab-active-ink);
  border-color: var(--tab-active-bg);
}

.v2-tab-tools {
  display: flex;
  gap: 0.2rem;
  flex: none;
}
/* 記事画面はタブがないので、ホームの「＋」と同じ右端に寄せる */
.v2-tab-tools-end { margin-left: auto; }

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

.v2-search-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.45);
}

.v2-search-backdrop[hidden] { display: none; }

.v2-search-box {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
  margin-bottom: 0.7rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.5rem;
}

.v2-search-box[hidden] { display: none; }

.v2-search-cancel {
  flex: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.45rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.v2-search-cancel:hover { color: var(--ink); background: var(--bg-soft); }

.v2-search-box input,
.v2-search-page input {
  flex: 1 1 auto;
  font: inherit;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem;
}

.v2-search-page {
  display: flex;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.v2-search-page button {
  flex: none;
  font: inherit;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

/* ---------- 本文領域 ---------- */

.v2-page {
  padding: 1.1rem 0 3rem;
}

.v2-page h1 { font-size: 1.5rem; margin: 0 0 0.8rem; line-height: 1.35; }
.v2-page h2 { font-size: 1.15rem; margin: 2rem 0 0.7rem; }

.v2-feed-title {
  font-size: 1.15rem;
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.v2-muted { color: var(--muted); }

.v2-tagline { color: var(--muted); margin-top: 0; }

/* ---------- 記事カード ---------- */

.v2-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1.5rem 1.1rem;
}

.v2-card { position: relative; min-width: 0; }

.v2-card:has(.v2-more-menu:not([hidden])) { z-index: 30; }

.v2-card-top {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  min-width: 0;
}

.v2-card-mark {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  flex: none;
  min-width: 0;
  max-width: 46%;
}

.v2-new {
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.v2-tag {
  flex: none;
  font-size: 0.75rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
  color: var(--muted);
  text-decoration: none;
}

.v2-tag-history { background: var(--field-history-bg); color: var(--field-history-ink); border-color: transparent; }
.v2-tag-science { background: var(--field-science-bg); color: var(--field-science-ink); border-color: transparent; }
.v2-tag-geography { background: var(--field-geography-bg); color: var(--field-geography-ink); border-color: transparent; }
.v2-tag-society { background: var(--field-society-bg); color: var(--field-society-ink); border-color: transparent; }
.v2-tag-culture { background: var(--field-culture-bg); color: var(--field-culture-ink); border-color: transparent; }
.v2-tag-technology { background: var(--field-technology-bg); color: var(--field-technology-ink); border-color: transparent; }

.v2-card-title {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.v2-card-title:hover { text-decoration: underline; }

.v2-card-more {
  position: relative;
  flex: none;
  margin-left: auto;
}

.v2-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
}

.v2-more-btn .v2-glyph {
  width: 1.1rem;
  height: 1.1rem;
}

.v2-more-btn:hover { background: var(--bg-soft); color: var(--ink); }

.v2-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.2rem);
  min-width: 11.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.3rem;
  z-index: 20;
}

.v2-more-menu[hidden] { display: none; }

.v2-more-menu.v2-more-up {
  top: auto;
  bottom: calc(100% + 0.2rem);
}

.v2-more-menu:has(.v2-card-fav-confirm:not([hidden])) { width: 16rem; }

.v2-card-sub {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.v2-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--card);
}

.v2-rank-s { border-color: var(--accent); color: var(--accent); }

.v2-card-thumb {
  display: block;
  text-decoration: none;
}

.v2-card-thumb figure { margin: 0; }

.v2-thumb-big {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
}

.v2-thumb-title {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

/* サムネイル未設定のとき。本のイラスト。 */
.v2-plate {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--plate-bg);
  color: var(--plate-ink);
}

.v2-plate-art {
  width: 40%;
  max-width: 5rem;
  height: auto;
}

.v2-thumb-small {
  width: 4.4rem;
  height: 3rem;
  flex: none;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.v2-thumb-small.v2-plate {
  background: var(--plate-bg);
}

.v2-thumb-small .v2-plate-art {
  width: 70%;
  color: var(--plate-ink);
}

/* ---------- 総履歴 ---------- */

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

.v2-activity li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.v2-activity li:last-child { border-bottom: 0; }

.v2-activity-thumb {
  display: block;
  flex: none;
  text-decoration: none;
}

.v2-activity-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.v2-activity-text a {
  font-weight: 600;
  color: var(--ink);
}

.v2-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- 分野の一覧（All の下） ---------- */

.v2-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.7rem;
  margin-bottom: 1.2rem;
}

.v2-field-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4.5rem;
  text-align: center;
  padding: 1rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.v2-field-btn:hover { background: var(--accent-soft); }

.v2-create {
  display: inline-block;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- ツリー ---------- */

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

.v2-tree-children {
  margin-left: 1.4rem;
}

.v2-tree-children[hidden] { display: none; }

.v2-tree > li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.v2-tree-children > li { border-bottom: 0; }

.v2-tree-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.v2-tree-link {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--ink);
}

.v2-tree-toggle {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- 下部 ---------- */

.v2-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem;
  padding: 1.2rem 0 2rem;
  border-top: 1px solid var(--line-soft);
  font-size: 0.82rem;
  color: var(--muted);
}

.v2-badge {
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* 指で押す端末では当たり判定を広げる */
/* ---------- 記事 ---------- */

.v2-readbar {
  padding: 0.35rem 0 0.7rem;
}

.v2-back {
  display: inline-block;
  margin-bottom: 0.35rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.95rem;
}

.v2-read-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: start;
}

.v2-read-mark {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.v2-rank-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.v2-views {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.v2-field-icons { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }

.v2-field-icon {
  display: inline-flex;
  width: 2.4rem;
  height: 2.4rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: inherit;
  text-decoration: none;
}

.v2-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; flex: none; max-width: 100%; }

.v2-read-title {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.35;
}

.v2-tool-wrap { position: relative; }

.v2-read-tools {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.15rem;
}

.v2-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border: 0;
  background: none;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
}

.v2-icon-btn:hover { background: var(--accent-soft); }

.v2-article-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  min-width: 14rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.4rem;
  z-index: 30;
}

.v2-article-menu[hidden] { display: none; }

.v2-cite-panel {
  /* 上の帯が隠れても残す。帯の真下に貼りつき、閉じるまで消えない */
  position: sticky;
  top: var(--v2-cite-top, 0px);
  z-index: 50;
  margin: 0 0 0.8rem;
  padding: 0.5rem 0 0.2rem;
  background: var(--bg);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  max-height: min(38vh, 18rem);
  overflow: auto;
  transition: top 0.22s ease, background-color 1s cubic-bezier(0.8, 0, 0.2, 1), border-color 1s cubic-bezier(0.8, 0, 0.2, 1);
}

.v2-cite-panel[hidden] { display: none; }

.v2-cite-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.v2-cite-panel h2 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

/* 上のタブが隠れているあいだだけ出す。表示の切り替えは app-v2.js の hidden */
.v2-cite-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.v2-cite-close[hidden] { display: none; }

body:has(#v2Bar.v2-bar-hidden) .v2-cite-head { align-items: center; }

.v2-cites {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
}

.v2-cites li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0 0.35rem 0.55rem;
  border-left: 2px solid transparent;
  font-size: 0.92rem;
}

.v2-cites li.v2-cite-focus { border-left-color: var(--accent); }

.v2-cite-num {
  flex: none;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}
.v2-cite-num::before { content: '['; }
.v2-cite-num::after { content: ']'; }

.v2-cite-text {
  flex: 1;
  min-width: 0;
  line-height: 1.7;
  letter-spacing: 0;
}

.v2-hero { margin: 0 0 1.1rem; }

.v2-thumb-hero {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 22em;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
  background: var(--plate-bg);
}

.v2-thumb-hero.v2-plate {
  display: flex;
  align-items: center;
  justify-content: center;
}

.v2-article-page {
  font-size: clamp(1.05rem, 0.72rem + 0.85vw, 1.85rem);
}

.v2-article .v2-read-title {
  font-size: clamp(1.45rem, 1rem + 1.15vw, 2.55rem);
}

.v2-body {
  max-width: none;
  font-size: 1em;
  line-height: 1.9;
}

.v2-article-page h2 { font-size: 1.1em; }

.v2-lead {
  font-size: 1.62em;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.v2-body .article-figure { margin: 1em 0; }
.v2-body .article-figure img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.v2-body figcaption { color: var(--muted); font-size: 0.81em; }

.v2-wiki-pop {
  position: fixed;
  z-index: 70;
  margin: 0;
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.v2-wiki-pop[hidden] { display: none; }

.v2-wiki-pop a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.05rem;
  min-height: 2.9rem;
  max-width: 16rem;
  padding: 0.45rem 0.95rem;
  background: var(--accent);
  color: var(--on-accent);
  text-decoration: none;
}

.v2-wiki-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.v2-wiki-title {
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.3;
}

.v2-rate { margin-top: 2em; max-width: none; }
.v2-article-page .v2-rate h2 { font-size: 1em; }
.v2-article-page .v2-star,
.v2-article-page .v2-star-send { width: 2.1em; height: 2.1em; }

.v2-stars { display: inline-flex; gap: 0.15rem; vertical-align: middle; }

.v2-star {
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}

.v2-star-on { color: var(--ink); }
.v2-star-on path { fill: currentColor; }

.v2-star-note {
  min-height: 1.4em;
  margin: 0.3rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.v2-star-send {
  width: 2.4rem;
  height: 2.4rem;
  margin-left: 0.4rem;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  vertical-align: middle;
}

.v2-rate-thanks { font-size: 1.05rem; }

.v2-form-error { color: var(--error-ink); margin: 0.3rem 0; }
.v2-form-error[hidden] { display: none; }

.v2-children { margin-top: 1.6rem; }
.v2-children-toggle {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-weight: 700;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  padding: 0.55rem 1rem;
}
.v2-children-toggle:hover { background: var(--accent-soft); }
.v2-children-list { list-style: none; margin: 0.7rem 0 0; padding: 0; }
.v2-children-list[hidden] { display: none; }
.v2-children-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
}

.v2-end-rec { margin-top: 2.2rem; }

.v2-article-menu:has(.v2-report-form:not([hidden])),
.v2-article-menu:has(.v2-delete-form:not([hidden])),
.v2-article-menu:has(.v2-fav-confirm:not([hidden])) {
  width: min(26rem, calc(100vw - 1.25rem));
  max-height: min(80vh, 40rem);
  overflow: auto;
}

.v2-delete-form,
.v2-report-form,
.v2-fav-confirm {
  padding: 0.35rem 0.45rem 0.55rem;
}
.v2-delete-form[hidden],
.v2-report-form[hidden],
.v2-fav-confirm[hidden] { display: none; }

.v2-delete-form p,
.v2-fav-confirm p { margin: 0.15rem 0 0.45rem; }

.v2-report-form label,
.v2-delete-form label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.92rem;
  font-weight: 700;
}

.v2-delete-form input,
.v2-delete-form textarea,
.v2-report-form textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 0.35rem 0 0.15rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
}

.v2-report-form textarea,
.v2-delete-form textarea { min-height: 9rem; }

.v2-delete-form input { min-height: 2.8rem; }

.v2-menu-submit,
.v2-fav-actions button {
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 999px;
}

.v2-menu-submit {
  display: block;
  width: auto;
  min-width: 8rem;
  min-height: 2.8rem;
  margin: 0.7rem 0 0.15rem auto;
  padding: 0 1.35rem;
  border: 0;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1rem;
  box-shadow: var(--shadow);
}

.v2-fav-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.v2-fav-actions button {
  min-height: 2.75rem;
  font-size: 1rem;
}

.v2-fav-no {
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
}

.v2-fav-yes {
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
}

@media (max-width: 720px) {
  .v2-fav-confirm p { font-size: 1.05rem; }
  .v2-fav-actions button,
  .v2-menu-submit {
    min-height: 3.15rem;
    font-size: 1.05rem;
  }
  .v2-report-form textarea,
  .v2-delete-form textarea {
    min-height: 12rem;
    font-size: 1.12rem;
    padding: 0.85rem 0.9rem;
  }
  .v2-delete-form input {
    min-height: 3.3rem;
    font-size: 1.08rem;
  }
}

.v2-comments { list-style: none; margin: 0; padding: 0; }
.v2-comments li { padding: 0.7rem 0; border-bottom: 1px solid var(--line-soft); }
.v2-comments p { margin: 0.25rem 0 0; }
.v2-post-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.v2-post-head strong { min-width: 0; overflow-wrap: anywhere; }
.v2-post-head .v2-card-more { margin-left: auto; }
.v2-post-head .v2-more-menu { z-index: 25; }
.v2-post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.v2-post-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  max-width: 24rem;
  margin-top: 0.5rem;
}
.v2-post-form[hidden] { display: none; }
.v2-post-form label { display: flex; flex-direction: column; gap: 0.25rem; width: 100%; }
.v2-post-form p { margin: 0; }
.v2-post-form textarea,
.v2-post-form input {
  font: inherit;
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
}
.v2-post-form-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.v2-post-form-actions button {
  font: inherit;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--bg);
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}
.v2-post-form-actions .v2-post-cancel {
  background: none;
  color: var(--muted);
  border: 1px solid var(--line);
}
.v2-agola-older { display: inline-block; margin: 0.8rem 0; }
.v2-agola-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 8rem);
  min-height: calc(100dvh - 8rem);
}
.v2-agola-page > .v2-agola-composer { margin-top: auto; }
.v2-agola-older-row { margin: 0; text-align: center; }
.v2-agola-login { margin-top: 1rem; }
.v2-agola-composer {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: 0.6rem;
  padding: 0.6rem 0 calc(0.6rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-top: 1px solid var(--line-soft);
}
.v2-agola-composer .v2-form-error { margin: 0 0 0.4rem; }
.v2-agola-row { display: flex; align-items: flex-end; gap: 0.5rem; }
.v2-agola-send {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}
.v2-agola-send:disabled { opacity: 0.35; cursor: default; }
.v2-agola-input {
  flex: 1;
  min-width: 0;
  min-height: 2.5rem;
  max-height: 9.5rem;
  resize: none;
  overflow-y: auto;
  padding: 0.55rem 0.9rem;
  font: inherit;
  line-height: 1.4;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
}
.v2-affiliations { border: 0; margin: 0.8rem 0; padding: 0; }
.v2-affiliations legend { font-weight: 600; }
.v2-affiliations .v2-muted { margin: 0.25rem 0 0.5rem; }
.v2-aff-list { display: grid; gap: 0.6rem; }
.v2-editor .v2-aff-row { margin: 0; }

.v2-stack-form { display: flex; flex-direction: column; gap: 0.45rem; max-width: 36rem; margin: 1rem 0 1.6rem; }
.v2-stack-form input,
.v2-stack-form textarea {
  font: inherit;
  width: 100%;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
}
.v2-stack-form button,
#v2LogoutBtn,
#v2IconClear {
  font: inherit;
  width: max-content;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}
.v2-hp { position: absolute; left: -999px; }
.v2-form-ok { color: var(--muted); }
.v2-policy-links { display: flex; flex-wrap: wrap; gap: 1rem; }
.v2-account-icon-row { display: flex; align-items: center; gap: 0.8rem; margin: 0.8rem 0; }
.v2-account-icon {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.v2-log { list-style: none; margin: 0; padding: 0; }
.v2-log li { display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; padding: 0.55rem 0; border-bottom: 1px solid var(--line-soft); }
.v2-twofa-qr svg { width: 10rem; height: 10rem; }

@media (max-width: 720px) {
  .v2-field-grid { grid-template-columns: 1fr 1fr; }
  .v2-cards { grid-template-columns: 1fr; }
}

@media (hover: none) {
  .v2-tab { padding: 0.45rem 1rem; }
  .v2-menu-item { padding: 0.6rem; }
  .v2-menu-btn,
  .v2-tool { padding: 0.5rem; }
  .v2-more-btn { width: 2rem; height: 2rem; }
  .v2-tree-toggle { width: 2rem; height: 2rem; }
}

.v2-editor-back {
  display: block;
  width: max-content;
  margin: 0 0 0.45rem;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  text-decoration: none;
}
.v2-editor > h1 {
  margin-top: 0;
  line-height: 1.15;
}
.v2-image-list { display: grid; gap: 0.45rem; margin-top: 0.55rem; }
.v2-editor label,
.v2-editor-row { display: flex; flex-direction: column; gap: 0.25rem; margin: 0.8rem 0; }
.v2-editor input,
.v2-editor textarea,
.v2-editor select,
.v2-table-cell input {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
}
.v2-editor textarea { width: 100%; resize: vertical; }
.v2-section-body { display: none; }
.v2-write {
  min-height: 10rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.v2-chip {
  display: inline-block;
  margin: 0 0.15rem;
  padding: 0 0.35rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-soft);
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.4;
  user-select: none;
}
.v2-editor-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.v2-section { border: 1px solid var(--line); border-radius: var(--radius); margin: 0.8rem 0; }
.v2-section-head { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; padding: 0.45rem; }
.v2-section-name { flex: 1; min-width: 8rem; }
.v2-section-panel { padding: 0 0.45rem 0.6rem; }
.v2-section-tools { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; margin-top: 0.4rem; }
.v2-image-caption { min-width: 10rem; }
.v2-file input { display: block; margin-top: 0.25rem; }
.v2-table-edit { margin-top: 0.6rem; padding: 0.5rem; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.v2-table-row {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.v2-row-remove { align-self: center; white-space: nowrap; }
.v2-table-cell { display: flex; gap: 0.25rem; align-items: center; }
.v2-table-cell input { width: 100%; min-width: 0; }
.v2-select-pop {
  position: fixed;
  z-index: 70;
  width: min(24rem, calc(100vw - 1.5rem));
  display: grid;
  gap: 0.45rem;
  padding: 0.6rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.v2-select-pop[hidden] { display: none; }
.v2-select-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.v2-intro {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem;
  margin: 0.8rem 0;
}
.v2-intro h2 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.v2-cited, .v2-body .cite-mark, .v2-section-copy .cite-mark {
  color: var(--accent);
}
.v2-body .cite-mark, .v2-section-copy .cite-mark {
  font-size: 0.72em;
  font-weight: 700;
  cursor: pointer;
}
.v2-section-title { font-size: 1.15rem; margin: 1.2rem 0 0.3rem; }
.v2-section-title a { color: inherit; text-underline-offset: 0.15em; }
.v2-size-l { font-size: 1.45rem; }
.v2-size-m { font-size: 1.05rem; }
.v2-size-s { font-size: 0.85rem; }
.v2-article-page .v2-size-l { font-size: 1.38em; }
.v2-article-page .v2-size-m { font-size: 1em; }
.v2-article-page .v2-size-s { font-size: 0.81em; }
.v2-weight-b { font-weight: 700; }
.v2-weight-l { font-weight: 300; }
.v2-table { width: 100%; border-collapse: collapse; margin: 0.6rem 0; }
.v2-table td { border: 1px solid var(--line); padding: 0.35rem 0.5rem; vertical-align: top; }
#v2ThumbPreview img { width: 8rem; height: auto; border-radius: var(--radius-sm); }

.v2-fields {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
}
.v2-fields legend { font-weight: 600; }
.v2-fields .v2-muted { flex-basis: 100%; margin: 0; }
.v2-field-check { display: inline-flex; align-items: center; gap: 0.3rem; }

.v2-share {
  /* 位置は JS が画面の中に収まるように決める */
  position: fixed;
  right: 0.5rem;
  top: 0.5rem;
  width: min(17.5rem, calc(100vw - 1rem));
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.7rem;
  z-index: 31;
}
.v2-share[hidden] { display: none; }

#v2CardShare {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 80;
  overflow-y: auto;
}

.v2-join {
  margin-top: 2.2em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
}

.v2-join-title {
  margin: 0 0 0.35em;
  font-size: 1em;
  font-weight: 700;
  line-height: 1.6;
  word-break: auto-phrase;
}

.v2-join-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92em;
  line-height: 1.8;
  word-break: auto-phrase;
  text-wrap: pretty;
}

.v2-join-confirm {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.3rem 0.9rem;
  margin-left: 1rem;
  color: var(--muted);
}
.v2-join-confirm[hidden] { display: none; }
.v2-join-confirm button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.v2-stay .v2-nudge-card[hidden] { display: none; }

.v2-join-go {
  display: inline-block;
  margin-top: 0.7em;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  cursor: pointer;
}

.v2-share-title { margin: 0 0 0.4rem; font-weight: 600; }
.v2-share-preview {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 9rem;
  overflow: auto;
}
.v2-share-actions { display: flex; flex-direction: column; gap: 0.25rem; }
.v2-share-actions a,
.v2-share-actions button,
.v2-share-close {
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  color: var(--ink);
  text-decoration: none;
  padding: 0.35rem 0.2rem;
  cursor: pointer;
}
.v2-share-note { margin: 0.3rem 0 0; color: var(--muted); }
.v2-nudge {
  /* 画面の下に小さく出す。背景は暗くせず、下の内容も操作できる */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: 0 0.75rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.v2-nudge[hidden] { display: none; }
.v2-nudge-card {
  pointer-events: auto;
  width: min(30rem, 100%);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem 0.65rem 1rem;
  box-shadow: var(--shadow-lg);
}
.v2-nudge-text {
  flex: 1 1 13rem;
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}
.v2-nudge-text strong { display: block; font-size: 0.95rem; font-weight: 600; }
.v2-nudge-text span { display: block; margin-top: 0.1rem; color: var(--muted); font-size: 0.82rem; }
.v2-nudge-actions { display: flex; align-items: center; gap: 0.3rem; margin-left: auto; }
.v2-nudge-actions a,
.v2-nudge-actions button {
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.2;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  padding: 0.5rem 0.7rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.v2-nudge-actions .v2-nudge-primary {
  background: var(--accent);
  color: var(--on-accent);
}
.v2-nudge-actions a:hover,
.v2-nudge-actions button:hover { text-decoration: underline; }
.v2-nudge-actions .v2-nudge-primary:hover { text-decoration: none; filter: brightness(1.08); }

/* コントロール画面の再認証など、入力が必要なものは中央の確認画面にする */
.v2-nudge-modal {
  inset: 0;
  align-items: center;
  background: rgba(20, 16, 12, 0.35);
  padding: 1rem;
  pointer-events: auto;
}
.v2-nudge-modal .v2-nudge-card {
  display: block;
  width: min(22rem, 100%);
  padding: 1rem 1.1rem;
}
.v2-nudge-modal .v2-nudge-card p { margin: 0 0 0.8rem; font-size: 1.05rem; }
.v2-nudge-modal .v2-nudge-actions { gap: 0.6rem; margin-left: 0; }
.v2-nudge-modal .v2-nudge-actions button {
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.45rem 0.8rem;
}

.v2-control section { margin-top: 1.4rem; }
.v2-control h2 { font-size: 1.05rem; }
.v2-control-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.v2-control-actions button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}
.v2-control-row {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.v2-control-row .v2-meta, .v2-control .v2-meta { color: var(--muted); font-size: 0.85rem; }
.v2-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
}
.v2-bar-list { list-style: none; margin: 0; padding: 0; }
.v2-bar-list li { display: grid; grid-template-columns: minmax(0, 1fr) 5rem auto; gap: 0.4rem; align-items: center; margin: 0.25rem 0; }
.v2-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; }
.v2-bar-track { height: 0.45rem; background: var(--bg-soft); border-radius: 999px; overflow: hidden; }
.v2-bar-fill { display: block; height: 100%; background: var(--ink); width: 0; }
.v2-bar-value { font-size: 0.85rem; color: var(--muted); }
#v2ControlAuth input { width: 100%; margin-bottom: 0.6rem; }

.v2-feed-more { text-align: center; margin: 1.2rem 0; }
.v2-feed-more a { color: var(--accent); }
.v2-feed-end { height: 1px; }

@media (min-width: 1200px) {
  .v2-article { --hale-read: 40rem; }

  .v2-article .v2-back {
    font-size: 1.2rem;
    padding: 0.35rem 0.2rem 0.45rem 0;
  }

  .v2-article .v2-read-main {
    width: min(var(--hale-read), 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .v2-article-page { position: relative; }

  .v2-article .v2-cite-panel:not([hidden]) {
    /* 本文の右に、画面に固定して置く。上の帯が隠れても動かない */
    position: fixed;
    top: calc(var(--v2-cite-top, 0px) + 1rem);
    left: calc(50% + (var(--hale-read) / 2) + 1.2rem);
    width: 15rem;
    max-width: 15rem;
    max-height: calc(100vh - var(--v2-cite-top, 0px) - 2rem);
    margin: 0;
    padding: 0 0 0 1rem;
    background: transparent;
    border: 0;
    border-left: 1px solid var(--line);
    overflow: auto;
    z-index: 5;
  }

  .v2-article-page .v2-hero,
  .v2-article-page .v2-body,
  .v2-article-page .v2-rate,
  .v2-article-page .v2-join,
  .v2-article-page .v2-children {
    width: min(var(--hale-read), 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .v2-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .v2-card { width: 18.5rem; flex: none; }
}
