:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --ink: #172026;
  --muted: #687782;
  --line: #dce4e8;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --teal: #147c78;
  --teal-soft: #dff4f1;
  --red: #c93d3d;
  --red-soft: #fde8e7;
  --amber: #a56916;
  --amber-soft: #fff1d6;
  --green: #21845b;
  --green-soft: #e1f5ea;
  --shadow: 0 18px 50px rgba(31, 51, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(20, 124, 120, 0.08), transparent 36%),
    linear-gradient(315deg, rgba(201, 61, 61, 0.07), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  min-height: 100vh;
  padding: 24px;
}

.sidebar,
.panel {
  border: 1px solid rgba(220, 228, 232, 0.9);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.sidebar {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  min-height: 0;
  overflow: hidden;
  padding: 24px;
  border-radius: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 22px;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
}

h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin: 30px 0 20px;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  background: var(--teal-soft);
  color: var(--teal);
}

.detector-info {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  overflow: hidden;
}

.detector-info summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 16px;
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  font-weight: 800;
  list-style: none;
  user-select: none;
}

.detector-info summary::-webkit-details-marker {
  display: none;
}

.detector-info summary:hover {
  background: var(--teal-soft);
  color: var(--teal);
}

.detector-info summary i {
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.2s ease;
}

.detector-info[open] summary i {
  transform: rotate(225deg) translate(-2px, -2px);
}

.detector-info > div {
  padding: 14px 16px 4px;
  border-top: 1px solid var(--line);
}

.detector-info p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.detector-info strong {
  color: #31424c;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 88px;
}

.actions {
  display: flex;
  gap: 10px;
}

.ghost-button,
.primary-button,
.language-button {
  min-width: 112px;
  height: 42px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.language-button {
  min-width: 52px;
  border: 1px solid #a9bbc3;
  background: var(--panel-soft);
  color: var(--teal);
}

.language-button:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.ghost-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.ghost-button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.primary-button {
  border: 1px solid var(--teal);
  background: var(--teal);
  color: white;
}

.primary-button:hover {
  background: #106a67;
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.progress-panel {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid rgba(20, 124, 120, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(20, 124, 120, 0.1), rgba(255, 255, 255, 0.92)),
    white;
  box-shadow: 0 14px 34px rgba(31, 51, 61, 0.1);
}

.progress-panel[hidden] {
  display: none;
}

.progress-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.progress-header h3 {
  font-size: 18px;
}

.progress-header strong {
  color: var(--teal);
  font-size: 22px;
}

.progress-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe9ec;
}

.progress-track::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.72), transparent);
  content: "";
  transform: translateX(-100%);
  animation: progress-shine 1.4s linear infinite;
}

.progress-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #55b38f);
  transition: width 0.32s ease;
}

#progressDetail {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@keyframes progress-shine {
  to {
    transform: translateX(100%);
  }
}

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

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

.span-2 {
  grid-column: 1 / -1;
}

.field-group {
  display: grid;
  gap: 8px;
}

.crawl-summary {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.crawl-summary[hidden] {
  display: none;
}

.crawl-summary-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crawl-summary-heading strong {
  color: var(--ink);
}

.crawl-summary dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.crawl-summary dl > div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
}

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

.crawl-summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: #31424c;
  font-size: 13px;
}

label {
  color: #41515c;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input[readonly] {
  color: #495965;
  background: #eef3f5;
}

input {
  height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 180px;
  resize: vertical;
  padding: 14px;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(20, 124, 120, 0.14);
}

.cards-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.detector-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
  gap: 20px;
  align-items: start;
}

.detector-card .panel-heading,
.detector-card .reason-text,
.detector-card .tag-list {
  grid-column: 1 / -1;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-pill.neutral {
  background: #edf1f3;
  color: #53636e;
}

.status-pill.safe {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.warn {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-pill.danger {
  background: var(--red-soft);
  color: var(--red);
}

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

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

.score-bars {
  display: grid;
  gap: 14px;
}

.score-line {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
}

.score-line.compact {
  margin-top: 2px;
}

.score-line span,
.score-line strong {
  color: var(--muted);
  font-size: 13px;
}

.score-line strong {
  text-align: right;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef1;
}

.bar i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #55b38f);
  transition: width 0.22s ease;
}

.domain-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.domain-compare div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.domain-compare span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.domain-compare strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reason-text {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.tag-list {
  min-height: 38px;
  margin: 0;
  color: #41515c;
  font-size: 13px;
  line-height: 1.7;
  word-break: break-word;
}

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

.cloaking-metrics > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.cloaking-metrics span,
.cloaking-metrics strong,
.cloaking-metrics small {
  font-size: 13px;
}

.cloaking-metrics span {
  color: #41515c;
  font-weight: 800;
}

.cloaking-metrics strong {
  color: var(--teal);
}

.cloaking-metrics .bar,
.cloaking-metrics small {
  grid-column: 1 / -1;
}

.cloaking-metrics small {
  color: var(--muted);
}

.result-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-left: 6px solid var(--teal);
}

.result-panel.risky {
  border-left-color: var(--red);
}

.result-panel.warning {
  border-left-color: var(--amber);
}

.result-panel.safe {
  border-left-color: var(--green);
}

#finalDescription {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.model-meta {
  margin: 12px 0 0;
  color: #53636e;
  font-size: 13px;
  line-height: 1.6;
}

.risk-meter {
  position: relative;
  flex: 0 0 118px;
  width: 118px;
  height: 118px;
}

.risk-meter svg {
  width: 118px;
  height: 118px;
  transform: rotate(-90deg);
}

.meter-bg,
.meter-arc {
  fill: none;
  stroke-width: 12;
}

.meter-bg {
  stroke: #e7edf0;
}

.meter-arc {
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-dasharray: 302;
  stroke-dashoffset: 302;
  transition: stroke-dashoffset 0.25s ease, stroke 0.25s ease;
}

.risk-meter strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 24px 0;
  }

  .nav-item {
    justify-content: center;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .result-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1;
  }

  .input-grid,
  .cards-row,
  .detector-card,
  .cloaking-metrics,
  .metric-form,
  .domain-compare,
  .nav-list {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 23px;
  }

  .crawl-summary dl > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
