:root {
  color-scheme: light;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-strong: #101820;
  --ink: #14181f;
  --muted: #5b6675;
  --line: #d8dee6;
  --teal: #0f766e;
  --blue: #2563eb;
  --amber: #b45309;
  --red: #be123c;
  --good: #15803d;
  --soft-teal: #dff4ef;
  --soft-blue: #e6efff;
  --soft-amber: #fff3d7;
  --soft-red: #ffe4e9;
  --shadow: 0 16px 40px rgba(16, 24, 32, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(243, 245, 247, 0.96) 420px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

.app-shell {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.3;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.icon-button:hover {
  border-color: #a8b3c1;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.icon-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: stretch;
  gap: 16px;
}

.score-panel,
.panel {
  min-width: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.score-panel {
  display: grid;
  grid-template-columns: 160px 1fr;
  grid-template-rows: auto auto;
  gap: 18px;
  align-items: center;
  align-content: center;
  padding: 20px;
}

.panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.overview-panel,
.network-panel,
.risk-panel {
  grid-column: span 4;
  min-height: 354px;
}

.fingerprint-panel {
  grid-column: span 8;
  min-height: 392px;
}

.graphics-panel {
  grid-column: span 4;
  min-height: 392px;
}

.capability-panel {
  grid-column: span 4;
  min-height: 360px;
}

.raw-panel {
  grid-column: span 8;
  min-height: 360px;
}

.score-ring {
  --score: 0;
  display: grid;
  place-items: center;
  width: 148px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 58%, transparent 59%),
    conic-gradient(var(--ring-color, var(--teal)) calc(var(--score) * 1%), #e2e8f0 0);
}

.score-ring span {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
}

.score-ring small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.metric-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0;
}

.metric-strip div {
  display: flex;
  min-height: 76px;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #f9fbfc;
}

.metric-strip dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-strip dd {
  margin: 5px 0 0;
  font-size: 22px;
  font-weight: 800;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.status-pill,
.mono-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--soft-blue);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.mono-pill {
  overflow: hidden;
  max-width: 240px;
  background: #edf2f7;
  color: #334155;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  text-overflow: ellipsis;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(64px, auto);
  gap: 10px;
}

.data-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(70px, auto);
}

.data-item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fbfcfe;
}

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

.data-value {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.signal-list {
  display: grid;
  align-content: start;
  gap: 9px;
  flex: 1;
}

.signal {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 10px;
  min-height: 60px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.signal::before {
  content: "";
  width: 8px;
  min-height: 100%;
  border-radius: 8px;
  background: var(--good);
}

.signal.medium::before {
  background: var(--amber);
}

.signal.high::before {
  background: var(--red);
}

.signal-title {
  margin: 0 0 3px;
  font-size: 14px;
  font-weight: 760;
}

.signal-detail {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

#canvasProbe {
  display: block;
  width: 100%;
  height: auto;
  min-height: 110px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.raw-output {
  flex: 1;
  overflow: auto;
  min-height: 290px;
  max-height: 430px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #101820;
  color: #e7eef7;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.skeleton {
  flex: 1;
  min-height: 112px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(226, 232, 240, 0.45), rgba(248, 250, 252, 0.95), rgba(226, 232, 240, 0.45));
  background-size: 220% 100%;
  animation: shimmer 1.2s infinite linear;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 32px));
  border-radius: 8px;
  padding: 11px 13px;
  background: var(--surface-strong);
  color: #ffffff;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.good {
  color: var(--good);
}

.warn {
  color: var(--amber);
}

.bad {
  color: var(--red);
}

@keyframes shimmer {
  from {
    background-position: 220% 0;
  }

  to {
    background-position: -220% 0;
  }
}

@media (max-width: 1120px) {
  .dashboard {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .overview-panel {
    grid-column: 1 / -1;
    min-height: 260px;
  }

  .network-panel,
  .risk-panel,
  .graphics-panel,
  .capability-panel {
    grid-column: span 4;
    min-height: 340px;
  }

  .fingerprint-panel,
  .raw-panel {
    grid-column: 1 / -1;
    min-height: 360px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  h1 {
    font-size: 24px;
  }

  .dashboard,
  .data-grid,
  .data-grid.compact {
    grid-template-columns: 1fr;
  }

  .overview-panel,
  .network-panel,
  .risk-panel,
  .fingerprint-panel,
  .graphics-panel,
  .capability-panel,
  .raw-panel {
    grid-column: 1 / -1;
    min-height: auto;
  }

  .score-panel {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .score-ring {
    width: 132px;
  }

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

  .panel,
  .score-panel {
    padding: 14px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
