:root {
  --bg: #0f1420;
  --card: #1a2233;
  --border: #2a3550;
  --text: #e8edf7;
  --muted: #8b96ad;
  --accent: #3b82f6;
  --accent2: #06b6d4;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #1c2a4d 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 20px 32px;
}

header {
  text-align: center;
  margin-bottom: 28px;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  margin-bottom: 20px;
}

.input-row {
  display: flex;
  gap: 10px;
}

#urlInput {
  flex: 1;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #121a2b;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

#urlInput:focus {
  border-color: var(--accent);
}

#urlInput::placeholder {
  color: #5a6485;
}

button {
  padding: 12px 24px;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
  white-space: nowrap;
}

button:hover:not(:disabled) {
  opacity: 0.9;
}

button:active:not(:disabled) {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 400;
  padding: 6px 12px;
  font-size: 13px;
}

.hint {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.hint label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.result-head h2 {
  margin: 0;
  font-size: 18px;
}

#resultTitle {
  word-break: break-all;
}

.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
  word-break: break-all;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  background: #121a2b;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent2);
}

.metric-label {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.metric-sub {
  font-size: 12px;
  color: #5a6485;
  margin-top: 2px;
}

.bars {
  margin: 16px 0 8px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bar-label {
  width: 110px;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 10px;
  border-radius: 6px;
  background: #121a2b;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.6s ease;
}

.bar-fill.static {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.bar-value {
  width: 64px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.resources {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.resources summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  user-select: none;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 500;
}

td.url-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge.ok {
  background: rgba(34, 197, 94, 0.15);
  color: var(--ok);
}

.badge.fail {
  background: rgba(239, 68, 68, 0.15);
  color: var(--err);
}

.note {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

footer {
  text-align: center;
  color: #5a6485;
  font-size: 13px;
  margin-top: 28px;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

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

@media (max-width: 640px) {
  .input-row {
    flex-direction: column;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .bar-label {
    width: 90px;
  }
}
