/* ==========================================================================
   1. Global Styles (Background, Navbar, Section Margins)
   ========================================================================== */

:root {
  --primary: #e3e3e3;
  --tag-bg: #519378;
  --tag-border: #519378;
  --card-bg: #f2eeeb;
  --text: #060609;
  --section-h-margin: 6.5rem;
}

:root.dark-mode,
body.dark-mode {
  --primary: #1a1a1a;
  --tag-bg: #2a2a2a;
  --tag-border: #1a1a1a;
  --card-bg: #2a2a2a;
  --text: #e0e0e0;
}



/* --- nav-container background (dark) --- */
:root.dark-mode .nav-container {
  background: rgba(255, 255, 255, 0.05);
  border-color: #444;
}

/* --- nav-links button hover / active colors --- */
:root.dark-mode .nav-links button:hover {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: #fff !important;
}

:root.dark-mode .nav-links button {
  background: transparent !important;
  border-color: transparent !important;
}

/* --- navDarkToggle border (dark) --- */
:root.dark-mode #navDarkToggle {
  border-color: rgba(255, 255, 255, 0.3);
}

:root.dark-mode #navDarkToggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Serif JP", serif;
  background-color: var(--primary);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  position: relative;
  padding-top: 70px;
}

.section {
  width: 100%;
  position: fixed;
  top: 70px;
  left: 0;
  height: calc(100vh - 70px);
  overflow: auto;
  will-change: opacity;
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.section.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 100;
  transition: opacity 0.4s ease;
}

#sectionDay {
  display: flex;
  flex-direction: column;
  position: fixed;
  overflow-y: auto;
}

#sectionDay>.section-filter-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--primary);
  flex-shrink: 0;
}


main {
  flex: 1;
  padding: 3rem 2rem;
  display: flex;
  justify-content: center;
}

.global-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 10000;
  padding: 10px 20px;
  /* Match page theme background */
  background: var(--primary);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 15px;
  background: rgba(255, 243, 195, 0.1);
  padding: 6px;
  border-radius: 30px;
  border: 2px solid var(--tag-border);
}

.nav-links {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 5px;
}

.nav-links button {
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-align: center;
}

.nav-links button:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--tag-border);
}

#navDarkToggle {
  background: transparent;
  border: 1px solid var(--tag-border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}

/* navNotion is an <a> tag — make it look like the other nav buttons */
#navNotion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 10px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  text-align: center;
}

#navNotion:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--tag-border);
}

#navDarkToggle:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--tag-border);
}



@media (max-width: 768px) {
  .global-navbar {
    padding: 8px 10px;
  }

  .nav-links button {
    font-size: 0.7rem;
    padding: 6px 4px;
  }

  body {
    padding-top: 65px;
  }
}




/* ==========================================================================
   2. Common Filter Areas (Day, Biography, Board)
   ========================================================================== */

/* --- button / select colors --- */
:root.dark-mode button,
:root.dark-mode select,
body.dark-mode button,
body.dark-mode select {
  background-color: #2a2a2a;
  color: #e0e0e0;
  border-color: #444;
}

:root.dark-mode button:hover,
:root.dark-mode select:hover,
body.dark-mode button:hover,
body.dark-mode select:hover {
  background-color: #333;
}

/* --- select / filter-select dark arrow icon --- */
:root.dark-mode select,
body.dark-mode select,
:root.dark-mode .filter-select,
body.dark-mode .filter-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22%23e0e0e0%22%3E%3Cpolygon%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E");
}

:root.dark-mode .filter-select,
body.dark-mode .filter-select {
  border-color: #444;
}

/* --- day-section-block border/background (dark) --- */
:root.dark-mode .day-section-block,
body.dark-mode .day-section-block {
  border-color: #444;
  background-color: rgba(255, 255, 255, 0.02);
}

button,
select {
  padding: 0.5rem 1rem;
  background-color: var(--tag-bg);
  color: var(--text);
  border: 1px solid var(--tag-border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: "Noto Serif JP", serif;
}

select {
  padding-right: 2rem;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22currentColor%22%3E%3Cpolygon%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 0.3rem center;
  background-size: 1.2em;
}

/* Filter Bar: shared by all sections */
.section-filter-bar {
  margin: 0 var(--section-h-margin);
  padding: 1rem 0 0;
}

.section-content-area {
  margin: 0 var(--section-h-margin);
  padding: 1rem 0 2rem;
}


main.day-section-block {
  margin: 1rem var(--section-h-margin) 1rem;
  padding: 2rem 1rem;
  border: 1px solid var(--tag-border);
  border-radius: 12px;
  background-color: rgba(255, 243, 195, 0.05);
  /* 雾面玻璃 */
}

#heatmapSection,
.progress-section {
  margin: 1rem var(--section-h-margin) !important;
  padding: 2rem 1rem !important;
  border: 1px solid var(--tag-border);
  border-radius: 12px;
  background-color: rgba(255, 243, 195, 0.05);
}

/* --- Standardized Filter Tags --- */
.filter-tag,
.filter-select,
.dropdown-toggle,
.filter-reset-btn,
.poster-filter-stats {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--tag-border);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: bold;
  font-family: "Noto Serif JP", serif;
  box-sizing: border-box;
  background-color: transparent;
  transition: all 0.2s;
}

/* 1. Multi-select tag (Dropdown toggles) */
.filter-tag.multi-select,
.dropdown-toggle {
  cursor: pointer;
  gap: 5px;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22currentColor%22%3E%3Cpolygon%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* 2. Single-select tag (Select inputs) */
.filter-tag.single-select,
.filter-select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22currentColor%22%3E%3Cpolygon%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  outline: none;
}

/* For the simulated select label div in Biography Group Select */
div.filter-tag.single-select {
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22currentColor%22%3E%3Cpolygon%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* 3. Fix tag (Read-only display stats) */
.filter-tag.fix-tag,
.poster-filter-stats {
  cursor: default;
}

/* 4. Click tag (Action/Reset buttons) */
.filter-tag.click-tag,
.filter-reset-btn {
  cursor: pointer;
}

/* Selected multi tags use fill instead of border emphasis */
.filter-tag.multi-select.is-selected,
.dropdown-toggle.is-selected {
  background-color: var(--tag-bg) !important;
}

/* Biography group label follows the same selected fill state */
.filter-select.single-select.is-selected,
div.filter-tag.single-select.is-selected {
  background-color: var(--tag-bg) !important;
}

/* Biography board rule tag uses the same fill state */
.filter-tag.fix-tag.is-selected,
.poster-filter-stats.is-selected {
  background-color: var(--tag-bg) !important;
}

/* Dark mode: selected filter tags also get a white outline */
:root.dark-mode .section-filter-bar .filter-tag.is-selected,
:root.dark-mode .section-filter-bar .dropdown-toggle.is-selected,
:root.dark-mode .section-filter-bar .filter-select.single-select.is-selected,
:root.dark-mode .section-filter-bar .filter-tag.fix-tag.is-selected,
:root.dark-mode .section-filter-bar .poster-filter-stats.is-selected,
body.dark-mode .section-filter-bar .filter-tag.is-selected,
body.dark-mode .section-filter-bar .dropdown-toggle.is-selected,
body.dark-mode .section-filter-bar .filter-select.single-select.is-selected,
body.dark-mode .section-filter-bar .filter-tag.fix-tag.is-selected,
body.dark-mode .section-filter-bar .poster-filter-stats.is-selected {
  border-color: #fff !important;
}

#yearSelect {
  margin-left: auto;
}

.filter-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--card-bg) !important;
  border: 1px solid var(--tag-border);
  border-radius: 8px;
  min-width: 150px;
  z-index: 1000;
  display: none;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  margin-top: 5px;
  max-height: 300px;
  overflow-y: auto;
}

.dropdown-menu.open {
  display: block;
}

.dropdown-item {
  padding: 6px 12px;
}

.dropdown-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text);
}

.dropdown-item input[type="checkbox"],
.dropdown-item input[type="radio"] {
  cursor: pointer;
}

/* --- Hover Effects --- */
.filter-tag.multi-select:hover,
.dropdown-toggle:hover,
.filter-tag.single-select:hover,
.filter-select:hover,
.filter-tag.click-tag:hover,
.filter-reset-btn:hover,
.group-select-container:hover .filter-tag.single-select,
.group-select-container:hover .filter-select {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Dark mode overrides for background and hover */
:root.dark-mode .filter-tag,
:root.dark-mode .filter-select,
:root.dark-mode .dropdown-toggle,
:root.dark-mode .filter-reset-btn,
:root.dark-mode .poster-filter-stats,
body.dark-mode .filter-tag,
body.dark-mode .filter-select,
body.dark-mode .dropdown-toggle,
body.dark-mode .filter-reset-btn,
body.dark-mode .poster-filter-stats {
  background-color: transparent !important;
  border-color: #444;
}

:root.dark-mode select.filter-tag.single-select,
:root.dark-mode .filter-select,
body.dark-mode select.filter-tag.single-select,
body.dark-mode .filter-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22%23e0e0e0%22%3E%3Cpolygon%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E") !important;
}

:root.dark-mode div.filter-tag.single-select,
body.dark-mode div.filter-tag.single-select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22%23e0e0e0%22%3E%3Cpolygon%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E") !important;
}

/* Dark mode multi-select / dropdown-toggle arrow color */
:root.dark-mode .filter-tag.multi-select,
:root.dark-mode .dropdown-toggle,
body.dark-mode .filter-tag.multi-select,
body.dark-mode .dropdown-toggle {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22%23e0e0e0%22%3E%3Cpolygon%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E") !important;
}

:root.dark-mode .filter-tag.multi-select:hover,
:root.dark-mode .dropdown-toggle:hover,
:root.dark-mode select.filter-tag.single-select:hover,
:root.dark-mode .filter-select:hover,
:root.dark-mode .filter-tag.click-tag:hover,
:root.dark-mode .filter-reset-btn:hover,
:root.dark-mode .group-select-container:hover .filter-tag.single-select,
:root.dark-mode .group-select-container:hover .filter-select,
body.dark-mode .filter-tag.multi-select:hover,
body.dark-mode .dropdown-toggle:hover,
body.dark-mode select.filter-tag.single-select:hover,
body.dark-mode .filter-select:hover,
body.dark-mode .filter-tag.click-tag:hover,
body.dark-mode .filter-reset-btn:hover,
body.dark-mode .group-select-container:hover .filter-tag.single-select,
body.dark-mode .group-select-container:hover .filter-select {
  background-color: rgba(255, 255, 255, 0.1) !important;
}




/* ==========================================================================
   3. Day Section: Cards
   ========================================================================== */

/* --- card-face border: none (removed) --- */

.columns-container {
  max-width: 1600px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  justify-content: center;
  align-items: flex-start;
}

.column {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
  max-width: 400px;
  justify-self: center;
}

.card-container {
  perspective: 1000px;
  width: 400px;
  height: 225px;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}

.card-inner.flipped {
  transform: rotateY(180deg);
}

.card-inner.hovered {
  transform: translateY(-10px);
}

.card-inner.flipped.hovered {
  transform: rotateY(180deg) translateY(-10px);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  background-color: var(--card-bg);
  border: none;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.card-front {
  padding: 0;
}

.card-front .card-title {
  position: absolute;
  top: 1rem;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  padding: 0 1rem;
}

.card-front .card-value {
  margin: 0;
  padding: 0 1rem;
}

.card-inner:hover .card-face {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card-title {
  font-size: clamp(0.9rem, 4vw, 1.2rem);
  font-weight: 500;
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.card-value {
  font-size: clamp(1.4rem, 8vw, 2.5rem);
  font-weight: 300;
  line-height: 1.3;
  width: 100%;
  text-align: center;
}

.sakai-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  font-size: 1.2rem;
  text-align: center;
  line-height: 1.6;
  padding: 1.5rem;
}

.card-back {
  transform: rotateY(180deg);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  padding: 1.5rem;
  font-size: 0.95rem;
  text-align: left;
  align-content: start;
}

@media (max-width: 1264px) {
  main {
    padding: 2rem 1rem;
  }

  .columns-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
  }

  .column {
    min-width: 100%;
    width: 100%;
    max-width: 100%;
    align-items: center;
  }

  .card-container {
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .card-inner {
    min-height: 200px;
  }
}

@media (max-width: 480px) {
  main {
    padding: 1.5rem 0.5rem;
  }

  main.day-section-block {
    margin-top: 1rem;
    padding-top: 0;
  }

  .card-container {
    min-height: 180px;
  }

  .card-title {
    font-size: 1rem;
  }

  .card-value {
    font-size: 1.6rem;
  }

  .card-back {
    font-size: 0.85rem;
    padding: 1rem;
  }

  footer {
    padding: 1rem;
    font-size: 0.8rem;
  }
}




/* ==========================================================================
   4. Day Section: Heatmap
   ========================================================================== */


/* --- heatmap-section-title color --- */
:root:not(.dark-mode) .heatmap-section-title,
body:not(.dark-mode) .heatmap-section-title {
  color: #333;
}

/* --- heatmap-grid background --- */
/* Now handled by --card-bg variable */

/* --- heatmap-cell colors --- */
:root.dark-mode .heatmap-cell,
body.dark-mode .heatmap-cell {
  color: #e0e0e0;
}

:root.dark-mode .heatmap-cell.header-col,
:root.dark-mode .heatmap-cell.header-row,
body.dark-mode .heatmap-cell.header-col,
body.dark-mode .heatmap-cell.header-row {
  color: #e0e0e0;
}

:root.dark-mode .heatmap-cell.day-cell,
body.dark-mode .heatmap-cell.day-cell {
  background-color: #444;
}

:root.dark-mode .heatmap-cell.day-cell.green,
body.dark-mode .heatmap-cell.day-cell.green {
  background-color: #5aa16d;
}

:root.dark-mode .heatmap-cell.day-cell.yellow,
body.dark-mode .heatmap-cell.day-cell.yellow {
  background-color: #f0c929;
}

:root.dark-mode .heatmap-cell.day-cell.empty,
body.dark-mode .heatmap-cell.day-cell.empty {
  background-color: transparent;
}

/* --- heatmap-grid variants background (dark) --- */
/* Now handled by --card-bg variable */

/* Heatmap Styles */
#heatmapSection {
  padding: 1rem;
  display: flex;
  justify-content: center;
}

.heatmap-scroll-wrapper {
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1rem;
}

.heatmap-grid,
.heatmap-grid-weekly,
.heatmap-grid-monthly,
.heatmap-grid-year-week,
.heatmap-grid-decades,
.heatmap-grid-20x20 {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 30px repeat(31, 24px);
  grid-template-rows: 30px repeat(12, 24px);
  gap: 4px;
  min-width: max-content;
  margin: 0 auto;
  background-color: var(--card-bg);
  padding: 10px;
  border-radius: 8px;
}

.heatmap-cell {
  width: 24px;
  height: 24px;
  border-radius: 2px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
}

.heatmap-cell.header-col {
  font-weight: bold;
  color: #000;
  background-color: transparent;
}

.heatmap-cell.header-row {
  font-weight: bold;
  color: #000;
  background-color: transparent;
  justify-content: flex-end;
  padding-right: 5px;
}

.heatmap-cell.day-cell {
  background-color: #E4E4E4;
}

.heatmap-cell.day-cell.green {
  background-color: #437C52;
}

.heatmap-cell.day-cell.yellow {
  background-color: #EAC119;
}

.heatmap-cell.day-cell.empty {
  background-color: transparent;
}

.heatmap-container {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.heatmap-section-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 1rem;
  text-align: center;
  width: 100%;
}

.heatmap-grid-weekly {
  display: grid;
  grid-template-rows: repeat(8, 24px);
  grid-auto-columns: 24px;
  grid-auto-flow: column;
  gap: 4px;
  padding: 10px;
  background-color: var(--card-bg);
  border-radius: 8px;
  width: max-content;
}

.heatmap-grid-monthly {
  display: grid;
  grid-template-rows: repeat(13, 24px);
  grid-auto-columns: 24px;
  grid-auto-flow: column;
  gap: 4px;
  padding: 10px;
  background-color: var(--card-bg);
  border-radius: 8px;
  width: max-content;
}

.heatmap-grid-year-week {
  display: grid;
  grid-template-rows: repeat(9, 24px);
  grid-auto-columns: 24px;
  grid-auto-flow: column;
  gap: 4px;
  padding: 10px;
  background-color: var(--card-bg);
  border-radius: 8px;
  width: max-content;
}

#yearWeekScrollWrapper {
  max-width: calc(54 * 28px);
  width: 100%;
  overflow-x: auto;
}

.heatmap-grid-decades {
  display: grid;
  grid-template-columns: auto repeat(10, 24px);
  gap: 4px;
  padding: 10px;
  background-color: var(--card-bg);
  border-radius: 8px;
  width: max-content;
}

.heatmap-grid-20x20 {
  display: grid;
  grid-template-columns: repeat(20, 24px);
  grid-template-rows: repeat(20, 24px);
  gap: 4px;
  padding: 10px;
  background-color: var(--card-bg);
  border-radius: 8px;
  width: max-content;
}

.heatmap-cell.label-cell {
  font-size: 0.7rem;
  justify-content: flex-end;
  padding-right: 5px;
  font-weight: bold;
  color: inherit;
}




/* ==========================================================================
   5. Day Section: Progress Bar
   ========================================================================== */

/* --- progress-content-card background --- */
/* (uses --card-bg variable for both light and dark modes) */
:root.dark-mode .progress-content-card,
body.dark-mode .progress-content-card {
  background-color: var(--card-bg);
  box-shadow: none;
}

/* --- legend-label / legend-value color --- */
:root:not(.dark-mode) .legend-label,
:root:not(.dark-mode) .legend-value {
  color: #000;
}

:root.dark-mode .legend-label,
:root.dark-mode .legend-value {
  color: #E0E0E0;
}

/* --- ring-progress stroke --- */
:root:not(.dark-mode) .ring-progress {
  stroke: #437C52;
}

:root.dark-mode .ring-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

:root.dark-mode .ring-progress {
  stroke: #437C52;
}

/* --- section border-color and background (dark) --- */
:root.dark-mode .section-filter-bar,
:root.dark-mode #heatmapSection,
:root.dark-mode .progress-section,
:root.dark-mode footer,
body.dark-mode .section-filter-bar,
body.dark-mode #heatmapSection,
body.dark-mode .progress-section,
body.dark-mode footer {
  border-color: #444;
}

:root.dark-mode #heatmapSection,
:root.dark-mode .progress-section,
body.dark-mode #heatmapSection,
body.dark-mode .progress-section {
  background-color: rgba(255, 255, 255, 0.02);
}

/* --- anniv-bar-track background (dark) --- */
:root.dark-mode .anniv-bar-track {
  background-color: rgba(255, 255, 255, 0.1);
}

.progress-section {
  padding: 1rem;
  display: flex;
  justify-content: center;
}

.progress-content-card {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  width: 440px;
  min-height: 250px;
  height: auto;
  max-width: 100%;
  /* Prevent overflow on mobile */
  justify-content: center;
  flex-wrap: wrap;
}

.concentric-chart-wrapper {
  width: 180px;
  height: 180px;
  position: relative;
}

.legend-container {
  display: grid;
  grid-template-columns: max-content max-content;
  align-items: center;
  gap: 8px 16px;
}

.legend-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
}

.legend-value {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
}

.concentric-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: #E4E4E4;
  stroke-width: 18;
  stroke-linecap: round;
}

.ring-progress {
  fill: none;
  stroke-width: 18;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.5s ease-out;
}

.progress-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
  gap: 1.5rem;
  justify-content: center;
  justify-items: center;
  align-items: start;
  width: 100%;
  max-width: 1368px;
  /* 3 * 440px + 2 * 24px gap */
  margin: 0 auto;
}

.anniv-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
  width: 100%;
  text-align: center;
  padding: 0 0.5rem;
}

.anniv-label {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  text-align: right;
  min-width: 80px;
  /* Ensure alignment */
}

.anniv-bar-track {
  width: 100%;
  height: 16px;
  background-color: #E4E4E4;
  border-radius: 8px;
  overflow: hidden;
}

.anniv-bar-fill {
  height: 100%;
  background-color: #437C52;
  border-radius: 8px;
  width: 0%;
  transition: width 1s ease-out;
}

.anniv-value {
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  min-width: 80px;
}




/* ==========================================================================
   6. Day Section: Footer
   ========================================================================== */

footer.day-section-block {
  margin: 1rem var(--section-h-margin) 1rem;
  border: 1px solid var(--tag-border);
  border-radius: 12px;
  background-color: rgba(255, 243, 195, 0.05);
}

footer {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.9rem;
  opacity: 1;
  line-height: 1.6;
}




/* ==========================================================================
   7. Biography Section: Overall Area
   ========================================================================== */

/* Board Rule Tag (Display-only tag in Biography section) */
#board-rule-tag {
  border: 1px solid var(--tag-border) !important;
  border-radius: 20px !important;
  padding: 0 14px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  height: 34px !important;
}

:root.dark-mode #board-rule-tag,
body.dark-mode #board-rule-tag {
  border-color: #444 !important;
}

:root.dark-mode body:not(.show-section-biography):not(.show-section-board) #navDay,
:root.dark-mode body.show-section-biography #navBiography,
:root.dark-mode body.show-section-board #navBoard {
  background: var(--tag-bg) !important;
  border-color: #fff !important;
  color: #fff !important;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

/* --- bio-group-section border/background (dark) --- */
:root.dark-mode .bio-group-section,
body.dark-mode .bio-group-section {
  border-color: #444;
  background-color: rgba(255, 255, 255, 0.02);
}

/* --- bio-group-header background (dark) --- */
:root.dark-mode .bio-group-header,
body.dark-mode .bio-group-header {
  background-color: rgba(255, 255, 255, 0.05);
}

/* --- bio-group-title color --- */
:root:not(.dark-mode) .bio-group-title {
  color: #333;
}

:root.dark-mode .bio-group-title {
  color: #e0e0e0;
}

#sectionBiography {
  background-color: var(--primary);
  display: flex;
  flex-direction: column;
  padding-bottom: 50px;
}

/* Active States */
body:not(.show-section-biography):not(.show-section-board) #navDay,
body.show-section-biography #navBiography,
body.show-section-board #navBoard {
  background: var(--tag-bg) !important;
  border-color: var(--tag-border) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Biography Grouped Styles */
.biography-grouped-container {
  width: 100%;
}

.bio-group-section {
  margin-bottom: 1.5rem;
  border: 1px solid var(--tag-border);
  border-radius: 12px;
  background-color: rgba(255, 243, 195, 0.05);
  /* 雾面玻璃 */
  overflow: hidden;
}

.bio-group-header {
  padding: 0.8rem 1.2rem;
  background-color: rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.3s;
}

.bio-group-header:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

.bio-group-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.bio-group-title small {
  font-weight: 400;
  opacity: 0.8;
  margin-left: 0.6rem;
  font-size: 0.85rem;
}

.bio-group-icon {
  font-size: 0.8rem;
  transition: transform 0.3s;
  opacity: 0.6;
  min-width: 1.2rem;
  text-align: center;
}

.bio-group-content {
  padding: 1.2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.bio-group-content:not(.open) {
  display: none;
}




/* ==========================================================================
   7.1 Biography Section: Pop-up Cards (Modal)
   ========================================================================== */

/* --- modal text colors --- */
:root:not(.dark-mode) .modal-title,
:root:not(.dark-mode) .modal-meta-row,
:root:not(.dark-mode) .modal-year,
:root:not(.dark-mode) .modal-role {
  color: #000 !important;
}

/* --- modal-memo-tag colors (dark) --- */
:root.dark-mode .modal-memo-tag,
body.dark-mode .modal-memo-tag {
  color: #fff;
}

.poster-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(5px);
}

.poster-modal-overlay.open {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding-top: 88px;
  overflow-y: auto;
}

.poster-modal {
  background: var(--card-bg);
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: 200px 1fr;
  position: relative;
}

.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  z-index: 10;
}

.modal-poster-side img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info-side {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow-x: auto;
  word-break: break-word;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--text);
}

.modal-meta-row {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text);
}

.modal-year {
  color: var(--text);
  font-weight: 500;
}

.modal-role {
  font-size: 0.95rem;
  color: var(--text);
}

.modal-links {
  margin-top: auto;
  display: flex;
  gap: 10px;
}

.modal-link-btn {
  padding: 5px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.8rem;
  background: var(--primary);
  color: #fff;
}

.modal-rating-chart {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-rating-chart-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.modal-rating-chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.modal-rating-chart-bg {
  fill: rgba(255, 255, 255, 0.22);
  stroke: rgba(128, 128, 128, 0.18);
  stroke-width: 1;
}

:root.dark-mode .modal-rating-chart-bg,
body.dark-mode .modal-rating-chart-bg {
  fill: rgba(255, 255, 255, 0.04);
  stroke: rgba(255, 255, 255, 0.08);
}

.modal-rating-chart-grid {
  stroke: rgba(128, 128, 128, 0.16);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

:root.dark-mode .modal-rating-chart-grid,
body.dark-mode .modal-rating-chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
}

.modal-rating-chart-axis {
  stroke: rgba(128, 128, 128, 0.45);
  stroke-width: 1.2;
  shape-rendering: crispEdges;
}

:root.dark-mode .modal-rating-chart-axis,
body.dark-mode .modal-rating-chart-axis {
  stroke: rgba(255, 255, 255, 0.24);
}

.modal-rating-chart-line {
  fill: none;
  stroke: #519378;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-rating-chart-line.is-personal {
  stroke: #4b86d0;
}

.modal-rating-chart-average-line {
  fill: none;
  stroke: rgba(81, 147, 120, 0.55);
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
}

.modal-rating-chart-average-line.is-personal {
  stroke: rgba(75, 134, 208, 0.58);
}

.modal-rating-chart-average-label {
  fill: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
}

.modal-rating-chart-point {
  fill: #519378;
  stroke: var(--card-bg);
  stroke-width: 2;
  cursor: pointer;
  transition: transform 0.15s ease, fill 0.15s ease, stroke 0.15s ease, opacity 0.15s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.modal-rating-chart-point.is-personal {
  fill: #4b86d0;
}

.modal-rating-chart-point:hover,
.modal-rating-chart-point.is-hovered {
  fill: #3f7f66;
  stroke: #3f7f66;
  transform: scale(1.45);
}

.modal-rating-chart-point.is-personal:hover,
.modal-rating-chart-point.is-personal.is-hovered {
  fill: #386eb5;
  stroke: #386eb5;
}

.modal-rating-chart-axis-label {
  fill: var(--text);
  font-size: 9px;
  opacity: 0.8;
  dominant-baseline: middle;
}

.modal-rating-chart-point-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 700;
  paint-order: stroke;
  stroke: var(--card-bg);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.modal-rating-chart-point-label.is-personal {
  fill: #4b86d0;
}

.modal-rating-chart-point-label.is-household {
  fill: #519378;
}

.modal-rating-chart-host {
  width: min(700px, 100%);
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px 18px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  margin-top: 2px;
  position: relative;
}

.modal-rating-chart-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  max-width: min(320px, calc(100% - 16px));
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.12s ease;
  z-index: 5;
}

.modal-rating-chart-tooltip.is-visible {
  opacity: 1;
}

@media (max-width: 768px) {
  .poster-modal-overlay.open {
    justify-content: flex-start;
    padding: 76px 20px 20px;
    -webkit-overflow-scrolling: touch;
  }

  .poster-modal {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
  }

  .modal-poster-side {
    height: 250px;
  }

  .modal-info-side {
    max-height: none;
    overflow: visible;
  }

  .poster-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .modal-rating-chart-host {
    padding: 12px 12px 14px;
    width: min(100%, 700px);
    margin-bottom: 4px;
  }
}

/* Modal Memo Tag Styles */
.modal-memo-tag {
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background-color: rgba(234, 193, 25, 0.2);
  color: var(--text);
}

.modal-memo-tag.anniv {
  background-color: rgba(67, 124, 82, 0.2);
}




/* ==========================================================================
   7.2 Biography Section: Posters & Hover Effects
   ========================================================================== */

#currentDateDisplay.poster-filter-stats {
  font-size: 0.95rem;
  font-weight: bold;
}

@media (max-width: 768px) {
  :root {
    --section-h-margin: 1rem;
  }


  #dateFilterPanel {
    width: 100%;
    justify-content: center;
  }

  #currentDateDisplay.poster-filter-stats {
    width: auto;
    max-width: 100%;
  }
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  width: 100%;
}

.poster-card {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: #1a1a1a;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(.4, 0, .2, 1), box-shadow 0.22s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.0);
}

.poster-card:hover {
  transform: translateY(-5px) scale(1.03);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.38);
  z-index: 10;
}

.poster-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.35s ease;
}

.poster-card .poster-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.2) 55%, transparent 100%);
  opacity: 0;
  transition: opacity 0.22s ease;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
}

.poster-card:hover .poster-overlay {
  opacity: 1;
}

.ov-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.4;
}

.ov-meta {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  gap: 5px;
  align-items: center;
}

.ov-type-badge {
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 0.6rem;
  background: #3cc160;
  color: #000;
}

.poster-filter-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
  background: rgba(255, 243, 195, 0.1);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--tag-border);
  align-items: center;
}

.poster-filter-stats {
  padding: 0 16px;
  gap: 5px;
}

.poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  color: rgba(255, 255, 255, 0.5);
  padding: 10px;
  text-align: center;
}




/* ==========================================================================
   8. Board Section: Cards
   ========================================================================== */

#sectionBoard {
  background-color: var(--primary);
  display: flex;
  flex-direction: column;
  padding-bottom: 50px;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.board-card {
  background: var(--card-bg);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  aspect-ratio: 3 / 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  text-align: left;
  transition: transform 0.22s cubic-bezier(.4, 0, .2, 1), box-shadow 0.22s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  /*卡片悬浮*/
}

.board-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  z-index: 10;
}

.board-card-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-word;
  max-width: 72%;
}

.board-card-count {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  text-align: right;
  min-width: 48px;
}

.board-empty {
  grid-column: 1 / -1;
  text-align: center;
  opacity: 0.6;
  padding: 50px;
}