:root {
  --paper: #fffdf7;
  --paper-deep: #f4f0e4;
  --ink: #273027;
  --muted: #687060;
  --line: #d9dec9;
  --matcha-50: #f1f7e9;
  --matcha-100: #e3edcf;
  --matcha-300: #acc58e;
  --matcha-500: #7fa067;
  --matcha-700: #4e6d48;
  --plum: #694a67;
  --rose: #ba6f79;
  --shadow: 0 18px 50px rgba(39, 48, 39, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 253, 247, 0.9), rgba(255, 253, 247, 0.9)),
    repeating-linear-gradient(0deg, transparent 0, transparent 27px, rgba(78, 109, 72, 0.07) 28px),
    var(--paper);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Hiragino Sans GB",
    system-ui,
    sans-serif;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.paper-texture {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(39, 48, 39, 0.06) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.35;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(16px, 5vw, 56px);
  border-bottom: 1px solid rgba(78, 109, 72, 0.16);
  background: rgba(255, 253, 247, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--matcha-500);
  border-radius: 8px;
  background: var(--matcha-100);
  color: var(--matcha-700);
  font-size: 0.9rem;
  font-weight: 800;
}

.brand-copy {
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 1rem;
  letter-spacing: 0;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.nav-links a {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--matcha-700);
  font-size: 0.92rem;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: var(--matcha-100);
  outline: none;
}

.site-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.opening-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 142px);
}

.profile-panel,
.composer-panel,
.content-tools,
.section-block,
.novel-panel {
  border: 1px solid rgba(78, 109, 72, 0.2);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.profile-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  min-height: 520px;
  padding: clamp(24px, 5vw, 52px);
}

.profile-panel::before {
  position: absolute;
  inset: 28px 28px auto auto;
  width: min(28vw, 260px);
  height: min(34vw, 320px);
  border: 1px solid rgba(105, 74, 103, 0.18);
  border-radius: 8px;
  transform: rotate(-4deg);
  content: "";
}

.profile-panel::after {
  position: absolute;
  inset: 62px 58px auto auto;
  width: 80px;
  height: 10px;
  border-top: 3px solid rgba(186, 111, 121, 0.55);
  border-bottom: 3px solid rgba(186, 111, 121, 0.28);
  transform: rotate(-4deg);
  content: "";
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--plum);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 11ch;
  margin-bottom: 8px;
  font-size: clamp(3.4rem, 9vw, 7rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.45rem, 2.8vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.3;
}

.screen-name {
  position: relative;
  z-index: 1;
  max-width: 22rem;
  margin-bottom: 12px;
  color: var(--matcha-700);
  font-size: clamp(1.25rem, 2.8vw, 1.75rem);
  font-weight: 800;
}

.intro {
  position: relative;
  z-index: 1;
  max-width: 42rem;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 1.02rem;
}

.tag-row,
.word-cloud {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-row span,
.word-cloud span,
.entry-tag,
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(78, 109, 72, 0.25);
  border-radius: 8px;
  background: var(--matcha-50);
  color: var(--matcha-700);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.composer-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 3vw, 28px);
}

.panel-title p {
  margin-bottom: 2px;
  color: var(--rose);
  font-size: 0.82rem;
  font-weight: 800;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-deep);
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
}

.segmented input:checked + span {
  background: var(--matcha-500);
  color: white;
}

.field,
.search-box {
  display: grid;
  gap: 6px;
}

.field span,
.search-box span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.field input,
.field textarea,
.search-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.field input,
.search-box input {
  min-height: 42px;
  padding: 0 12px;
}

.field textarea {
  min-height: 132px;
  resize: vertical;
  padding: 10px 12px;
}

.field input:focus,
.field textarea:focus,
.search-box input:focus {
  border-color: var(--matcha-500);
  box-shadow: 0 0 0 3px rgba(127, 160, 103, 0.18);
  outline: none;
}

.primary-action,
.filter-button,
.entry-action,
.dialog-close {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  background: var(--matcha-700);
  color: white;
}

.primary-action:hover,
.primary-action:focus-visible {
  background: var(--plum);
  outline: none;
}

.local-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.content-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
  padding: 16px;
}

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

.filter-button {
  padding: 0 13px;
  border-color: var(--line);
  background: white;
  color: var(--matcha-700);
}

.filter-button.is-active,
.filter-button:hover,
.filter-button:focus-visible {
  border-color: var(--matcha-500);
  background: var(--matcha-100);
  outline: none;
}

.section-block {
  margin-top: 18px;
  padding: clamp(18px, 3vw, 28px);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

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

.entry-card {
  display: flex;
  min-height: 220px;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.entry-type {
  color: var(--plum);
  font-weight: 800;
}

.entry-card h3 {
  margin: 0;
  font-size: 1.12rem;
}

.entry-card p {
  margin: 0;
  color: #41483f;
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.entry-action {
  align-self: flex-start;
  min-height: 34px;
  padding: 0 10px;
  border-color: rgba(186, 111, 121, 0.35);
  background: #fff8f8;
  color: #8b4b55;
  font-size: 0.82rem;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

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

.art-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.art-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--paper-deep);
}

.art-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 180ms ease;
}

.art-frame:hover img,
.art-frame:focus-visible img {
  transform: scale(1.035);
}

.art-frame:focus-visible {
  outline: 3px solid rgba(127, 160, 103, 0.35);
}

.art-card figcaption {
  display: grid;
  gap: 2px;
  padding: 11px 12px 13px;
}

.art-card strong {
  font-size: 0.96rem;
}

.art-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.novel-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  margin-top: 18px;
  padding: clamp(20px, 4vw, 36px);
}

.novel-copy p {
  color: var(--muted);
}

blockquote {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 4px solid var(--matcha-500);
  border-radius: 0 8px 8px 0;
  background: var(--matcha-50);
  color: var(--ink);
  font-weight: 800;
}

.novel-card {
  align-self: start;
  padding: 16px;
  border: 1px solid rgba(105, 74, 103, 0.24);
  border-radius: 8px;
  background: #fbf7fb;
}

.art-dialog {
  width: min(920px, calc(100% - 28px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.22);
}

.art-dialog::backdrop {
  background: rgba(39, 48, 39, 0.42);
}

.art-dialog img {
  max-height: 76vh;
  margin: 0 auto;
  border-radius: 8px;
  object-fit: contain;
}

.art-dialog p {
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
}

.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  border-color: var(--line);
  background: white;
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  min-width: 180px;
  max-width: calc(100vw - 36px);
  padding: 12px 14px;
  border: 1px solid rgba(78, 109, 72, 0.25);
  border-radius: 8px;
  background: var(--matcha-700);
  color: white;
  font-weight: 800;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  padding: 24px 16px 34px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .opening-layout,
  .novel-panel {
    grid-template-columns: 1fr;
  }

  .entry-grid,
  .entry-grid-wide,
  .art-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-panel {
    min-height: 430px;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
  }

  .site-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 18px;
  }

  .opening-layout {
    min-height: 0;
  }

  .profile-panel {
    min-height: 390px;
    padding: 22px;
  }

  h1 {
    font-size: clamp(3rem, 19vw, 4.6rem);
  }

  .content-tools {
    grid-template-columns: 1fr;
  }

  .entry-grid,
  .entry-grid-wide,
  .art-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
