@charset "utf-8";

:root {
  --bg-color: #f4f2ee;
  --card-bg: #f7f5f1;
  --card-white: #ffffff;
  --text-color: #222222;
  --title-color: #141414;
  --accent-color: #8d233f;
  --meta-color: #7a766f;
  --line-color: #e5e0d8;
  --shadow-soft: 0 1px 2px rgba(15, 14, 12, 0.08);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-color);
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a,
button,
input,
.article-list-item {
  -webkit-tap-highlight-color: rgba(141, 35, 63, 0.16);
}

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

:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent-color) 70%, transparent);
  outline-offset: 1px;
}

.app-container {
  min-height: 100vh;
  padding: 8px 0 28px;
}

.container {
  max-width: 740px;
  margin: 0 auto;
  padding: 0 10px;
}

.list-shell {
  width: 100%;
}

.hero-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--line-color);
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
}

.hero-caption {
  margin: 0;
  font-size: 14px;
  color: var(--meta-color);
}

.hero-title-row {
  margin-top: 6px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.hero-title {
  margin: 0;
  color: var(--title-color);
  font-size: 28px;
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0.5px;
  font-family: "STSong", "Songti SC", "Noto Serif SC", serif;
}

.hero-mark {
  color: var(--accent-color);
  margin-right: 6px;
}

.hero-meta-line {
  margin-top: 10px;
}

.hero-date-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-color);
  font-weight: 700;
  font-size: 16px;
}

.hero-date-count::before {
  content: "🗓";
  transform: translateY(-1px);
}

.header-btn-group {
  display: flex;
  gap: 4px;
}

.refresh-list-btn,
.calendar-btn,
.calendar-nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: color-mix(in srgb, var(--meta-color) 82%, #000 18%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.refresh-list-btn svg,
.calendar-btn svg {
  width: 19px;
  height: 19px;
}

.refresh-list-btn:hover,
.calendar-btn:hover,
.calendar-nav-btn:hover {
  color: var(--accent-color);
  background: #f0ece6;
}

.refresh-list-btn.is-loading {
  animation: spin 1s linear infinite;
}

.nav-container {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.category-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-button {
  border: 1px solid #dcd6cd;
  background: #eeeae4;
  border-radius: 999px;
  padding: 6px 12px;
  color: #4d4a46;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.category-button.active {
  background: var(--accent-color);
  border-color: transparent;
  color: #fff;
}

.search-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #ddd8cf;
  background: #f7f5f1;
  color: #6f6a64;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.search-icon-btn svg {
  width: 18px;
  height: 18px;
}

.search-icon-btn:hover {
  color: var(--accent-color);
}

.date-filter-indicator {
  margin-top: 8px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 12px;
  background: #f8f5f1;
  border: 1px solid #e6e0d6;
  padding: 8px 10px;
}

.date-filter-text {
  color: #59544d;
  font-size: 13px;
}

.clear-date-filter-btn,
.search-submit-btn,
.pagination-controls button {
  border: 1px solid #ddd8cf;
  background: #f5f2ed;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #4d4a46;
  cursor: pointer;
}

.clear-date-filter-btn:hover,
.search-submit-btn:hover,
.pagination-controls button:hover:not(:disabled) {
  color: var(--accent-color);
  border-color: color-mix(in srgb, var(--accent-color) 35%, #ddd8cf);
}

.title-list-container {
  margin-top: 8px;
}

.article-list-item {
  border-radius: 16px;
  border: 1px solid #e7e2d9;
  background: #f7f5f1;
  box-shadow: var(--shadow-soft);
  margin-bottom: 8px;
  overflow: hidden;
}

.article-link-wrapper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 10px;
}

.article-link-wrapper.no-image {
  grid-template-columns: minmax(0, 1fr);
}

.text-content {
  min-width: 0;
}

.item-title {
  font-size: 17px;
  line-height: 1.22;
  font-weight: 850;
  color: #1d1b19;
  letter-spacing: 0.1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.item-summary {
  margin-top: 4px;
  font-size: 13px;
  color: #79756e;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.image-container {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: #e9e5de;
  align-self: center;
}

.item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #9a9489;
}

.article-list-item.last-visited {
  border-color: color-mix(in srgb, var(--accent-color) 30%, #e7e2d9);
  background: #faf4f7;
}

.pagination-controls {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pagination-controls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pagination-info {
  min-width: 56px;
  text-align: center;
  color: #59544d;
  font-size: 13px;
  font-weight: 600;
}

.search-dialog,
.calendar-popup {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1900;
}

.search-dialog.is-active,
.calendar-popup.is-active {
  display: block;
}

.search-dialog-overlay,
.calendar-popup-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(5px);
}

.search-dialog-content {
  position: relative;
  z-index: 2;
  width: min(760px, calc(100vw - 24px));
  margin: 88px auto 0;
}

.search-shell {
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(230, 224, 216, 0.95);
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  padding: 0 12px;
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.12);
}

.search-shell-icon {
  width: 17px;
  height: 17px;
  color: #7b756e;
}

#site-search-input,
.admin-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 16px;
  padding: 0;
  outline: none;
}

.search-close-btn {
  border: none;
  background: transparent;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #7b756e;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.search-close-btn:hover {
  color: var(--accent-color);
}

.search-submit-inline {
  margin-top: 10px;
  float: right;
}

.calendar-popup-content {
  position: relative;
  z-index: 2;
  width: min(360px, calc(100vw - 20px));
  margin: 96px auto 0;
  background: #f8f6f2;
  border: 1px solid #e5e0d8;
  border-radius: 16px;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.14);
  padding: 12px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.calendar-month-year {
  font-weight: 700;
  color: #3d3832;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.calendar-weekdays {
  text-align: center;
  font-size: 12px;
  color: #7a756f;
  margin-bottom: 6px;
}

.calendar-grid {
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #3f3933;
}

.calendar-day.empty {
  visibility: hidden;
}

.calendar-day.has-articles {
  background: #f0e7eb;
  color: #8d233f;
  cursor: pointer;
  font-weight: 700;
}

.calendar-day.has-articles:hover,
.calendar-day.selected {
  background: #8d233f;
  color: #fff;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 1.6px #8d233f;
}

.page-container {
  display: none;
}

.sidebar {
  display: none;
}

.main-content {
  border-radius: 16px;
  background: var(--card-white);
  border: 1px solid #ece7de;
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.article-header h1 {
  margin: 0;
  color: #1a1917;
  line-height: 1.24;
  font-weight: 900;
  font-size: 34px;
  font-family: "STSong", "Songti SC", "Noto Serif SC", serif;
}

.article-meta {
  margin: 10px 0 0;
  color: #716b64;
  font-size: 14px;
}

.content-info-box {
  margin-top: 14px;
  border-left: 3px solid #e2d7dc;
  background: #f9f6f8;
  border-radius: 10px;
  padding: 10px;
  color: #6a6560;
  font-size: 15px;
}

.content-info-box p {
  margin: 0;
}

.article-content {
  margin-top: 16px;
  color: #252321;
  font-size: 18px;
  line-height: 1.7;
}

.article-content img,
.article-content video,
.article-content iframe {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  margin: 12px auto;
}

.article-content p {
  margin: 0 0 14px;
}

.empty-hint {
  color: #7a766f;
  font-size: 14px;
}

.back-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
}

.back-link-inline {
  margin-top: 10px;
  display: inline-block;
}

.admin-fab {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #938d84;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(222, 216, 206, 0.86);
  text-decoration: none;
  opacity: 0.55;
  transition: all 0.2s ease;
  z-index: 1600;
}

.admin-fab:hover {
  opacity: 0.95;
  color: var(--accent-color);
}

.admin-fab svg {
  width: 14px;
  height: 14px;
}

.gate-layer {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(244, 241, 236, 0.95);
  backdrop-filter: blur(4px);
}

.gate-card {
  width: min(420px, 100%);
  border-radius: 18px;
  border: 1px solid #e5dfd6;
  background: #f9f7f3;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
  padding: 18px;
}

.gate-title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  color: #1a1917;
  font-family: "STSong", "Songti SC", "Noto Serif SC", serif;
}

.gate-desc {
  margin: 8px 0 12px;
  color: #706a63;
  font-size: 13px;
}

.gate-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.admin-login-form {
  grid-template-columns: 1fr;
}

.gate-status {
  margin: 10px 2px 0;
  color: #706a63;
  font-size: 12px;
  min-height: 1.2em;
}

.gate-btn {
  min-width: 78px;
}

.mobile-back-btn {
  position: sticky;
  top: 10px;
  z-index: 15;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(120deg, #82223a 0%, #9d3a56 100%);
  box-shadow: 0 8px 20px rgba(141, 35, 63, 0.26);
}

.mobile-back-btn .arrow {
  font-size: 14px;
}

.article-standalone-shell {
  max-width: 800px;
  padding-top: 12px;
  padding-bottom: 24px;
}

.standalone-main {
  margin-top: 10px;
}

.admin-page-shell {
  padding-top: 12px;
  padding-bottom: 16px;
}

.main-header {
  border-radius: 16px;
  border: 1px solid #e6e0d7;
  background: #f8f5f1;
  box-shadow: var(--shadow-soft);
  padding: 14px;
  margin-bottom: 10px;
}

.main-header .pre-title {
  margin: 0;
  color: #7a766f;
  font-size: 13px;
}

.main-header h1 {
  margin: 6px 0 0;
  color: #171513;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 900;
  font-family: "STSong", "Songti SC", "Noto Serif SC", serif;
}

.admin-grid {
  display: grid;
  gap: 10px;
}

.content-qa-card {
  border-radius: 16px;
  border: 1px solid #e8e2d9;
  background: #faf8f4;
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.content-qa-card .question {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 800;
  color: #1e1b18;
}

.content-qa-card .answer {
  margin: 8px 0 0;
  color: #6c665f;
  font-size: 14px;
}

.visit-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.visit-stat-item {
  border-radius: 12px;
  border: 1px solid #ebe5dc;
  background: #fff;
  padding: 10px 8px;
  text-align: center;
}

.visit-stat-label {
  display: block;
  font-size: 12px;
  color: #7b756d;
  margin-bottom: 4px;
}

.visit-stat-item strong {
  font-size: 20px;
  line-height: 1;
  color: #2a2520;
}

.sync-setting-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

#feed-form {
  display: grid;
  gap: 8px;
}

.feed-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #ece6dd;
  margin-bottom: 8px;
}

.feed-item .meta {
  margin-top: 3px;
  font-size: 12px;
  color: #7b756d;
  word-break: break-all;
}

.feed-actions {
  display: grid;
  gap: 6px;
}

.feed-actions .search-submit-btn {
  white-space: nowrap;
}

@media (max-width: 900px) {
  .hero-title {
    font-size: clamp(32px, 8.5vw, 38px);
  }

  .item-title {
    font-size: clamp(17px, 4.8vw, 21px);
  }

  .article-header h1 {
    font-size: clamp(34px, 9.2vw, 46px);
  }

  .article-content {
    font-size: clamp(17px, 4.6vw, 21px);
  }

  .feed-item {
    grid-template-columns: 1fr;
  }

  .visit-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sync-setting-row {
    grid-template-columns: 1fr;
  }

  .feed-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 901px) {
  .app-container {
    max-width: 1520px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 430px minmax(0, 1fr);
    gap: 18px;
    padding: 14px;
    align-items: start;
  }

  .container {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .page-container {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 14px;
    min-height: calc(100vh - 30px);
  }

  .sidebar {
    display: block;
    border-radius: 14px;
    border: 1px solid #e7e1d8;
    background: #f8f6f2;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 26px);
  }

  .sidebar-header-sticky {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f8f6f2;
    border-bottom: 1px solid #ebe5dc;
    padding: 12px;
  }

  .sidebar-header-sticky h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #282520;
  }

  .sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    overflow: auto;
    max-height: calc(100vh - 85px);
  }

  .sidebar-nav-item {
    margin-bottom: 5px;
  }

  .sidebar-nav-item a {
    display: block;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #fff;
    padding: 8px 9px;
    text-decoration: none;
    color: #292622;
    font-size: 13px;
    line-height: 1.42;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .sidebar-nav-item.active a {
    border-color: color-mix(in srgb, var(--accent-color) 30%, #e7e1d8);
    background: #fbf5f8;
    color: #6f1d33;
  }

  .main-content {
    min-height: calc(100vh - 32px);
    padding: 20px 24px;
  }

  .back-link {
    display: inline-block;
    margin-bottom: 12px;
  }

  .article-content {
    font-size: 18px;
  }

  .article-header h1 {
    font-size: 38px;
  }

  .item-title {
    font-size: 20px;
  }

  .hero-title {
    font-size: 34px;
  }

  .admin-grid {
    grid-template-columns: 1fr 1.25fr;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}
