/* static/css/style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

:root {
  --bg-base: #f4f6fa; --surface: #ffffff; --surface-glass: rgba(255,255,255,0.7);
  --border: #e2e7f0; --border-subtle: #eef1f7;
  --text-primary: #080e1a; --text-secondary: #364155; --text-muted: #7b889e;
  --accent: #e5452d; --accent-hover: #c73a24; --accent-soft: rgba(229,69,45,0.12);
  --status-ok-bg: #eafdf4; --status-ok-text: #0b5e3c; --status-ok-dot: #10b981;
  --status-warn-bg: #fffaf0; --status-warn-text: #9a4d0c; --status-warn-dot: #f59e0b;
  --status-bad-bg: #fef3f2; --status-bad-text: #991b1b; --status-bad-dot: #ef4444;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.02); --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06); --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 18px;
  --font-sans: 'Inter', system-ui, sans-serif; --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.25s cubic-bezier(0.2, 0, 0, 1);
  --header-bg: rgba(244, 246, 250, 0.8); --header-border: rgba(0,0,0,0.04);
  --modal-overlay: rgba(0,0,0,0.4);
}

[data-theme="dark"] {
  --bg-base: #0f1520; --surface: #1a1f2b; --surface-glass: rgba(26,31,43,0.75);
  --border: #2a3142; --border-subtle: #232839;
  --text-primary: #eef2f9; --text-secondary: #b0bed4; --text-muted: #647086;
  --accent: #f96b5e; --accent-hover: #e05549; --accent-soft: rgba(249,107,94,0.25);
  --status-ok-bg: #0c2a1e; --status-ok-text: #8ee9bd; --status-ok-dot: #3bb97e;
  --status-warn-bg: #281f0e; --status-warn-text: #edc274; --status-warn-dot: #dba430;
  --status-bad-bg: #2b1316; --status-bad-text: #feb7bd; --status-bad-dot: #f96b5e;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2); --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35); --shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
  --header-bg: rgba(15,21,32,0.82); --header-border: rgba(255,255,255,0.05);
  --modal-overlay: rgba(0,0,0,0.7);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  font-family: var(--font-sans); background: var(--bg-base); color: var(--text-primary);
  line-height: 1.5; -webkit-font-smoothing: antialiased;
  padding: 0 2rem 2.5rem; max-width: 1280px; margin: 0 auto;
  transition: background 0.4s, color 0.4s; min-height: 100vh;
  font-weight: 530; letter-spacing: -0.018em;
}

nav {
  position: sticky; top: 14px; z-index: 100; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: nowrap;
  background: var(--header-bg); backdrop-filter: blur(20px) saturate(200%);
  border: 1px solid var(--header-border); border-radius: 24px;
  padding: 0.6rem 1.4rem; margin: 1.2rem 0 2rem; box-shadow: var(--shadow-lg);
}
.nav-logo { font-weight: 780; font-size: 1.25rem; letter-spacing: -0.04em; text-decoration: none; display: flex; align-items: center; gap: 0; }
.logo-ai { color: #f96b5e; } .logo-zer { color: var(--text-primary); margin-left: 4px; }
.logo-tagline { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); line-height: 1.2; display: flex; flex-direction: column; margin-left: 0.9rem; }
.marquee-wrap {
  flex: 0 0 33%; min-width: 200px; overflow: hidden; position: relative;
  background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  border-left: none; border-right: none; border-radius: 0; padding: 0.35rem 0.6rem;
  font-size: 0.85rem; font-weight: 580; color: var(--accent); white-space: nowrap;
}
.marquee-text { display: inline-block; animation: marquee 14s linear infinite; }
@keyframes marquee { 0% { transform: translateX(100%); } 100% { transform: translateX(-100%); } }

.nav-links { display: flex; gap: 1.5rem; list-style: none; font-weight: 580; font-size: 0.85rem; align-items: center; }
.nav-links a { color: var(--text-secondary); text-decoration: none; border-bottom: 2px solid transparent; transition: color 0.2s; }
.nav-links a:hover { color: var(--text-primary); border-bottom-color: var(--accent); }
.nav-actions { display: flex; align-items: center; gap: 0.6rem; }
.btn-icon {
  background: transparent; border: 1.5px solid var(--border); border-radius: 50%;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  color: var(--text-primary); cursor: pointer; transition: all 0.2s;
}
.btn-icon:hover { background: var(--surface); border-color: var(--accent); }
.user-icon svg { stroke: var(--text-primary); }
.burger-btn { display: none; }
.mobile-menu { display: none; position: absolute; top: 100%; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 0.6rem 0; min-width: 180px; flex-direction: column; }
.mobile-menu.active { display: flex; }
.mobile-menu a { padding: 0.6rem 1.2rem; color: var(--text-primary); text-decoration: none; font-size: 0.9rem; }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: var(--modal-overlay);
  z-index: 200; justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-popup {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem; width: 90%; max-width: 400px;
  box-shadow: var(--shadow-lg); position: relative;
}
.modal-close-btn { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); }
.modal-tabs { display: flex; gap: 0; margin-bottom: 1.2rem; }
.modal-tab { flex: 1; text-align: center; padding: 0.5rem; cursor: pointer; border-bottom: 2px solid var(--border); font-weight: 600; color: var(--text-muted); }
.modal-tab.active { border-bottom-color: var(--accent); color: var(--text-primary); }
.modal-input { width: 100%; padding: 0.7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-base); color: var(--text-primary); font-family: var(--font-sans); margin-bottom: 0.8rem; }
.modal-btn { width: 100%; padding: 0.7rem; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer; }

.search-row { display: flex; gap: 0.6rem; align-items: stretch; margin: 1.8rem 0 0.4rem; position: relative; }
h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.025em; margin: 1.6rem 0 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
h3 { font-size: 0.9rem; font-weight: 650; letter-spacing: -0.02em; margin: 1.2rem 0 0.4rem; color: var(--text-secondary); }
.section-icon { font-weight: 400; opacity: 0.9; }

.url-bar-wrap { flex: 2; position: relative; }
.url-bar { display: flex; align-items: center; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius-md); transition: var(--transition); }
.url-bar:focus-within { border-color: var(--accent-hover); box-shadow: 0 0 0 5px var(--accent-soft), 0 0 20px rgba(249,107,94,0.2); }
.url-bar.error { border-color: var(--status-bad-dot); }
.url-input { flex: 1; border: none; background: transparent; padding: 0.8rem 0.8rem; font-size: 0.85rem; font-family: var(--font-mono); color: var(--text-primary); outline: none; font-style: normal; }
.url-input::placeholder { color: var(--text-muted); font-style: normal; }
.url-input:focus::placeholder { opacity: 0; }
.error-message { display: none; color: var(--status-bad-dot); font-size: 0.7rem; margin-top: 0.3rem; }
.url-bar.error + .error-message { display: block; }
.analyze-btn { background: var(--accent); color: #fff; border: none; padding: 0.8rem 1.4rem; border-radius: 0 calc(var(--radius-md) - 2px) calc(var(--radius-md) - 2px) 0; font-weight: 640; font-size: 0.85rem; cursor: pointer; transition: background 0.2s, opacity 0.2s; display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; align-self: stretch; }
.analyze-btn:hover { background: var(--accent-hover); }
.analyze-btn.loading { pointer-events: none; opacity: 0.7; }
.analyze-btn.loading svg { animation: spin 0.8s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.sites-dropdown { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); max-height: 240px; overflow-y: auto; z-index: 50; }
.sites-dropdown.active { display: block; }
.site-option { padding: 0.65rem 1rem; cursor: pointer; font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-primary); border-bottom: 1px solid var(--border-subtle); transition: background 0.15s; display: flex; align-items: center; gap: 0.5rem; }
.site-option:last-child { border-bottom: none; }
.site-option:hover { background: var(--border-subtle); }
.site-option .site-icon { color: var(--accent); font-size: 1rem; }

.instruction-box { flex: 1; background: transparent; border: none; border-radius: var(--radius-md); padding: 0.4rem 0.8rem; font-size: 0.66rem; color: var(--text-muted); font-family: var(--font-mono); display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.progress-bar-wrap { display: none; margin: 1rem 0; background: var(--border-subtle); border-radius: 20px; height: 6px; overflow: hidden; }
.progress-bar-wrap.active { display: block; }
.progress-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #10b981, var(--accent)); background-size: 200% 100%; animation: progressShimmer 1.5s infinite linear; border-radius: 20px; transition: width 0.3s ease; }
@keyframes progressShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.metrics-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.6rem; margin: 1.2rem 0 1.5rem; }
.metric-card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.9rem 0.4rem; text-align: center; box-shadow: var(--shadow-sm); transition: all 0.3s; }
.metric-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.metric-value { font-size: 1.5rem; font-weight: 750; font-family: var(--font-mono); }
.metric-label { font-size: 0.66rem; color: var(--text-secondary); margin-top: 0.15rem; }

.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.5rem 0; }
.check-card { background: var(--surface); border-radius: var(--radius-md); padding: 0.8rem 0.9rem; border: 1px solid var(--border-subtle); border-left: 4px solid transparent; transition: all 0.3s; box-shadow: var(--shadow-xs); position: relative; }
.check-card:hover { border-color: var(--border); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.status-ok { background: var(--status-ok-bg); border-color: var(--status-ok-dot); border-left-color: var(--status-ok-dot); }
.status-warn { background: var(--status-warn-bg); border-color: var(--status-warn-dot); border-left-color: var(--status-warn-dot); }
.status-bad { background: var(--status-bad-bg); border-color: var(--status-bad-dot); border-left-color: var(--status-bad-dot); }
.check-header { display: flex; justify-content: space-between; align-items: center; }
.check-title { font-weight: 650; font-size: 0.8rem; display: flex; align-items: center; gap: 0.4rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.badge-status { font-size: 0.6rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 10px; text-transform: uppercase; font-family: var(--font-mono); }
.badge-ok { background: var(--status-ok-dot); color: var(--status-ok-text); }
.badge-warn { background: var(--status-warn-dot); color: var(--status-warn-text); }
.badge-bad { background: var(--status-bad-dot); color: var(--status-bad-text); }
.check-detail { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.2rem; font-family: var(--font-mono); }

.tooltip-trigger {
  position: absolute; top: 8px; right: 10px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--border-subtle); color: var(--text-muted);
  font-size: 0.7rem; font-weight: 700; display: flex;
  align-items: center; justify-content: center; cursor: help; outline: none;
}
.tooltip-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tooltip-popup {
  display: none; position: absolute; top: 30px; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  padding: 0.6rem 0.8rem; font-size: 0.68rem; color: var(--text-secondary);
  max-width: 220px; z-index: 20; line-height: 1.4;
}
.tooltip-trigger:hover + .tooltip-popup,
.tooltip-trigger:focus + .tooltip-popup { display: block; }

hr { border-color: var(--border-subtle); margin: 2rem 0 1rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.6rem 0.9rem; margin-bottom: 0.4rem; transition: 0.2s; }
.faq-item[open] { border-color: var(--accent); box-shadow: var(--shadow-sm); }
summary { font-weight: 650; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::after { content: '▾'; transition: 0.2s; font-size: 0.8rem; }
details[open] summary::after { transform: rotate(180deg); }
.faq-answer { margin-top: 0.5rem; color: var(--text-secondary); font-size: 0.8rem; line-height: 1.5; }

.scroll-top-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 150;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--header-bg); backdrop-filter: blur(14px) saturate(200%);
  border: 1px solid var(--header-border); box-shadow: var(--shadow-lg);
  color: var(--text-primary); cursor: pointer; font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}
.scroll-top-btn.visible { opacity: 1; pointer-events: auto; }
.scroll-top-btn:hover { transform: translateY(-2px); border-color: var(--accent); }

.site-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border-subtle); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-size: 0.78rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; list-style: none; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--text-primary); }
.version-drop { position: relative; }
.version-btn { background: none; border: none; color: var(--accent); font-weight: 650; cursor: pointer; font-family: var(--font-mono); font-size: 0.8rem; padding: 0.2rem 0; transition: opacity 0.2s; }
.version-btn:hover { opacity: 0.8; }
.version-menu { display: none; position: absolute; bottom: calc(100% + 8px); left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 0.5rem 0; min-width: 190px; z-index: 50; font-family: var(--font-mono); font-size: 0.7rem; list-style: none; }
.version-menu.active { display: block; }
.version-menu a { display: block; padding: 0.4rem 1rem; color: var(--text-secondary); text-decoration: none; transition: background 0.15s; }
.version-menu a:hover { background: var(--border-subtle); color: var(--text-primary); }

@media (max-width: 850px) { .nav-links { display: none; } .burger-btn { display: flex; } .logo-tagline { display: none; } .marquee-wrap { display: none; } }
@media (max-width: 700px) {
  body { padding: 0 0.8rem 1.5rem; }
  .search-row { flex-direction: column; }
  .instruction-box { white-space: nowrap; overflow-x: auto; }
  .analyze-btn { padding: 0.8rem 1rem; font-size: 0; } .analyze-btn svg { margin: 0; }
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .analysis-grid { grid-template-columns: 1fr; }
}
@media (max-width: 400px) { .metrics-grid { grid-template-columns: repeat(2, 1fr); } }