:root {
  --paper: #f4f7f2;
  --ink: #121713;
  --muted: #667067;
  --line: #ced6cc;
  --white: #ffffff;
  --green: #137d4e;
  --green-soft: #dff3e7;
  --yellow: #d4a90b;
  --yellow-soft: #fff3c6;
  --red: #bd4f39;
  --blue: #315eaa;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, "SF Pro Display", "Noto Sans TC", "PingFang TC", system-ui,
    sans-serif;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 247, 242, 0.94);
  padding: 0 32px;
  backdrop-filter: blur(14px);
}

.brand,
.top-actions,
.live-dot {
  display: flex;
  align-items: center;
}

.brand {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  margin-right: 10px;
  place-items: center;
  background: var(--ink);
  color: var(--white);
  font-family: Georgia, serif;
  font-size: 18px;
}

.top-actions {
  gap: 14px;
}

.live-dot {
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.live-dot i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(19, 125, 78, 0.12);
}

.live-dot.stale i {
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(212, 169, 11, 0.18);
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  cursor: pointer;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
}

.icon-button:hover {
  background: var(--white);
}

.icon-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.icon-button svg,
.candidate-link svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-button.loading svg {
  animation: spin 0.8s linear infinite;
}

main {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.intro {
  display: grid;
  min-height: 400px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  grid-template-columns: minmax(0, 1.2fr) minmax(350px, 0.8fr);
  gap: 72px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Noto Serif TC", serif;
  font-weight: 500;
}

h1 {
  font-size: clamp(48px, 6vw, 82px);
  line-height: 1;
}

h2 {
  font-size: 38px;
  line-height: 1.12;
}

.plain-explain {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.formula {
  display: grid;
  align-items: end;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 18px 0 24px;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 12px;
}

.formula > span {
  grid-column: 1 / -1;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 11px;
}

.formula > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.formula strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 24px;
  white-space: nowrap;
}

.formula small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.formula b {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 18px;
}

.formula-edge strong {
  color: var(--green);
}

.summary {
  display: grid;
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(4, 1fr);
}

.summary > div {
  min-height: 128px;
  border-right: 1px solid var(--line);
  padding: 24px 20px;
}

.summary > div:first-child {
  border-left: 1px solid var(--line);
}

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

.summary strong {
  display: block;
  margin-top: 26px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 26px;
}

.radar,
.rules {
  padding: 72px 0;
  border-bottom: 1px solid var(--line);
}

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

.segments {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px;
  background: var(--white);
}

.segments button {
  min-width: 72px;
  min-height: 32px;
  cursor: pointer;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.segments button.active {
  background: var(--ink);
  color: var(--white);
}

.candidate-list {
  border-top: 1px solid var(--ink);
}

.candidate {
  display: grid;
  min-height: 178px;
  border-bottom: 1px solid var(--line);
  grid-template-columns: minmax(260px, 1.3fr) 160px minmax(260px, 1fr) 46px;
  gap: 28px;
  padding: 26px 0;
}

.candidate-main {
  min-width: 0;
}

.candidate-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 17px;
}

.candidate-index,
.category {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.status {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e6eae5;
  color: #465048;
  font-size: 11px;
  font-weight: 700;
}

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

.status.fee,
.status.close,
.status.stale {
  background: var(--yellow-soft);
  color: #725c00;
}

.status.incomplete {
  background: #f6ded8;
  color: var(--red);
}

.candidate h3 {
  margin: 0 0 10px;
  font-size: 21px;
  line-height: 1.3;
}

.candidate-main p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.candidate-edge {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.candidate-edge strong {
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 40px;
}

.candidate-edge strong.positive {
  color: var(--green);
}

.candidate-edge span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.candidate-facts {
  display: grid;
  align-content: center;
  grid-template-columns: 1fr 1fr;
  gap: 16px 22px;
}

.fact span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.fact strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.candidate-risk {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.candidate-link {
  display: grid;
  width: 38px;
  height: 38px;
  align-self: center;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--blue);
}

.candidate-link:hover {
  background: var(--white);
}

.candidate-skeleton {
  height: 178px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.82),
    transparent
  );
  background-size: 240% 100%;
  animation: shimmer 1.4s linear infinite;
}

.empty-state {
  padding: 36px 0;
  color: var(--muted);
  font-size: 13px;
}

.data-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.checks {
  display: grid;
  border-top: 1px solid var(--ink);
  grid-template-columns: repeat(3, 1fr);
}

.checks article {
  min-height: 190px;
  border-right: 1px solid var(--line);
  padding: 24px;
}

.checks article:first-child {
  border-left: 1px solid var(--line);
}

.checks span {
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.checks h3 {
  margin: 42px 0 10px;
  font-size: 18px;
}

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

.warning {
  display: grid;
  margin: 52px 0 72px;
  border-left: 4px solid var(--red);
  background: var(--white);
  padding: 22px 26px;
  grid-template-columns: 180px 1fr;
}

.warning strong {
  font-size: 14px;
}

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

footer {
  display: flex;
  min-height: 86px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding: 0 32px;
  color: var(--muted);
  font-size: 11px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    background-position: -240% 0;
  }
}

@media (max-width: 900px) {
  main {
    width: min(100% - 32px, 720px);
  }

  .intro {
    min-height: auto;
    padding: 42px 0;
    grid-template-columns: 1fr;
    gap: 36px;
  }

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

  .summary > div:nth-child(3) {
    border-left: 1px solid var(--line);
  }

  .candidate {
    grid-template-columns: minmax(220px, 1fr) 130px 38px;
  }

  .candidate-facts {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }

  .candidate-risk {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 0 16px;
  }

  .brand {
    font-size: 11px;
  }

  .live-dot span {
    display: none;
  }

  h1 {
    font-size: 44px;
  }

  h2 {
    font-size: 32px;
  }

  .plain-explain {
    margin-top: 18px;
    font-size: 13px;
  }

  .formula {
    gap: 7px;
  }

  .formula strong {
    font-size: 19px;
  }

  .summary {
    grid-template-columns: repeat(3, 1fr);
  }

  .summary > div {
    min-height: 82px;
    padding: 14px 10px;
  }

  .summary > div:nth-child(3) {
    border-left: 0;
  }

  .summary > div:nth-child(4) {
    display: none;
  }

  .summary strong {
    margin-top: 12px;
    font-size: 19px;
  }

  .radar,
  .rules {
    padding: 44px 0;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 24px;
  }

  .candidate {
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 98px 38px;
    gap: 14px;
    padding: 24px 0;
  }

  .candidate h3 {
    font-size: 18px;
  }

  .candidate-edge strong {
    font-size: 30px;
  }

  .candidate-facts {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .candidate-risk {
    grid-column: 1 / -1;
  }

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

  .checks article,
  .checks article:first-child {
    min-height: 150px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .checks h3 {
    margin-top: 26px;
  }

  .warning {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 0 16px;
  }
}

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