:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #5c6370;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --ok: #059669;
  --miss: #b45309;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
  --max: 860px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1rem; }

header.site {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 0;
  flex-wrap: wrap;
}
.logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}
.logo:hover { text-decoration: none; color: var(--accent); }
nav {
  display: flex;
  gap: .25rem .85rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: .92rem;
}
nav a { color: var(--muted); }
nav a:hover, nav a.active { color: var(--accent); text-decoration: none; }

main { flex: 1; padding: 2rem 0 3rem; }

.hero { text-align: center; padding: 1.5rem 0 2rem; }
.hero h1 {
  font-size: clamp(1.55rem, 4.5vw, 2.1rem);
  line-height: 1.25;
  margin: 0 0 .75rem;
  letter-spacing: -.02em;
}
.hero .tagline {
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 .5rem;
  font-size: 1rem;
}
.hero .sub {
  color: var(--muted);
  margin: 0 auto 1.5rem;
  max-width: 38rem;
  font-size: 1.02rem;
}
.actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .7rem 1.25rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-primary:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: #c5cad3; }

.features {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin: 2rem 0;
}
@media (min-width: 560px) {
  .features { grid-template-columns: repeat(3, 1fr); }
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 .4rem; font-size: 1rem; }
.card p { margin: 0; color: var(--muted); font-size: .92rem; }

.how { margin-top: 2rem; }
.how h2 { font-size: 1.2rem; margin: 0 0 1rem; text-align: center; }
.how ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: .75rem;
}
.how li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1rem .9rem 3rem;
  position: relative;
  counter-increment: step;
}
.how li::before {
  content: counter(step);
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-title { margin: 0 0 1.25rem; font-size: 1.5rem; }

.toolbar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 1.25rem 0 .75rem;
  align-items: center;
}

.status {
  margin-top: .5rem;
  font-size: .92rem;
  min-height: 1.4em;
  color: var(--muted);
}
.status.ok { color: var(--ok); }
.status.err { color: var(--danger); }

.privacy-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}
.privacy-body p {
  margin: 0 0 1rem;
  color: var(--muted);
}
.privacy-body p:last-child { margin-bottom: 0; }

footer.site {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.25rem 0;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}

.privacy-banner {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .9rem;
  margin: 0 0 1.25rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  margin: 0;
}
.panel label {
  display: block;
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: .45rem;
}
.panel .hint {
  margin: .55rem 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.tool-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
}

.field-panel textarea {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  line-height: 1.45;
  padding: .75rem .85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  resize: vertical;
  min-height: 14rem;
  color: var(--text);
}
.field-panel textarea:focus {
  outline: 2px solid #bfdbfe;
  border-color: var(--accent);
}

.results { margin-top: 1.25rem; }

.score-card {
  text-align: center;
  margin-bottom: 1rem;
}
.score-label {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
  font-size: .95rem;
}
.score-value {
  margin: .35rem 0 .5rem;
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--accent);
  line-height: 1.1;
}
.score-max {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--muted);
  margin-left: .15rem;
}
.stats-line {
  margin: 0 0 .35rem;
  font-size: .95rem;
  font-weight: 600;
}

.heuristics {
  list-style: none;
  margin: .85rem 0 0;
  padding: 0;
  text-align: left;
  display: grid;
  gap: .35rem;
}
.heuristics-title {
  font-weight: 600;
  font-size: .88rem;
  color: var(--text);
  margin-top: .25rem;
}
.heuristics li:not(.heuristics-title) {
  font-size: .85rem;
  color: var(--muted);
  padding-left: 1.1rem;
  position: relative;
}
.heuristics li:not(.heuristics-title)::before {
  content: "•";
  position: absolute;
  left: .25rem;
  color: var(--accent);
}

.kw-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .kw-grid { grid-template-columns: 1fr 1fr; }
}

.kw-heading {
  margin: 0 0 .75rem;
  font-size: .95rem;
}
.kw-heading.matched { color: var(--ok); }
.kw-heading.missing { color: var(--miss); }

.kw-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.kw-chip {
  display: inline-block;
  padding: .25rem .55rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.kw-chip.ok {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.kw-chip.miss {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}
.kw-empty {
  color: var(--muted);
  font-size: .9rem;
  list-style: none;
}

.local-note {
  margin: 1rem 0 0;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

.keywords-note {
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  margin-top: 2rem;
}
