:root {
  --ink: #2d3328;
  --muted: #6c7464;
  --paper: #fff9e8;
  --paper-soft: #fffdf4;
  --line: #d9cba5;
  --line-strong: #bfae7e;
  --green: #527a43;
  --green-dark: #33552f;
  --gold: #c18a35;
  --sky: #d9edf2;
  --grass: #9bbf63;
  --danger: #b44a3c;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: linear-gradient(180deg, #d8edf5 0%, #f4efd6 58%, #dbe7b4 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 118px;
  pointer-events: none;
  background:
    linear-gradient(135deg, transparent 0 62%, rgba(72, 111, 50, .24) 63% 68%, transparent 69%) 0 0 / 42px 32px,
    linear-gradient(45deg, transparent 0 58%, rgba(88, 135, 62, .25) 59% 64%, transparent 65%) 12px 10px / 46px 34px,
    linear-gradient(180deg, rgba(139, 181, 83, .42), rgba(98, 146, 63, .62));
  border-top: 1px solid rgba(90, 132, 62, .35);
  z-index: -1;
}

.field-lines {
  position: fixed;
  inset: auto 0 0;
  height: 34vh;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      100deg,
      rgba(113, 139, 66, .12) 0,
      rgba(113, 139, 66, .12) 2px,
      transparent 2px,
      transparent 34px
    );
  opacity: .7;
  z-index: -2;
}

.cloud {
  position: fixed;
  width: 156px;
  height: 44px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .78);
  filter: drop-shadow(0 2px 0 rgba(116, 152, 164, .15));
  pointer-events: none;
  z-index: -1;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  bottom: 16px;
  border-radius: 6px;
  background: inherit;
}

.cloud::before {
  left: 28px;
  width: 48px;
  height: 48px;
}

.cloud::after {
  right: 24px;
  width: 58px;
  height: 58px;
}

.cloud.one {
  top: 48px;
  left: -180px;
  animation: cloud-drift 46s linear infinite;
}

.cloud.two {
  top: 132px;
  left: -240px;
  width: 118px;
  height: 34px;
  opacity: .62;
  animation: cloud-drift 64s linear 12s infinite;
}

@keyframes cloud-drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(100vw + 320px));
  }
}

.journal-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0 72px;
}

.notice-panel {
  position: relative;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(175, 149, 85, .08) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(180deg, var(--paper-soft), var(--paper));
  border: 1px solid var(--line-strong);
  overflow: hidden;
}

.notice-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 4px solid rgba(82, 122, 67, .75);
  pointer-events: none;
}

.board-header {
  padding: 28px 30px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 244, .72);
}

.kicker {
  width: max-content;
  margin-bottom: 8px;
  padding: 4px 8px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 700;
  background: #e5efd3;
  border: 1px solid #b9cc8f;
  border-radius: 4px;
}

.title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.12;
  font-weight: 800;
  color: #2b3b24;
}

.refresh-button,
.page-button,
.page-number,
.page-jump-button {
  min-height: 36px;
  border: 1px solid #405f34;
  border-radius: 4px;
  background: linear-gradient(180deg, #6f9b54, #4e783e);
  color: #fffdf2;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.refresh-button {
  padding: 0 18px;
}

.refresh-button:hover,
.page-button:hover,
.page-number:hover,
.page-jump-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #7fac60, #568345);
}

.refresh-button:active,
.page-button:active,
.page-number:active,
.page-jump-button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.list-panel {
  padding: 18px 30px 24px;
}

.list-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 30px;
  color: var(--muted);
  font-size: 14px;
}

.status.is-loading::after {
  content: "";
  display: inline-block;
  width: 18px;
  overflow: hidden;
  vertical-align: bottom;
  animation: dots 1.2s steps(4, end) infinite;
}

@keyframes dots {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

.status.is-error {
  color: var(--danger);
  font-weight: 700;
}

.page-indicator {
  white-space: nowrap;
  color: #55704a;
  font-weight: 700;
}

.article-list {
  display: grid;
  gap: 0;
  margin: 12px 0 20px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.article-card {
  animation: item-in .34s ease both;
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  width: 100%;
  min-height: 78px;
  padding: 15px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.article-card:last-child .article-button {
  border-bottom: 0;
}

.article-button:hover {
  background:
    linear-gradient(90deg, rgba(82, 122, 67, .12), transparent 42%),
    rgba(255, 255, 255, .38);
}

.article-button:focus-visible,
.refresh-button:focus-visible,
.page-button:focus-visible,
.page-number:focus-visible {
  outline: 3px solid rgba(193, 138, 53, .4);
  outline-offset: 2px;
}

.article-main {
  min-width: 0;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.article-id {
  flex: 0 0 auto;
  color: #7b765f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.article-title {
  min-width: 0;
  color: #293522;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.38;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-card.is-featured .article-button {
  background: linear-gradient(90deg, rgba(193, 138, 53, .16), transparent 52%);
}

.article-card.is-featured .article-button:hover {
  background:
    linear-gradient(90deg, rgba(193, 138, 53, .22), transparent 52%),
    rgba(255, 255, 255, .42);
}

.featured-mark {
  flex: 0 0 auto;
  padding: 2px 6px;
  color: #fffdf2;
  font-size: 12px;
  font-weight: 900;
  background: #b06e27;
  border: 1px solid #8e5319;
  border-radius: 4px;
}
.file-mark {
  flex: 0 0 auto;
  padding: 2px 6px;
  color: #7b4e16;
  font-size: 12px;
  font-weight: 800;
  background: #f7df9a;
  border: 1px solid #d4af59;
  border-radius: 4px;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.read-count {
  align-self: center;
  color: #4e6842;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.pager {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 2px;
}

.pager-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.page-button,
.page-number {
  min-width: 38px;
  padding: 0 12px;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-number.is-current {
  color: #3d321c;
  background: linear-gradient(180deg, #f0d181, #d7ac52);
  border-color: #9f7530;
  opacity: 1;
}

.page-ellipsis {
  min-width: 24px;
  text-align: center;
  color: #766c56;
  font-weight: 800;
}

.page-jump-form {
  display: grid;
  grid-template-columns: auto 76px auto 64px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.page-jump-input {
  width: 76px;
  height: 36px;
  padding: 0 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: center;
  background: var(--paper-soft);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  outline: none;
}

.page-jump-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(82, 122, 67, .16);
}

.page-jump-input[aria-invalid="true"] {
  border-color: var(--danger);
}

.page-jump-button {
  min-width: 64px;
  padding: 0 12px;
}

.page-jump-error {
  grid-column: 1 / -1;
  min-height: 18px;
  margin: -2px 0 0;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}


body.has-search-dialog,
body.has-blog-dialog,
body.has-favorites-dialog {
  overflow: hidden;
}

.search-dialog {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .16s ease, visibility .16s ease;
  z-index: 20;
}

.search-dialog[hidden] {
  display: none;
}

.search-dialog.is-open {
  opacity: 1;
  visibility: visible;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 51, 40, .38);
}

.search-panel {
  position: relative;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--paper-soft), var(--paper));
  box-shadow: 0 18px 48px rgba(45, 51, 40, .22);
}

.search-panel h2 {
  margin: 0 0 18px;
  color: #2b3b24;
  font-size: 22px;
  line-height: 1.2;
}

.search-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.search-close-button:hover {
  color: var(--ink);
  background: rgba(82, 122, 67, .1);
}

.search-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
}

.search-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-input-row input {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fffef7;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.search-input-row input:focus,
.search-close-button:focus-visible,
.search-submit-button:focus-visible {
  outline: 3px solid rgba(193, 138, 53, .4);
  outline-offset: 2px;
}

.search-submit-button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #405f34;
  border-radius: 4px;
  background: linear-gradient(180deg, #6f9b54, #4e783e);
  color: #fffdf2;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.search-submit-button:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, #7fac60, #568345);
}

.search-error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.favorites-dialog {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .16s ease, visibility .16s ease;
  z-index: 22;
}

.favorites-dialog[hidden] {
  display: none;
}

.favorites-dialog.is-open {
  opacity: 1;
  visibility: visible;
}

.favorites-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 51, 40, .42);
}

.favorites-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(640px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--paper-soft), var(--paper));
  box-shadow: 0 18px 48px rgba(45, 51, 40, .24);
}

.favorites-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.favorites-close-button:hover {
  color: var(--ink);
  background: rgba(82, 122, 67, .1);
}

.favorites-heading span {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
}

.favorites-heading h2 {
  margin: 3px 40px 4px 0;
  color: #2b3b24;
  font-size: 23px;
  line-height: 1.2;
}

.favorites-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.favorites-error {
  min-height: 20px;
  padding-top: 8px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.favorites-empty {
  display: grid;
  place-items: center;
  min-height: 150px;
  margin: 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.favorites-empty[hidden] {
  display: none;
}

.favorites-list {
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid var(--line);
}

.favorites-list:empty {
  display: none;
}

.favorite-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.favorite-open-button {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 6px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.favorite-open-button:hover strong {
  color: var(--green);
}

.favorite-open-button strong {
  overflow: hidden;
  font-size: 15px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-open-button span,
.favorite-open-button time {
  color: var(--muted);
  font-size: 12px;
}

.favorite-remove-button {
  min-height: 34px;
  padding: 0 10px;
  color: #8f3b31;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  background: #fff8ed;
  border: 1px solid #d7a69d;
  border-radius: 4px;
  cursor: pointer;
}

.favorite-remove-button:hover {
  background: #fde8df;
}

.favorites-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.favorites-pager button {
  min-height: 34px;
  padding: 0 12px;
  color: #fffdf2;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  background: linear-gradient(180deg, #6f9b54, #4e783e);
  border: 1px solid #405f34;
  border-radius: 4px;
  cursor: pointer;
}

.favorites-close-button:focus-visible,
.favorite-open-button:focus-visible,
.favorite-remove-button:focus-visible,
.favorites-pager button:focus-visible {
  outline: 3px solid rgba(193, 138, 53, .4);
  outline-offset: 2px;
}

@media (max-width: 680px) {
  .journal-shell {
    width: min(100% - 20px, 980px);
    padding: 24px 0 40px;
  }

  .board-header {
    padding: 22px 18px 14px;
  }

  .title-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 14px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    width: 100%;
  }

  .refresh-button {
    width: 100%;
    min-width: 0;
    padding: 0 8px;
  }

  .search-panel {
    padding: 22px 18px 18px;
  }

  .search-input-row {
    grid-template-columns: 1fr;
  }

  .list-panel {
    padding: 14px 18px 18px;
  }

  .list-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .article-button {
    grid-template-columns: 1fr;
    gap: 7px;
    min-height: 86px;
    padding: 14px 0;
  }

  .article-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .read-count {
    align-self: start;
  }

  .pager {
    gap: 12px;
  }

  .favorites-panel {
    max-height: calc(100vh - 24px);
    padding: 20px 16px 14px;
  }

  .favorite-list-item {
    gap: 6px;
  }

  .favorite-open-button {
    padding: 11px 4px;
  }

  .pager-controls {
    flex-wrap: wrap;
  }

  .page-jump-form {
    grid-template-columns: auto 72px auto 64px;
  }

  .page-jump-input {
    width: 72px;
  }
}

.site-bottom {
  width: min(980px, calc(100% - 32px));
  margin: -20px auto 42px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.site-bottom-links {
  display: flex;
  justify-content: center;
  padding: 14px 0;
}

.site-bottom-links[hidden],
.site-footer[hidden] { display: none; }

.site-bottom-links a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 15px;
  color: #fffdf2;
  font-weight: 900;
  text-decoration: none;
  background: #4f7844;
  border: 1px solid #365d34;
  border-radius: 4px;
}

.site-bottom-links a:hover { background: #355f36; }

.site-footer {
  padding: 13px 16px;
  overflow-wrap: anywhere;
  line-height: 1.7;
  border-top: 1px solid rgba(103, 112, 92, .28);
}

.site-footer a { color: #3f6e3c; font-weight: 800; }

@media (max-width: 680px) {
  .site-bottom { width: min(100% - 22px, 980px); margin-top: -14px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
