:root {
  --bg: #0c0e12;
  --surface: #12151b;
  --surface2: #191d26;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.14);
  --text: #e2e6f0;
  --muted: #6b7280;
  --dim: #3a3f4a;
  --accent: #3b82f6;
  --accent-glow: rgba(59,130,246,0.15);
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --green-border: rgba(34,197,94,0.25);
  --yellow: #eab308;
  --yellow-bg: rgba(234,179,8,0.1);
  --yellow-border: rgba(234,179,8,0.25);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.1);
  --red-border: rgba(239,68,68,0.25);
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  line-height: 1.6;
}

.scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

.wrap {
  position: relative; z-index: 1;
  max-width: 780px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.header {
  margin-bottom: 40px;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.blink-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 1.4s step-end infinite;
  flex-shrink: 0;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--mono);
}

.lang-toggle {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  flex-shrink: 0;
}

.lang-toggle:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: var(--surface2);
}

.lang-separator {
  color: var(--dim);
  margin: 0 6px;
  user-select: none;
}

.lang-option {
  color: var(--muted);
  transition: color 0.2s;
  user-select: none;
}

.lang-option.active {
  color: var(--accent);
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-family: var(--mono);
  margin-bottom: 12px;
}

h1 .dim { color: var(--muted); font-weight: 400; }

.subtitle {
  color: var(--muted);
  font-size: 0.875rem;
  font-family: var(--sans);
  max-width: 52ch;
  line-height: 1.7;
}

.form-section {
  margin-bottom: 32px;
}

.input-wrap {
  position: relative;
  margin-bottom: 12px;
}

.input-prefix {
  position: absolute;
  left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
  user-select: none;
}

#url-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 14px 16px 14px 32px;
  font-size: 0.95rem;
  font-family: var(--mono);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

#url-input.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

#url-input::placeholder { color: var(--dim); }

.controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-wrap input[type="checkbox"] {
  appearance: none;
  width: 34px; height: 20px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 999px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-wrap input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}

.toggle-wrap input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-wrap input[type="checkbox"]:checked::after {
  transform: translateX(14px);
  background: #fff;
}

.toggle-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--sans);
}

.btn {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--mono);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: opacity 0.15s, transform 0.1s;
  display: flex; align-items: center; gap: 8px;
}

.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-icon { font-size: 14px; }

.err-msg {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--red);
  font-family: var(--sans);
  display: none;
}

.err-msg.visible { display: block; }

.results { display: none; }
.results.visible { display: block; animation: fadeUp 0.35s ease; }
@keyframes fadeUp { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 28px;
}

.verdict-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.score-block {}
.score-num {
  font-size: 3.5rem;
  font-weight: 600;
  line-height: 1;
  transition: color 0.3s;
}
.score-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.verdict-badge {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid;
  font-family: var(--mono);
}

.verdict-badge.low { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.verdict-badge.mid { background: var(--yellow-bg); border-color: var(--yellow-border); color: var(--yellow); }
.verdict-badge.high { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }

.meter-bar {
  height: 6px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}
.meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1), background 0.3s;
}

.summary-text {
  font-size: 0.875rem;
  color: var(--muted);
  font-family: var(--sans);
  margin-bottom: 24px;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: 8px;
  border-left: 3px solid var(--border2);
  line-height: 1.65;
}

.checks-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.check-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.3s, background 0.3s;
}

.check-card.safe { border-color: var(--green-border); background: var(--green-bg); }
.check-card.warn { border-color: var(--yellow-border); background: var(--yellow-bg); }
.check-card.danger { border-color: var(--red-border); background: var(--red-bg); }
.check-card.info { border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.08); }
.check-card.neutral { border-color: var(--border); background: var(--surface2); }

.check-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-family: var(--sans);
}

.check-value {
  font-size: 0.875rem;
  font-weight: 600;
}

.check-card.safe .check-value { color: var(--green); }
.check-card.warn .check-value { color: var(--yellow); }
.check-card.danger .check-value { color: var(--red); }
.check-card.info .check-value { color: var(--accent); }
.check-card.neutral .check-value { color: var(--muted); }

.section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  margin-bottom: 12px;
  font-family: var(--sans);
}

.findings {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
}

.finding-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: var(--sans);
  border: 1px solid transparent;
  line-height: 1.55;
}

.finding-item.safe { background: var(--green-bg); border-color: var(--green-border); }
.finding-item.warn { background: var(--yellow-bg); border-color: var(--yellow-border); }
.finding-item.danger { background: var(--red-bg); border-color: var(--red-border); }
.finding-item.info { background: rgba(59,130,246,0.07); border-color: rgba(59,130,246,0.2); }
.finding-item.neutral { background: var(--surface2); border-color: var(--border); }

.f-icon {
  font-size: 13px;
  min-width: 18px;
  line-height: 1.55;
  font-weight: 600;
  font-family: var(--mono);
}

.finding-item.safe .f-icon { color: var(--green); }
.finding-item.warn .f-icon { color: var(--yellow); }
.finding-item.danger .f-icon { color: var(--red); }
.finding-item.info .f-icon { color: var(--accent); }
.finding-item.neutral .f-icon { color: var(--muted); }

.source-section {
  margin-bottom: 28px;
}

.source-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.source-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-family: var(--mono);
}

.source-status {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--mono);
}

.source-status.ok { background: var(--green-bg); color: var(--green); }
.source-status.err { background: var(--red-bg); color: var(--red); }
.source-status.loading { background: var(--yellow-bg); color: var(--yellow); }

.source-body {
  padding: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
  line-height: 1.8;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.source-body::-webkit-scrollbar { width: 4px; }
.source-body::-webkit-scrollbar-track { background: transparent; }
.source-body::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 4px; }

.source-findings {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.src-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-family: var(--mono);
  padding: 4px 8px;
  border-radius: 4px;
}

.src-tag.danger { background: var(--red-bg); color: var(--red); }
.src-tag.warn { background: var(--yellow-bg); color: var(--yellow); }
.src-tag.safe { background: var(--green-bg); color: var(--green); }

.footer-note {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.footer-item {}
.footer-item-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  margin-bottom: 4px;
  font-family: var(--sans);
}
.footer-item-desc {
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--sans);
  line-height: 1.55;
}

.loading-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 50;
  background: rgba(12,14,18,0.85);
  align-items: center; justify-content: center;
  flex-direction: column; gap: 16px;
  font-family: var(--mono);
}
.loading-overlay.active { display: flex; }

.spin-ring {
  width: 40px; height: 40px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text {
  color: var(--muted);
  font-size: 0.85rem;
}

.loading-log {
  color: var(--dim);
  font-size: 0.75rem;
  max-width: 380px;
  text-align: center;
  line-height: 1.7;
}

@media (max-width: 600px) {
  .checks-grid { grid-template-columns: 1fr; }
  .footer-note { grid-template-columns: 1fr; }
  .controls { flex-wrap: wrap; }
  .btn { margin-left: 0; width: 100%; justify-content: center; }
  .verdict-row { flex-direction: column; align-items: flex-start; }
}
