*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --accent: #4f8ef7;
  --accent-hover: #3a7ae8;
  --danger: #f75f5f;
  --warn: #f7a94f;
  --success: #4fcf8e;
  --text: #e2e4ed;
  --muted: #7a7f99;
  --radius: 10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  padding: 2rem 1rem;
}

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

header { margin-bottom: 2rem; }

.logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.shield { font-size: 2.5rem; }

h1 { font-size: 1.8rem; font-weight: 700; }
header p { color: var(--muted); margin-top: 0.2rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.input-row {
  display: flex;
  gap: 0.75rem;
}

#urlInput {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

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

button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

button[type="submit"]:hover { background: var(--accent-hover); }
button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }

.options {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  font-size: 0.9rem;
  color: var(--muted);
}

.toggle input { display: none; }

.toggle small { color: var(--muted); font-size: 0.75rem; }

.slider {
  width: 36px; height: 20px;
  background: var(--border);
  border-radius: 20px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.slider::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: transform 0.2s;
}

.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::after { transform: translateX(16px); }

.max-pages {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.max-pages input {
  width: 60px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

.status {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status.scanning::before {
  content: '';
  width: 16px; height: 16px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

.hidden { display: none !important; }

.summary-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
}

.stat { font-size: 0.9rem; color: var(--muted); }
.stat strong { color: var(--text); }

.export-btns {
  margin-left: auto;
  display: flex;
  gap: 0.5rem;
}

.export-btns button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.export-btns button:hover { border-color: var(--accent); background: rgba(79,142,247,0.08); }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

#filterBtns { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--muted);
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn.active, .filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(79,142,247,0.1);
}

.page-group { margin-bottom: 1.5rem; }

.page-header {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.4rem 0;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}

.page-header a {
  color: var(--accent);
  text-decoration: none;
}

.page-header a:hover { text-decoration: underline; }

.issue-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.issue-tag {
  background: rgba(247,95,95,0.15);
  color: var(--danger);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 1px;
}

.issue-url a {
  color: var(--warn);
  text-decoration: none;
  word-break: break-all;
}

.issue-url a:hover { text-decoration: underline; }

.no-issues {
  text-align: center;
  padding: 3rem;
  color: var(--success);
  font-size: 1.1rem;
}

.no-issues span { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

.error-section { margin-top: 1rem; }

.error-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.error-item .err-url { color: var(--muted); word-break: break-all; }
.error-item .err-msg { color: var(--warn); margin-top: 0.2rem; }

.api-hint {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.api-hint code {
  color: var(--accent);
  font-family: 'Consolas', monospace;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-copy {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.modal-copy:hover { border-color: var(--accent); background: rgba(79,142,247,0.08); }

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.modal-close:hover { color: var(--text); }

#modalContent {
  overflow: auto;
  padding: 1rem;
  font-size: 0.8rem;
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--text);
  white-space: pre;
  flex: 1;
}

.crawled-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
  overflow: hidden;
}

.crawled-header {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.crawled-list { padding: 0.5rem 0; }

.crawled-item {
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
}

.crawled-item a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.crawled-item a:hover { text-decoration: underline; }
