/* ===== 1) Global Foundation (tokens + reset + utilities) ===== */
:root {
  --ink: #1f2933;
  --muted: #6b7280;
  --border: #cfd6df;
  --soft-border: #e5e9ef;
  --card: #ffffff;
  --bg: #f7f8fa;
  /* Fixed photo viewport height to avoid scroll target drift */
  --photo_stage_h: clamp(220px, 26vw, 340px);
  /* Left timeline column width (desktop) */
  --timeline_col_w: 280px;
  /* Sticky filter bar height fallback (JS may set --filter_h to exact px for scroll-margin-top) */
  --top_clearance: 92px;
  /* Timeline header height (independent from filter bar) */
  --timeline_head_h: 56px;
  /* Liquid Glass base tone (slightly darker than pure white) */
  --glass-base: 232 234 238;

  /* Liquid Glass tuning knobs */
  --glass-alpha: 0.72;
  --glass-alpha-soft: 0.32;
  --glass-tint: 15 23 42;
  --glass-tint-alpha: 0.055;
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-border-soft: rgba(255, 255, 255, 0.40);
  --glass-blur-filter: 18px;
  --glass-blur-panel: 26px;
}

/* --- Reset --- */
* {
  box-sizing: border-box;
}

/* Honor the HTML `hidden` attribute even when author CSS sets display. */
[hidden] {
  display: none !important;
}
/* Modals / drawer: avoid background scroll chaining while overlay locks the page */
html.is_bio_scroll_locked,
html.is_bio_scroll_locked body {
  overscroll-behavior: none;
}

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

/* ===== 2) Biography Root & Loading State (.koda_section_general) ===== */
.koda_section_general {
  position: relative;
}

.koda_section_general.is_loading > :not(.bio_loading_overlay) {
  display: none !important;
}

.koda_section_general.is_loading {
  /* Keep a meaningful content gap between header and footer while loading */
  min-height: clamp(360px, 56vh, 760px);
}

.bio_loading_overlay {
  position: absolute;
  inset: 0;
  z-index: 899;
  display: grid;
  place-items: center;
  backdrop-filter: blur(2px);
}

.bio_loading_inner {
  padding: 24px 28px;
  border: 1px solid var(--soft-border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.bio_loading_spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #d7dee8;
  border-top-color: #2563eb;
  animation: bio_loading_spin 0.85s linear infinite;
  flex: 0 0 auto;
}

.bio_loading_text {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

@keyframes bio_loading_spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== 3) Main Content Area (page_wrap / filter / timeline / list) ===== */
.page_wrap {
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Sticky filter bar: lives inside .main_column above diary_list */
.main_column {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  min-height: 0;
  /* Single vertical scroll lives in .diary_list (virtual list); avoid nested column scroll + document chaining */
  overflow: hidden;
}

.filter_bar {
  position: sticky;
  top: 0;
  z-index: 4;
  width: 99%;
  justify-self: center;
}

.filter_shell {
  display: grid;
  grid-template-columns: 1fr;
  pointer-events: auto;
}

.filter_shell::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  background: var(--card);
  border: 1px solid var(--soft-border);
  border-top: none;
  border-radius: 0 0 16px 16px;
}

.filter_shell[data-filter-style="liquid"]::before {
  background:
    linear-gradient(180deg, rgb(var(--glass-base) / var(--glass-alpha)), rgb(var(--glass-base) / calc(var(--glass-alpha) - 0.08))),
    radial-gradient(900px 520px at 0% 0%, rgba(37, 99, 235, 0.08), transparent 55%),
    linear-gradient(180deg, rgb(var(--glass-tint) / var(--glass-tint-alpha)), transparent 70%);
  border: 1px solid var(--glass-border);
  border-top: none;
  -webkit-backdrop-filter: saturate(185%) blur(var(--glass-blur-filter));
  backdrop-filter: saturate(185%) blur(var(--glass-blur-filter));
}

.filter_shell[data-filter-style="liquid"] .category_row__label {
  color: rgba(17, 24, 39, 0.88);
}

.filter_shell[data-filter-style="liquid"] .category_row__control {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.55));
  box-shadow:
    0 10px 22px rgba(15, 23, 42, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.filter_shell[data-filter-style="liquid"] .category_row__control:hover {
  box-shadow:
    0 14px 28px rgba(15, 23, 42, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.filter_shell[data-filter-style="liquid"] .category_row__control:active {
  transform: translateY(1px);
}

.filter_shell[data-filter-style="liquid"] .category_row__control.is_open {
  border-color: rgba(37, 99, 235, 0.55);
}

.filter_shell[data-filter-style="liquid"] .filter_count {
  color: rgba(17, 24, 39, 0.62);
}

.filter_row {
  display: flex;
  align-items: center;
  gap: 16px;
  grid-column: 1;
  grid-row: 1;
  padding: 12px;
  /* 表示カテゴリの高さをタイムラインの年代ヘッダと揃える */
  min-height: var(--timeline_head_h);
}

.filter_count {
  font-size: 13px;
  color: var(--muted);
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.diary_list {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px;
  padding-top: 0;
}

.diary_list::-webkit-scrollbar {
  width: 10px;
}

.diary_list::-webkit-scrollbar-track {
  border-radius: 8px;
  background-color: #e7e7e7;
  border: 1px solid #cacaca;
}

.diary_list::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background-color: #7c7c7c;
}

.diary_empty_state {
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px dashed var(--soft-border);
  border-radius: 12px;
  background: #fcfcfd;
  color: var(--muted);
  text-align: center;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

/* --- Timeline navigation + timeline body --- */
.content_layout {
  display: flex;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
}

.timeline_nav {
  position: sticky;
  top: 0;
}

.timeline_tab {
  display: none;
}

.timeline_backdrop {
  display: none;
}

.timeline_shell {
  border-radius: 0;
  border: 1px solid var(--soft-border);
  background: var(--card);
  /* When viewport height is small, allow the whole timeline to scroll
     so the year list doesn't get pushed off-screen. */
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* Hide scrollbar (keep scrolling) */
  scrollbar-width: none; /* Firefox */
}

.timeline_shell::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.timeline_fixed {
  flex: 0 0 auto;
}

.timeline_fixed .timeline_head {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.timeline_scroll {
  flex: 1 1 auto;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 12px;
  scrollbar-width: none;
  padding-bottom: 200px;
}

.timeline_scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* reuse the same liquid attribute concept as filter_shell */
.timeline_shell[data-filter-style="liquid"] {
  /* Focus tuning (brighten panel only while focused) */
  --tl-glass-alpha-top: calc(var(--glass-alpha) - 0.04);
  --tl-glass-alpha-bottom: var(--glass-alpha-soft);
  --tl-glass-tint-alpha: var(--glass-tint-alpha);
  --tl-glass-border: var(--glass-border-soft);
  --tl-glass-inner-top: 0.80;
  --tl-glass-inner-bottom: 0.06;
  background:
    linear-gradient(180deg, rgb(var(--glass-base) / var(--tl-glass-alpha-top)), rgb(var(--glass-base) / var(--tl-glass-alpha-bottom))),
    radial-gradient(1200px 600px at -10% 0%, rgba(37, 99, 235, 0.10), transparent 52%),
    radial-gradient(800px 500px at 110% 20%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(180deg, rgb(var(--glass-tint) / var(--tl-glass-tint-alpha)), transparent 70%);
  border: 1px solid var(--tl-glass-border);
  -webkit-backdrop-filter: saturate(185%) blur(var(--glass-blur-panel));
  backdrop-filter: saturate(185%) blur(var(--glass-blur-panel));
  transition: background 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.timeline_shell[data-filter-style="liquid"]:focus-within {
  /* Brighter greys when the user is interacting with the timeline */
  --tl-glass-alpha-top: 0.84;
  --tl-glass-alpha-bottom: 0.50;
  --tl-glass-tint-alpha: 0.035;
  --tl-glass-border: rgba(255, 255, 255, 0.52);
  --tl-glass-inner-top: 0.86;
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .filter_shell[data-filter-style="liquid"]::before {
    background: rgb(var(--glass-base) / 0.92);
  }

  .timeline_shell[data-filter-style="liquid"] {
    background: rgb(var(--glass-base) / 0.92);
  }
}

.timeline_head {
  padding: 6px 8px 10px;
}

.timeline_head_row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.timeline_title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(17, 24, 39, 0.88);
  margin: 10px 0;
  line-height: 1.1;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.timeline_meta {
  margin-top: 2px;
  font-size: 13px;
  color: rgba(17, 24, 39, 0.56);
  white-space: nowrap;
  margin-bottom: 0;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}


.timeline_decade_list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: none;
  overflow: visible;
  padding: 4px 0;
}

.timeline_year_list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: none;
  overflow: visible;
  padding: 4px 0 8px 28px;
  border-top: none;
}

/* When the year list is collapsed, remove the container entirely (no "ghost" panel). */
.timeline_year_list[data-collapsed="1"] {
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.timeline_decade_btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  text-align: left;
  font-size: 14px;
  letter-spacing: 0.01em;
  color: rgba(17, 24, 39, 0.76);
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  white-space: nowrap;
}

.timeline_decade_btn.is_active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.18)),
    linear-gradient(180deg, rgba(37, 99, 235, 0.24), rgba(37, 99, 235, 0.12));
  color: rgba(17, 24, 39, 0.94);
}

.timeline_decade_btn:focus-visible {
  outline: none;
}

.timeline_decade_badge {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.26);
  border: 0;
  color: rgba(17, 24, 39, 0.56);
}

.timeline_item_icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  border: 0;
  color: rgba(37, 99, 235, 0.90);
  font-size: 22px;
}

.timeline_decade_btn .timeline_item_icon {
  transform: translateY(-3px);
}

.timeline_item_chev {
  margin-left: 2px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  color: rgba(17, 24, 39, 0.42);
  transform: rotate(0deg);
  transition: transform 160ms ease, color 160ms ease;
}

.timeline_decade_btn.is_years_open .timeline_item_chev {
  transform: rotate(90deg);
  color: rgba(17, 24, 39, 0.60);
}

.timeline_year {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
  text-align: left;
  font-size: 14px;
  color: rgba(17, 24, 39, 0.78);
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  white-space: nowrap;
}

.timeline_year_row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline_year_row .timeline_year {
  flex: 1 1 auto;
  width: auto;
}

.timeline_year_row :is(.timeline_year) {
  min-height: 36px;
}

.timeline_life_btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  padding: 5px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.20)),
    linear-gradient(180deg, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0.08));
  color: rgba(17, 24, 39, 0.90);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.timeline_life_btn:disabled {
  border-color: #A9A9A9;
  background: #A9A9A9;
  color: #ffffff;
  cursor: not-allowed;
}

.timeline_life_btn:focus-visible {
  outline: none;
}

.timeline_item_label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* Apply hover styles only on devices that actually support hover.
   On touch devices (e.g. iOS Safari), :hover can “stick” and sometimes makes the first tap feel unresponsive. */
@media (hover: hover) and (pointer: fine) {
  .timeline_decade_btn:hover {
    background: rgba(255, 255, 255, 0.22);
  }

  .timeline_year:hover {
    background: rgba(255, 255, 255, 0.22);
  }

  .timeline_life_btn:hover {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.26)),
      linear-gradient(180deg, rgba(37, 99, 235, 0.22), rgba(37, 99, 235, 0.10));
  }
}

.timeline_life_btn:disabled:hover {
  background: #A9A9A9;
}

.timeline_year.is_active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.18)),
    linear-gradient(180deg, rgba(37, 99, 235, 0.24), rgba(37, 99, 235, 0.12));
  color: rgba(17, 24, 39, 0.94);
}

.timeline_year:focus-visible {
  outline: none;
}

.timeline_year:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.timeline_year:disabled .timeline_item_icon {
  color: rgba(107, 114, 128, 0.55);
}

.timeline_decade_btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.timeline_decade_btn:disabled:hover {
  background: transparent;
}

.timeline_decade_btn:disabled .timeline_item_icon {
  color: rgba(107, 114, 128, 0.55);
  background: rgba(255, 255, 255, 0.12);
}

.timeline_decade_btn:disabled .timeline_decade_badge {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(17, 24, 39, 0.44);
}

/* --- Filter category selector + category dialog --- */
.category_selector {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;

  display: grid;
  grid-template-columns: minmax(min-content, 100px) 1fr;
  align-items: center;
  gap: 10px;
}

.category_row__label {
  font-size: 12px;
  color: rgba(17, 24, 39, 0.88);
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
  min-width: 0;
  overflow: visible;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.category_row__control {
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  cursor: pointer;
  overflow: hidden;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.category_row__control:focus,
.category_row__control:focus-visible {
  outline: none;
}

.category_row__control.is_open {
  border-color: #2563eb;
  box-shadow: none;
  position: relative;
  z-index: 799;
}

.category_row__left {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  line-height: 1.3;
}

.category_row__right {
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  line-height: 1.3;
}

.category_row__icon {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 14px;
  color: var(--muted);
  margin-left: 2px;
}

.category_row__count {
  display: none;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 998;
}

.backdrop.is_open {
  opacity: 1;
  pointer-events: auto;
}

.category_panel {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  border: 1px solid var(--soft-border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  z-index: 999;
  overflow: hidden;
  max-height: calc(100dvh - 24px);
}

.category_panel.is_open {
  display: block;
  border-color: #2563eb;
}

.category_panel__header {
  padding: 12px;
  border-bottom: 1px solid var(--soft-border);
}

.category_panel__title {
  font-size: 13px;
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.category_panel__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.btn--ghost {
  color: #374151;
}

.btn--primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.cat_chip_area {
  padding: 10px 12px 12px;
}

.cat_chip_grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-height: none;
  overflow: auto;
  padding-right: 2px;
}

.cat_chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  cursor: pointer;
  user-select: none;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.cat_chip__dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #9ca3af;
  flex: 0 0 auto;
}

.cat_chip__label {
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
}

.cat_chip__count {
  font-size: 12px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #6b7280;
}

.cat_chip.is_on {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.cat_chip.is_on .cat_chip__dot {
  background: #2563eb;
}

@media (max-width: 640px) {
  .category_selector {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .category_row__control {
    padding: 12px 12px;
  }

  .cat_chip_grid {
    gap: 8px;
  }

  .cat_chip {
    padding: 11px 10px 11px 12px;
  }
}

/* -------------------------------------------------------------------------
   Detail cards: split NEWS vs non-NEWS so each can be styled independently.
   Category uses data-diary-category (see bio.js getDiaryCategoryCode).
   ------------------------------------------------------------------------- */

/* Shared shell (all categories) */
.detail_card {
  position: relative;
  width: 100%;
  margin: 0.5em 0;
  background: var(--card);
  border-style: solid;
  border-width: 2px;
  border-radius: 10px;
}

/* Non-NEWS (DIARY, 活動履歴, etc.) */
.detail_card:not([data-diary-category="news" i]) {
  border-color: var(--border);
  padding: 20px 25px;
}

/* NEWS — de-emphasized / compact */
.detail_card[data-diary-category="news" i] {
  border-color: var(--soft-border);
  background: whitesmoke;
  padding: 12px 14px;
}

.detail_card[data-diary-category="news" i] .detail_blocks {
  gap: 4px;
}

.detail_card.is_url_anchor {
  border-color: #2563eb;
  box-shadow:
    0 18px 50px rgba(15, 23, 42, 0.08),
    0 0 0 3px rgba(37, 99, 235, 0.24);
}

.detail_blocks {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.block_date {
  padding-bottom: 0;
  border-bottom: none;
}

/* ===== 4) Detail Card Area (date/meta/title/body/media/related) ===== */
/* --- Date + meta + title row --- */
.date_row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.block_date .date_label {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.02em;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  line-height: 1.05;
}

.meta_row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
  align-items: center;
}

.meta_tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.meta_tag span {
  white-space: normal;
}

/* Meta pills: NEWS (both category + age tags) */
.detail_card[data-diary-category="news" i] .meta_tag {
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.detail_card[data-diary-category="news" i] .meta_tag_icon {
  font-size: 11px;
  color: var(--muted);
}

.meta_tag_icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
}

.meta_tag_icon:empty {
  display: none;
}

.title_row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  row-gap: 6px;
}

.detail_title {
  margin: 0;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-weight: 700;
}

.detail_card:not([data-diary-category="news" i]) .detail_title {
  font-size: 18px;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: royalblue;
}

.detail_card[data-diary-category="news" i] .detail_title {
  font-size: 15px;
  line-height: 1.35;
  color: var(--muted);
}

.btn_minor {
  height: fit-content;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  justify-self: end;
}

.btn_icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  line-height: 1;
  font-size: 12px;
  color: var(--muted);
}

.btn_minor[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn_minor[data-detail-trigger],
.btn_minor[data-photo-play] {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--_koda---bg_button);
  border-radius: 0;
}

.btn_minor[data-detail-trigger]:hover:not([disabled]),
.btn_minor[data-photo-play]:hover:not([disabled]) {
  border-color: rgba(37, 99, 235, 0.85);
  background: rgba(37, 99, 235, 0.06);
}

/* --- Context: artist / venue as plain labeled lines (stacked) --- */
.context_section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.detail_card:not([data-diary-category="news" i]) .context_section {
  margin-top: 24px;
  gap: 10px 18px;
}

.detail_card[data-diary-category="news" i] .context_section {
  margin-top: 12px;
  gap: 8px 12px;
}

.context_dl {
  margin: 0;
}

.context_dl dt,
.context_dl dd {
  margin: 0;
}

.context_subsection + .context_subsection {
  margin-top: 0;
}

.context_plain_line {
  margin: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.context_plain_label {
  display: inline;
  margin-right: 0.2em;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.context_plain_names {
  display: inline;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  white-space: normal;
}

.context_meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
}

/* 人物/場所はスペース優先: なるべく1行、溢れたら横スクロール */
.context_meta--singleline {
  margin-top: 0;
}

.context_meta--singleline .context_item {
  flex: 1 1 auto;
  min-width: 0;
}

.context_meta--singleline .chip_row {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  gap: 6px;
}

.context_item--ellipsis {
  width: 100%;
  min-width: 0;
}

/* 人物/場所: 独立した四角チップ + 末尾… */
.chip_row--ellipsis .chip {
  flex: 0 0 auto;
  max-width: none;
}

.chip_box {
  border-radius: 6px;
}

.chip_row--ellipsis .chip_text {
  display: block;
  white-space: nowrap;
}

.context_item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.context_item svg {
  width: 16px;
  height: 16px;
}

.context_icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  line-height: 1;
  font-size: 13px;
  color: var(--muted);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--soft-border);
  background: var(--card);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-width: 0;
}

.chip_dense {
  padding: 4px 10px;
  font-size: 12px;
}

.chip_text {
  min-width: 0;
}

.chip_clickable {
  cursor: pointer;
}

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

.chip_clickable:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
}

/* --- Diary text + expandable detail drawer --- */
.diary_text {
  display: flex;
  flex-direction: column;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail_card:not([data-diary-category="news" i]) .diary_text {
  margin-top: 10px;
  gap: 16px;
}

.detail_card[data-diary-category="news" i] .diary_text {
  margin-top: 8px;
  gap: 10px;
}

.sub_heading {
  margin: 14px 0 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.4;
  color: var(--muted);
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.diary_text p {
  margin: 0;
}

.detail_card:not([data-diary-category="news" i]) .diary_text p {
  font-size: 15px;
  line-height: 1.9;
  color: var(--ink);
}

.detail_card[data-diary-category="news" i] .diary_text p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

/* 本文内の見出し的要素（将来の拡張用） */
.diary_text h2,
.diary_text h3,
.diary_text h4 {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  letter-spacing: 0.04em;
  line-height: 1.4;
}

.diary_text h2 {
  font-size: 16px;
  font-weight: 800;
  margin-top: 10px;
}

.diary_text h3 {
  font-size: 15px;
  font-weight: 800;
  margin-top: 10px;
}

.diary_text h4 {
  font-size: 14px;
  font-weight: 800;
  margin-top: 8px;
}

.detail_panel {
  margin-top: 14px;
  display: none;
}

.detail_panel[data-open="true"] {
  display: block;
}

.detail_drawer {
  margin-top: 8px;
  border: 1px solid var(--soft-border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
  background: #fcfcfd;
}

.detail_drawer p {
  margin: 0;
}

/* --- Photos + detail modal --- */
.photo_section {
  margin-top: 12px;
}

.photo_divider {
  border: none;
  border-top: 1px solid var(--soft-border);
  margin: 14px 0 12px;
}

.photo_carousel {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
}

.photo_carousel[data-nav-hidden="true"] {
  grid-template-columns: minmax(0, 1fr);
}

.photo_stage--carousel {
  max-width: none;
  margin: 0;
  cursor: zoom-in;
}

.photo_nav {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.photo_nav .photo_nav_icon {
  width: 16px;
  height: 16px;
  display: block;
}

.photo_nav[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

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

.photo_counter {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
}

.photo_hint {
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* Detail HTML popup */
.detail_modal_overlay {
  position: fixed;
  inset: 0;
  padding: 18px 12px;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.detail_modal_overlay[data-open="true"] {
  display: flex;
}

.detail_modal_panel {
  width: min(980px, 100%);
  max-height: min(86vh, 920px);
  overflow: hidden;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 22px 80px rgba(15, 23, 42, 0.35);
  display: flex;
  flex-direction: column;
}

.detail_modal_header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--soft-border);
  gap: 10px;
  flex-shrink: 0;
}

.detail_modal_title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  min-width: 0;
}

.detail_modal_close {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  flex-shrink: 0;
}

.detail_modal_body {
  padding: 12px 12px 14px;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.detail_modal_content {
  flex: 1 1 auto;
  min-height: 200px;
  max-height: min(72vh, 760px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--soft-border);
  border-radius: 10px;
  padding: 16px 18px;
  background: #fcfcfd;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
}

.bio_detail_modal_prose :where(p, ul, ol, blockquote, pre, table) {
  margin: 0 0 0.85em;
}

.bio_detail_modal_prose :where(ul, ol) {
  padding-left: 1.35em;
}

.bio_detail_modal_prose :where(p:last-child, ul:last-child, ol:last-child) {
  margin-bottom: 0;
}

.photo_stage {
  max-width: 760px;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  height: var(--photo_stage_h);
  /* Keep layout stable even before the image loads */
  contain: layout paint;
}

.photo_stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* --- Bio photo popup local overrides --- */

.modal-score1-popup .wrapper_item,
.modal-score1-popup .wrapper_popup_common {
  background: #000;
  color: #fff;
  border-radius: 10px;
  max-height: none !important;
}

.modal-score1-popup .wrapper_item_title {
  padding: 12px 40px 5px 0;
}

.modal-score1-popup .icon_item_title,
.modal-score1-popup .text_item_title {
  display: none !important;
}

.modal-score1-popup .text_item_popup_content_name {
  color: #fff !important;
  background: transparent !important;
  border: 0;
  padding: 0;
}

.modal-score1-popup .pv-close,
.modal-score1-popup .btn_pop_close {
  color: #fff;
}

/* Keep existing colors; only normalize button corner shape */
.modal-score1-popup .pv-btn,
.modal-score1-popup .pv-nav {
  border-radius: 0;
}

body.sod-top-ml-pop .modal-score1-popup .pv-nav.pv-prev,
body.sod-top-ml-pop .modal-score1-popup .pv-nav.pv-next {
  border-radius: 0 !important;
}

/* --- Related section (images/videos/links/chips) --- */
.related_section {
  border-top: none;
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.related_groups {
  margin-top: 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.related_groups dt,
.related_groups dd {
  margin: 0;
}

.related_divider {
  border: none;
  border-top: 1px solid var(--soft-border);
  margin: 12px 0 10px;
}

.reference_actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.reference_panel {
  display: none;
}

.reference_panel[data-open="true"] {
  display: block;
}

.reference_drawer {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reference_item {
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
}

.reference_item :is(img, video) {
  width: 100%;
  height: auto;
  display: block;
}

.reference_iframe_wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.reference_iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.reference_link {
  display: block;
  padding: 12px;
  background: var(--card);
  color: var(--ink);
  text-decoration: underline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference_caption {
  margin: 0;
  padding: 10px 12px;
  background: var(--card);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.related_group {
  margin: 0;
  padding: 0;
  display: block;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.related_group .related_label {
  display: inline;
  margin: 0 0.2em 0 0;
  padding: 0;
  vertical-align: baseline;
  white-space: normal;
}

.related_plain_dd {
  display: inline;
  margin: 0;
  padding: 0;
  vertical-align: baseline;
  max-width: 100%;
}

.related_plain_text {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
    BlinkMacSystemFont, sans-serif;
  white-space: normal;
}

.related_plain_link {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  font-family: "Noto Serif JP", "Times New Roman", "Hiragino Mincho ProN", serif;
}

.related_plain_link:hover {
  text-decoration: underline;
}

.related_plain_link:focus-visible {
  outline: 2px solid var(--_koda---bg_button);
  outline-offset: 2px;
}

.related_plain_link::after {
  font: normal 900 1em / 1 "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 1em;
  content: " \f101";
  color: var(--_koda---bg_button);
}

.bio_scroll_assist {
  display: none;
}

/* ===== 5) Responsive Overrides (tablet/mobile) ===== */
@media (max-width: 900px) {
  :root {
    --top_clearance: 88px;
    --timeline_col_w: 230px;
  }

  body {
    padding: 0 0 0 14px;
  }

  .filter_row {
    gap: 12px;
  }

  /* Tablet: keep timeline vertical (no horizontal scroll) */
  .content_layout {
    gap: 14px;
  }

  .detail_card:not([data-diary-category="news" i]) {
    padding: 20px 25px;
  }

  .detail_card[data-diary-category="news" i] {
    padding: 10px 12px;
  }

  .detail_title {
    font-size: 18px;
  }
}

@media (max-width: 640px) {
  :root {
    --top_clearance: 60px;
    --photo_stage_h: clamp(180px, 52vw, 260px);
  }

  body {
    padding: 0 0 0 12px;
  }

  .filter_shell::before {
    content: none;
  }

  .bio_scroll_assist {
    position: fixed;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 930;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .bio_scroll_assist_btn {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: #fff;
    color: rgba(17, 24, 39, 0.9);
    font-size: 18px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
    cursor: pointer;
  }

  .bio_scroll_assist_btn:active {
    transform: translateY(1px);
  }

  .bio_scroll_assist_btn:focus-visible {
    outline: 1px solid var(--_koda---bg_button);
    outline-offset: 2px;
  }

  .filter_shell[data-filter-style="liquid"] {
    /* slightly lighter/"thinner" panel */
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-top: none;
    box-shadow:
      0 14px 40px rgba(15, 23, 42, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
  }

  .filter_row {
    grid-column: auto;
    grid-row: auto;
    padding: 0;
    gap: 10px;
  }

  /* Mobile: make the selector more compact; ラベル「表示カテゴリ」が欠けないよう min-content を許容 */
  .category_selector {
    grid-template-columns: minmax(min-content, 72px) 1fr;
    gap: 10px;
  }

  .category_row__label {
    display: block;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: rgba(17, 24, 39, 0.88);
    margin-bottom: 6px;
    font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
      BlinkMacSystemFont, sans-serif;
  }

  /* Mobile: shorten selector summary text */
  .category_row__right {
    display: none;
  }

  .category_row__control {
    padding: 9px 12px;
    min-height: 34px;
    border-radius: 999px;
  }

  .category_row__left,
  .category_row__right {
    font-size: 12px;
  }

  /* Restore right-end visible count (separate from selected-category count) */
  .category_row__count {
    display: none;
  }

  .filter_count {
    display: block;
    font-size: 12px;
  }

  /* Smartphone: timeline becomes an off-canvas drawer with a visible tab */
  .content_layout {
    grid-template-columns: 1fr;
    /* Shared timeline tokens (tab is a sibling of nav, so vars must live here) */
    /* Handle color (category blue) */
    --tl-tab: 37 99 235;
    /* Panel accent follows the handle for a cohesive liquid tint */
    --tl-accent: var(--tl-tab);
    --tl-accent-ink: rgb(var(--tl-accent) / 0.86);
    --tl-accent-soft: rgb(var(--tl-accent) / 0.18);
    --tl-peek: 10px; /* how much the drawer peeks when closed */
    /* Handle size (a bit wider for easier grabbing) */
    --tl-tab-w: 30px;
    --tl-tab-h: 108px;
    /* How much the tab is buried into the left screen edge (≈1/3 of width) */
    --tl-tab-bury: 10px;
  }

  .timeline_nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    width: min(320px, 86vw);
    z-index: 900;
    margin-top: 0;
    /* IMPORTANT: Don't transform this container.
       A transformed ancestor breaks viewport-fixed children (tab/handle). */
    transform: none;
    /* Closed: don't block taps on the page. */
    pointer-events: none;
  }

  .timeline_nav.is_open {
    transform: none;
    pointer-events: auto;
  }

  .timeline_tab {
    display: inline-flex;
    /* Thin handle at mid screen */
    position: fixed;
    top: 46dvh;
    /* Slightly off-screen so it feels embedded */
    left: calc(env(safe-area-inset-left) - var(--tl-tab-bury));
    width: var(--tl-tab-w);
    height: var(--tl-tab-h);
    /* Keep the label 100% visible even when the tab is buried */
    padding-left: var(--tl-tab-bury);
    padding-right: 2px;
    border-radius: 999px;
    border: 2px solid rgb(var(--tl-tab) / 0.98);
    /* Category-blue handle + black text */
    background:
      linear-gradient(180deg, rgba(236, 252, 255, 0.92), rgba(210, 246, 255, 0.72)),
      linear-gradient(180deg, rgb(var(--tl-tab) / 0.62), rgb(var(--tl-tab) / 0.26));
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    color: rgba(17, 24, 39, 0.94);
    text-shadow:
      0 1px 0 rgba(255, 255, 255, 0.70),
      0 0 6px rgb(var(--tl-tab) / 0.38);
    font-weight: 900;
    letter-spacing: 0.08em;
    font-size: 12px;
    font-family: "Noto Sans JP", "Hiragino Sans", "Segoe UI", system-ui, -apple-system,
      BlinkMacSystemFont, sans-serif;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-orientation: mixed;
    pointer-events: auto;
    z-index: 920;
    filter: saturate(1.04) contrast(1.04);
    /* Improve touch ergonomics on mobile without changing visual size too much */
    touch-action: manipulation;
  }

  .timeline_tab::before {
    content: "";
    position: absolute;
    inset: -12px -10px;
    border-radius: 999px;
    background: transparent;
  }

  /* When the drawer is open, the tab isn't needed (backdrop tap / swipe close). */
  .timeline_tab.is_open {
    opacity: 0;
    pointer-events: none;
  }

  .timeline_backdrop {
    display: block;
    position: fixed;
    inset: 0;
    /* Dim the page behind the drawer (modal feel) */
    background: rgba(0, 0, 0, 0.14);
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 260ms cubic-bezier(0.35, 0, 0.2, 1),
      background-color 260ms cubic-bezier(0.35, 0, 0.2, 1);
    /* Must stay behind the timeline panel */
    z-index: 890;
  }

  /* Backdrop: thin at the beginning of open, then deepen */
  .timeline_nav.is_opening .timeline_backdrop {
    background: rgba(0, 0, 0, 0.14);
  }

  .timeline_nav.is_open .timeline_backdrop {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.32);
  }

  .timeline_shell {
    /* Focus tuning (brighten drawer while focused) */
    /* Base layer is intentionally a bit thicker than PC so content behind doesn't show through too much */
    --tl-drawer-alpha-top: 0.90;
    --tl-drawer-alpha-bottom: 0.74;
    --tl-drawer-tint-alpha: 0.032;
    --tl-drawer-border: rgba(255, 255, 255, 0.34);
    --tl-drawer-inner-top: 0.78;
    --tl-drawer-inner-blue: 0.10;
    position: relative;
    margin-top: 0;
    height: 100dvh;
    border-radius: 0 20px 20px 0;
    overflow: hidden;
    z-index: 891;
    /* No inner top clearance; header stays fixed. */
    padding: 0;
    border-top: none;

    /* Liquid panel */
    background:
      linear-gradient(180deg, rgb(var(--glass-base) / var(--tl-drawer-alpha-top)), rgb(var(--glass-base) / var(--tl-drawer-alpha-bottom))),
      radial-gradient(900px 600px at 0% 0%, rgb(var(--tl-accent) / 0.06), transparent 58%),
      radial-gradient(900px 600px at 100% 20%, rgba(255, 255, 255, 0.16), transparent 60%),
      linear-gradient(180deg, rgb(var(--glass-tint) / var(--tl-drawer-tint-alpha)), transparent 70%);
    border: 1px solid var(--tl-drawer-border);
    box-shadow:
      0 26px 70px rgba(15, 23, 42, 0.24),
      0 0 0 1px rgb(var(--tl-accent) / var(--tl-drawer-inner-blue)),
      inset 0 1px 0 rgba(255, 255, 255, var(--tl-drawer-inner-top));
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);

    /* Off-canvas slide (closed shows a small peek) */
    transform: translateX(calc(-100% + var(--tl-peek)));
    transition: transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
    will-change: opacity, transform;
    /* Closed: don't intercept taps */
    pointer-events: none;
  }

  .timeline_nav.is_open .timeline_shell:focus-within {
    /* Brighter greys while interacting (keyboard/touch focus) */
    --tl-drawer-alpha-top: 0.92;
    --tl-drawer-alpha-bottom: 0.80;
    --tl-drawer-tint-alpha: 0.026;
    --tl-drawer-border: rgba(255, 255, 255, 0.44);
    --tl-drawer-inner-top: 0.84;
    --tl-drawer-inner-blue: 0.14;
    box-shadow:
      0 28px 78px rgba(15, 23, 42, 0.22),
      0 0 0 1px rgb(var(--tl-accent) / var(--tl-drawer-inner-blue)),
      0 0 0 2px rgba(255, 255, 255, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, var(--tl-drawer-inner-top));
  }

  .timeline_fixed {
    flex: 0 0 auto;
  }

  .timeline_scroll {
    flex: 1 1 auto;
    overflow: auto;
    padding: 8px 12px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .timeline_nav.is_open .timeline_shell {
    transform: translateX(0);
    pointer-events: auto;
  }

  /* Header pinned to the top inside the drawer */
  .timeline_head {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 8px 12px;
    margin: 0 0 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.70), rgba(255, 255, 255, 0.52));
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
  }

  .timeline_title {
    color: rgba(17, 24, 39, 0.90);
  }

  .timeline_meta {
    font-size: 12px;
    color: rgba(17, 24, 39, 0.56);
  }

  .timeline_decade_list {
    padding: 8px 6px 10px;
  }

  /* Year list is inserted under the selected decade button; style it as a nested panel */
  .timeline_year_list {
    border-top: none;
    margin: 6px 0 10px 8px;
    padding: 6px 6px 10px 28px;
    border-left: none;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .timeline_decade_btn {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }

  .timeline_decade_btn.is_active {
    background:
      linear-gradient(180deg, rgb(var(--tl-accent) / 0.16), rgb(var(--tl-accent) / 0.10)),
      rgba(255, 255, 255, 0.14);
    color: rgba(17, 24, 39, 0.92);
  }

  .timeline_decade_badge {
    background: rgba(255, 255, 255, 0.24);
    border-color: transparent;
    color: rgba(17, 24, 39, 0.56);
  }

  .timeline_decade_btn.is_active .timeline_decade_badge {
    background: rgba(255, 255, 255, 0.34);
    color: rgba(17, 24, 39, 0.64);
  }

  .timeline_year {
    background: transparent;
    border-color: transparent;
  }

  .timeline_year.is_active {
    background:
      linear-gradient(180deg, rgb(var(--tl-accent) / 0.16), rgb(var(--tl-accent) / 0.10)),
      rgba(255, 255, 255, 0.14);
    color: rgba(17, 24, 39, 0.92);
  }

  .timeline_decade_list,
  .timeline_year_list {
    max-height: none;
  }

  .detail_card:not([data-diary-category="news" i]) {
    padding: 18px 20px;
  }

  .detail_card[data-diary-category="news" i] {
    padding: 8px 10px;
  }

  .detail_title {
    font-size: 18px;
  }

  /* Smartphone: meta row goes above date when wrapped */
  .date_row {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 6px;
  }

  .block_date .date_label {
    font-size: 14px;
  }

  .meta_row {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    min-width: auto;
    gap: 6px;
  }

  .block_main {
    margin-top: 10px;
  }

  .title_row {
    row-gap: 4px;
    grid-template-columns: 1fr;
  }

  .title_row .btn_minor {
    justify-self: start;
  }

  .context_section {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .diary_list {
    gap: 14px;
  }

  .filter_shell {
    display: block; 
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--soft-border);
    border-top: none;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.07);
  }

  .filter_row {
    flex-wrap: nowrap;
    gap: 8px;
  }

  /* Smartphone: keep "表示カテゴリ" on a single row; ラベルが欠けないよう min-content を許容 */
  .filter_shell .category_row {
    grid-template-columns: minmax(min-content, 68px) 1fr;
    gap: 8px;
  }

  .filter_shell .category_row__control {
    padding: 8px 12px;
    min-height: 32px;
    border-radius: 999px;
  }

  .filter_count {
    flex: 0 0 auto;
    text-align: right;
    font-size: 11px;
  }

  .photo_carousel {
    padding: 0;
    gap: 8px;
  }

  .photo_nav {
    background: var(--card);
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }
  .photo_controls {
    gap: 8px;
  }

  .photo_stage {
    border-radius: 14px;
  }
}
