:root {
  --bg: #f4efe6;
  --bg-soft: #fbf8f2;
  --card: rgba(255, 251, 245, 0.92);
  --card-strong: #fffdfa;
  --ink: #1d2a28;
  --muted: rgba(29, 42, 40, 0.68);
  --line: rgba(39, 64, 56, 0.12);
  --line-strong: rgba(39, 64, 56, 0.2);
  --teal: #0d6a67;
  --teal-deep: #094e4d;
  --teal-soft: #d9efea;
  --peach: #f0b199;
  --peach-deep: #cb6b4c;
  --sand: #efe4d2;
  --shadow-lg: 0 24px 60px rgba(22, 39, 35, 0.12);
  --shadow-md: 0 14px 32px rgba(22, 39, 35, 0.09);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --font-body: "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei UI", sans-serif;
  --font-display: "Source Han Serif SC", "Songti SC", "STZhongsong", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(13, 106, 103, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(240, 177, 153, 0.22), transparent 30%),
    linear-gradient(180deg, #efe7da 0%, #f8f4ec 44%, #f5f2eb 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.65;
  background-image:
    linear-gradient(rgba(13, 106, 103, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 106, 103, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.15));
}

.page-shell {
  position: relative;
  width: min(1560px, calc(100% - 40px));
  margin: 24px auto 40px;
}

a {
  color: inherit;
}

.hero,
.panel {
  backdrop-filter: blur(10px);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.9fr);
  gap: 24px;
  padding: 30px 32px;
  border-radius: var(--radius-xl);
}

.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13, 106, 103, 0.18), rgba(13, 106, 103, 0));
}

.hero-copyblock,
.hero-card {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(34px, 4.8vw, 60px);
  line-height: 1.04;
}

h2 {
  font-size: 26px;
  line-height: 1.15;
}

.hero-copy,
.hero-path,
.panel-title p,
.job-current,
.result-body p,
.empty-state,
.log-line,
.message-line,
.capability-card p {
  line-height: 1.65;
}

.hero-copy {
  max-width: 64ch;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.hero-highlights,
.meta-pills,
.inline-options,
.score-line,
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-highlights {
  margin-top: 18px;
}

.hero-pill,
.pill,
.score-line span,
.result-meta span,
.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  border: 1px solid rgba(13, 106, 103, 0.1);
}

.hero-pill,
.pill,
.score-line span,
.result-meta span {
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.status-pill {
  font-weight: 700;
}

.status-ready {
  background: rgba(13, 106, 103, 0.14);
  color: var(--teal-deep);
}

.status-disabled {
  background: rgba(203, 107, 76, 0.14);
  color: var(--peach-deep);
}

.hero-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 180px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 243, 234, 0.76)),
    linear-gradient(130deg, rgba(13, 106, 103, 0.09), rgba(240, 177, 153, 0.06));
  border: 1px solid rgba(13, 106, 103, 0.08);
}

.hero-label {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 13px;
}

.hero-path {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.hero-actions {
  display: flex;
  justify-content: flex-end;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(360px, 0.9fr);
  gap: 20px;
  align-items: start;
  margin-top: 20px;
}

.connection-banner {
  margin-top: 16px;
  display: none;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(203, 107, 76, 0.16);
  border: 1px solid rgba(203, 107, 76, 0.16);
  color: #8b3f29;
  box-shadow: var(--shadow-md);
}

.connection-banner.is-visible {
  display: block;
}

.main-column,
.side-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 22px;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-title > div {
  min-width: 0;
}

.panel-title p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 38ch;
  text-align: left;
}

.panel-title-results {
  align-items: end;
}

.panel-results {
  min-height: 620px;
}

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

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(242, 248, 246, 0.85));
  border: 1px solid rgba(13, 106, 103, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -20px -20px auto;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 177, 153, 0.22), rgba(240, 177, 153, 0));
}

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

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1;
}

.stat-card small {
  display: block;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.meta-pills {
  margin-top: 16px;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.capability-card {
  border-radius: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(39, 64, 56, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(247, 243, 236, 0.92));
}

.capability-card.is-ready {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.capability-card.is-disabled {
  background: linear-gradient(180deg, rgba(255, 247, 244, 0.95), rgba(255, 240, 234, 0.82));
}

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

.capability-card strong {
  font-size: 15px;
}

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

.stack,
.search-form {
  display: grid;
  gap: 14px;
}

.search-form {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 243, 236, 0.92));
  border: 1px solid rgba(39, 64, 56, 0.08);
}

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

.field {
  min-width: 0;
}

.field-compact {
  gap: 10px;
}

.field-span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(39, 64, 56, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font: inherit;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

input:hover,
select:hover {
  border-color: rgba(13, 106, 103, 0.22);
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(13, 106, 103, 0.48);
  box-shadow: 0 0 0 4px rgba(13, 106, 103, 0.12);
}

input[type="file"] {
  padding: 10px 12px;
}

.path-row,
.action-row,
.root-actions,
.search-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.path-row input {
  flex: 1;
}

.path-row-secondary {
  flex-wrap: wrap;
}

.field-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.search-actions {
  justify-content: flex-start;
  margin-top: 2px;
}

.action-row-stack {
  flex-wrap: wrap;
}

.staged-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(244, 249, 247, 0.92));
  border: 1px solid rgba(39, 64, 56, 0.08);
}

.mini-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.mini-title strong {
  font-size: 14px;
}

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

.root-chip-list,
.queue-list {
  display: grid;
  gap: 10px;
}

.root-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(13, 106, 103, 0.08);
  border: 1px solid rgba(13, 106, 103, 0.08);
}

.root-chip-text {
  min-width: 0;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-all;
}

.chip-remove {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--peach-deep);
  background: rgba(255, 255, 255, 0.84);
  cursor: pointer;
}

.chip-remove:hover {
  transform: translateY(-1px);
}

.inline-options {
  margin-top: 2px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 106, 103, 0.07);
  border: 1px solid rgba(13, 106, 103, 0.08);
  font-size: 13px;
  font-weight: 500;
}

.check input {
  width: auto;
  margin: 0;
  accent-color: var(--teal);
}

.primary-button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, opacity 180ms ease;
}

.primary-button {
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--teal-deep), var(--teal));
  box-shadow: 0 16px 28px rgba(13, 106, 103, 0.22);
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.ghost-button {
  padding: 10px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(39, 64, 56, 0.12);
}

.danger-button {
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(135deg, #c25d42, var(--peach-deep));
  box-shadow: 0 14px 24px rgba(203, 107, 76, 0.2);
}

.primary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled,
input:disabled,
select:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.job-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(248, 251, 250, 0.92), rgba(255, 255, 255, 0.8));
  border: 1px solid rgba(39, 64, 56, 0.1);
}

.job-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.progress-track {
  margin-top: 14px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(13, 106, 103, 0.12);
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--peach-deep), var(--teal));
  transition: width 300ms ease;
}

.job-current {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.job-meta {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.log-list,
.message-strip,
.roots-list {
  display: grid;
  gap: 10px;
}

.log-list {
  margin-top: 14px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.log-line,
.message-line,
.empty-state {
  border-radius: 14px;
  padding: 11px 12px;
  font-size: 13px;
  background: rgba(13, 106, 103, 0.06);
  border: 1px solid rgba(13, 106, 103, 0.06);
}

.message-strip {
  margin-top: 14px;
}

.message-line {
  background: rgba(240, 177, 153, 0.18);
  border-color: rgba(203, 107, 76, 0.12);
}

.queue-list {
  margin-top: 14px;
}

.queue-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(39, 64, 56, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(246, 243, 237, 0.88));
}

.queue-card strong {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  word-break: break-all;
}

.queue-current {
  background: linear-gradient(180deg, rgba(230, 245, 241, 0.96), rgba(242, 250, 247, 0.9));
}

.queue-pending {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 243, 237, 0.92));
}

.queue-done {
  background: linear-gradient(180deg, rgba(255, 247, 244, 0.92), rgba(255, 252, 248, 0.88));
}

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

.root-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(246, 243, 237, 0.88));
  border: 1px solid rgba(39, 64, 56, 0.08);
}

.root-copy {
  min-width: 0;
}

.root-card strong {
  display: block;
  font-size: 14px;
  word-break: break-all;
}

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

.empty-state.compact {
  padding: 10px 12px;
}

.panel-results .results-grid {
  margin-top: 8px;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.result-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  background: var(--card-strong);
  border: 1px solid rgba(39, 64, 56, 0.1);
  box-shadow: var(--shadow-md);
  animation: rise-in 260ms ease both;
}

.result-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: rgba(13, 106, 103, 0.08);
}

.result-body {
  display: grid;
  gap: 8px;
  padding: 10px 10px 12px;
}

.result-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.result-topline strong {
  font-size: 13px;
  line-height: 1.35;
}

.result-score {
  white-space: nowrap;
  color: var(--teal-deep);
  font-weight: 700;
}

.result-body p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}

.result-date {
  color: var(--muted);
}

.path {
  min-height: 2.8em;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: rgba(29, 42, 40, 0.76);
}

.score-line {
  min-height: 34px;
}

.results-grid .ghost-button {
  width: 100%;
}

.legal-footer {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
  margin-top: 20px;
  padding: 24px;
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.legal-footer-copy {
  min-width: 0;
}

.legal-footer-actions {
  margin-top: 16px;
  justify-content: flex-start;
}

.legal-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.legal-link-grid-wide {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.legal-link-card {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 243, 237, 0.88));
  border: 1px solid rgba(39, 64, 56, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.legal-link-card:hover {
  transform: translateY(-2px);
  border-color: rgba(13, 106, 103, 0.18);
  box-shadow: var(--shadow-md);
}

.legal-link-card strong {
  font-size: 15px;
}

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

.legal-shell {
  position: relative;
  width: min(1120px, calc(100% - 40px));
  margin: 24px auto 40px;
}

.legal-page .legal-hero,
.legal-page .legal-article,
.legal-page .legal-center {
  backdrop-filter: blur(10px);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
}

.legal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 28px 30px;
  border-radius: var(--radius-xl);
}

.legal-hero-copy {
  min-width: 0;
}

.legal-hero-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.legal-note {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--teal-deep);
}

.legal-article,
.legal-center {
  margin-top: 20px;
  border-radius: var(--radius-lg);
  padding: 24px;
}

.legal-article-body h1,
.legal-article-body h2,
.legal-article-body h3 {
  margin-top: 0;
}

.legal-article-body h1 {
  margin-bottom: 18px;
}

.legal-article-body h2 {
  margin-top: 30px;
  margin-bottom: 12px;
  font-size: 24px;
}

.legal-article-body h3 {
  margin-top: 22px;
  margin-bottom: 10px;
  font-family: var(--font-body);
  font-size: 18px;
}

.legal-article-body p,
.legal-article-body li {
  font-size: 15px;
  line-height: 1.85;
}

.legal-article-body p {
  margin: 0 0 14px;
}

.legal-article-body ul,
.legal-article-body ol {
  margin: 0 0 14px;
  padding-left: 24px;
}

.legal-article-body code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(13, 106, 103, 0.08);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.94em;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.95fr);
  }

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

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

  .panel-results {
    min-height: 0;
  }

  .legal-footer {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100% - 24px, 100%);
    margin-top: 18px;
  }

  .hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .legal-shell {
    width: min(100% - 24px, 100%);
    margin-top: 18px;
  }

  .legal-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .panel {
    padding: 18px;
  }

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

  .field-span-2 {
    grid-column: auto;
  }

  .panel-title,
  .job-topline,
  .root-card,
  .path-row,
  .action-row,
  .search-actions,
  .mini-title,
  .root-chip,
  .legal-hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-actions {
    justify-content: stretch;
  }

  .results-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .legal-article,
  .legal-center,
  .legal-footer {
    padding: 18px;
  }
}

@media (max-width: 560px) {
  body::before {
    background-size: 22px 22px;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 22px;
  }

  .hero-pill,
  .pill,
  .score-line span,
  .result-meta span,
  .status-pill {
    font-size: 12px;
  }

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