:root {
  --bg: #050505;
  --surface: #090909;
  --surface-2: #0d0d0d;

  --white: #f5f5f3;
  --text: #ededeb;
  --body: #a7a7a7;
  --muted: #707070;
  --dim: #4b4b4b;

  --line: #202020;
  --line-soft: #151515;
  --line-strong: #303030;
}

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

/* Ensure the HTML `hidden` attribute always wins over component
   `display` rules. Without this, .modal { display: grid } and
   .usage-bar { display: flex } override [hidden] and elements
   stay visible after being hidden via JS. */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);

  font-family:
    Inter,
    system-ui,
    -apple-system,
    sans-serif;

  line-height: 1.5;

  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

/* ============================================================
   Topbar (with safe-area inset for iOS notch)
============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;

  height: calc(72px + env(safe-area-inset-top, 0px));

  padding-top: env(safe-area-inset-top, 0px);
  padding-left: 32px;
  padding-right: 32px;
  padding-bottom: 0;

  display: flex;
  align-items: center;
  justify-content: space-between;

  border-bottom: 1px solid #1b1b1b;

  background: rgba(5, 5, 5, .9);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand img {
  width: 145px;
  display: block;
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-right {
  color: #656565;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 9px;
  letter-spacing: .08em;

  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 5px;
  height: 5px;

  border-radius: 50%;

  background: #888;
}

main {
  min-height: calc(100vh - 72px);
}

.workspace {
  width: min(calc(100% - 40px),
      1120px);

  margin: auto;

  padding: 90px 0 120px;
}

.workspace-head {
  max-width: 760px;
}

.eyebrow,
.label,
.section-title,
.meta-grid span,
.technical-card span {
  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 10px;
  letter-spacing: .08em;

  color: #666;
}

.workspace h1 {
  margin-top: 18px;

  font-size: clamp(38px, 6vw, 72px);
  line-height: .96;

  letter-spacing: -.065em;
}

.workspace-head p {
  margin-top: 20px;

  max-width: 600px;

  color: var(--body);

  font-size: 15px;
  line-height: 1.7;
}

.analyzer {
  display: flex;
  gap: 8px;

  margin-top: 42px;
}

.input-wrap {
  flex: 1;

  display: flex;
  align-items: center;

  border: 1px solid var(--line-strong);

  background: #090909;
}

.input-prefix {
  padding-left: 15px;

  color: #555;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 9px;
}

.input-wrap input {
  width: 100%;

  padding: 16px 15px;

  background: transparent;

  border: 0;
  outline: 0;

  color: white;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 12px;
}

.input-wrap:focus-within {
  border-color: #666;
}

.input-wrap input::placeholder {
  color: #444;
}

.analyzer button {
  padding: 0 24px;

  background: white;
  color: black;

  font-size: 12px;
  font-weight: 700;
}

.analyzer button:hover {
  background: #d5d5d5;
}

.error {
  margin-top: 15px;

  padding: 12px 15px;

  border: 1px solid #343434;

  color: #aaa;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 10px;
}

.empty,
.loading {
  margin-top: 45px;

  padding: 70px 20px;

  text-align: center;

  border: 1px solid var(--line);
}

.empty-mark {
  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  margin: 0 auto 18px;

  border: 1px solid #333;

  color: #777;

  font-family:
    "JetBrains Mono",
    monospace;
}

.empty h2 {
  font-size: 19px;
}

.empty p {
  margin-top: 7px;

  color: #666;

  font-size: 12px;
}

.loading {
  display: flex;

  align-items: center;
  justify-content: center;

  gap: 15px;

  text-align: left;
}

.loader {
  width: 20px;
  height: 20px;

  border: 1px solid #333;
  border-top-color: white;

  border-radius: 50%;

  animation:
    spin .8s linear infinite;
}

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

.loading strong {
  font-size: 12px;
}

.loading p {
  margin-top: 3px;

  color: #666;

  font-size: 10px;
}

.report {
  margin-top: 45px;

  border: 1px solid #262626;

  background: #080808;
}

.report-head {
  display: flex;

  justify-content: space-between;
  align-items: flex-start;

  gap: 30px;

  padding: 28px;

  border-bottom: 1px solid #202020;
}

.report-url {
  max-width: 700px;

  margin-top: 8px;

  color: #aaa;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 12px;

  overflow-wrap: anywhere;
  word-break: break-word;
}

.assessment {
  padding: 8px 11px;

  border: 1px solid #444;

  color: #aaa;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 9px;

  letter-spacing: .05em;

  white-space: nowrap;
}

.meta-grid {
  display: grid;
  grid-template-columns:
    repeat(4, 1fr);

  border-bottom: 1px solid #202020;
}

.meta-grid>div {
  padding: 22px;

  border-right: 1px solid #202020;
}

.meta-grid>div:last-child {
  border-right: 0;
}

.meta-grid strong {
  display: block;

  margin-top: 8px;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 10px;

  color: #aaa;

  word-break: break-word;
}

.section-title {
  padding: 25px 28px 12px;
}

.evidence {
  padding: 0 28px;
}

.evidence-item {
  display: grid;

  grid-template-columns:
    30px 1fr auto;

  gap: 15px;

  align-items: start;

  padding: 19px 0;

  border-bottom: 1px solid #151515;
}

.evidence-symbol {
  width: 24px;
  height: 24px;

  display: grid;
  place-items: center;

  border: 1px solid #2d2d2d;

  color: #888;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 10px;
}

.evidence-item strong {
  font-size: 13px;
}

.evidence-item p {
  margin-top: 5px;

  color: #8a8a8a;

  font-size: 11.5px;
  line-height: 1.6;
}

.evidence-type {
  color: #555;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 8px;
}

.technical {
  display: grid;

  grid-template-columns:
    repeat(5, 1fr);

  margin: 0 28px;

  border: 1px solid #202020;
}

.technical-card {
  padding: 18px;

  border-right: 1px solid #202020;
}

.technical-card:last-child {
  border-right: 0;
}

.technical-card strong {
  display: block;

  margin-top: 9px;

  color: #aaa;

  font-family:
    "JetBrains Mono",
    monospace;

  font-size: 10px;
}

.disclaimer {
  margin: 30px 28px;

  padding: 17px;

  border: 1px solid #202020;

  color: #8a8a8a;

  font-size: 10px;

  line-height: 1.7;
}

.disclaimer strong {
  color: #888;
}

/* ============================================================
   SCORE PANEL
============================================================ */

.score-panel {
  display: flex;
  align-items: center;
  gap: 26px;

  padding: 26px 28px;

  border-bottom: 1px solid #202020;
}

.score-number {
  min-width: 96px;

  font-family: "JetBrains Mono", monospace;
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.05em;

  color: #ddd;

  transition: color .4s ease;
}

.score-meta {
  flex: 1;
  min-width: 0;
}

.score-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .08em;
  color: #666;
  margin-bottom: 10px;
}

.score-bar {
  position: relative;
  height: 4px;
  background: #141414;
  overflow: hidden;
}

.score-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: #888;
  transition: width .9s cubic-bezier(.2, .8, .2, 1), background .3s ease;
}

.score-summary {
  margin-top: 12px;
  max-width: 640px;
  font-size: 12px;
  line-height: 1.6;
  color: #8b8b8b;
}

/* Severity accents */

.severity-low .score-number,
.severity-low.assessment {
  color: #9bc18c;
}

.severity-low .score-bar-fill {
  background: #7fb069;
}

.severity-review .score-number,
.severity-review.assessment {
  color: #d9c15a;
}

.severity-review .score-bar-fill {
  background: #d9c15a;
}

.severity-caution .score-number,
.severity-caution.assessment {
  color: #d99a4a;
}

.severity-caution .score-bar-fill {
  background: #d98e3a;
}

.severity-high .score-number,
.severity-high.assessment {
  color: #e06a5a;
}

.severity-high .score-bar-fill {
  background: #d65a4a;
}

.severity-critical .score-number,
.severity-critical.assessment {
  color: #ff6b6b;
}

.severity-critical .score-bar-fill {
  background: #e04a4a;
}

.severity-high.assessment,
.severity-critical.assessment {
  border-color: #8a3a3a;
  background: #1a0d0d;
}

.severity-caution.assessment {
  border-color: #6b4c22;
}

.severity-review.assessment {
  border-color: #5a5230;
}

/* Evidence severity */

.evidence-item.positive .evidence-symbol {
  color: #8fb684;
  border-color: #2e3d2c;
}

.evidence-item.info .evidence-symbol {
  color: #888;
  border-color: #2d2d2d;
}

.evidence-item.review .evidence-symbol {
  color: #d9c15a;
  border-color: #4d4426;
}

.evidence-item.danger .evidence-symbol {
  color: #ff6b6b;
  border-color: #6b2a2a;
}

.evidence-item.danger .evidence-type {
  color: #8a3a3a;
}

.evidence-item.review .evidence-type {
  color: #7a6a2a;
}

.evidence-item.positive .evidence-type {
  color: #4d6a48;
}

.evidence-item.danger strong {
  color: #f0b0b0;
}

/* Severe disclaimer */

.disclaimer.severe {
  border-color: #5a2020;
  background: #120808;
  color: #c8a5a5;
}

.disclaimer.severe strong {
  color: #ff8a8a;
}

/* ============================================================
   Report brand label
============================================================ */

.report-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.report-brand img {
  opacity: .7;
  display: block;
}

/* ============================================================
   Skip link
============================================================ */

.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 2000;
  padding: 10px 14px;
  background: #fff;
  color: #000;
  font-size: 12px;
  font-weight: 700;
  transition: top .2s ease;
}

.skip:focus {
  top: 16px;
}

/* ============================================================
   Usage bar
============================================================ */

.usage-bar {
  margin-top: 26px;
  padding: 14px 16px;
  border: 1px solid #202020;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.usage-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #8a8a8a;
}

.usage-label {
  color: #666;
  letter-spacing: .08em;
}

.usage-progress {
  position: relative;
  height: 3px;
  background: #141414;
  overflow: hidden;
}

.usage-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: #7fb069;
  transition: width .5s ease, background .3s ease;
}

.usage-fill-warn   { background: #d9c15a; }
.usage-fill-danger { background: #d65a4a; }

/* ============================================================
   Topbar upgrade button
============================================================ */

.topbar-upgrade {
  display: inline-block;
  padding: 8px 12px;
  background: #fff;
  color: #000;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  transition: background .2s ease, transform .2s ease;
}

.topbar-upgrade:hover {
  background: #d8d8d8;
  transform: translateY(-1px);
}

/* ============================================================
   Mode toggle
============================================================ */

.mode-toggle {
  display: flex;
  gap: 0;
  margin-top: 24px;
  border: 1px solid #202020;
  width: fit-content;
}

.mode-btn {
  padding: 10px 16px;
  background: transparent;
  color: #777;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: .08em;
  border-right: 1px solid #202020;
  transition: background .2s ease, color .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mode-btn:last-child { border-right: 0; }
.mode-btn:hover { color: #ccc; background: #0c0c0c; }
.mode-btn.active { color: #fff; background: #141414; }

.mode-pro {
  padding: 2px 5px;
  background: #d9c15a;
  color: #000;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
}

/* ============================================================
   Bulk form
============================================================ */

.analyzer-bulk {
  align-items: stretch;
}

.input-wrap-bulk {
  align-items: flex-start;
  padding-top: 12px;
}

.input-wrap-bulk .input-prefix {
  padding-top: 4px;
}

.input-wrap-bulk textarea {
  width: 100%;
  padding: 4px 15px 12px;
  background: transparent;
  border: 0;
  outline: 0;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  line-height: 1.7;
  resize: vertical;
  min-height: 120px;
}

.input-wrap-bulk textarea::placeholder { color: #444; }

/* ============================================================
   History panel
============================================================ */

.history-panel {
  margin-top: 36px;
  border: 1px solid #202020;
  background: #080808;
}

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #202020;
}

.history-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .1em;
  color: #666;
}

.history-clear {
  color: #888;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .06em;
  transition: color .2s ease;
}

.history-clear:hover { color: #ff6b6b; }

.history-list {
  display: flex;
  flex-direction: column;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 18px;
  align-items: center;
  padding: 12px 18px;
  background: transparent;
  color: #aaa;
  text-align: left;
  border-bottom: 1px solid #141414;
  transition: background .15s ease;
}

.history-item:last-child { border-bottom: 0; }
.history-item:hover { background: #0f0f0f; color: #fff; }

.history-url {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-sev {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: .06em;
  padding: 4px 8px;
  border: 1px solid #2e2e2e;
}

.history-sev.severity-low { color: #9bc18c; border-color: #2e3d2c; }
.history-sev.severity-review { color: #d9c15a; border-color: #4d4426; }
.history-sev.severity-caution { color: #d99a4a; border-color: #553c22; }
.history-sev.severity-high,
.history-sev.severity-critical { color: #ff6b6b; border-color: #6b2a2a; }

.history-score {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: #777;
}

.history-date {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: #555;
}

/* ============================================================
   Bulk results
============================================================ */

.bulk-results {
  margin-top: 45px;
  border: 1px solid #262626;
  background: #080808;
}

.bulk-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #1e1e1e;
  gap: 20px;
  flex-wrap: wrap;
}

.bulk-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .1em;
  color: #666;
}

.bulk-summary {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: #888;
}

.bulk-list { display: flex; flex-direction: column; }

.bulk-row {
  display: grid;
  grid-template-columns: 1fr auto 80px 80px;
  gap: 18px;
  padding: 14px 20px;
  align-items: center;
  border-bottom: 1px solid #141414;
}

.bulk-row:last-child { border-bottom: 0; }

.bulk-row-error { opacity: .55; }

.bulk-url {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  color: #aaa;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-sev {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  letter-spacing: .06em;
  padding: 4px 8px;
  border: 1px solid #2e2e2e;
  color: #888;
  white-space: nowrap;
}

.bulk-sev.severity-low { color: #9bc18c; border-color: #2e3d2c; }
.bulk-sev.severity-review { color: #d9c15a; border-color: #4d4426; }
.bulk-sev.severity-caution { color: #d99a4a; border-color: #553c22; }
.bulk-sev.severity-high,
.bulk-sev.severity-critical { color: #ff6b6b; border-color: #6b2a2a; }

.bulk-score {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  color: #ccc;
  text-align: right;
}

.bulk-score small {
  font-size: 9px;
  color: #555;
  margin-left: 1px;
}

.bulk-view {
  padding: 8px 12px;
  border: 1px solid #2e2e2e;
  background: transparent;
  color: #ccc;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .05em;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.bulk-view:hover {
  background: #fff;
  color: #000;
  border-color: #fff;
}

@media (max-width: 700px) {
  .mode-toggle { width: 100%; }
  .mode-btn { flex: 1; justify-content: center; }
  .history-item { grid-template-columns: 1fr auto; gap: 10px; }
  .history-score, .history-date { display: none; }
  .bulk-row { grid-template-columns: 1fr auto; gap: 10px; }
  .bulk-score, .bulk-view { display: none; }
}

/* ============================================================
   Upgrade modal
============================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  padding: 34px 32px 30px;
  background: #0a0a0a;
  border: 1px solid #262626;
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #666;
  font-size: 20px;
  transition: color .2s ease;
}

.modal-close:hover { color: #fff; }

.modal-eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .14em;
  color: #666;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 26px;
  letter-spacing: -.04em;
  font-weight: 700;
}

.modal-copy {
  margin-top: 12px;
  color: #8a8a8a;
  font-size: 13.5px;
  line-height: 1.7;
}

.modal-form { margin-top: 24px; }

.modal-label {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: .08em;
  color: #777;
  margin-bottom: 10px;
}

.modal-optional { color: #555; font-style: italic; }

.modal-textarea {
  width: 100%;
  padding: 13px 14px;
  background: #060606;
  border: 1px solid #2e2e2e;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  min-height: 80px;
  outline: none;
}

.modal-textarea:focus { border-color: #666; }

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 11px 16px;
  font-size: 12.5px;
  font-weight: 700;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.modal-btn-secondary {
  background: transparent;
  border: 1px solid #2e2e2e;
  color: #ccc;
}

.modal-btn-secondary:hover { background: #141414; color: #fff; }

.modal-btn-primary {
  background: #fff;
  color: #000;
  border: 1px solid #fff;
}

.modal-btn-primary:hover { background: #d8d8d8; border-color: #d8d8d8; }

.modal-btn-primary[disabled] { opacity: .55; cursor: not-allowed; }

.modal-success {
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid #2c3d2c;
  background: #0d140d;
  color: #a8c8a8;
  font-size: 13px;
  line-height: 1.6;
}

.modal-success strong { color: #b8e0b8; }

/* ============================================================
   Mobile
============================================================ */

@media (max-width: 700px) {

  .topbar {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar-right {
    display: none;
  }

  .topbar-end {
    gap: 12px;
  }

  .workspace {
    width: min(calc(100% - 30px),
        1120px);

    padding-top: 60px;
  }

  .analyzer {
    flex-direction: column;
  }

  .analyzer button {
    padding: 14px;
  }

  .report-head {
    flex-direction: column;
  }

  .score-panel {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  .score-number {
    font-size: 44px;
    min-width: 0;
  }

  .meta-grid {
    grid-template-columns:
      1fr 1fr;
  }

  .meta-grid>div:nth-child(2) {
    border-right: 0;
  }

  .technical {
    grid-template-columns:
      1fr 1fr;
  }

  .technical-card:nth-child(2) {
    border-right: 0;
  }

  .technical-card:nth-child(3),
  .technical-card:nth-child(4) {
    border-top: 1px solid #202020;
  }

  .technical-card:nth-child(4) {
    border-right: 0;
  }

  .technical-card:last-child {
    grid-column: 1 / -1;

    border-top: 1px solid #202020;
    border-right: 0;
  }

  .evidence-item {
    grid-template-columns:
      28px 1fr;
  }

  .evidence-type {
    display: none;
  }
}

/* ============================================================
   Reduced motion
============================================================ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}