:root {
  --bg:             #F9F7F4;
  --surface:        #FFFFFF;
  --border:         #E2E8F0;
  --text-primary:   #0F172A;
  --text-secondary: #475569;
  --text-muted:     #94A3B8;

  --orange:         #EA580C;
  --orange-light:   #FFF7ED;
  --orange-dark:    #C2410C;

  --green:          #16A34A;
  --green-light:    #DCFCE7;

  --red:            #DC2626;
  --red-light:      #FEF2F2;

  --amber:          #D97706;
  --amber-light:    #FFFBEB;

  --slate:          #475569;
  --slate-light:    #F8FAFC;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  padding-top: 88px;
}

.mono { font-family: 'JetBrains Mono', monospace; }

/* ── Header ─────────────────────────────────────────────── */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 88px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100% - 1024px) / 2 + 24px));
  z-index: 100;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

.wordmark-icon {
  height: 68px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.wordmark-name {
  height: 44px;
  width: auto;
  display: block;
}

.nav-links { display: flex; gap: 20px; }

.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 150ms;
}

.nav-links a:hover { color: var(--orange); }

/* ── Mobile footer */
.mobile-footer {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.mobile-footer a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 150ms;
}

.mobile-footer a:hover { color: var(--orange); }

@media (max-width: 640px) {
  .nav-links { display: none; }
  .mobile-footer { display: flex; }
  body { padding-bottom: 56px; }
  header { justify-content: center; }
}

/* ── Page wrapper ───────────────────────────────────────── */
.page { max-width: 780px; margin: 0 auto; padding: 0 24px 64px; }

/* ── Input zone ─────────────────────────────────────────── */
.input-zone { padding: 48px 0 32px; }

.input-zone h1 { font-size: 20px; font-weight: 600; color: var(--text-primary); }

.input-zone .subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Pill tabs */
.pill-tabs { display: flex; gap: 8px; margin-top: 20px; }

.pill {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: background 150ms, color 150ms, border-color 150ms;
}

.pill.active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

/* Textarea */
textarea {
  margin-top: 12px;
  width: 100%;
  height: 120px;
  resize: vertical;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 150ms;
  display: block;
}

textarea::placeholder { color: var(--text-muted); }
textarea:focus { border-color: var(--orange); }

/* Analyse button */
.btn-analyse {
  margin-top: 12px;
  width: 100%;
  height: 48px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms, transform 80ms, opacity 150ms;
}

.btn-analyse:hover { background: var(--orange-dark); }
.btn-analyse:active { transform: scale(0.98); }
.btn-analyse:disabled { opacity: 0.8; cursor: not-allowed; }

/* Import labels link */
.import-labels {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--orange);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.import-labels:hover { color: var(--orange-dark); }
#file-input { display: none; }

/* Error banner */
.error-banner {
  display: none;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--red-light);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  font-size: 13px;
  color: var(--red);
}

/* ── Network toggle ─────────────────────────────────────── */
.network-toggle {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.network-toggle input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--orange);
  cursor: pointer;
  flex-shrink: 0;
}

.network-toggle-detail { color: var(--text-muted); }

/* ── Results zone ───────────────────────────────────────── */
.results-zone {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}

.results-zone.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Score card */
.score-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 32px;
  display: flex;
  gap: 32px;
}

.score-left { width: 180px; flex-shrink: 0; }

.score-number {
  font-size: 64px;
  font-weight: 600;
  line-height: 1;
}

.score-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

.verdict-pill {
  display: inline-block;
  margin-top: 8px;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 500;
}

.verdict-good  { background: var(--green-light);  color: var(--green); }
.verdict-fair  { background: var(--amber-light);  color: var(--amber); }
.verdict-poor  { background: var(--red-light);    color: var(--red); }

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

/* Gauge */
.gauge-wrap { position: relative; }

.gauge-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: visible;
}

.gauge-seg-red   { width: 39%; background: var(--red);   border-radius: 4px 0 0 4px; }
.gauge-seg-amber { width: 30%; background: var(--amber); }
.gauge-seg-green { width: 31%; background: var(--green); border-radius: 0 4px 4px 0; }

.gauge-dot {
  position: absolute;
  top: 50%;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #fff;
  border-width: 2px;
  border-style: solid;
  transform: translate(-50%, -50%);
  transition: left 400ms ease;
}

/* Metadata chips */
.meta-chips {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.chip {
  background: var(--slate-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* ── Section headings ───────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-head h2 { font-size: 20px; font-weight: 600; color: var(--text-primary); }

.count-badge {
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  border-radius: 12px;
  padding: 2px 10px;
}

/* ── Finding cards ──────────────────────────────────────── */
.findings-section { margin-top: 32px; }

.finding-card {
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 16px 20px;
  margin-bottom: 8px;
  border-left-width: 3px;
  border-left-style: solid;
}

.finding-card.critical  { border-left-color: var(--red); }
.finding-card.warning   { border-left-color: var(--amber); }
.finding-card.info      { border-left-color: var(--slate); }
.finding-card.positive  {
  border-left-color: var(--green);
  background: var(--green-light);
}
.finding-card.positive .finding-title { color: var(--green); }

.no-findings {
  background: var(--green-light);
  border: 1px solid #86EFAC;
  border-left: 3px solid var(--green);
  border-radius: 8px;
  padding: 16px 20px;
  color: var(--green);
  font-size: 14px;
  font-weight: 500;
}

.finding-row1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.severity-badge {
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
}

.severity-badge.critical { background: var(--red-light);   color: var(--red); }
.severity-badge.warning  { background: var(--amber-light); color: var(--amber); }
.severity-badge.info     { background: var(--slate-light); color: var(--slate); border: 1px solid var(--border); }
.severity-badge.positive { background: var(--green-light); color: var(--green); }

.heuristic-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.finding-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 8px;
}

.finding-detail {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.6;
}

.finding-suggestion {
  font-size: 13px;
  font-weight: 500;
  color: var(--orange);
  margin-top: 8px;
}

/* ── Checks ─────────────────────────────────────────────── */
.checks-section { margin-top: 32px; }

.check-list {
  display: grid;
  gap: 6px;
}

.check-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.check-row.fail        { border-left-color: var(--red); }
.check-row.pass        { border-left-color: var(--green); }
.check-row.unavailable { border-left-color: var(--amber); }
.check-row.skipped     { border-left-color: #CBD5E1; }

.check-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.check-title { min-width: 0; }

.check-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.check-reason {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 2px;
}

.check-status {
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
}

.check-status.fail        { background: var(--red-light);   color: var(--red); }
.check-status.pass        { background: var(--green-light); color: var(--green); }
.check-status.unavailable { background: var(--amber-light); color: var(--amber); }
.check-status.skipped     { background: var(--slate-light); color: var(--slate); }

/* ── Coin labels ────────────────────────────────────────── */
.labels-section { margin-top: 32px; }

.label-row {
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 12px 16px;
  margin-bottom: 6px;
}

.label-row.tainted-active { background: var(--orange-light); }

.label-row-inner {
  display: flex;
  align-items: center;
  gap: 0;
}

.label-utxo {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 8px;
}

.label-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-left: 12px;
  flex: 1;
}

.tag-pill {
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
}

.tag-pill.tainted          { background: var(--red-light);   color: var(--red); }
.tag-pill.coinjoin,
.tag-pill.clean            { background: var(--green-light); color: var(--green); }
.tag-pill.unknown          { background: var(--slate-light); color: var(--slate); }

.label-taint-warning {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── What to do next ────────────────────────────────────── */
.next-card {
  margin-top: 24px;
  background: var(--orange-light);
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  padding: 16px 20px;
}

.next-card h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.next-card ol {
  margin-top: 8px;
  padding-left: 18px;
}

.next-card ol li {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Download button ────────────────────────────────────── */
.btn-download {
  margin-top: 16px;
  padding: 10px 20px;
  background: #fff;
  border: 1px solid var(--orange);
  color: var(--orange);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms;
}

.btn-download:hover { background: var(--orange-light); }

/* ── Glossary backdrop ──────────────────────────────────── */
.glossary-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 200;
  transition: opacity 200ms;
  opacity: 0;
}

.glossary-backdrop.open {
  display: block;
  opacity: 1;
}

/* ── Glossary panel ─────────────────────────────────────── */
.glossary-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  background: var(--bg);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.10);
}

.glossary-panel.open {
  transform: translateX(0);
}

.glossary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.glossary-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.glossary-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 3px;
}

.glossary-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 150ms, background 150ms;
}

.glossary-close:hover {
  color: var(--text-primary);
  background: var(--border);
}

/* ── Glossary search ────────────────────────────────────── */
.glossary-search {
  margin: 12px 20px;
  padding: 9px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 150ms;
  flex-shrink: 0;
}

.glossary-search::placeholder { color: var(--text-muted); }
.glossary-search:focus { border-color: var(--orange); }

/* ── Glossary list ──────────────────────────────────────── */
.glossary-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 24px;
}

.glossary-empty {
  padding: 24px 20px;
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Term card ──────────────────────────────────────────── */
.term-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--orange);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 8px;
}

.term-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.term-definition {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 6px;
}

.term-why {
  font-size: 12px;
  font-style: italic;
  color: var(--orange);
  margin-top: 8px;
  line-height: 1.5;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 560px) {
  .score-card { flex-direction: column; gap: 24px; }
  .score-left { width: auto; }
  .glossary-panel { width: 100%; }
}
