:root {
  --bg: #f6f9fc;
  --bg-alt: #eef3f8;
  --card: #ffffff;
  --card-border: #dbe4ee;
  --text: #152535;
  --muted: #5a6b7d;
  --accent: #0d9488;
  --accent-light: #14b8a6;
  --accent-dark: #0f766e;
  --accent-glow: rgba(13, 148, 136, 0.14);
  --on-accent: #ffffff;
  --green: #10b981;
  --yellow: #ca8a04;
  --red: #ef4444;
  --blue: #0891b2;
  --reveal-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --reveal-duration: 0.85s;
}

html { scroll-behavior: smooth; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(56, 189, 248, 0.08), transparent 55%),
    linear-gradient(180deg, #f8fbfe 0%, var(--bg) 35%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  position: relative;
}

.brand { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1;
  transition: opacity 0.2s;
}
.logo:hover { opacity: 0.85; }
.logo svg { display: block; }
h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.3px; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.back-link { color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.back-link:hover { color: var(--accent); }

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 999px;
}

.lang-switch button {
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.lang-switch button:hover { color: var(--text); }

.lang-switch button.active {
  background: var(--accent);
  color: var(--on-accent);
}

.intro {
  margin-bottom: 20px;
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(56, 189, 248, 0.06));
  border: 1px solid rgba(13, 148, 136, 0.18);
  border-radius: 14px;
}

.intro-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.2px;
}

.intro-lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 62ch;
}

.intro-points {
  margin: 0 0 14px;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.intro-points li + li { margin-top: 6px; }

.intro-note {
  margin: 0;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(21, 37, 53, 0.05);
}

.input-card { margin-bottom: 20px; }

.input-row {
  display: flex;
  gap: 10px;
}

input#email {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 18px;
  padding: 14px 18px;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
}

input#email:focus { border-color: var(--accent); }

.result-email {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

button {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: var(--on-accent);
  border: none;
  font-weight: 700;
  font-size: 15px;
  padding: 0 26px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .05s ease, opacity .2s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.2);
}

button:hover {
  opacity: .95;
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.26);
}

button:active { transform: translateY(1px); }

.examples {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.examples .ex {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--card-border);
  font-size: 12px;
  padding: 3px 9px;
  margin-left: 6px;
  border-radius: 999px;
  box-shadow: none;
}

.examples .ex:hover {
  background: var(--accent-glow);
  border-color: rgba(13, 148, 136, 0.3);
}

#results { margin-top: 10px; }
.hidden { display: none; }

.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.domain-name { font-size: 22px; font-weight: 600; }
.timestamp { font-size: 12px; color: var(--muted); }

.grade-wrap { display: flex; align-items: center; gap: 12px; text-align: right; }

.grade-badge {
  width: 68px;
  height: 68px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  border: 4px solid transparent;
}

.grade-badge.A { background: #ecfdf5; color: #059669; border-color: #6ee7b7; }
.grade-badge.B { background: #f0fdf4; color: #16a34a; border-color: #86efac; }
.grade-badge.C { background: #fefce8; color: #ca8a04; border-color: #fde047; }
.grade-badge.D { background: #fff7ed; color: #ea580c; border-color: #fdba74; }
.grade-badge.F { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

.score { font-size: 13px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.result-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 16px rgba(21, 37, 53, 0.04);
  min-width: 0;
  overflow: hidden;
}

.result-card h3 { margin: 0 0 10px; font-size: 15px; color: var(--muted); }
.card-head { display: flex; justify-content: space-between; align-items: center; }

.status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.status-pill.pass { background: #ecfdf5; color: #059669; }
.status-pill.warn { background: #fefce8; color: #ca8a04; }
.status-pill.fail { background: #fef2f2; color: #dc2626; }

.record {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: var(--bg-alt);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  word-break: break-all;
  color: #334155;
  min-height: 42px;
  margin: 8px 0;
  border: 1px solid var(--card-border);
}

.meta { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

.issues { list-style: none; margin: 0; padding: 0; }

.issues li {
  font-size: 13px;
  padding: 5px 0;
  border-top: 1px solid var(--card-border);
}

.issues li:first-child { border-top: none; }
.issues li.issue { color: #dc2626; }
.issues li.warn { color: #b45309; }

.mx-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }

.mx-list li {
  padding: 4px 0;
  font-family: ui-monospace, monospace;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.mx-list .prio {
  color: var(--muted);
  width: 32px;
  flex-shrink: 0;
  text-align: right;
}

.mx-list .mx-host {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.dkim-groups { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }

.dkim-group-title {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.dkim-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }

.dkim-list li.dkim-empty {
  border-top: none;
  padding: 10px 0;
  color: var(--muted);
  font-style: italic;
}

.dkim-list li {
  padding: 10px 0;
  border-top: 1px solid var(--card-border);
}

.dkim-list li:first-child { border-top: none; }

.dkim-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.dkim-row-head strong { font-size: 14px; }

.dkim-provider { color: var(--muted); font-size: 12px; }

.dkim-key {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: var(--muted);
}

.dkim-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}

.dkim-badge.pass { background: #ecfdf5; color: #059669; }
.dkim-badge.warn { background: #fffbeb; color: #b45309; }
.dkim-badge.fail { background: #fef2f2; color: #dc2626; }

.dkim-list li.dkim-missing { opacity: 0.92; }
.dkim-list li.dkim-missing .dkim-key { color: #dc2626; }

.summary {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(21, 37, 53, 0.04);
}

.summary .label { color: var(--muted); font-size: 12px; margin-bottom: 4px; }

.cta-card {
  margin-top: 18px;
  padding: 20px 22px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(56, 189, 248, 0.06));
  border: 1px solid rgba(13, 148, 136, 0.2);
  border-radius: 12px;
}

.cta-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--text);
}

.cta-card p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.cta-btn {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: var(--on-accent);
  padding: 12px 22px;
  font-size: 15px;
}

.cta-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.cta-input-row {
  display: flex;
  gap: 10px;
}

.cta-input-row input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
}

.cta-input-row input:focus { border-color: var(--accent); }

.cta-input-row button {
  padding: 12px 20px;
  white-space: nowrap;
}

.cta-error {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--red);
}

.cta-success {
  margin: 0;
  font-size: 15px;
  color: var(--green);
  font-weight: 600;
}

.actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

.actions button {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--card-border);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: none;
}

.actions button:hover {
  background: var(--card);
  border-color: var(--accent);
  box-shadow: none;
}

footer {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

footer a { color: var(--accent); text-decoration: none; }

/* Scroll reveal animations */
.scroll-reveal,
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--reveal-duration) var(--reveal-ease),
    transform var(--reveal-duration) var(--reveal-ease);
  transition-delay: var(--reveal-delay, 0s);
}

.scroll-reveal.is-visible,
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal--scale { transform: scale(0.96); }
.scroll-reveal--scale.is-visible { transform: scale(1); }
.scroll-reveal--fade { transform: none; }
.scroll-reveal--fade.is-visible { transform: none; }

.scroll-delay-1 { --reveal-delay: 0.1s; }
.scroll-delay-2 { --reveal-delay: 0.2s; }
.scroll-delay-3 { --reveal-delay: 0.3s; }

.scroll-stagger > .scroll-reveal:nth-child(1),
.scroll-stagger > *:nth-child(1).scroll-reveal { --reveal-delay: 0s; }
.scroll-stagger > .scroll-reveal:nth-child(2),
.scroll-stagger > *:nth-child(2).scroll-reveal { --reveal-delay: 0.08s; }
.scroll-stagger > .scroll-reveal:nth-child(3),
.scroll-stagger > *:nth-child(3).scroll-reveal { --reveal-delay: 0.16s; }

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

  .scroll-reveal,
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

@media (max-width: 640px) {
  header { flex-wrap: wrap; }
  .header-actions { width: 100%; justify-content: flex-end; }
  .input-row { flex-direction: column; }
  .cta-input-row { flex-direction: column; }
  button[type="submit"] { padding: 14px; }
}