:root {
  color-scheme: light;
  --bg: #f3f0ea;
  --panel: #fffaf2;
  --text: #1f1b16;
  --muted: #6f665c;
  --line: rgba(102, 93, 81, 0.18);
  --accent: #0f766e;
  --soft: rgba(15, 118, 110, 0.08);
  --warn: #b76516;
  --shadow: 0 12px 24px rgba(31, 27, 22, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(180deg, #f7f4ef 0%, var(--bg) 100%);
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;
}

button,
input,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1800px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.brain-strip,
.summary-row,
.section-block {
  margin-bottom: 12px;
}

.topbar,
.brain-strip,
.summary-box,
.section-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
}

.title-wrap h1,
.section-label h2 {
  margin: 0;
}

.title-wrap p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.toolbar input,
.toolbar button,
.brain-actions button,
.pin-toggle,
.volume-row input {
  border: 1px solid var(--line);
  border-radius: 10px;
}

.toolbar input {
  min-width: 280px;
  padding: 10px 12px;
  background: #fff;
}

.toolbar button {
  padding: 10px 12px;
  background: #fff;
  cursor: pointer;
}

.brain-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
}

.brain-title {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brain-title span {
  color: var(--muted);
  font-size: 14px;
}

.brain-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.brain-actions button {
  padding: 8px 12px;
  background: #fff;
  cursor: pointer;
}

.tone-stop {
  color: #8a2f2f;
}

.volume-row {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

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

.summary-box {
  padding: 12px 14px;
}

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

.summary-box strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

.section-block {
  padding: 12px;
}

.section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-label span {
  color: var(--muted);
  font-size: 13px;
}

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

.entry {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.entry-link {
  min-height: 78px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: space-between;
}

.entry-link.private {
  background: #fbf5ea;
}

.entry-link.planned {
  opacity: 0.68;
}

.entry-link.live {
  border-color: rgba(15, 118, 110, 0.28);
}

.entry-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

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

.entry-status {
  color: var(--accent);
  font-size: 12px;
}

.entry-link.private .entry-status {
  color: var(--warn);
}

.pin-toggle {
  padding: 6px 8px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.pin-toggle.active {
  background: var(--soft);
  color: var(--accent);
}

@media (max-width: 1440px) {
  .entry-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .topbar,
  .brain-strip {
    flex-direction: column;
    align-items: stretch;
  }

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

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

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

@media (max-width: 640px) {
  .shell {
    padding: 10px;
  }

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

.subpage-body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(180deg, #f7f4ef 0%, var(--bg) 100%);
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    sans-serif;
}

.detail-shell {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.detail-header,
.detail-toolbar,
.journey-hero,
.detail-card,
.tag-group,
.site-panel,
.site-button,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.detail-header h1,
.card-head h3,
.site-panel-head strong {
  margin: 0;
}

.detail-header p {
  margin: 6px 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.55;
}

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

.detail-stats span,
.detail-pill,
.site-badge,
.tag-code {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.detail-stats span,
.detail-pill,
.site-badge.preview {
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent);
}

.site-badge.catalog,
.tag-code {
  background: rgba(33, 27, 22, 0.06);
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.detail-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.detail-toolbar input {
  flex: 1;
  min-width: 280px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.helper-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.tag-groups,
.journey-main,
.session-list {
  display: grid;
  gap: 12px;
}

.tag-group,
.detail-card,
.site-panel,
.empty-state {
  padding: 12px;
}

.tag-group-head,
.card-head,
.site-panel-head,
.site-button-title,
.session-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.tag-group-head {
  margin-bottom: 10px;
  align-items: flex-end;
}

.tag-group-head p,
.empty-state p,
.session-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.tag-card {
  min-height: 148px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tag-card strong {
  font-size: 15px;
  line-height: 1.35;
}

.tag-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tag-link {
  margin-top: auto;
  color: var(--accent);
  font-size: 13px;
}

.journey-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 12px;
}

.site-panel {
  align-self: start;
}

.site-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.site-button {
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.site-button-title strong {
  font-size: 14px;
  line-height: 1.35;
}

.site-button small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.site-button.active {
  border-color: rgba(15, 118, 110, 0.28);
  background: var(--soft);
}

.journey-hero {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hero-copy h2 {
  margin: 0;
}

.hero-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-pill-row,
.session-trail,
.session-anomalies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hero-pill-row {
  margin-top: 10px;
}

.mini-stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 21px;
}

.journey-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.card-head {
  margin-bottom: 10px;
  align-items: flex-end;
}

.card-head span {
  color: var(--muted);
  font-size: 13px;
}

.flow-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: auto;
  padding-bottom: 4px;
}

.flow-node {
  min-width: 138px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.flow-node small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.flow-node strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.flow-link {
  color: var(--muted);
  font-size: 14px;
}

.insight-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.insight-list li + li {
  margin-top: 6px;
}

.session-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
}

.session-head {
  margin-bottom: 10px;
}

.session-head strong {
  display: block;
  font-size: 15px;
}

.session-head span {
  color: var(--muted);
  font-size: 12px;
}

.session-route {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 10px 0;
}

.route-node,
.trail-chip,
.anomaly-chip {
  font-size: 12px;
}

.route-node {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent);
}

.route-arrow {
  color: var(--muted);
  font-size: 12px;
}

.trail-chip {
  padding: 6px 8px;
  border-radius: 10px;
  background: #f7f3ed;
  color: var(--muted);
}

.anomaly-chip {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(183, 101, 22, 0.08);
  color: var(--warn);
}

.empty-state h2 {
  margin: 0 0 8px;
}

@media (max-width: 1200px) {
  .tag-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .journey-layout,
  .journey-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .detail-shell {
    padding: 10px;
  }

  .detail-header,
  .detail-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .journey-hero {
    grid-template-columns: 1fr;
  }

  .detail-toolbar input {
    min-width: 0;
    width: 100%;
  }

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