:root {
  --fj-bg: #f4f1ea;
  --fj-paper: #fffdf9;
  --fj-paper-2: #f7f2ea;
  --fj-line: #e6ddcf;
  --fj-line-strong: #d8c9af;
  --fj-text: #332b22;
  --fj-muted: #7d705f;
  --fj-accent: #9e6f43;
  --fj-accent-dark: #6f4c2f;
  --fj-shadow: 0 10px 30px rgba(68, 50, 29, 0.08);
}

html,
body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top left, rgba(158,111,67,.10), transparent 22%),
    linear-gradient(180deg, #f7f3ed 0%, #f1ede5 100%);
  color: var(--fj-text);
  font-family: "Segoe UI", "PingFang SC", Arial, sans-serif;
}

body {
  line-height: 1.75;
}

img {
  max-width: 100%;
}

a {
  color: var(--fj-accent-dark);
  text-decoration: none;
  transition: .2s ease;
}

a:hover {
  color: var(--fj-accent);
}

.fj-hidden {
  display: none;
}

.fj-wrap {
  width: min(1380px, calc(100% - 24px));
  margin: 0 auto;
}

.fj-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 241, 234, .95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--fj-line);
}

/* Top row: brand + search/actions */
.fj-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 16px;
}

.fj-brand a {
  font-size: 26px;
  font-weight: 800;
  color: var(--fj-text);
  letter-spacing: .01em;
  white-space: nowrap;
}

.fj-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Bottom row: nav bar */
.fj-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 0 12px;
  border-top: 1px solid var(--fj-line);
  margin-top: 2px;
}

.fj-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--fj-text);
  font-size: 14px;
  font-weight: 500;
  transition: .2s ease;
  white-space: nowrap;
}

.fj-nav a:hover,
.fj-nav-home {
  background: rgba(255,255,255,.7);
  color: var(--fj-accent-dark);
}

.fj-nav-home {
  font-weight: 700;
}

.fj-search {
  display: grid;
  grid-template-columns: minmax(120px, 200px) auto;
  gap: 0;
}

.fj-search input,
.fj-search-wide input {
  height: 38px;
  border-radius: 12px 0 0 12px;
  border: 1px solid var(--fj-line);
  border-right: none;
  background: rgba(255,255,255,.8);
  padding: 0 14px;
  outline: none;
  color: var(--fj-text);
  font-size: 13px;
}

.fj-search input:focus {
  border-color: var(--fj-accent);
  background: #fff;
}

.fj-search button,
.fj-search-wide button,
.fj-btn {
  height: 38px;
  border: 0;
  border-radius: 0 12px 12px 0;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--fj-accent), var(--fj-accent-dark));
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}

.fj-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.fj-btn-light {
  background: #fff;
  color: var(--fj-text);
  border: 1px solid var(--fj-line);
}

.fj-menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--fj-line);
  background: #fff;
  color: var(--fj-text);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.fj-main {
  padding: 24px 0 40px;
}

.fj-intro-band,
.fj-lead-story,
.fj-list-head,
.fj-search-panel,
.fj-diy-panel,
.fj-empty-page,
.fj-article,
.fj-detail-panel,
.fj-comments-box,
.fj-tag-side {
  background: var(--fj-paper);
  border: 1px solid var(--fj-line);
  border-radius: 24px;
  box-shadow: var(--fj-shadow);
}

.fj-intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 28px;
  margin-bottom: 22px;
  align-items: center;
}

.fj-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f1e6d7;
  color: var(--fj-accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.fj-intro-copy h1,
.fj-list-head h1,
.fj-search-panel h1,
.fj-diy-panel h1,
.fj-article h1,
.fj-empty-page h1 {
  margin: 14px 0 10px;
  font-size: 48px;
  line-height: 1.08;
}

.fj-intro-copy p,
.fj-list-head p,
.fj-lead-story p,
.fj-card p,
.fj-diy-panel p {
  color: var(--fj-muted);
  font-size: 16px;
}

.fj-intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.fj-lead-story {
  padding: 24px 28px;
  margin-bottom: 22px;
}

.fj-lead-story h2 {
  margin: 10px 0 10px;
  font-size: 34px;
  line-height: 1.12;
}

.fj-lead-meta,
.fj-card-meta,
.fj-article-meta,
.fj-prev-item strong,
.fj-diy-item strong,
.fj-tag-box p,
.fj-mini-card span {
  color: var(--fj-muted);
  font-size: 13px;
}

.fj-text-link {
  font-weight: 700;
}

.fj-masonry-shell {
  margin-bottom: 22px;
}

.fj-masonry {
  column-count: 4;
  column-gap: 18px;
}

.fj-card,
.fj-tag-box {
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  break-inside: avoid;
  background: var(--fj-paper);
  border: 1px solid var(--fj-line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--fj-shadow);
}

.fj-card-thumb {
  display: block;
  background: var(--fj-paper-2);
}

.fj-card-thumb img {
  width: 100%;
  height: auto;
  display: block;
}

.fj-card-body {
  padding: 16px 18px 18px;
}

.fj-card h3,
.fj-tag-box h3 {
  margin: 8px 0 10px;
  font-size: 24px;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.fj-card h3 a,
.fj-tag-box h3 a {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fj-card-featured .fj-card-body {
  padding-bottom: 22px;
}

.fj-card-list .fj-card-body p,
.fj-search-card .fj-card-body p,
.fj-card .fj-card-body p {
  margin-bottom: 0;
}

.fj-list-head,
.fj-search-panel,
.fj-diy-panel,
.fj-empty-page {
  padding: 26px 28px;
  margin-bottom: 22px;
}

.fj-breadcrumb {
  margin-bottom: 18px;
  color: var(--fj-muted);
}

.fj-breadcrumb li,
.fj-breadcrumb a {
  color: var(--fj-muted);
}

.fj-pagination,
.pagination {
  margin-top: 16px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  margin: 4px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--fj-line);
  background: #fff;
  color: var(--fj-text);
}

.fj-empty-inline {
  padding: 24px;
  text-align: center;
  color: var(--fj-muted);
  background: var(--fj-paper);
  border: 1px dashed var(--fj-line-strong);
  border-radius: 18px;
}

.fj-detail-wrap {
  width: min(1080px, calc(100% - 24px));
}

.fj-article {
  padding: 30px;
  margin-bottom: 22px;
}

.fj-article-header {
  margin-bottom: 20px;
}

.fj-article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.fj-article-tags a,
.fj-tag-side-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f7f2ea;
  border: 1px solid var(--fj-line);
  color: var(--fj-text);
}

.fj-article-cover {
  margin-bottom: 22px;
  overflow: hidden;
  border-radius: 18px;
}

.fj-article-content {
  font-size: 17px;
  line-height: 1.95;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.fj-article-content > :first-child {
  margin-top: 0 !important;
}

.fj-article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  margin: 18px 0;
  display: block;
}

.fj-article-content h1,
.fj-article-content h2,
.fj-article-content h3,
.fj-article-content h4,
.fj-article-content h5,
.fj-article-content h6 {
  color: var(--fj-text);
  font-weight: 700;
  margin: 32px 0 14px;
  line-height: 1.3;
}

.fj-article-content h1 { font-size: 28px; }
.fj-article-content h2 { font-size: 24px; border-bottom: 1px solid var(--fj-line); padding-bottom: 8px; }
.fj-article-content h3 { font-size: 20px; }
.fj-article-content h4 { font-size: 18px; }

.fj-article-content p,
.fj-article-content div {
  margin: 0 0 16px;
}

.fj-article-content a {
  color: var(--fj-accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fj-article-content a:hover {
  color: var(--fj-accent);
}

.fj-article-content b,
.fj-article-content strong {
  font-weight: 700;
  color: var(--fj-text);
}

.fj-article-content ul,
.fj-article-content ol {
  list-style: disc outside none;
  margin: 14px 0;
  padding: 0 0 0 28px;
  line-height: 1.8;
}

.fj-article-content ol { list-style: decimal; }
.fj-article-content ul ul, .fj-article-content ol ul { list-style: circle outside none; }
.fj-article-content ul ul, .fj-article-content ol ul,
.fj-article-content ul ol, .fj-article-content ol ol { padding-left: 24px; }
.fj-article-content li { margin-bottom: 6px; }

.fj-article-content blockquote {
  border-left: 4px solid var(--fj-accent);
  padding: 14px 20px;
  margin: 20px 0;
  background: var(--fj-paper-2);
  border-radius: 0 14px 14px 0;
  color: var(--fj-muted);
}

.fj-article-content blockquote > :first-child { margin-top: 0; }
.fj-article-content blockquote > :last-child { margin-bottom: 0; }

.fj-article-content code {
  display: inline;
  padding: 2px 6px;
  margin: 0 3px;
  background: var(--fj-paper-2);
  border: 1px solid var(--fj-line);
  border-radius: 6px;
  font-size: 14px;
  font-family: 'Consolas', 'Monaco', monospace;
  color: var(--fj-accent-dark);
}

.fj-article-content pre {
  padding: 18px 20px;
  margin: 20px 0;
  display: block;
  line-height: 1.6;
  background: var(--fj-text);
  border-radius: 14px;
  font-size: 14px;
  font-family: 'Consolas', 'Monaco', monospace;
  white-space: pre;
  word-wrap: normal;
  overflow-x: auto;
  color: var(--fj-paper);
}

.fj-article-content pre code {
  display: block;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  border-radius: 0;
  color: inherit;
}

.fj-article-content hr {
  border: 0;
  border-top: 1px solid var(--fj-line);
  margin: 24px 0;
}

.fj-article-content table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 20px 0;
  overflow-x: auto;
  display: block;
}

.fj-article-content thead { background: var(--fj-paper-2); }

.fj-article-content td,
.fj-article-content th {
  min-width: 60px;
  height: 36px;
  border: 1px solid var(--fj-line);
  padding: 8px 12px;
  text-align: left;
  box-sizing: border-box;
}

.fj-article-content th {
  font-weight: 700;
  color: var(--fj-accent-dark);
}

/* Article title responsive */
.fj-article h1 {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.fj-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 22px;
}

.fj-detail-panel,
.fj-comments-box {
  padding: 22px;
}

.fj-detail-panel h3,
.fj-tag-side h3 {
  margin: 0 0 16px;
  font-size: 20px;
}

.fj-related-list {
  display: grid;
  gap: 12px;
}

.fj-mini-card,
.fj-prev-item,
.fj-diy-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: #faf6ef;
  border: 1px solid var(--fj-line);
}

.fj-mini-card a,
.fj-prev-item a {
  display: block;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.fj-mini-card span {
  display: block;
  margin-top: 6px;
}

.fj-prev-next {
  display: grid;
  gap: 12px;
}

.fj-tag-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.fj-tag-box {
  margin: 0;
  padding: 22px;
}

.fj-tag-detail-head {
  margin-bottom: 22px;
}

.fj-search-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.fj-search-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.fj-search-masonry {
  column-count: 3;
}

.fj-so-panel {
  text-align: center;
}

.fj-diy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.fj-diy-item span {
  display: block;
  margin-top: 8px;
  font-size: 16px;
  color: var(--fj-text);
  word-break: break-all;
}

.fj-tag-side {
  padding: 22px;
}

.fj-tag-side-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.fj-tag-side-cloud span {
  color: var(--fj-muted);
  font-size: 12px;
}

.fj-empty-page {
  text-align: center;
  padding: 60px 24px;
}

.fj-footer {
  padding: 0 0 30px;
}

.fj-footer-inner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
  background: rgba(255,255,255,.72);
  border: 1px solid var(--fj-line);
  border-radius: 22px;
}

.fj-footer p,
.fj-copy {
  margin: 6px 0 0;
  color: var(--fj-muted);
}

.fj-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.fj-scrolltop {
  position: fixed;
  right: 20px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--fj-accent), var(--fj-accent-dark));
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .25s ease;
  box-shadow: 0 8px 24px rgba(111, 76, 47, .24);
}

.fj-scrolltop.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 1200px) {
  .fj-masonry {
    column-count: 3;
  }

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

@media (max-width: 991px) {
  .fj-intro-band,
  .fj-search-top,
  .fj-detail-grid,
  .fj-footer-inner,
  .fj-diy-grid {
    grid-template-columns: 1fr;
  }

  .fj-menu-toggle {
    display: inline-flex;
  }

  .fj-nav {
    display: none;
    border-top: none;
    padding: 8px 0 12px;
  }

  .fj-nav.open {
    display: flex;
  }

  .fj-search {
    grid-template-columns: 1fr auto;
  }

  .fj-masonry,
  .fj-search-masonry {
    column-count: 2;
  }

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

@media (max-width: 767px) {
  .fj-wrap,
  .fj-detail-wrap {
    width: min(100% - 16px, 1380px);
  }

  .fj-main {
    padding-top: 16px;
  }

  /* Header mobile: stack brand and search */
  .fj-header-top {
    flex-wrap: wrap;
    min-height: 50px;
    gap: 8px;
  }

  .fj-brand a {
    font-size: 22px;
  }

  .fj-search,
  .fj-search-wide {
    grid-template-columns: 1fr auto;
  }

  .fj-search input {
    min-width: 0;
    width: 100%;
  }

  .fj-intro-copy h1,
  .fj-list-head h1,
  .fj-search-panel h1,
  .fj-diy-panel h1,
  .fj-article h1,
  .fj-empty-page h1 {
    font-size: 32px;
  }

  .fj-lead-story h2,
  .fj-card h3,
  .fj-tag-box h3 {
    font-size: 22px;
  }

  .fj-masonry,
  .fj-search-masonry {
    column-count: 1;
  }

  .fj-tag-grid,
  .fj-diy-grid {
    grid-template-columns: 1fr;
  }

  .fj-intro-band,
  .fj-lead-story,
  .fj-list-head,
  .fj-search-panel,
  .fj-diy-panel,
  .fj-empty-page,
  .fj-article,
  .fj-detail-panel,
  .fj-comments-box,
  .fj-tag-side,
  .fj-footer-inner {
    padding: 18px;
  }

  /* Article content mobile */
  .fj-article-content {
    font-size: 15px;
  }

  .fj-article-content h1 { font-size: 24px; }
  .fj-article-content h2 { font-size: 20px; }
  .fj-article-content h3 { font-size: 18px; }

  .fj-article-content pre {
    font-size: 12px;
    padding: 14px;
  }

  .fj-article-content table {
    font-size: 13px;
  }

  .fj-article-content td,
  .fj-article-content th {
    padding: 6px 8px;
    min-width: 40px;
  }

  .fj-article-content img {
    border-radius: 10px;
    margin: 12px 0;
  }

  .fj-detail-grid {
    grid-template-columns: 1fr;
  }

  /* Nav links text truncation */
  .fj-nav a {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }
}
