/* cholab scan — 웹 보안 취약점 스캐너 */
:root {
  --bg: #0f1419;
  --bg-elev: #171d25;
  --bg-elev2: #1e2630;
  --border: #2a323d;
  --text: #e6eaef;
  --text-dim: #9aa5b1;
  --text-faint: #6b7581;
  --accent: #00cc78;
  --accent-dim: #00a368;
  --input-bg: #10161d;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
  --crit: #ff4d5e;
  --high: #ff8c3b;
  --med: #ffcc3b;
  --low: #6a9bff;
  --info: #7a8794;
  --pass: #00cc78;
}
[data-theme="light"] {
  --bg: #f4f6f8;
  --bg-elev: #ffffff;
  --bg-elev2: #f0f3f6;
  --border: #dde3ea;
  --text: #1a2028;
  --text-dim: #5a6672;
  --text-faint: #8a95a1;
  --accent: #00a368;
  --accent-dim: #007d50;
  --input-bg: #ffffff;
  --shadow: 0 8px 30px rgba(20,30,45,.10);
  --crit: #e02940;
  --high: #e0721b;
  --med: #c99700;
  --low: #3466e0;
  --info: #6b7581;
  --pass: #00a368;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Malgun Gothic", Roboto, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── topbar ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-elev); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mark { font-size: 22px; }
.brand-name { font-size: 19px; font-weight: 600; letter-spacing: -.2px; }
.brand-name b { color: var(--accent); font-weight: 800; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px; padding: 0 10px;
  background: var(--bg-elev2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 15px; font-weight: 600; cursor: pointer;
  text-decoration: none; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--border); }

/* ── layout ── */
.wrap { max-width: 860px; margin: 0 auto; padding: 30px 20px 60px; }

/* ── hero ── */
.hero { text-align: center; padding: 26px 0 8px; }
.hero h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: -.6px; }
.hero-sub { color: var(--text-dim); margin: 0 auto 24px; max-width: 560px; font-size: 15.5px; }
.scan-box {
  display: flex; gap: 10px; max-width: 620px; margin: 0 auto;
}
.scan-input {
  flex: 1; min-width: 0; padding: 15px 16px; font-size: 16px;
  background: var(--input-bg); border: 1.5px solid var(--border); border-radius: 12px;
  color: var(--text); outline: none; transition: border-color .15s;
}
.scan-input:focus { border-color: var(--accent); }
.scan-input::placeholder { color: var(--text-faint); }
.scan-btn {
  padding: 0 26px; font-size: 16px; font-weight: 700; white-space: nowrap;
  background: var(--accent); color: #04120b; border: none; border-radius: 12px;
  cursor: pointer; transition: background .15s, opacity .15s;
}
.scan-btn:hover { background: var(--accent-dim); }
.scan-btn:disabled { opacity: .55; cursor: default; }
.form-error {
  color: var(--crit); font-size: 14px; margin: 12px auto 0; max-width: 620px;
  font-weight: 500;
}
.active-toggle {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  max-width: 620px; margin: 12px auto 0; color: var(--text-dim); font-size: 13.5px;
  cursor: pointer; user-select: none;
}
.active-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.disclaimer {
  max-width: 620px; margin: 18px auto 0; padding: 13px 16px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 12px;
  text-align: left;
}
.disc-title { font-size: 13.5px; font-weight: 700; color: var(--high); margin-bottom: 6px; }
.disclaimer ul { margin: 0; padding-left: 20px; }
.disclaimer li { color: var(--text-dim); font-size: 12.5px; margin: 3px 0; line-height: 1.5; }

/* ── loading ── */
.loading { text-align: center; padding: 48px 0; color: var(--text-dim); }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 16px;
  border: 3.5px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── report ── */
.report { margin-top: 34px; }
.report-head {
  display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px 24px; box-shadow: var(--shadow);
}
.grade-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.grade {
  width: 96px; height: 96px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 52px; font-weight: 800; line-height: 1;
  border: 4px solid var(--info); color: var(--info);
}
.grade.g-A { border-color: var(--pass); color: var(--pass); }
.grade.g-B { border-color: #4bd18a; color: #4bd18a; }
.grade.g-C { border-color: var(--med); color: var(--med); }
.grade.g-D { border-color: var(--high); color: var(--high); }
.grade.g-F { border-color: var(--crit); color: var(--crit); }
.grade-score { font-size: 15px; color: var(--text-dim); font-weight: 600; }
.grade-max { color: var(--text-faint); font-weight: 400; }
.report-meta { flex: 1; min-width: 240px; font-size: 13.5px; }
.rm-target { font-size: 17px; font-weight: 700; word-break: break-all; margin-bottom: 8px; }
.rm-row { display: flex; gap: 10px; padding: 2px 0; }
.rm-k { color: var(--text-faint); min-width: 68px; }
.rm-v { color: var(--text-dim); word-break: break-all; }

.counts { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0 8px; }
.count-chip {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-weight: 600;
}
.count-chip .cc-num { font-size: 18px; font-weight: 800; }
.count-chip .cc-dot { width: 10px; height: 10px; border-radius: 50%; }

.findings-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 28px 0 12px; gap: 12px; flex-wrap: wrap;
}
.findings-head h2 { font-size: 19px; margin: 0; }
.passtoggle { font-size: 13.5px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; cursor: pointer; }

.findings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.finding {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-left: 4px solid var(--info); border-radius: 12px; overflow: hidden;
}
.finding.sev-critical { border-left-color: var(--crit); }
.finding.sev-high { border-left-color: var(--high); }
.finding.sev-medium { border-left-color: var(--med); }
.finding.sev-low { border-left-color: var(--low); }
.finding.st-pass { border-left-color: var(--pass); opacity: .82; }
.f-head {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer;
  user-select: none;
}
.f-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.f-title { flex: 1; font-weight: 600; font-size: 15px; }
.f-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.b-critical { background: rgba(255,77,94,.16); color: var(--crit); }
.b-high { background: rgba(255,140,59,.16); color: var(--high); }
.b-medium { background: rgba(255,204,59,.18); color: var(--med); }
.b-low { background: rgba(106,155,255,.16); color: var(--low); }
.b-info { background: rgba(122,135,148,.16); color: var(--info); }
.b-pass { background: rgba(0,204,120,.16); color: var(--pass); }
.f-caret { color: var(--text-faint); font-size: 12px; transition: transform .18s; }
.finding.open .f-caret { transform: rotate(90deg); }
.f-body { padding: 0 16px 15px 48px; display: none; font-size: 14px; }
.finding.open .f-body { display: block; }
.f-desc { color: var(--text-dim); margin: 2px 0 10px; }
.f-evidence {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 11px; color: var(--text); word-break: break-all; margin: 0 0 10px;
}
.f-fix { color: var(--text); }
.f-fix b { color: var(--accent); }

/* ── checks info ── */
.checks-info { margin-top: 48px; }
.checks-info h2 { font-size: 18px; margin: 0 0 14px; }
.checks-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.checks-grid li {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; font-size: 14px;
}
.checks-grid li b { display: block; margin-bottom: 3px; }
.checks-grid li span { color: var(--text-dim); font-size: 13px; }

/* ── footer ── */
.footer {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 860px; margin: 0 auto; padding: 22px 20px 40px;
  color: var(--text-faint); font-size: 13px; flex-wrap: wrap; gap: 8px;
}
.footer a { color: var(--text-dim); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ── 계산기 모달 ── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
.calc {
  position: relative; width: 300px; max-width: calc(100vw - 32px);
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 16px;
}
.calc-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 12px; }
.calc-close {
  background: var(--bg-elev2); border: 1px solid var(--border); border-radius: 8px;
  width: 30px; height: 30px; color: var(--text); cursor: pointer; font-size: 14px;
}
.calc-display {
  width: 100%; text-align: right; font-size: 26px; font-weight: 600;
  padding: 12px 14px; margin-bottom: 12px; background: var(--input-bg);
  border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  font-family: ui-monospace, Menlo, monospace; overflow: hidden;
}
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ck {
  padding: 14px 0; font-size: 18px; font-weight: 600; cursor: pointer;
  background: var(--bg-elev2); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); transition: background .12s;
}
.ck:hover { background: var(--border); }
.ck:active { transform: translateY(1px); }
.ck-op { color: var(--accent); font-weight: 700; }
.ck-fn { color: var(--text-dim); }
.ck-eq { background: var(--accent); color: #04120b; border-color: var(--accent); font-weight: 800; }
.ck-eq:hover { background: var(--accent-dim); }

@media (max-width: 560px) {
  .hero h1 { font-size: 24px; }
  .scan-box { flex-direction: column; }
  .scan-btn { padding: 14px; }
  .grade { width: 80px; height: 80px; font-size: 42px; }
  .report-head { padding: 18px; gap: 16px; }
  .wrap { padding: 20px 15px 50px; }
}
