:root {
  --brand-primary:   #2E7D52;
  --brand-dark:      #1B5E42;
  --brand-light:     #E8F5EE;

  --score-safe:      #2E7D52;
  --score-safe-bg:   #E8F5EE;
  --score-warn:      #B07D1A;
  --score-warn-bg:   #FFF8E6;
  --score-danger:    #C0392B;
  --score-danger-bg: #FDECEA;

  --bg-page:         #FAF8F4;
  --bg-card:         #FFFFFF;
  --border:          #D6D0C4;
  --text-main:       #1A1A1A;
  --text-secondary:  #6B6459;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.45;
  min-height: 100vh;
}

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

.container { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }

.topbar {
  background: var(--brand-dark);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px 12px 0 0;
}
.topbar-logo { font-size: 20px; }
.topbar-title { color: #fff; font-weight: 500; font-size: 16px; }
.topbar-sub { color: #9FE1CB; font-size: 12px; margin-left: auto; }

.page {
  background: var(--bg-page);
  border-radius: 12px;
  overflow: hidden;
  border: 0.5px solid var(--border);
}
.content { padding: 22px; display: flex; flex-direction: column; gap: 16px; }

/* --- form --- */
.form-card {
  background: var(--bg-card);
  border-radius: 10px;
  border: 0.5px solid var(--border);
  padding: 20px 22px;
}
.form-title { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
.form-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 18px; line-height: 1.5; }

label { display: block; font-size: 12px; color: var(--text-secondary); margin: 12px 0 4px; font-weight: 500; }
input[type=text], input[type=email], input[type=url] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  background: #fff;
  color: var(--text-main);
  font-family: inherit;
}
input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-light); }
input.invalid { border-color: var(--score-danger); }

.consent-box {
  background: var(--brand-light);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 18px;
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.consent-box input { margin-top: 3px; flex-shrink: 0; }
.consent-box strong { color: var(--text-main); }

.disclaimer-note {
  background: var(--score-warn-bg);
  border-left: 3px solid var(--score-warn);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  color: #6B5410;
  margin-top: 16px;
  line-height: 1.5;
}

button.primary {
  width: 100%;
  background: var(--brand-primary);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 18px;
  font-family: inherit;
}
button.primary:hover:not(:disabled) { background: var(--brand-dark); }
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- loading --- */
.loading {
  text-align: center;
  padding: 36px 20px;
  background: var(--bg-card);
  border-radius: 10px;
  border: 0.5px solid var(--border);
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--brand-light);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: var(--text-secondary); }

/* --- score card --- */
.score-card { background: #fff; border-radius: 10px; border: 0.5px solid var(--border); padding: 18px 20px; }
.score-header { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.score-number { font-size: 48px; font-weight: 500; line-height: 1; }
.score-number.safe { color: var(--score-safe); }
.score-number.warn { color: var(--score-warn); }
.score-number.danger { color: var(--score-danger); }
.score-info { flex: 1; }
.score-badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 12px;
  border-radius: 20px;
  color: #fff;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.score-badge.safe { background: var(--score-safe); }
.score-badge.warn { background: var(--score-warn); }
.score-badge.danger { background: var(--score-danger); }
.score-summary { font-size: 13px; color: #4A4A4A; line-height: 1.5; }

.score-bar-track { height: 8px; background: #F0EDE6; border-radius: 4px; overflow: hidden; margin-top: 14px; }
.score-bar-fill { height: 100%; background: linear-gradient(90deg, var(--score-safe) 0%, var(--score-warn) 45%, var(--score-danger) 80%); border-radius: 4px; transition: width 0.4s ease; }
.score-bar-labels { display: flex; justify-content: space-between; font-size: 10px; color: #9A9A9A; margin-top: 4px; }

.flags-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.flag-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #922B21;
  background: var(--score-danger-bg);
  border-radius: 6px;
  padding: 8px 10px;
  line-height: 1.5;
}
.flag-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--score-danger); margin-top: 4px; flex-shrink: 0; }

/* --- section card --- */
.section-card { background: #fff; border-radius: 10px; border: 0.5px solid var(--border); overflow: hidden; }
.section-header { padding: 12px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 0.5px solid #F0EDE6; }
.section-icon { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.section-title { font-size: 13px; font-weight: 500; color: var(--text-main); }
.section-meta { font-size: 11px; color: #9A9A9A; margin-left: auto; }
.section-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }

.found-item { background: #F7FAF8; border-radius: 7px; padding: 10px 12px; border-left: 3px solid var(--score-safe); }
.found-item.warn { background: #FFFBF2; border-left-color: var(--score-warn); }
.found-item.danger { background: #FEF5F4; border-left-color: var(--score-danger); }
.found-item.neutral { background: #F7F6F4; border-left-color: var(--border); }
.found-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.found-label.ok { color: var(--score-safe); }
.found-label.warn { color: var(--score-warn); }
.found-label.danger { color: var(--score-danger); }
.found-label.neutral { color: #9A9A9A; }
.found-value { font-size: 13px; color: var(--text-main); line-height: 1.45; }
.found-source { font-size: 11px; color: #9A9A9A; margin-top: 4px; }

.snippet {
  background: #F0EDE6;
  border-radius: 6px;
  padding: 9px 11px;
  font-size: 12px;
  color: #4A4A4A;
  line-height: 1.5;
  border-left: 2px solid var(--border);
  font-style: italic;
}
.snippet.danger { background: var(--score-danger-bg); border-left-color: var(--score-danger); color: #922B21; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-mini { background: #F7F6F4; border-radius: 7px; padding: 10px; text-align: center; }
.stat-mini-val { font-size: 18px; font-weight: 500; color: var(--text-main); }
.stat-mini-lbl { font-size: 10px; color: #9A9A9A; margin-top: 2px; }

/* --- recommendation --- */
.recommendation { background: var(--brand-dark); border-radius: 10px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rec-icon { font-size: 24px; }
.rec-text { color: var(--brand-light); font-size: 13px; line-height: 1.5; flex: 1; min-width: 200px; }
.rec-title { font-weight: 500; font-size: 14px; color: #fff; margin-bottom: 2px; }
.rec-btn { background: #fff; color: var(--brand-dark); border: none; border-radius: 7px; padding: 8px 16px; font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; font-family: inherit; }
.rec-btn:hover { background: var(--brand-light); }
.rec-btn.danger { background: #fff; color: var(--score-danger); }

.disclaimer-final {
  background: #F0EDE6;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: center;
}

.toggle-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--brand-primary);
  padding: 0; margin-top: 8px;
  text-decoration: underline; font-family: inherit;
}

.new-search-row {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
}
.btn-new-search {
  display: inline-block;
  background: var(--brand-primary);
  color: white;
  text-decoration: none;
  padding: 12px 28px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
  font-family: inherit;
}
.btn-new-search:hover { background: var(--brand-dark); }

.error-box {
  background: var(--score-danger-bg);
  border: 1px solid var(--score-danger);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--score-danger);
  font-size: 13px;
}

pre.raw-data {
  background: #2A2A2A;
  color: #DDD;
  padding: 14px;
  border-radius: 7px;
  font-size: 11px;
  overflow-x: auto;
  margin-top: 10px;
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Code", monospace;
  line-height: 1.5;
}
