:root{
  --bg:#0b1220;
  --card:#111827;
  --text:#e5e7eb;
  --muted:#9aa4b2;
  --brand:#60a5fa;
  --accent:#22c55e;
  --danger:#ef4444;
  --border:#2a3342;
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;}
html,body{margin:0;padding:0;background:var(--bg);color:var(--text);font:16px/1.5 system-ui,Segoe UI,Roboto,Helvetica,Arial;overflow-x:hidden;}
body{overscroll-behavior-y:contain;}
a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:underline}

.top-nav{
  display:grid;
  grid-template-columns:auto auto auto;
  align-items:center;
  justify-content:center;
  gap:clamp(18px, 5vw, 64px);
  padding:18px 28px;
  background:rgba(10,16,30,.85);
  border-bottom:1px solid var(--border);
  width:100%;
}
.top-nav .brand{
  justify-self:center;
  font-size:1.08rem;
  font-weight:700;
  color:var(--text);
  text-decoration:none;
  letter-spacing:.03em;
}
.top-nav .brand:hover,
.top-nav .brand:focus-visible{
  text-decoration:none;
  color:var(--text);
}
.top-nav .nav-link{
  color:var(--muted);
  font-weight:600;
  letter-spacing:.02em;
  font-size:.9rem;
  padding:6px 12px;
  border-radius:8px;
  transition:color .18s ease, background .18s ease, transform .2s ease;
}
.top-nav .nav-link:hover,
.top-nav .nav-link:focus-visible{
  color:var(--text);
  background:rgba(96,165,250,.12);
  text-decoration:none;
}

.nav-link-how{
  text-align:right;
  justify-self:end;
}
.nav-link-why{
  text-align:left;
  justify-self:start;
}

@media (max-width:640px){
  .top-nav{
    grid-template-columns:auto auto auto;
    column-gap:12px;
    padding:14px 16px;
  }
  .top-nav .brand{font-size:.98rem;text-align:center;}
  .top-nav .nav-link{font-size:.85rem;}
  .nav-link-how{justify-self:end;text-align:right;}
  .nav-link-why{justify-self:start;text-align:left;}

  .container{padding:14px 12px 80px;}
  .card{padding:18px 16px;}
  .card,.accuracy{width:100%;box-sizing:border-box;margin:0 auto;}
  input,select{font-size:16px;}
}

@media (max-width:420px){
  .top-nav{padding:12px 12px;gap:8px;}
  .top-nav .nav-link{font-size:.8rem;letter-spacing:.01em;}
}

.site-header{padding:28px 16px 10px;text-align:center}
.site-header h1{margin:0;font-weight:800;letter-spacing:.2px}
.site-header .sub{margin:6px 0 0;color:var(--muted)}

.logo-wrap{display:flex;justify-content:center;margin:12px 0 4px}
.logo{max-width:245px;width:48%;height:auto;opacity:.95}

.container{max-width:980px;margin:0 auto;padding:16px;width:100%;box-sizing:border-box}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:20px;
  box-shadow:0 10px 30px rgba(0,0,0,.25);
}
.card-title{margin:0 0 10px;font-size:1.25rem}

.grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  column-gap:18px;
  row-gap:22px;
}
.grid-3{
  grid-template-columns:repeat(3,minmax(0,1fr));
  column-gap:18px;
  row-gap:22px;
  margin-top:32px;
}
@media (max-width:820px){
  .grid,.grid-3{grid-template-columns:1fr}
}

.field{display:flex;flex-direction:column;gap:6px}
.suggest-field{position:relative;margin-bottom:24px}
label{font-weight:600;color:#f3f4f6}
input,select{
  background:#0e1626;
  color:var(--text);
  border:1px solid var(--border);
  border-radius:10px;
  padding:12px 12px;
  outline:none;
  transition:border-color .12s, box-shadow .12s;
  width:100%;
  font-size:16px;
  line-height:1.4;
}
input::placeholder{color:#6b7280}
input:focus,select:focus{
  border-color:#3b82f6;
  box-shadow:0 0 0 3px rgba(59,130,246,.15)
}

.actions{margin-top:14px;display:flex;gap:10px;align-items:center}
.btn-primary{
  background:var(--brand);
  color:#07101f;
  border:1px solid transparent;
  padding:12px 16px;
  border-radius:12px;
  font-weight:700;
  cursor:pointer;
  touch-action:manipulation;
}
.btn-primary:disabled{opacity:.65;cursor:not-allowed}

.suggestions{
  position:absolute;
  top:100%;
  left:0;
  right:0;
  margin-top:4px;
  background:#0e1626;
  border:1px solid var(--border);
  border-radius:10px;
  box-shadow:0 12px 24px rgba(0,0,0,.35);
  padding:4px 0;
  max-height:240px;
  overflow-y:auto;
  z-index:80;
}
.suggestions[hidden]{display:none;}
.suggestion-item{
  width:100%;
  display:block;
  padding:10px 12px;
  cursor:pointer;
  transition:background .12s ease,color .12s ease,transform .12s ease;
  text-align:left;
  border:0;
  background:transparent;
  color:var(--text);
  border-radius:6px;
  font:inherit;
}
.suggestion-item:is(:hover,:focus){
  background:rgba(96,165,250,.15);
  outline:none;
}
.suggestion-item[aria-selected="true"]{
  background:rgba(96,165,250,.25);
  color:#fff;
}
.suggestion-item:active{
  transform:scale(.99);
}

.result{
  margin-top:16px;
  background:#091021;
  border:1px solid #193055;
  border-radius:12px;
  padding:16px;
}
.result-title{color:var(--muted);font-size:.95rem;margin-bottom:2px}
.result-value{font-size:2rem;font-weight:800}

.why-container{
  min-height:60vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:48px 16px;
}
.why-copy{
  max-width:720px;
  text-align:center;
}
.why-copy h1{
  margin-bottom:0.75rem;
  font-size:2.2rem;
  font-weight:800;
}
.why-copy .lead{
  color:var(--muted);
  margin-bottom:1.75rem;
}
.story-block{
  background:rgba(15,23,42,.65);
  border:1px solid rgba(96,165,250,.25);
  border-radius:16px;
  padding:24px;
  text-align:left;
  line-height:1.65;
}
.story-block p{
  margin:0 0 1em;
  color:var(--text);
}
.story-block p:last-child{margin-bottom:0;}
.story-block figure{
  margin:24px 0 0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.story-block img{
  width:100%;
  border-radius:12px;
  border:1px solid rgba(96,165,250,.25);
}
.story-block img.story-image-small{
  width:66%;
  align-self:center;
}
.story-block figcaption{
  font-size:.9rem;
  color:var(--muted);
}

.source-notes{
  margin-top:32px;
  text-align:left;
}
.source-notes h2{
  margin:0 0 12px;
  font-size:1.2rem;
  font-weight:700;
}
.source-notes ul{
  margin:0;
  padding-left:1.1rem;
  display:grid;
  gap:12px;
  color:var(--muted);
  overflow-wrap:break-word;
}
.source-notes li{
  line-height:1.55;
}
.source-notes a{
  color:var(--brand);
  text-decoration:underline;
}
.source-notes a:hover,
.source-notes a:focus-visible{
  text-decoration:none;
}

.site-footer{color:var(--muted);text-align:center;padding:24px 12px 36px}
.fill-note{margin-top:10px;font-size:.85rem;color:var(--muted);} .fill-note a{color:var(--brand);text-decoration:underline;}

.label-line{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.label-line label{margin:0;}

.help-tip{margin-left:12px;display:inline-flex;align-items:center;gap:6px;}
.help-tip .tip-trigger{
  padding:3px 10px;
  font-size:.8rem;
  font-weight:600;
  background:rgba(96,165,250,.1);
  color:var(--text);
  border:1px solid rgba(148,163,184,.4);
  border-radius:999px;
  cursor:pointer;
  transition:background .2s ease, color .2s ease, border-color .2s ease;
}
.help-tip .tip-trigger:hover,
.help-tip .tip-trigger:focus-visible{
  background:rgba(96,165,250,.18);
  border-color:rgba(96,165,250,.45);
  outline:none;
}
.help-tip .tip-content{max-width:24rem;}

.tip-link{
  display:inline-flex;
  align-items:center;
  margin-left:8px;
  gap:6px;
  padding-bottom:0;
  position:relative;
}
.tip-link .tip-trigger{
  font-size:.85rem;
  font-weight:600;
  padding:0;
  background:none;
  border:none;
  color:var(--brand);
  text-decoration:underline;
  cursor:pointer;
}
.tip-link .tip-trigger:hover,
.tip-link .tip-trigger:focus-visible{
  text-decoration:none;
}
.tip-link .tip-content{
  max-width:22rem;
}
.tip-link a{
  display:inline-block;
  margin-top:0.5rem;
  color:var(--brand);
  text-decoration:underline;
}

.accuracy{
  margin-top:40px;
  background:linear-gradient(145deg, rgba(17,24,39,.95), rgba(12,18,30,.92));
  border:1px solid rgba(96,165,250,.22);
  border-radius:18px;
  padding:28px;
  box-shadow:0 24px 60px rgba(0,0,0,.35);
}
.accuracy h2{
  margin:0 0 6px;
  font-size:1.6rem;
  font-weight:800;
}
.accuracy .subtitle{
  margin:0;
  color:var(--muted);
}
.accuracy .table-wrap{
  margin-top:24px;
  border:1px solid rgba(96,165,250,.18);
  border-radius:14px;
  overflow:auto;
  background:rgba(8,13,26,.88);
  backdrop-filter:blur(10px);
  -webkit-overflow-scrolling:touch;
}
#accuracy-table{
  width:100%;
  border-collapse:collapse;
  font-size:.95rem;
  font-variant-numeric:tabular-nums;
}
#accuracy-table th,
#accuracy-table td{
  padding:14px 18px;
  border-bottom:1px solid rgba(37,56,84,.65);
  text-align:right;
  white-space:nowrap;
}
#accuracy-table th:nth-child(-n+4),
#accuracy-table td:nth-child(-n+4){text-align:left;}
#accuracy-table thead th{
  text-transform:uppercase;
  font-size:.72rem;
  letter-spacing:.12em;
  background:linear-gradient(90deg, rgba(59,130,246,.22), rgba(59,130,246,.05));
  color:var(--text);
  border-bottom:1px solid rgba(96,165,250,.35);
  position:sticky;
  top:0;
  z-index:1;
}
#accuracy-table tbody tr:last-child td{border-bottom:none;}
#accuracy-table tbody tr:hover{background:rgba(96,165,250,.12);}
.accuracy .footnote{
  font-size:.85rem;
  color:var(--muted);
  text-align:left;
  padding:16px 18px;
  background:rgba(12,20,34,.8);
  overflow-wrap:anywhere;
}
.badge-up{color:var(--accent);font-weight:600;}
.badge-down{color:var(--danger);font-weight:600;}
details.sources{
  margin-top:18px;
  font-size:.92rem;
  color:var(--muted);
}
details.sources summary{
  cursor:pointer;
  font-weight:600;
  color:var(--brand);
  display:inline-flex;
  align-items:center;
  gap:8px;
}
details.sources summary::after{
  content:"";
  border:5px solid transparent;
  border-left-color:var(--brand);
  transform:rotate(0deg);
  transition:transform .18s ease;
}
details.sources[open] summary::after{transform:rotate(90deg);}
details.sources ul{margin:12px 0 0 1.2rem;padding:0;display:grid;gap:8px;}
details.sources li{list-style:disc;color:var(--text);line-height:1.5;overflow-wrap:anywhere;}

@media (max-width:768px){
  .accuracy{padding:22px;}
  #accuracy-table th,
  #accuracy-table td{padding:12px 14px;}
}

@media (max-width:560px){
  .accuracy .table-wrap{border-radius:12px;}
  #accuracy-table th,
  #accuracy-table td{padding:11px 12px;font-size:.9rem;}
  .accuracy h2{font-size:1.4rem;}
  .accuracy .subtitle{font-size:.9rem;}
}

@media (max-width:640px){
  .accuracy{padding:18px 16px;margin-top:28px;}
  .accuracy .table-wrap{overflow:visible;width:100%;box-sizing:border-box;}
  #accuracy-table,
  #accuracy-table tbody,
  #accuracy-table tr,
  #accuracy-table td{display:block;width:100%;}
  #accuracy-table thead{display:none;}
  #accuracy-table tr{
    margin-bottom:18px;
    border:1px solid rgba(37,56,84,.6);
    border-radius:12px;
    overflow:hidden;
    background:rgba(10,16,28,.85);
    box-shadow:0 12px 28px rgba(0,0,0,.35);
    box-sizing:border-box;
  }
  #accuracy-table td{
    border-bottom:1px solid rgba(37,56,84,.45);
    padding:12px 14px;
    text-align:left;
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
    box-sizing:border-box;
  }
  #accuracy-table td:last-child{border-bottom:none;}
  #accuracy-table td::before{
    content:attr(data-label);
    font-weight:600;
    color:var(--muted);
    text-transform:uppercase;
    font-size:.72rem;
    letter-spacing:.1em;
    width:100%;
  }
  #accuracy-table td.badge-up,
  #accuracy-table td.badge-down{justify-content:flex-start;gap:6px;}
  #accuracy-table td.badge-up span,
  #accuracy-table td.badge-down span{font-weight:600;}
  #accuracy-table td span{display:block;width:100%;overflow-wrap:anywhere;}
  #accuracy-table tbody tr:hover{background:rgba(10,16,28,.85);}
  #accuracy-table tfoot tr{margin-bottom:0;border:none;box-shadow:none;background:transparent;}
  #accuracy-table tfoot td{
    border:none;
    display:block;
    padding:0;
  }
  #accuracy-table tfoot td::before{display:none;}
  .accuracy .footnote{
    border-radius:12px;
    margin-top:8px;
    padding:12px 14px;
    overflow-wrap:anywhere;
  }
  .source-notes{margin-top:24px;padding:0 4px;}
  .source-notes ul{padding-left:1rem;}
}

/* Alerts */
.alert{
  border-radius:10px;
  padding:10px 12px;
  margin-bottom:10px;
  font-weight:600;
  border:1px solid transparent;
}
.alert.error{
  background:rgba(239,68,68,.12);
  color:#fecaca;
  border-color:rgba(239,68,68,.35);
}
.alert.info{
  background:rgba(96,165,250,.12);
  color:#dbeafe;
  border-color:rgba(96,165,250,.35);
}

/* Tooltip pattern */
.with-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
}
.tip-icon {
  display: inline-grid; place-items: center;
  width: 1.15em; height: 1.15em; line-height: 1;
  font-weight: 700; font-size: 0.9em;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  color:#e5e7eb;
}
.tip-content {
  position: absolute;
  left: 0;
  bottom: 100%;
  transform: translateY(-12px);
  background: #111; color: #fff; padding: 10px 12px; border-radius: 8px;
  max-width: 28rem; width: max-content; min-width: 16rem;
  font-size: 0.9rem; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none; transition: opacity .12s ease-in-out;
  z-index: 50;
}
.with-tip[data-open="true"] .tip-content,
.with-tip.tip-open .tip-content,
.with-tip .tip-icon[aria-expanded="true"] + .tip-content {
  opacity: 1; pointer-events: auto;
}
.with-tip .tip-content code { background: rgba(255,255,255,.12); padding: 0 4px; border-radius: 4px; }

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button{
  -webkit-appearance:none;
  margin:0;
}

input[type=number]{
  -moz-appearance:textfield;
}

@media (max-width:640px){
  .actions{flex-direction:column;align-items:stretch;}
  .btn-primary{width:100%;}
  .suggestions{max-height:220px;}
  .suggestion-item{padding:9px 10px;font-size:.95em;}
  .with-tip{align-items:flex-start;}
  .with-tip .tip-content{
    left:0;
    right:auto;
    transform:translateY(-12px);
    max-width:calc(100vw - 32px);
    min-width:min(18rem, calc(100vw - 32px));
    width:auto;
    padding:12px 14px;
    text-align:left;
  }
  .with-tip .tip-content::after{display:none;}
  .help-tip .tip-content,
  .tip-link .tip-content{
    left:50%;
    transform:translate(-50%, -12px);
    max-width:calc(100vw - 48px);
  }
}

.made-by .pill{
  font-size:.75rem; text-transform:uppercase; letter-spacing:.06em;
  padding:.2rem .5rem; border:1px solid var(--border);
  border-radius:999px; margin-right:.4rem; color:var(--muted);
}
.fill-help{
  margin-left:12px;
  padding:4px 10px;
  font-size:.82rem;
  font-weight:600;
  background:rgba(96,165,250,.18);
  color:var(--brand);
  border:1px solid rgba(96,165,250,.35);
  border-radius:999px;
  transition:background .2s ease, color .2s ease;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.fill-help:hover,
.fill-help:focus-visible{
  background:rgba(96,165,250,.28);
  outline:none;
  color:var(--brand);
}
