:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #1a1d29;
  --muted: #6b7280;
  --border: #e5e7eb;
  --brand: #4f46e5;
  --brand-ink: #ffffff;
  --pass: #16a34a;
  --pass-bg: #ecfdf3;
  --warn: #b45309;
  --warn-bg: #fffaeb;
  --fail: #dc2626;
  --fail-bg: #fef2f2;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #e7e9ee;
    --muted: #9aa1b1;
    --border: #2a2e3a;
    --brand: #818cf8;
    --brand-ink: #0f1115;
    --pass: #34d399;
    --pass-bg: #0f2a20;
    --warn: #fbbf24;
    --warn-bg: #2a2210;
    --fail: #f87171;
    --fail-bg: #2b1414;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

/* [hidden] 속성은 이후 나오는 .loading 등 authored display 규칙에 의해 항상
   깨질 수 있다 — author 일반 선언은 UA 기본 스타일보다 origin이 우선이라
   specificity/순서와 무관하게 이긴다. !important로 항상 최우선 되게 고정한다. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
}

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

.hero { text-align: center; margin-bottom: 32px; }

.eyebrow {
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 12px;
  font-size: 0.9rem;
}

h1 {
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}

.lead {
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 28px;
  font-size: 1rem;
}

.analyze-form {
  display: flex;
  gap: 8px;
  max-width: 560px;
  margin: 0 auto;
}

#url-input {
  flex: 1;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

#url-input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

#submit-btn {
  padding: 14px 22px;
  border-radius: 12px;
  border: none;
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  white-space: nowrap;
}

#submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
#submit-btn:not(:disabled):hover { filter: brightness(1.08); }

.form-error {
  max-width: 560px;
  margin: 12px auto 0;
  color: var(--fail);
  font-weight: 600;
  text-align: center;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  padding: 40px 0;
}

.spinner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

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

.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
}

.summary-item { display: flex; flex-direction: column; gap: 2px; }
.summary-item .num { font-size: 1.5rem; font-weight: 800; }
.summary-item .label { color: var(--muted); font-size: 0.82rem; }
.summary-item.pass .num { color: var(--pass); }
.summary-item.warn .num { color: var(--warn); }
.summary-item.fail .num { color: var(--fail); }
.summary-url { color: var(--muted); font-size: 0.88rem; word-break: break-all; margin-top: 4px; }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.group-block { margin-bottom: 22px; }
.group-title { font-size: 0.95rem; font-weight: 800; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.check-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.badge {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  margin-top: 1px;
}

.badge.pass { background: var(--pass-bg); color: var(--pass); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.fail { background: var(--fail-bg); color: var(--fail); }

.check-body .check-label { font-weight: 700; margin-bottom: 2px; }
.check-body .check-detail { color: var(--muted); font-size: 0.9rem; word-break: break-word; }

.action-item, .waiting-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.action-item .title, .waiting-item .title { font-weight: 700; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; }
.action-item .desc, .waiting-item .desc { color: var(--muted); font-size: 0.9rem; word-break: break-word; }
.action-item .title::before { content: "☐"; color: var(--brand); }
.waiting-item .title::before { content: "⏳"; }

.footer { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 48px; }

@media (max-width: 520px) {
  .analyze-form { flex-direction: column; }
  #submit-btn { width: 100%; }
}
