:root {
  --tz-bg: #f2e6d3;
  --tz-bg-deep: #dfc8a2;
  --tz-card: rgba(255, 249, 239, 0.88);
  --tz-card-strong: #fff8ec;
  --tz-border: rgba(124, 85, 42, 0.18);
  --tz-text: #654a2e;
  --tz-title: #2f1f12;
  --tz-accent: #9a5a20;
  --tz-accent-strong: #c86d21;
  --tz-accent-soft: #f2d1a6;
  --tz-muted: #8a7255;
  --tz-shadow: 0 18px 40px rgba(83, 54, 24, 0.12);
  --tz-shadow-soft: 0 10px 24px rgba(83, 54, 24, 0.08);
  --tz-danger: #9b3a22;
  --tz-success: #2c6e49;
  --tz-surface: rgba(255, 255, 255, 0.48);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--tz-title);
  font-family: "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 246, 227, 0.92), transparent 32%),
    radial-gradient(circle at 92% 12%, rgba(227, 183, 120, 0.35), transparent 24%),
    linear-gradient(160deg, var(--tz-bg) 0%, var(--tz-bg-deep) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.trending-shell {
  min-height: 100vh;
}

.trending-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid #d7c5a8;
  background: linear-gradient(180deg, #faf2e4 0%, #f5ecda 100%);
}

.trending-topbar-inner {
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto;
  min-height: 56px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
}

.trending-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  color: #6e4a2f;
  white-space: nowrap;
}

.trending-logo svg {
  width: 26px;
  height: 26px;
}

.trending-logo span {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.trending-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.95rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.trending-nav-link {
  text-decoration: none;
  color: #6e4a2f;
  white-space: nowrap;
  font-size: 0.84rem;
}

.trending-nav-link.active,
.trending-nav-link:hover {
  color: #2f506c;
}

.trending-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.trending-topbar-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d7c5a8;
  border-radius: 999px;
  background: #fffdf8;
  color: #6e4a2f;
  padding: 0.42rem 0.82rem;
  font-size: 0.78rem;
  line-height: 1;
  text-decoration: none;
}

.trending-topbar-btn.ghost {
  background: transparent;
}

.trending-main {
  width: min(1360px, calc(100vw - 24px));
  margin: 0 auto;
  padding: clamp(0.8rem, 2vw, 1.5rem) 0 1.8rem;
}

.hero-card,
.panel,
.stat-card,
.note-card,
.detail-modal {
  border: 1px solid var(--tz-border);
  background: var(--tz-card);
  box-shadow: var(--tz-shadow-soft);
}

/* ── Hero + Stats Bar (merged) ──────────────── */
.hero-stats-bar {
  border-radius: 20px;
  padding: clamp(1rem, 2vw, 1.4rem) clamp(1.2rem, 2.5vw, 1.8rem);
  background:
    radial-gradient(circle at 84% 16%, rgba(255, 212, 145, 0.26), transparent 18%),
    linear-gradient(145deg, rgba(255, 252, 245, 0.96), rgba(255, 237, 203, 0.86));
  box-shadow: var(--tz-shadow);
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 1.5rem;
  border: 1px solid var(--tz-border);
}
.hero-stats-bar .hero-copy { min-width: 0; }
.hero-stats-bar .trending-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.6rem);
  line-height: 1.15;
}
.hero-stats-bar .trending-subtitle {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40ch;
}
.stats-inline {
  display: flex;
  gap: 1.2rem;
}
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.stat-item .stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--tz-ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-item .stat-value-small { font-size: 0.82rem; }
.stat-item .stat-label {
  font-size: 0.65rem;
  color: var(--tz-text);
  letter-spacing: 0.04em;
}
.hero-stats-bar .trending-actions {
  display: flex;
  gap: 0.5rem;
}

.hero-card {
  border-radius: 24px;
  padding: clamp(1rem, 2.5vw, 1.6rem);
  background:
    radial-gradient(circle at 84% 16%, rgba(255, 212, 145, 0.26), transparent 18%),
    linear-gradient(145deg, rgba(255, 252, 245, 0.96), rgba(255, 237, 203, 0.86));
  box-shadow: var(--tz-shadow);
}

.hero-copy {
  max-width: 76ch;
}

.trending-eyebrow {
  margin: 0;
  color: var(--tz-accent);
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 800;
}

.trending-title {
  margin: 0.48rem 0 0;
  font-size: clamp(1.5rem, 3.5vw, 2.4rem);
  line-height: 1.08;
}

.trending-subtitle {
  margin: 0.72rem 0 0;
  max-width: 72ch;
  color: var(--tz-text);
  font-size: 0.96rem;
  line-height: 1.65;
}

.trending-subtitle.error {
  color: var(--tz-danger);
}

.trending-actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.68rem;
}

.trending-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--tz-accent);
  border-radius: 999px;
  padding: 0.52rem 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--tz-accent), var(--tz-accent-strong));
  text-decoration: none;
  font-size: 0.82rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  box-shadow: 0 8px 18px rgba(154, 90, 32, 0.18);
}

.trending-btn:hover {
  transform: translateY(-1px);
}

.trending-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.trending-btn.ghost {
  color: var(--tz-accent);
  background: transparent;
  box-shadow: none;
}

.stats-grid,
.insight-grid {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

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

.stat-card {
  border-radius: 20px;
  padding: 0.8rem 1rem;
}

.stat-label,
.stat-foot,
.section-kicker,
.section-meta,
.ranking-caption,
.meta-line,
.task-progress-text,
.empty-state p,
.note-desc,
.note-meta,
.note-stats,
.tag-cloud button,
.task-log,
.search-input::placeholder,
.field span,
.filter-row select {
  color: var(--tz-muted);
}

.stat-label,
.section-kicker {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.stat-value {
  display: block;
  margin-top: 0.42rem;
  font-size: clamp(1.45rem, 3.2vw, 2.3rem);
  color: var(--tz-title);
  line-height: 1.08;
}

.stat-value-small {
  font-size: clamp(1rem, 2.4vw, 1.28rem);
}

.stat-foot {
  display: block;
  margin-top: 0.54rem;
  font-size: 0.82rem;
}

.panel {
  border-radius: 22px;
  padding: 1.1rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.95rem;
}

.section-head h2 {
  margin: 0.18rem 0 0;
  font-size: 1.18rem;
  line-height: 1.2;
}

.section-meta {
  font-size: 0.82rem;
  text-align: right;
}

.task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 0.72rem;
  align-items: start;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field span {
  font-size: 0.8rem;
  font-weight: 600;
}

.field textarea,
.search-input,
.filter-row select {
  border: 1px solid rgba(124, 85, 42, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  padding: 0.82rem 0.95rem;
  color: var(--tz-title);
  outline: none;
  resize: vertical;
}

.field textarea {
  min-height: 50px;
}

.field textarea:focus,
.search-input:focus,
.filter-row select:focus {
  border-color: rgba(154, 90, 32, 0.48);
  box-shadow: 0 0 0 3px rgba(154, 90, 32, 0.08);
}

.task-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.task-status {
  margin-top: 0.82rem;
  padding-top: 0.82rem;
  border-top: 1px solid rgba(124, 85, 42, 0.12);
}

.task-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.4rem;
  padding: 0.28rem 0.72rem;
  border-radius: 999px;
  background: rgba(124, 85, 42, 0.12);
  color: var(--tz-text);
  font-size: 0.76rem;
  font-weight: 700;
}

.status-chip.running {
  background: rgba(154, 90, 32, 0.16);
  color: var(--tz-accent);
}

.status-chip.done {
  background: rgba(44, 110, 73, 0.16);
  color: var(--tz-success);
}

.status-chip.error {
  background: rgba(155, 58, 34, 0.14);
  color: var(--tz-danger);
}

.progress-track {
  margin-top: 0.86rem;
  height: 10px;
  border-radius: 999px;
  background: rgba(154, 90, 32, 0.1);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--tz-accent), var(--tz-accent-strong));
  border-radius: inherit;
}

.progress-fill.idle {
  width: 0;
}

.progress-fill.done {
  width: 100%;
}

.progress-fill.running {
  width: 38%;
  animation: task-progress 1.35s ease-in-out infinite;
}

@keyframes task-progress {
  0% {
    transform: translateX(-115%);
  }
  55% {
    transform: translateX(120%);
  }
  100% {
    transform: translateX(160%);
  }
}

.task-log {
  margin: 0.85rem 0 0;
  border-radius: 16px;
  padding: 0.95rem;
  max-height: 220px;
  overflow: auto;
  background: #241d17;
  color: #f6ead8;
  font-family: "Cascadia Code", "Fira Code", monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-log-wrap {
  margin-top: 0.72rem;
}

.task-log-wrap summary {
  cursor: pointer;
  color: var(--tz-muted);
  font-size: 0.78rem;
  user-select: none;
}

.task-log-wrap[open] summary {
  color: var(--tz-text);
}

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

.ranking-list {
  display: grid;
  gap: 0.78rem;
}

.ranking-item {
  padding: 0.78rem 0.86rem;
  border-radius: 16px;
  background: var(--tz-surface);
}

.ranking-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.ranking-name {
  font-weight: 700;
}

.ranking-value {
  font-size: 0.84rem;
  color: var(--tz-text);
}

.ranking-track {
  margin-top: 0.55rem;
  height: 8px;
  border-radius: 999px;
  background: rgba(154, 90, 32, 0.1);
  overflow: hidden;
}

.ranking-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(154, 90, 32, 0.72), rgba(200, 109, 33, 0.92));
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.tag-cloud button {
  border: 1px solid rgba(154, 90, 32, 0.18);
  border-radius: 999px;
  padding: 0.44rem 0.88rem;
  background: rgba(255, 255, 255, 0.7);
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.tag-cloud button:hover {
  border-color: rgba(154, 90, 32, 0.48);
  transform: translateY(-1px);
}

.top-notes-list {
  display: grid;
  gap: 0.72rem;
}

.top-note-item {
  display: flex;
  gap: 0.78rem;
  align-items: flex-start;
  border: 1px solid rgba(124, 85, 42, 0.1);
  border-radius: 16px;
  padding: 0.84rem;
  background: rgba(255, 255, 255, 0.62);
  text-align: left;
}

.top-note-rank {
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--tz-accent), var(--tz-accent-strong));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.top-note-body {
  min-width: 0;
  flex: 1;
}

.top-note-title {
  font-weight: 700;
  color: var(--tz-title);
}

.top-note-meta {
  margin-top: 0.28rem;
  font-size: 0.8rem;
  color: var(--tz-muted);
}

.browser-panel {
  margin-top: 1rem;
}

.city-tabs {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: thin;
}

.city-tabs::-webkit-scrollbar {
  height: 6px;
}

.city-tab {
  border: 1px solid rgba(124, 85, 42, 0.12);
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  padding: 0.55rem 0.94rem;
  white-space: nowrap;
  color: var(--tz-text);
  display: inline-flex;
  align-items: center;
  gap: 0.44rem;
}

.city-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--tz-accent), var(--tz-accent-strong));
  border-color: transparent;
}

.city-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  padding: 0.1rem 0.44rem;
  border-radius: 999px;
  background: rgba(124, 85, 42, 0.12);
  font-size: 0.72rem;
}

.city-tab.active .city-tab-count {
  background: rgba(255, 255, 255, 0.24);
}

.filter-row {
  margin-top: 0.95rem;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) auto auto auto;
  gap: 0.82rem;
}

.search-input {
  min-width: 0;
}

.notes-section {
  margin-top: 1rem;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.note-card {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.note-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--tz-shadow);
}

.note-cover-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(255, 235, 203, 0.8), rgba(225, 189, 140, 0.6));
}

.note-cover,
.detail-gallery img,
.detail-video,
#lightbox-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.note-cover {
  display: block;
}

.note-cover-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(101, 74, 46, 0.54);
  font-size: 2rem;
  letter-spacing: 0.08em;
}

.note-badges {
  position: absolute;
  inset: 0.8rem 0.8rem auto auto;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.note-badge {
  border-radius: 999px;
  padding: 0.3rem 0.62rem;
  background: rgba(32, 25, 18, 0.72);
  color: #fff;
  font-size: 0.72rem;
}

.note-body {
  padding: 1rem;
}

.note-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}

.note-desc {
  margin: 0.56rem 0 0;
  font-size: 0.86rem;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.note-meta {
  margin-top: 0.72rem;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.78rem;
}

.note-stats {
  margin-top: 0.84rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.note-stat {
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  background: rgba(124, 85, 42, 0.08);
  font-size: 0.76rem;
}

.note-tags {
  margin-top: 0.84rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.note-tag {
  border-radius: 999px;
  padding: 0.22rem 0.62rem;
  background: rgba(154, 90, 32, 0.1);
  color: var(--tz-accent);
  font-size: 0.74rem;
}

.empty-state {
  margin-top: 1rem;
  border: 1px dashed rgba(124, 85, 42, 0.28);
  border-radius: 24px;
  padding: 2rem 1.4rem;
  text-align: center;
  background: rgba(255, 251, 244, 0.66);
}

.empty-state h2 {
  margin: 0;
  font-size: 1.18rem;
}

.empty-state p {
  margin: 0.7rem auto 0;
  max-width: 52ch;
  line-height: 1.7;
}

.modal-overlay,
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(18, 12, 8, 0.64);
}

.modal-overlay {
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.detail-modal {
  position: relative;
  width: min(980px, 100%);
  max-height: calc(100vh - 2.4rem);
  border-radius: 24px;
  overflow: auto;
  padding: 1.25rem;
}

.modal-close,
.lightbox-close {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: 999px;
  background: rgba(32, 25, 18, 0.12);
  color: var(--tz-title);
  font-size: 1.4rem;
}

.detail-title {
  margin: 0;
  padding-right: 3rem;
  font-size: 1.5rem;
  line-height: 1.34;
}

.detail-meta {
  margin-top: 0.72rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.68rem;
  font-size: 0.84rem;
  color: var(--tz-muted);
}

.detail-gallery {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.7rem;
}

.detail-gallery img {
  border-radius: 16px;
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
}

.detail-video-wrap {
  margin-top: 1rem;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
}

.detail-video {
  display: block;
}

.detail-desc {
  margin-top: 1rem;
  line-height: 1.82;
  color: var(--tz-text);
  white-space: pre-wrap;
}

.detail-tags {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-stats {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  margin-top: 1rem;
  border-radius: 999px;
  padding: 0.56rem 0.96rem;
  background: linear-gradient(135deg, var(--tz-accent), var(--tz-accent-strong));
  color: #fff;
  text-decoration: none;
}

.detail-comments {
  margin-top: 1.2rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(124, 85, 42, 0.12);
}

.detail-comments h3 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
}

.comment-item {
  padding: 0.84rem 0;
  border-bottom: 1px solid rgba(124, 85, 42, 0.1);
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
}

.comment-name {
  font-weight: 700;
}

.comment-location,
.comment-like {
  font-size: 0.78rem;
  color: var(--tz-muted);
}

.comment-content {
  margin-top: 0.35rem;
  color: var(--tz-text);
  line-height: 1.7;
}

.lightbox {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.lightbox-close {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

#lightbox-image {
  max-width: min(1180px, 100%);
  max-height: calc(100vh - 4rem);
  border-radius: 18px;
  object-fit: contain;
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .trending-topbar-inner {
    grid-template-columns: auto 1fr;
  }

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

  .task-actions {
    flex-direction: row;
  }
}

@media (max-width: 900px) {
  .insight-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .hero-stats-bar {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .stats-inline { justify-content: space-around; }
  .hero-stats-bar .trending-subtitle { white-space: normal; }
  .trending-topbar-inner,
  .trending-main {
    width: min(1360px, calc(100vw - 18px));
  }

  .trending-topbar-inner {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 8px 0;
  }

  .trending-nav {
    gap: 0.7rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .trending-actions {
    width: 100%;
  }

  .trending-actions .trending-btn {
    flex: 1 1 calc(50% - 0.68rem);
    text-align: center;
    justify-content: center;
  }

  .detail-modal {
    max-height: calc(100vh - 1.4rem);
    padding: 1rem;
  }

  .detail-title {
    font-size: 1.28rem;
  }
}
