/* ===== CSS Variables & Theme ===== */
:root {
  --bg: #f5f6fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f9fb;
  --bg-input: #f1f2f6;
  --bg-badge: #e8edf5;
  --bg-hero: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #5f6b7a;
  --text-muted: #8b95a5;
  --border: #e2e5ea;
  --border-light: #eef0f4;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04);
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --green: #059669;
  --green-bg: #ecfdf5;
  --green-border: #a7f3d0;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --amber-border: #fde68a;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-border: #fecaca;
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --gradient-hero: linear-gradient(135deg, #f8faff 0%, #eef2ff 50%, #f0f9ff 100%);
  --gradient-btn: linear-gradient(135deg, #2563eb 0%, #4f46e5 100%);
  --gradient-btn-hover: linear-gradient(135deg, #1d4ed8 0%, #4338ca 100%);
  --wave-color: #2563eb;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-card-hover: #222530;
  --bg-input: #1e2130;
  --bg-badge: #1e2130;
  --bg-hero: #1a1d27;
  --text: #e4e6f0;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: #2a2d3a;
  --border-light: #222530;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow: 0 2px 12px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.35);
  --green-bg: rgba(5, 150, 105, 0.12);
  --amber-bg: rgba(217, 119, 6, 0.12);
  --red-bg: rgba(220, 38, 38, 0.12);
  --gradient-hero: linear-gradient(135deg, #1a1d27 0%, #1e2235 50%, #1a2330 100%);
  --wave-color: #3b82f6;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

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

/* ===== Theme Toggle ===== */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: var(--text-secondary);
  transition: all 0.25s;
  box-shadow: var(--shadow-sm);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
  transform: scale(1.08);
}
[data-theme="light"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }

/* ===== Hero ===== */
.hero {
  text-align: center;
  padding: 48px 20px 40px;
  background: var(--bg-hero);
  border-radius: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(37,99,235,0.06) 0%, transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: var(--bg-badge);
  border-radius: 50px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #059669;
  position: relative;
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: #059669;
  opacity: 0.3;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(2); opacity: 0; }
}

.hero h1 {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.gradient-text {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 24px;
  line-height: 1.7;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
}
.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.hs-num {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}
.hs-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ===== Checker Form ===== */
.checker-form {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  transition: all 0.3s;
}
.checker-form:focus-within {
  box-shadow: var(--shadow-lg), 0 0 0 3px rgba(37,99,235,0.1);
  border-color: #2563eb;
}
.input-wrapper {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 4px;
  transition: background 0.2s;
}
.url-icon {
  padding: 0 10px 0 16px;
  color: var(--text-muted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 6px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  color: var(--text);
  outline: none;
  min-width: 0;
}
.input-wrapper input::placeholder {
  color: var(--text-muted);
}
.input-wrapper button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: var(--gradient-btn);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}
.input-wrapper button:hover {
  background: var(--gradient-btn-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
}
.input-wrapper button:active {
  transform: translateY(0);
}
.btn-arrow {
  transition: transform 0.2s;
}
.input-wrapper button:hover .btn-arrow {
  transform: translateX(3px);
}
.url-suggestions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.url-suggestions > span {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}
.suggest-chip {
  padding: 5px 14px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.suggest-chip:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: rgba(37,99,235,0.05);
}

/* ===== Loading ===== */
.loading { margin-bottom: 20px; }
.loading.hidden { display: none; }
.loading-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.loading-wave {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 24px;
}
.loading-wave span {
  width: 6px;
  height: 40px;
  background: var(--wave-color);
  border-radius: 6px;
  animation: wave 1.2s ease-in-out infinite;
}
.loading-wave span:nth-child(2) { animation-delay: 0.1s; }
.loading-wave span:nth-child(3) { animation-delay: 0.2s; }
.loading-wave span:nth-child(4) { animation-delay: 0.3s; }
.loading-wave span:nth-child(5) { animation-delay: 0.4s; }
@keyframes wave {
  0%, 40%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  20% { transform: scaleY(1); opacity: 1; }
}
.loading-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.loading-sub {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.loading-bar {
  width: 240px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 0 auto;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gradient-btn);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ===== Error ===== */
.error {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}
.error svg { flex-shrink: 0; margin-top: 1px; }
.error.hidden { display: none; }

/* ===== Results Top Bar ===== */
.results-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.checked-url {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.checked-url svg { color: var(--text-muted); flex-shrink: 0; }
.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}
.copy-btn.copied {
  border-color: #059669;
  color: #059669;
  background: var(--green-bg);
}

/* ===== Summary Card ===== */
.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}
.score-section {
  display: flex;
  align-items: center;
  gap: 36px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.score-circle {
  position: relative;
  width: 140px;
  height: 140px;
  flex-shrink: 0;
}
.score-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.score-circle .bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}
.score-circle .progress {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 376.99;
  transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.score-text span {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.score-text small {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}
.score-meter {
  flex: 1;
  min-width: 200px;
}
.meter-segments {
  display: flex;
  height: 10px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  background: var(--border);
}
.meter-seg {
  transition: flex 0.6s ease;
}
.pass-seg { background: #059669; }
.warn-seg { background: #d97706; }
.fail-seg { background: #dc2626; }
.meter-labels {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.meter-labels span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.meter-labels strong {
  font-weight: 700;
  font-size: 1rem;
}
.ml-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.ml-pass .ml-dot { background: #059669; }
.ml-warn .ml-dot { background: #d97706; }
.ml-fail .ml-dot { background: #dc2626; }

.verdict {
  padding: 14px 20px;
  border-radius: var(--radius-xs);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.verdict.good { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.verdict.warn { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.verdict.bad { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }

/* ===== Category Cards ===== */
.category-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.category-card:hover {
  box-shadow: var(--shadow);
}
.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.category-header:hover {
  background: var(--bg-card-hover);
}
.category-header .icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.icon-tech { background: rgba(37,99,235,0.1); color: #2563eb; }
.icon-content { background: rgba(139,92,246,0.1); color: #7c3aed; }
.icon-meta { background: rgba(5,150,105,0.1); color: #059669; }
.icon-pages { background: rgba(217,119,6,0.1); color: #d97706; }
.icon-prohibited { background: rgba(220,38,38,0.1); color: #dc2626; }
.icon-nav { background: rgba(14,165,233,0.1); color: #0ea5e9; }
.icon-domain { background: rgba(236,72,153,0.1); color: #ec4899; }

.category-header .name {
  flex: 1;
  font-weight: 600;
  font-size: 1rem;
}
.category-header .badge {
  display: flex;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}
.category-header .badge span {
  padding: 4px 10px;
  border-radius: 50px;
}
.b-pass { background: var(--green-bg); color: var(--green); }
.b-warn { background: var(--amber-bg); color: var(--amber); }
.b-fail { background: var(--red-bg); color: var(--red); }

.category-header .arrow {
  display: flex;
  align-items: center;
  transition: transform 0.3s;
  color: var(--text-muted);
}
.category-header.expanded .arrow {
  transform: rotate(180deg);
}

.category-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.category-body.show {
  max-height: 2000px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px 14px 72px;
  border-top: 1px solid var(--border-light);
  transition: background 0.15s;
}
.check-item:hover {
  background: var(--bg-card-hover);
}
.check-item .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.status-dot.pass { background: #059669; box-shadow: 0 0 0 3px rgba(5,150,105,0.15); }
.status-dot.warning { background: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,0.15); }
.status-dot.fail { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.15); }

.check-item .check-info { flex: 1; }
.check-item .check-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 3px;
  color: var(--text);
}
.check-item .check-detail {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ===== Disclaimer ===== */
.disclaimer {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.disclaimer-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 1px;
}
.disclaimer strong { color: var(--text); }

/* ===== Recent Section ===== */
.recent-section {
  margin-top: 32px;
  margin-bottom: 32px;
}
.recent-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}
.recent-title svg { color: var(--text-muted); }
.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.recent-item:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: rgba(37,99,235,0.04);
}
.recent-item .ri-score {
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 50px;
}
.ri-score.good { background: var(--green-bg); color: var(--green); }
.ri-score.warn { background: var(--amber-bg); color: var(--amber); }
.ri-score.bad { background: var(--red-bg); color: var(--red); }
.recent-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 4px 0;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 24px 0 0;
  border-top: 1px solid var(--border);
}
.site-footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-links a {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.footer-links a:hover {
  color: #2563eb;
}

/* ===== Hidden Utility ===== */
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .container { padding: 12px 12px 40px; }
  .hero {
    padding: 32px 16px 28px;
    border-radius: 18px;
  }
  .hero h1 { font-size: 1.8rem; }
  .hero-subtitle { font-size: 0.9rem; }
  .hero-stats { gap: 20px; }
  .hero-stat { gap: 0; }
  .hs-num { font-size: 1.2rem; }
  .hs-label { font-size: 0.7rem; }

  .input-wrapper {
    flex-direction: column;
    padding: 6px;
    gap: 6px;
  }
  .url-icon { display: none; }
  .input-wrapper input {
    padding: 12px 14px;
    width: 100%;
    background: transparent;
  }
  .input-wrapper button {
    width: 100%;
    justify-content: center;
    padding: 14px;
  }

  .score-section {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  .score-circle {
    width: 110px;
    height: 110px;
  }
  .meter-labels { justify-content: center; }

  .check-item {
    padding: 12px 16px 12px 16px;
  }
  .check-item .status-dot { display: none; }

  .category-header { padding: 14px 16px; }
  .category-header .badge { display: none; }
  .category-header .icon { width: 34px; height: 34px; font-size: 1rem; }

  .theme-toggle { top: 10px; right: 10px; width: 38px; height: 38px; }
}