:root {
  color-scheme: light;
  --ink: #2f2a24;
  --muted: #6d645a;
  --paper: #fffaf5;
  --line: #ded4c8;
  --orange: #f07857;
  --blue: #36aeda;
  --green: #8ebf4d;
  --shadow: 0 18px 55px rgb(77 60 43 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 0, #fff8ef 0, transparent 45rem),
    radial-gradient(circle at 100% 15%, #eaf8fb 0, transparent 42rem),
    #f8f2ea;
  min-height: 100vh;
}

button, input { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 4rem 0 2rem; }
.hero { max-width: 800px; margin-bottom: 2.5rem; }
.hero h1 { margin: .35rem 0 .7rem; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.35rem, 5vw, 3.8rem); line-height: 1.05; letter-spacing: -.035em; }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 800; color: var(--muted); }
.lede { max-width: 670px; margin: 0; font-size: clamp(1rem, 2vw, 1.28rem); line-height: 1.6; color: var(--muted); }

.panel { border: 1px solid rgb(109 100 90 / 18%); border-radius: 1.35rem; background: rgb(255 250 245 / 82%); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.compare-panel { padding: clamp(1.25rem, 4vw, 2.25rem); }
.user-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 1rem; }
label > span, legend { display: block; margin-bottom: .55rem; color: var(--muted); font-size: .8rem; font-weight: 800; letter-spacing: .04em; }
input[type="text"] { width: 100%; padding: .95rem 1rem; border: 1px solid var(--line); border-radius: .75rem; background: #fff; color: var(--ink); outline: none; }
input[type="text"]:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgb(240 120 87 / 16%); }
.versus { padding-bottom: .85rem; color: var(--orange); font-family: Georgia, serif; font-size: 1.5rem; }
fieldset { margin: 1.5rem 0; padding: 0; border: 0; }
.periods { display: flex; flex-wrap: wrap; gap: .55rem; }
.periods label { position: relative; }
.periods input { position: absolute; opacity: 0; pointer-events: none; }
.periods span { display: block; margin: 0; padding: .56rem .85rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; transition: .15s ease; }
.periods input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.periods input:focus-visible + span { outline: 3px solid rgb(54 174 218 / 35%); outline-offset: 2px; }
.primary, .secondary { border: 0; border-radius: .75rem; font-weight: 800; }
.primary { width: 100%; padding: 1rem 1.25rem; background: var(--orange); color: #fff; box-shadow: 0 8px 20px rgb(240 120 87 / 25%); }
.primary:hover { background: #db6748; }
.primary:disabled { cursor: wait; opacity: .65; }
.secondary { padding: .7rem .9rem; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary:hover { border-color: var(--ink); }
.status { min-height: 1.3rem; margin: 1rem 0 0; color: var(--muted); font-size: .9rem; text-align: center; }
.status.error { color: #a53b2c; font-weight: 700; }

.fingerprint { margin-top: 2rem; padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: 1.35rem; color: #fff; background: var(--ink); box-shadow: var(--shadow); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto; gap: 2rem; align-items: center; }
.fingerprint[hidden] { display: none; }
.fingerprint .eyebrow { color: #cabfb3; }
.fingerprint h2 { margin: .35rem 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.3rem); color: #ffc1ae; }
.fingerprint-summary { margin: 0; color: #e5ddd4; }
.fingerprint dl { display: grid; gap: 1rem; margin: 0; }
.fingerprint dl div { padding-left: 1rem; border-left: 3px solid var(--green); }
.fingerprint dt { color: #bfb5ab; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; }
.fingerprint dd { margin: .2rem 0 0; font-weight: 750; }

.results { display: grid; gap: 2rem; margin-top: 2rem; }
.result-card { overflow: hidden; }
.result-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.5rem 1.7rem; border-bottom: 1px solid var(--line); }
.result-header h2 { margin: .25rem 0 0; font-family: Georgia, serif; font-size: 2rem; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.metric { padding: 1.15rem 1.5rem; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { display: flex; align-items: center; gap: .3rem; overflow: hidden; color: var(--muted); font-size: .72rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.metric strong { display: block; margin-top: .2rem; font-family: Georgia, serif; font-size: 1.75rem; }
.match-heading { position: relative; display: inline-flex; align-items: center; gap: .25rem; }
.methodology-help { position: relative; display: inline-grid; width: 1rem; height: 1rem; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid currentColor; border-radius: 50%; background: transparent; color: var(--muted); font: inherit; font-size: .65rem; line-height: 1; }
.methodology-help::after { content: attr(data-tooltip); position: absolute; z-index: 2; top: calc(100% + .5rem); right: 0; width: min(18rem, 70vw); padding: .6rem .7rem; border: 1px solid var(--line); border-radius: .45rem; background: var(--paper); box-shadow: 0 8px 20px rgb(77 60 43 / 14%); color: var(--ink); font-size: .78rem; font-weight: 500; line-height: 1.4; opacity: 0; pointer-events: none; text-align: left; transform: translateY(-.2rem); transition: opacity .15s ease, transform .15s ease; white-space: normal; }
.methodology-help:hover::after, .methodology-help:focus-visible::after { opacity: 1; transform: translateY(0); }
.methodology-help:focus-visible { outline: 3px solid rgb(54 174 218 / 35%); outline-offset: 2px; }
.result-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.venn-wrap { display: grid; min-height: 420px; place-items: center; padding: 1.5rem; border-right: 1px solid var(--line); background: #fffaf5; }
.venn { width: min(100%, 590px); height: auto; overflow: visible; }
.venn circle { opacity: .7; mix-blend-mode: multiply; }
.venn text { fill: var(--ink); text-anchor: middle; font-weight: 800; }
.venn .count { font-family: Georgia, serif; font-size: 29px; }
.venn .name { font-size: 15px; }
.venn .caption { fill: var(--muted); font-size: 13px; font-weight: 600; }
.table-wrap { min-width: 0; padding: 1.6rem; }
.table-wrap h3 { margin: 0; font-family: Georgia, serif; font-size: 1.45rem; }
.table-note { margin: .3rem 0 1rem; color: var(--muted); font-size: .85rem; }
.scroll-table { max-height: 380px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: .68rem .5rem; border-bottom: 1px solid #eadfd4; text-align: right; }
th { position: sticky; top: 0; background: var(--paper); color: var(--muted); font-size: .7rem; text-transform: uppercase; }
th:first-child, td:first-child { text-align: left; }
td:first-child { max-width: 13rem; overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 3rem 1rem; color: var(--muted); text-align: center; }
.error-card { padding: 1.5rem; border-color: rgb(165 59 44 / 35%); color: #8b3023; }
.footer {
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-size: .9rem;
}
.footer-inner {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.footer a { color: var(--green); }
.footer a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
.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; }

@media (max-width: 820px) {
  .shell { padding-top: 2.5rem; }
  .fingerprint { grid-template-columns: 1fr; gap: 1.4rem; }
  .fingerprint .secondary { justify-self: start; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .result-grid { grid-template-columns: 1fr; }
  .venn-wrap { min-height: 330px; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 1rem, 1180px); }
  .user-grid { grid-template-columns: 1fr; }
  .versus { display: none; }
  .result-header { align-items: flex-start; }
  .download { font-size: .75rem; }
  .metric { padding: 1rem; }
  .metric strong { font-size: 1.4rem; }
  .table-wrap { padding: 1rem; }
  .footer-inner {
    width: min(100% - 22px, 1120px);
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
