:root {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --surface-strong: #111827;
  --ink: #111827;
  --muted: #667085;
  --line: #d9e2ec;
  --line-soft: #edf2f7;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #b42318;
  --bad-soft: #fef3f2;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(37, 99, 235, .12), transparent 30%),
    radial-gradient(circle at 92% 12%, rgba(20, 184, 166, .10), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--ink);
}

.app-header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 28px 18px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
}

.eyebrow,
.section-kicker {
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.app-header h1 {
  margin: 8px 0 8px;
  font-size: 32px;
  line-height: 1.12;
  letter-spacing: 0;
}

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

.header-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.header-stats span {
  padding: 7px 10px;
  border: 1px solid rgba(37, 99, 235, .18);
  background: rgba(255, 255, 255, .72);
  border-radius: 999px;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 700;
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 28px 40px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(520px, 1.2fr);
  gap: 18px;
  align-items: stretch;
}

.hero-copy,
.run-card,
.panel,
.empty-grid article {
  background: rgba(255, 255, 255, .9);
  border: 1px solid rgba(217, 226, 236, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-copy {
  padding: 24px;
  min-height: 214px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-copy h2 {
  margin: 10px 0 10px;
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: 0;
}

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

.run-card {
  padding: 20px;
}

.run-options {
  margin-top: 14px;
  border: 1px solid rgba(37, 99, 235, .10);
  background: linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(248,250,252,.96) 100%);
}

.run-options > summary {
  padding: 13px 14px;
  background: transparent;
  border: 0;
  align-items: center;
}

.run-options-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line-soft);
}

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

.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.option-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.option-chip:hover {
  border-color: rgba(37, 99, 235, .28);
  transform: translateY(-1px);
}

.option-chip:has(input:checked) {
  border-color: rgba(37, 99, 235, .34);
  background: rgba(239, 246, 255, .96);
  box-shadow: 0 8px 18px rgba(37, 99, 235, .10);
}

.option-chip input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.custom-note {
  margin-top: 12px;
}

.custom-note label {
  margin-bottom: 8px;
}

.custom-note input {
  width: 100%;
}

.internal-block {
  border-color: rgba(17, 24, 39, .08);
}

.internal-stack {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.internal-item {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.internal-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.internal-item pre {
  border-top: 1px solid var(--line-soft);
}

.row {
  display: grid;
  grid-template-columns: 1fr 190px 132px;
  gap: 12px;
  align-items: end;
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 7px;
  font-weight: 700;
}

input,
select,
button {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(37, 99, 235, .72);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

button {
  background: linear-gradient(180deg, #3b82f6 0%, var(--accent-strong) 100%);
  color: #ffffff;
  border-color: transparent;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 20px rgba(37, 99, 235, .22);
}

button:hover:not(:disabled) {
  filter: brightness(1.02);
  transform: translateY(-1px);
}

button:disabled {
  opacity: .64;
  cursor: wait;
  transform: none;
}

.status {
  margin-top: 14px;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

.status-running,
.status-fetching,
.status-schema,
.status-summarizing {
  color: #1e40af;
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, .18);
}

.status-running::after,
.status-fetching::after,
.status-schema::after,
.status-summarizing::after {
  content: "";
  position: absolute;
  left: -35%;
  bottom: 0;
  width: 35%;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, .85), transparent);
  animation: progressSweep 1.45s ease-in-out infinite;
}

.status-completed {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(4, 120, 87, .18);
}

.status-failed {
  color: var(--bad);
  background: var(--bad-soft);
  border-color: rgba(180, 35, 24, .18);
}

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

.empty-grid article {
  padding: 18px;
  min-height: 148px;
}

.step {
  display: inline-flex;
  width: 34px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
  font-size: 12px;
}

.empty-grid h3 {
  margin: 14px 0 8px;
  font-size: 16px;
}

.empty-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.score-board {
  margin-top: 18px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(217, 226, 236, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.score-board-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
}

.score-board-head h2 {
  margin: 7px 0 0;
  font-size: 19px;
}

.score-board-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 480px;
  text-align: right;
}

.score-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.score-card {
  min-height: 108px;
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.score-card span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-card em {
  color: var(--muted);
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-card strong {
  align-self: end;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.score-card.score-has-value strong::after {
  content: "/100";
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.score-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-card.score-running {
  border-color: rgba(37, 99, 235, .28);
  background: var(--accent-soft);
  position: relative;
  animation: cardPulse 1.4s ease-in-out infinite;
}

.score-card.score-running::after {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(37, 99, 235, .35);
  animation: dotPulse 1.1s ease-out infinite;
}

.score-card.score-low {
  border-color: rgba(4, 120, 87, .22);
  background: var(--ok-soft);
}

.score-card.score-mid {
  border-color: rgba(180, 83, 9, .18);
  background: #fff7ed;
}

.score-card.score-warn {
  border-color: rgba(180, 83, 9, .28);
  background: var(--warn-soft);
}

.score-card.score-high {
  border-color: rgba(180, 35, 24, .28);
  background: var(--bad-soft);
}

.panel {
  margin-top: 18px;
  padding: 18px;
}

.history-panel {
  margin-top: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(217, 226, 236, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.history-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.history-head h2 {
  margin: 7px 0 0;
  font-size: 19px;
}

.history-head button {
  width: 104px;
  height: 36px;
  font-size: 13px;
  box-shadow: none;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  width: 100%;
  height: auto;
  min-height: 78px;
  display: grid;
  grid-template-columns: 58px 1fr 96px;
  gap: 12px;
  align-items: center;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  box-shadow: none;
}

.history-item:hover {
  border-color: rgba(37, 99, 235, .35);
  background: #f8fbff;
}

.history-item img,
.history-img-empty {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-soft);
  border: 1px solid var(--line-soft);
}

.history-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-main strong,
.history-main em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-main strong {
  font-size: 14px;
}

.history-main small,
.history-main em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.history-score {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.history-score b {
  font-size: 24px;
}

.history-score small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  align-items: start;
}

.summary img {
  width: 140px;
  height: 140px;
  object-fit: contain;
  object-position: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  padding: 8px;
}

.meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  font-size: 14px;
}

.meta div {
  min-height: 34px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 7px;
}

.product-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  transition: color .18s ease;
}

.product-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.product-link[aria-disabled="true"] {
  pointer-events: none;
}

.score {
  font-size: 28px;
  font-weight: 900;
}

.advice {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 800;
}

.advice.ok {
  color: var(--ok);
  background: var(--ok-soft);
}

.advice.warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.advice.bad {
  color: var(--bad);
  background: var(--bad-soft);
}

.parsed-summary {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 160px 180px minmax(0, 1fr);
  gap: 12px;
}

.parsed-summary article {
  min-height: 92px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  padding: 14px;
}

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

.parsed-summary strong {
  display: block;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.15;
}

.parsed-summary p {
  margin: 0;
  color: #1f2937;
  line-height: 1.55;
  font-size: 14px;
}

.modules {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.module-card {
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease;
}

.module-card:hover {
  box-shadow: 0 12px 28px rgba(15, 23, 42, .08);
}

details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
  position: relative;
}

.module-card.module-running {
  border-color: rgba(37, 99, 235, .35);
  box-shadow: 0 10px 26px rgba(37, 99, 235, .10);
}

.module-card.module-running::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent);
  animation: sideGlow 1.2s ease-in-out infinite;
}

.module-card.module-low {
  border-color: rgba(4, 120, 87, .24);
}

.module-card.module-low summary,
.module-card.module-low .module-meta {
  color: var(--ok);
}

.module-card.module-mid {
  border-color: rgba(180, 83, 9, .20);
}

.module-card.module-mid summary,
.module-card.module-mid .module-meta {
  color: #9a3412;
}

.module-card.module-warn {
  border-color: rgba(180, 83, 9, .34);
}

.module-card.module-warn summary,
.module-card.module-warn .module-meta {
  color: var(--warn);
}

.module-card.module-high {
  border-color: rgba(180, 35, 24, .34);
}

.module-card.module-high summary,
.module-card.module-high .module-meta {
  color: var(--bad);
}

.block {
  margin-top: 18px;
}

summary {
  cursor: pointer;
  padding: 13px 15px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  position: relative;
  padding-right: 52px;
}

summary::-webkit-details-marker {
  display: none;
}

summary span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding-right: 6px;
  text-align: right;
  line-height: 1.2;
}

details > summary::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: translateY(-60%) rotate(45deg);
  transition: transform .18s ease, border-color .18s ease;
}

details[open] > summary::after {
  transform: translateY(-35%) rotate(225deg);
  border-color: #2563eb;
}

pre {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border-top: 1px solid var(--line);
  line-height: 1.55;
  font-size: 13px;
  max-height: 460px;
  overflow: auto;
}

.module-meta {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  font-weight: 700;
}

.module-body.markdown-body {
  padding: 18px 22px;
  border-top: 1px solid var(--line);
  max-height: 580px;
  overflow: auto;
  font-size: 15px;
  line-height: 1.65;
  color: #1f2937;
  animation: moduleReveal .22s ease;
}

.module-body.markdown-body h2,
.module-body.markdown-body h3 {
  margin-top: 18px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}

.module-body.markdown-body h2:first-child,
.module-body.markdown-body h3:first-child {
  margin-top: 0;
}

.module-body.markdown-body p,
.module-body.markdown-body ul,
.module-body.markdown-body ol {
  margin-top: 8px;
  margin-bottom: 10px;
}

.module-body.markdown-body a {
  color: var(--accent);
  text-decoration: none;
}

.module-body.markdown-body a:hover {
  text-decoration: underline;
}

.module-body.markdown-body pre {
  border-radius: 8px;
  max-height: 360px;
}

.placeholder {
  color: var(--muted);
}

.error {
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid #fecdca;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 14px;
}

@keyframes progressSweep {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(390%);
  }
}

@keyframes cardPulse {
  0%,
  100% {
    box-shadow: 0 0 0 rgba(37, 99, 235, 0);
  }
  50% {
    box-shadow: 0 12px 26px rgba(37, 99, 235, .15);
  }
}

@keyframes dotPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, .38);
  }
  100% {
    box-shadow: 0 0 0 9px rgba(37, 99, 235, 0);
  }
}

@keyframes sideGlow {
  0%,
  100% {
    opacity: .45;
  }
  50% {
    opacity: 1;
  }
}

@keyframes moduleReveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media (max-width: 1180px) {
  .score-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .score-card {
    min-height: 96px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 4px 12px;
  }

  .score-card span,
  .score-card em,
  .score-card small {
    grid-column: 1;
  }

  .score-card strong {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    margin-top: 0;
    font-size: 30px;
  }
}

@media (max-width: 900px) {
  .app-header,
  .hero-panel {
    display: block;
  }

  .header-stats,
  .run-card {
    margin-top: 16px;
  }

  .row,
  .summary,
  .meta,
  .parsed-summary,
  .history-item {
    grid-template-columns: 1fr;
  }

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

  .empty-grid article {
    min-height: 132px;
    padding: 14px;
  }

  .option-list {
    gap: 8px;
  }

  .score-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .history-head {
    display: block;
  }

  .history-head button {
    margin-top: 12px;
  }

  .history-score {
    justify-items: start;
  }

  .score-board-head {
    display: block;
  }

  .score-board-head p {
    margin-top: 8px;
    text-align: left;
  }

  .summary img {
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: contain;
  }
}

@media (max-width: 640px) {
  .app-header,
  main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .app-header h1 {
    font-size: 26px;
  }

  .hero-copy h2 {
    font-size: 23px;
  }

  .score-board {
    padding: 12px;
  }

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

  .empty-grid article {
    min-height: 124px;
    padding: 12px;
  }

  .empty-grid h3 {
    font-size: 15px;
  }

  .empty-grid p {
    font-size: 12px;
    line-height: 1.45;
  }

  .option-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .option-chip {
    width: 100%;
    justify-content: flex-start;
  }

  .score-board-head {
    margin-bottom: 10px;
  }

  .score-board-head h2 {
    font-size: 17px;
  }

  .score-board-head p {
    font-size: 12px;
  }

  .score-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-left: -2px;
    margin-right: -2px;
  }

  .score-card {
    min-width: 0;
    width: 100%;
    min-height: 98px;
    padding: 10px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr auto;
    gap: 4px;
  }

  .score-card span {
    font-size: 13px;
  }

  .score-card em {
    font-size: 9px;
  }

  .score-card em,
  .score-card small {
    max-width: 100%;
  }

  .score-card[data-score-card="platform_compliance"] em,
  .score-card[data-score-card="utility_model_patent"] em,
  .score-card[data-score-card="invention_patent"] em {
    font-size: 8px;
  }

  .score-card strong {
    grid-column: auto;
    grid-row: auto;
    justify-self: start;
    align-self: end;
    margin-top: 6px;
    font-size: 24px;
  }

  .score-card small {
    font-size: 11px;
  }
}

@media (max-width: 380px) {
  .score-board {
    padding: 10px;
  }

  .score-cards {
    gap: 6px;
  }

  .score-card {
    padding: 9px;
  }

  .score-card span {
    font-size: 12px;
  }

  .score-card strong {
    font-size: 22px;
  }
}
