:root {
  --ink: #17130d;
  --muted: #6f6554;
  --paper: #f7efe1;
  --card: rgba(255, 252, 244, 0.9);
  --line: rgba(23, 19, 13, 0.14);
  --accent: #d55c2b;
  --accent-dark: #8e3317;
  --good: #1f7a4d;
  --warn: #b26a00;
  --bad: #b42318;
  --shadow: 0 12px 32px rgba(54, 37, 12, 0.12);
  font-family: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #f7efe1;
}

.shell { width: min(1180px, calc(100vw - 32px)); margin: 0 auto; padding: 38px 0; will-change: transform; }
.hero { display: grid; grid-template-columns: 1.35fr 0.65fr; gap: 24px; align-items: stretch; }
.panel, .report-card, .module-card { background: var(--card); border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow); contain: layout style paint; }
.module-card, .report-card { content-visibility: auto; contain-intrinsic-size: auto 180px; }
.panel { padding: 34px; }
h1 { font-size: clamp(2.5rem, 8vw, 6.2rem); line-height: 0.9; letter-spacing: -0.08em; margin: 0 0 18px; max-width: 780px; }
h2 { margin: 0 0 14px; font-size: 1.45rem; }
p { color: var(--muted); line-height: 1.6; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
button { border: 0; border-radius: 999px; padding: 13px 18px; background: var(--ink); color: #fff9eb; cursor: pointer; font-weight: 700; }
button.secondary { background: #fff7e7; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: 0.55; cursor: progress; }
.score { display: grid; place-items: center; min-height: 260px; text-align: center; }
.score strong { font-size: 5rem; line-height: 1; letter-spacing: -0.08em; }
.score span { color: var(--muted); text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.82rem; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.module-card, .report-card { padding: 18px; }
.status { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 5px 10px; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }
.status.pass { background: rgba(31, 122, 77, 0.12); color: var(--good); }
.status.warn, .status.risk { background: rgba(178, 106, 0, 0.14); color: var(--warn); }
.status.fail { background: rgba(180, 35, 24, 0.13); color: var(--bad); }
.finding { border-top: 1px solid var(--line); padding: 12px 0; }
pre { max-height: 320px; overflow: auto; background: #19140e; color: #fff2d6; padding: 14px; border-radius: 16px; font-size: 0.78rem; }
.muted { color: var(--muted); }

/* ---- Findings Alert Banner (between hero and grid) ---- */
.findings-alert-zone { margin-top: 18px; }
.alert-banner {
  background: linear-gradient(135deg, rgba(180, 35, 24, 0.06) 0%, rgba(178, 106, 0, 0.06) 100%);
  border: 2px solid rgba(180, 35, 24, 0.25);
  border-radius: 28px;
  padding: 28px 30px;
  box-shadow: var(--shadow);
}
.alert-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.alert-header h2 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--bad);
}
.alert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(180, 35, 24, 0.12);
  color: var(--bad);
  font-size: 1.4rem;
  flex-shrink: 0;
}
.alert-list { display: flex; flex-direction: column; gap: 14px; }
.alert-item {
  background: rgba(255, 252, 244, 0.85);
  border-radius: 18px;
  padding: 16px 20px;
  border-left: 4px solid var(--line);
}
.alert-item.alert-critical { border-left-color: var(--bad); }
.alert-item.alert-high { border-left-color: #d45a00; }
.alert-item.alert-medium { border-left-color: var(--warn); }
.alert-item.alert-low { border-left-color: var(--muted); }
.alert-item-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.severity-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.severity-critical { background: rgba(180, 35, 24, 0.14); color: var(--bad); }
.severity-high { background: rgba(212, 90, 0, 0.12); color: #d45a00; }
.severity-medium { background: rgba(178, 106, 0, 0.12); color: var(--warn); }
.severity-low { background: rgba(111, 101, 84, 0.12); color: var(--muted); }
.severity-info { background: rgba(31, 122, 77, 0.12); color: var(--good); }
.alert-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink);
}
.alert-explanation {
  margin: 4px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}
.alert-evidence {
  margin-top: 8px;
  font-size: 0.82rem;
}
.alert-evidence summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
}

.finding-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.finding-evidence {
  margin-top: 10px;
}

.finding-evidence summary,
.finding-section summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

.finding-code {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: 'Courier New', monospace;
  font-size: 0.78rem;
}

.finding-section {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.finding-section-head h3 {
  margin: 0 0 6px;
}

.finding-section-head p,
.finding-section > p {
  margin: 0 0 12px;
  font-size: 0.88rem;
}

.finding-section-reference {
  background: rgba(31, 122, 77, 0.06);
  border: 1px solid rgba(31, 122, 77, 0.16);
  border-radius: 22px;
  padding: 16px 18px;
}

.finding-section-supporting {
  background: rgba(23, 19, 13, 0.04);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px 18px;
}

.finding-section-list .finding:first-child {
  border-top: 0;
  padding-top: 0;
}

/* ---- Version verdict card ---- */
.version-verdict {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 22px;
  margin-bottom: 20px;
}
.version-verdict.verdict-mismatch {
  border-color: rgba(212, 73, 10, 0.35);
  background: rgba(212, 73, 10, 0.05);
}
.version-verdict.verdict-ok {
  border-color: rgba(31, 122, 77, 0.3);
  background: rgba(31, 122, 77, 0.05);
}
.version-verdict.verdict-conflict {
  border-color: rgba(180, 140, 30, 0.35);
  background: rgba(180, 140, 30, 0.05);
}
.version-verdict-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.version-verdict-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.verdict-label {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 14px;
}
.verdict-mismatch .verdict-label {
  background: rgba(212, 73, 10, 0.12);
  color: #c4450a;
}
.verdict-ok .verdict-label {
  background: rgba(31, 122, 77, 0.12);
  color: #1f7a4d;
}
.verdict-conflict .verdict-label {
  background: rgba(180, 140, 30, 0.12);
  color: #b48c1e;
}
.version-verdict-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}
.verdict-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
}
.verdict-key {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}
.verdict-value {
  font-size: 0.95rem;
  font-weight: 600;
}
.verdict-details {
  margin-top: 14px;
  font-size: 0.82rem;
}
.verdict-details pre {
  max-height: 180px;
  overflow-y: auto;
}

/* ---- Top bar / Language Switcher ---- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.lang-switcher {
  display: flex;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--card);
}
.lang-btn {
  border: 0;
  border-radius: 0;
  padding: 8px 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  transition: background 0.15s, color 0.15s;
}
.lang-btn.active {
  background: var(--ink);
  color: #fff9eb;
}
.lang-btn:not(.active):hover {
  background: rgba(23, 19, 13, 0.06);
  color: var(--ink);
}

@media (max-width: 760px) {
  .hero, .grid { grid-template-columns: 1fr; }
  .shell { width: min(100vw - 20px, 1180px); padding: 14px 0; }
  .panel { padding: 24px; border-radius: 22px; }
  .alert-banner { padding: 20px; border-radius: 22px; }
  .alert-item { padding: 12px 14px; }
  .bscan-grid { grid-template-columns: 1fr; }
  .bscan-version-grid { grid-template-columns: 1fr 1fr; }
}

/* ======================================================================== */
/* BrowserScan standalone section                                            */
/* ======================================================================== */

.bscan-section {
  margin-top: 32px;
  background: linear-gradient(135deg, rgba(23, 19, 13, 0.04) 0%, rgba(213, 92, 43, 0.06) 100%);
  border: 2px solid rgba(213, 92, 43, 0.2);
  border-radius: 28px;
  padding: 28px 30px;
  box-shadow: var(--shadow);
}

.bscan-header h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  color: var(--ink);
}

.bscan-header p {
  margin: 0 0 20px;
  font-size: 0.85rem;
}

.bscan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.bscan-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
}

.bscan-card h3 {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--ink);
}

.bscan-card code {
  background: rgba(213, 92, 43, 0.1);
  color: var(--accent-dark);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.bscan-engine {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bscan-engine-badge {
  display: inline-block;
  border-radius: 8px;
  padding: 4px 12px;
  font-weight: 700;
  font-size: 0.88rem;
  width: fit-content;
}

.bscan-engine-detail {
  font-size: 0.78rem;
  color: var(--muted);
}

.bscan-sub-engines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.sub-engine-badge {
  display: inline-block;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.7rem;
  font-weight: 600;
}

.sub-engine-badge.detected {
  background: rgba(31, 122, 77, 0.12);
  color: var(--good);
}

.sub-engine-badge.not-detected {
  background: rgba(111, 101, 84, 0.08);
  color: var(--muted);
}

.bscan-enum-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bscan-enum-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bscan-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bscan-enum-grid strong {
  font-size: 1.3rem;
  color: var(--ink);
}

.bscan-sub {
  font-size: 0.7rem;
  color: var(--muted);
}

.bscan-ua {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.bscan-ua strong {
  font-size: 0.9rem;
  color: var(--ink);
  word-break: break-all;
}

/* Version results */
.bscan-version-results {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 24px;
  margin-bottom: 16px;
}

.bscan-version-results h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  color: var(--accent-dark);
}

.bscan-version-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.bscan-version-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(23, 19, 13, 0.03);
  border-radius: 12px;
}

.bscan-version {
  font-size: 1.6rem;
  color: var(--ink);
  line-height: 1;
}

.bscan-version-main {
  font-size: 2rem;
  color: var(--accent);
}

.bscan-overall {
  background: rgba(213, 92, 43, 0.06);
  border: 1px solid rgba(213, 92, 43, 0.2);
}

.bscan-conf {
  font-size: 0.72rem;
  color: var(--muted);
}

.bscan-ua-compare {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.bscan-match {
  background: rgba(31, 122, 77, 0.12);
  color: var(--good);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

.bscan-mismatch {
  background: rgba(180, 35, 24, 0.1);
  color: var(--bad);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
}

/* BrowserScan API comparison table */
.bscan-api-compare {
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(31, 122, 77, 0.04) 0%, rgba(23, 19, 13, 0.04) 100%);
  border: 2px solid rgba(31, 122, 77, 0.25);
  border-radius: 28px;
  padding: 28px 30px;
  box-shadow: var(--shadow);
}
.bscan-api-compare h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  color: var(--ink);
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.88rem;
}
.compare-table th {
  text-align: left;
  padding: 10px 14px;
  background: rgba(23, 19, 13, 0.05);
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid var(--line);
}
.compare-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.compare-table td strong {
  color: var(--accent-dark);
}
.compare-table tr:last-child td {
  border-bottom: none;
}

/* Raw data toggle */
.bscan-raw {
  margin-top: 12px;
  font-size: 0.82rem;
}

.bscan-raw summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}

.bscan-raw pre {
  margin-top: 8px;
}

