:root {
  color-scheme: light;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --accent-color: #3b82f6;
  --accent-purple: #8b5cf6;
  --amber: #9f6a00;
  --red: #d5393e;
  --green: #299764;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .05), 0 2px 4px -1px rgba(0, 0, 0, .03);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, .08), 0 4px 6px -2px rgba(0, 0, 0, .04);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle 500px at 50% 200px, #c9ebff, transparent),
    linear-gradient(to right, #f0f0f0 1px, transparent 1px),
    linear-gradient(to bottom, #f0f0f0 1px, transparent 1px),
    #ffffff;
  background-size: auto, 6rem 4rem, 6rem 4rem, auto;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 max(24px, calc((100vw - 1200px) / 2));
  border-bottom: 1px solid rgba(226, 232, 240, .86);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-purple));
  font-size: 12px;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.nav-links a {
  color: inherit;
  text-decoration: none;
  transition: color .2s ease;
}

.nav-links a:hover {
  color: var(--accent-color);
}

.nav-tools {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  cursor: pointer;
}

.shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 50px 0 48px;
}

.masthead {
  text-align: center;
  margin-bottom: 34px;
}

h1 {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(36px, 5vw, 48px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: 0;
}

h1 span {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.intro {
  max-width: 640px;
  margin: 16px auto 0;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.65;
}

.stats-row {
  display: inline-flex;
  align-items: center;
  margin-top: 30px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px 38px;
  background: var(--card-bg);
  box-shadow: var(--shadow-md);
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}

.stat-label {
  margin-bottom: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.stat-value {
  color: var(--text-primary);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-value.highlight {
  color: var(--accent-color);
}

.stat-divider {
  width: 1px;
  height: 38px;
  margin: 0 30px;
  background: var(--card-border);
}

.checker-shell {
  max-width: 1120px;
  margin: 0 auto;
}

.panel,
.toolbar {
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--shadow-md);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: end;
  border-radius: 16px;
  padding: 20px;
  transition: box-shadow .3s ease;
}

.toolbar:hover,
.panel:hover {
  box-shadow: var(--shadow-hover);
}

.ip-input {
  display: grid;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0 12px;
  color: var(--text-primary);
  background: #ffffff;
}

button {
  height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-purple));
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(59, 130, 246, .16);
}

button:disabled {
  cursor: wait;
  opacity: .7;
  transform: none;
  box-shadow: none;
}

button.secondary {
  background: #1e293b;
}

button.mini {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  box-shadow: none;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 20px;
  margin-top: 20px;
}

.panel {
  border-radius: 16px;
  padding: 24px;
  transition: box-shadow .3s ease, border-color .3s ease;
}

.panel:hover {
  border-color: rgba(59, 130, 246, .45);
}

.result-panel {
  grid-column: 1 / -1;
  padding: 24px;
  overflow: hidden;
}

.result-panel .panel-title {
  padding: 0;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 800;
}

.panel-title strong {
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.panel-title strong.good {
  background: rgba(16, 185, 129, .14);
  color: var(--green);
}

.panel-title strong.warn {
  background: rgba(234, 179, 8, .14);
  color: var(--amber);
}

.panel-title strong.bad {
  background: rgba(244, 63, 94, .14);
  color: var(--red);
}

.ip-main {
  margin: 6px 0 20px;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1;
  font-weight: 800;
  word-break: break-all;
}

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

.result-row {
  display: block;
  min-height: 96px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  background: #ffffff;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.result-row:nth-child(even) {
  background: #ffffff;
}

.result-row.emphasis {
  border-color: rgba(59, 130, 246, .34);
  background: linear-gradient(180deg, rgba(59, 130, 246, .08), #ffffff 62%);
}

.result-row:hover {
  border-color: rgba(59, 130, 246, .55);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.result-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border: 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.result-label a {
  color: #0ea5e9;
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
}

.result-value {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  word-break: break-word;
}

.row-action {
  margin-left: 0;
  color: #2563eb;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
}

.linkish {
  color: #2563eb;
  text-decoration: underline;
}

.mini-badge,
.big-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #ffffff;
  font-weight: 800;
  white-space: nowrap;
}

.mini-badge {
  min-width: 44px;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
}

.big-badge {
  min-width: 112px;
  height: 36px;
  padding: 0 14px;
  font-size: 15px;
}

.mini-badge.good,
.big-badge.good {
  background: #2ecc33;
}

.mini-badge.bad,
.big-badge.bad {
  background: #f47f84;
}

.big-badge.warn {
  background: #f0b429;
}

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

.purity-section .result-row {
  min-height: 112px;
}

.split-row .result-value {
  justify-content: flex-start;
}

.purity-cell {
  display: grid;
  gap: 10px;
}

.purity-dot {
  display: none;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  background: #0a8f17;
}

.purity-dot.warn {
  background: #eab308;
}

.purity-dot.bad {
  background: #008000;
}

.purity-bar {
  width: 100%;
  height: 34px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
}

.purity-bar div {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  min-width: 56px;
  height: 100%;
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
}

.purity-bar .good {
  background: #2ecc33;
}

.purity-bar .warn {
  background: #eab308;
}

.purity-bar .bad {
  background: #2ecc33;
}

.risk-blocks {
  display: flex;
  gap: 4px;
}

.risk-blocks span {
  display: block;
  flex: 1;
  width: auto;
  height: 8px;
  border-radius: 999px;
}

.risk-blocks span:nth-child(1) {
  background: #b7df5b;
}

.risk-blocks span:nth-child(2) {
  background: #dce000;
}

.risk-blocks span:nth-child(3) {
  background: #ffc400;
}

.risk-blocks span:nth-child(4) {
  background: #ff1b00;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
  padding: 0;
  background: transparent;
}

.scenario-card {
  min-height: 116px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px;
  background: #ffffff;
  box-shadow: none;
  text-align: center;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.scenario-card:hover {
  border-color: rgba(59, 130, 246, .55);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.scenario-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text-primary);
  font-size: 15px;
}

.stars {
  margin-bottom: 8px;
  color: #16a34a;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

.scenario-card span {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 700;
}

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

.facts.compact {
  grid-template-columns: 1fr;
}

.explain-panel {
  grid-column: 2;
  grid-row: 3;
}

.explain-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.explain-item {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}

.explain-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 14px;
}

.explain-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.fact {
  min-height: 64px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}

.fact span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.fact strong {
  display: block;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
}

.risk-meter {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-secondary);
}

.risk-meter div {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 220ms ease, background 220ms ease;
}

.note {
  margin: 14px 0 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

.candidate-list {
  display: grid;
  gap: 12px;
}

.candidate {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}

.candidate strong {
  display: block;
  margin-bottom: 5px;
}

.candidate span {
  color: var(--text-secondary);
  font-size: 13px;
}

.raw-panel {
  margin-top: 20px;
}

.source-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.source-item {
  min-height: 70px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
}

.source-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 800;
}

.source-item strong {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.source-item.ok {
  border-color: rgba(16, 185, 129, .45);
  background: rgba(16, 185, 129, .08);
}

.source-item.bad {
  border-color: rgba(244, 63, 94, .45);
  background: rgba(244, 63, 94, .08);
}

.source-item.muted {
  background: var(--bg-secondary);
}

pre {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  border-radius: 12px;
  padding: 14px;
  background: #0f172a;
  color: #dbeafe;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 980px) {
  .nav-links {
    display: none;
  }

  .result-table,
  .purity-section,
  .scenario-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .explain-panel {
    grid-column: auto;
    grid-row: auto;
  }
}

@media (max-width: 820px) {
  .stats-row {
    width: 100%;
    flex-direction: column;
    padding: 20px;
  }

  .stat-divider {
    width: 100%;
    height: 1px;
    margin: 15px 0;
  }

  .toolbar,
  .grid,
  .facts,
  .result-table,
  .purity-section,
  .scenario-grid,
  .explain-grid,
  .source-list {
    grid-template-columns: 1fr;
  }

  .shell {
    padding-top: 34px;
  }

  h1 {
    font-size: 34px;
  }
}
