@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600&family=ZCOOL+XiaoWei&display=swap');

:root {
  --bg: #f4efe8;
  --bg-2: #efe7dd;
  --card: rgba(255, 255, 255, 0.92);
  --ink: #1f1f1f;
  --muted: #6f6a63;
  --accent: #0f766e;
  --accent-2: #d97706;
  --line: rgba(28, 27, 26, 0.12);
  --shadow: 0 24px 50px rgba(31, 31, 31, 0.12);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Noto Sans SC", "PingFang SC", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff8ef, var(--bg) 42%),
    radial-gradient(circle at 80% 10%, rgba(15, 118, 110, 0.18), transparent 45%),
    radial-gradient(circle at 20% 90%, rgba(217, 119, 6, 0.2), transparent 50%),
    var(--bg);
  min-height: 100vh;
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image: radial-gradient(rgba(0, 0, 0, 0.1) 1px, transparent 1px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}

.hero {
  padding: 56px 5vw 32px;
}

.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 252, 247, 0.9));
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.profile {
  display: flex;
  gap: 24px;
  align-items: center;
}

.avatar {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  background: linear-gradient(135deg, #0f766e, #22c1b0);
  display: grid;
  place-items: center;
  color: #fff;
  font-family: "ZCOOL XiaoWei", serif;
  font-size: 40px;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(15, 118, 110, 0.25);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-main {
  flex: 1;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  display: none;
}

.handle {
  margin-top: 4px;
  color: var(--muted);
}

.bio {
  margin: 12px 0 8px;
  line-height: 1.6;
  font-size: 15px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 13px;
  color: var(--muted);
}

.stats {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.stat {
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--line);
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
}

.stat .value {
  font-size: 18px;
  font-weight: 600;
  margin-top: 6px;
}

.main {
  max-width: 1280px;
  margin: 0 auto 80px;
  padding: 0 5vw;
}

.toolbar {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.search {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--card);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(31, 31, 31, 0.08);
}

.search input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  outline: none;
  color: var(--ink);
}

.search button {
  border: none;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chips button {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.chips button.active {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.4);
}

.filters select,
.filters .toggle {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 14px;
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
}

.filters .toggle {
  cursor: pointer;
}

.summary {
  font-size: 13px;
  color: var(--muted);
}

.tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.section-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.section-tabs button,
.favorites-entry {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 10px 16px;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.section-tabs button.active {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.4);
}

.favorites-entry {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.35);
}

.favorites-entry.active {
  background: rgba(217, 119, 6, 0.2);
  color: #92400e;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.viewer {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 16px 36px rgba(31, 31, 31, 0.08);
  margin-bottom: 24px;
}

.viewer-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.viewer-header p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.viewer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.viewer-controls button {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 14px;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.viewer-controls .viewer-save.active {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.4);
}

.viewer-controls .viewer-note {
  border-color: rgba(217, 119, 6, 0.4);
  color: #b45309;
  background: rgba(217, 119, 6, 0.12);
}

.viewer-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.viewer-info {
  color: var(--muted);
  font-size: 13px;
}

.viewer-jump {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.viewer-jump input {
  width: 80px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}

.viewer-canvas {
  border-radius: var(--radius-md);
  border: 1px dashed var(--line);
  background: rgba(31, 31, 31, 0.03);
  padding: 16px;
  text-align: center;
  min-height: 240px;
  position: relative;
}

.viewer-page-wrap {
  position: relative;
  display: none;
}

.viewer-canvas.loaded .viewer-page-wrap {
  display: inline-block;
}

.viewer-page-wrap canvas {
  display: block;
  border-radius: var(--radius-md);
  background: #fff;
}

.textLayer {
  position: absolute;
  inset: 0;
  color: transparent;
  transform-origin: 0 0;
  line-height: 1;
  user-select: text;
}

.textLayer span {
  position: absolute;
  white-space: pre;
  transform-origin: 0 0;
}

.textLayer ::selection {
  background: rgba(15, 118, 110, 0.22);
}

.viewer-placeholder {
  color: var(--muted);
  font-size: 13px;
}

.favorites {
  display: grid;
  gap: 18px;
}

.favorites-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.favorites-header button {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 14px;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.favorites-header button:hover {
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.4);
}

.favorites-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.favorites-tabs button {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 14px;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.favorites-tabs button.active {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.4);
}

.favorites-panel {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 16px 36px rgba(31, 31, 31, 0.08);
}

.favorites-panel.active {
  display: block;
}

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

.favorite-item {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  padding: 12px 14px;
  display: grid;
  gap: 6px;
}

.favorite-item .meta {
  font-size: 12px;
  color: var(--muted);
}

.favorite-item .fav-content {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--ink);
}

.favorite-item .fav-image {
  width: min(420px, 100%);
  height: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: zoom-in;
}

.favorite-item .fav-note {
  font-size: 13px;
  line-height: 1.6;
  background: rgba(15, 118, 110, 0.08);
  border-radius: 10px;
  padding: 8px 10px;
  white-space: pre-wrap;
}

.favorite-item .fav-note.empty {
  color: var(--muted);
  background: rgba(31, 31, 31, 0.05);
}

.favorite-item .fav-editor {
  width: 100%;
  min-height: 90px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.favorite-item .actions {
  display: flex;
  gap: 8px;
}

.favorite-item button {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 6px 12px;
  background: rgba(31, 31, 31, 0.04);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 60px;
}

.pagination button,
.pagination span {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 14px;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
}

.pagination button {
  cursor: pointer;
}

.pagination button.active {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.4);
}

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

.grid {
  column-count: 1;
  column-gap: 24px;
}

.card {
  break-inside: avoid;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin: 0 0 24px;
  box-shadow: 0 18px 40px rgba(31, 31, 31, 0.1);
  opacity: 0;
  transform: translateY(12px);
  animation: rise 420ms ease forwards;
  animation-delay: calc(var(--i) * 18ms);
}


.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.card-header .type {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.12);
  color: var(--accent-2);
  font-weight: 600;
}

.content {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 14px;
}

.content a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed rgba(15, 118, 110, 0.5);
}

.media {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  align-items: start;
}

.media.single {
  grid-template-columns: 1fr;
  justify-items: center;
}

.media img,
.media video {
  width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f5f2ed;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  max-height: none;
}

.media img {
  cursor: zoom-in;
}

.media.single img,
.media.single video {
  width: min(80%, 420px);
  height: 220px;
  aspect-ratio: auto;
  object-fit: cover;
}

.media video {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.card-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.favorite {
  display: flex;
  align-items: center;
  gap: 8px;
}

.favorite-toggle {
  border: 1px solid var(--line);
  background: rgba(31, 31, 31, 0.04);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.favorite-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(31, 31, 31, 0.2);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.card.is-favorite .favorite-toggle {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.4);
}

.card.is-favorite .favorite-light {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(15, 118, 110, 0.6);
}


.card-footer .sensitive {
  color: #b91c1c;
  font-weight: 600;
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(15, 118, 110, 0.3);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 50;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  border-radius: 18px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
  background: #111;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
}

.note-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 15, 0.5);
  z-index: 70;
}

.note-modal.show {
  display: flex;
}

.note-card {
  width: min(520px, 92vw);
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 20px;
  box-shadow: 0 20px 50px rgba(31, 31, 31, 0.2);
}

.note-card h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.note-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

#noteInput {
  width: 100%;
  min-height: 140px;
  border-radius: 12px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.note-actions button {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 14px;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.note-actions #noteSave {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  border-color: rgba(15, 118, 110, 0.4);
}

.announcement-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 15, 0.5);
  z-index: 80;
}

.announcement-modal.show {
  display: flex;
}

.announcement-card {
  width: min(560px, 92vw);
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 22px;
  box-shadow: 0 24px 60px rgba(31, 31, 31, 0.25);
  display: grid;
  gap: 12px;
}

.announcement-card h3 {
  margin: 0;
  font-size: 20px;
}

.announcement-card ol {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

.announcement-quote {
  margin: 0;
  font-weight: 600;
  color: var(--accent);
}

.announcement-sign {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  gap: 10px;
  flex-wrap: wrap;
}

.announcement-sign a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.announcement-sign a:hover {
  text-decoration: underline;
}

#announcementDismiss {
  border-radius: 999px;
  border: 1px solid rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
  justify-self: start;
}

.announcement-badge {
  position: fixed;
  right: 18px;
  bottom: 90px;
  border-radius: 999px;
  border: 1px solid rgba(217, 119, 6, 0.4);
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  padding: 8px 12px;
  font-weight: 600;
  cursor: pointer;
  display: none;
  z-index: 60;
  box-shadow: 0 12px 26px rgba(31, 31, 31, 0.15);
}

.announcement-badge.show {
  display: inline-flex;
}


@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .hero-inner {
    padding: 24px;
  }

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

@media (max-width: 600px) {

  .search {
    flex-direction: column;
    align-items: stretch;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters select,
  .filters .toggle {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
