:root {
  /* Vintage Topps — aged cream paper, faded teal, tomato red */
  --bg: #ece0c8;
  --bg-glow-1: rgba(44, 131, 120, 0.08);
  --bg-glow-2: rgba(201, 58, 46, 0.08);
  --panel: #faf3e1;
  --panel-2: #f3e8cf;
  --inset: #fffbf0;
  --line: rgba(52, 42, 30, 0.15);
  --line-strong: rgba(52, 42, 30, 0.28);
  --gold: #e0a637;
  --gold-deep: #b9832a;
  --gold-soft: rgba(224, 166, 55, 0.16);
  --text: #2f2820;
  --muted: #6a5c49;
  --faint: #9b8a70;
  --green: #3f9e63;
  --green-deep: #2c7d4b;
  --red: #cf4436;
  --red-deep: #a8362b;
  --teal: #2c8378;
  --teal-deep: #1f6b61;
  --teal-soft: rgba(44, 131, 120, 0.15);
  --shadow: 0 14px 30px rgba(70, 50, 25, 0.18);
  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 9px;
  /* handwriting-note accent */
  --hand: "Caveat", "Segoe Print", cursive;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60vw 40vh at 12% -5%, var(--bg-glow-1), transparent 60%),
    radial-gradient(55vw 40vh at 92% 0%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.15rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: "Anton", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  height: 34px;
}
.brand-mark svg {
  height: 100%;
  width: auto;
  display: block;
}

.brand-accent { color: var(--gold); }

.topnav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.topnav a { color: var(--muted); transition: color 0.15s; }
.topnav a:hover { color: var(--text); }

.btn-ghost {
  padding: 0.5rem 1.05rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text) !important;
  transition: border-color 0.15s, background 0.15s;
}
.btn-ghost:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}

/* ---------- Hero ---------- */
.hero {
  max-width: 780px;
  margin: 2.5rem auto 0;
  padding: 0 1.5rem;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--gold-soft);
  border-radius: 999px;
  background: var(--gold-soft);
  margin-bottom: 1.1rem;
}

.hero h1 {
  font-family: "Anton", sans-serif;
  font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hero h1 span {
  color: var(--teal);
  text-shadow: 0 2px 0 var(--teal-deep);
}

.lede {
  max-width: 580px;
  margin: 1.1rem auto 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 2rem;
}

.hero-stats div { display: flex; flex-direction: column; align-items: center; }
.hero-stats strong {
  font-family: "Anton", sans-serif;
  font-weight: 400;
  font-size: 1.9rem;
  color: var(--text);
  line-height: 1;
}
.hero-stats span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--faint);
  margin-top: 0.35rem;
}

/* ---------- App grid ---------- */
.app {
  max-width: 1000px;
  margin: 3rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 1.5rem;
  align-items: start;
}

.panel {
  position: relative;
  background: linear-gradient(165deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow);
}

/* thin foil accent along the top edge of each panel */
.panel::before {
  content: "";
  position: absolute;
  top: -1px; left: 24px; right: 24px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--green), transparent);
  opacity: 0.7;
}

.panel--results { position: sticky; top: 1.25rem; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  margin-bottom: 1.3rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-family: "Anton", sans-serif;
  font-weight: 400;
  font-size: 1.3rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.chip {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--gold-soft);
}

/* ---------- Form ---------- */
#cardInput { display: flex; flex-direction: column; gap: 1.1rem; }

.field { display: flex; flex-direction: column; gap: 0.45rem; }

.field label { display: inline-flex; align-items: center; }
.field label,
.grades legend {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}

input,
select {
  width: 100%;
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  /* Explicit, because input and select resolve `normal` differently and the
     two controls end up a pixel apart sitting side by side. */
  line-height: 1.4;
  color: var(--text);
  padding: 0.72rem 0.9rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--inset);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--faint); }
input:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

/* Strip the native control and draw our own chevron, so the dropdown reads as
   the same paper-and-ink family as the text inputs instead of an OS widget.
   Chevron is an inline data URI — no extra request, and it inherits --muted. */
select {
  appearance: none; -webkit-appearance: none;
  cursor: pointer;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236a5c49' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 0.7rem;
}
select:hover { border-color: var(--gold); }

.grades {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.015);
}
.grades legend { padding: 0 0.5rem; }
.grades legend span { color: var(--faint); font-weight: 500; }

.grade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 0.35rem;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.85rem;
}

/* ---------- Submit button ---------- */
#btn-Submit {
  margin-top: 0.3rem;
  width: 100%;
  font-family: "Inter", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--bg);
  cursor: pointer;
  padding: 0.95rem 1rem;
  border: none;
  border-radius: var(--r-sm);
  background: linear-gradient(150deg, #ffe487, var(--gold) 48%, var(--gold-deep));
  box-shadow: 0 8px 22px rgba(245, 196, 81, 0.28);
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
#btn-Submit:hover { filter: brightness(1.05); box-shadow: 0 10px 26px rgba(245, 196, 81, 0.4); }
#btn-Submit:active { transform: translateY(2px); box-shadow: 0 4px 12px rgba(245, 196, 81, 0.3); }
#btn-Submit:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gold-soft), 0 8px 22px rgba(245, 196, 81, 0.28); }

.field-hint {
  font-size: 0.82rem;
  color: var(--faint);
  text-align: center;
}
.field-hint span { color: var(--muted); }

/* ---------- Results ---------- */
.results-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  min-height: 260px;
  text-align: center;
  color: var(--faint);
  padding: 1rem;
}
.results-empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 1.3rem;
  color: var(--gold);
  background: var(--gold-soft);
}
.results-empty p { max-width: 240px; font-size: 0.95rem; }
.results-empty strong { color: var(--muted); }

/* verdict banner (JS sets .is-good / .is-bad on #results) */
.verdict {
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.3rem;
  animation: dealIn 0.35s ease-out;
}
#results.is-good .verdict {
  background: linear-gradient(150deg, rgba(56, 229, 196, 0.16), rgba(56, 229, 196, 0.04));
  border: 1px solid rgba(56, 229, 196, 0.4);
}
#results.is-bad .verdict {
  background: linear-gradient(150deg, rgba(255, 93, 125, 0.16), rgba(255, 93, 125, 0.04));
  border: 1px solid rgba(255, 93, 125, 0.4);
}
.verdict-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.6rem;
}
#results.is-good .verdict-tag { color: var(--bg); background: var(--green); }
#results.is-bad .verdict-tag { color: #fff; background: var(--red); }
.verdict-msg {
  font-family: "Anton", sans-serif;
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
#results.is-good .verdict-msg { color: var(--green); }
#results.is-bad .verdict-msg { color: var(--red); }

/* stat rows */
.stat-grid { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 1.3rem; }
.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px dashed var(--line);
}
.stat:last-child { border-bottom: none; }
.stat-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}
.stat-value {
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}
.stat--hero {
  padding: 0.9rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: var(--r-sm);
  border-bottom: none;
  background: var(--inset);
}
.stat--hero .stat-value { font-size: 1.5rem; }
.stat--hero.pos .stat-value { color: var(--green); }
.stat--hero.neg .stat-value { color: var(--red); }

/* net-by-grade ladder */
.ladder h3 {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.6rem;
}
.ladder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 0.4rem;
}
.ladder-grade {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.5px;
}
.ladder-value { font-weight: 600; color: var(--text); }
.ladder-value.neg { color: var(--red); }

@keyframes dealIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}
.footer-brand {
  font-family: "Anton", sans-serif;
  color: var(--muted);
  letter-spacing: 1px;
}

.footer-note { flex: 1; text-align: right; min-width: 200px; }

/* support link inside the results output */

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .panel--results { position: static; }
  .topnav a:not(.btn-ghost) { display: none; }
}
@media (max-width: 480px) {
  .hero-stats { gap: 1.4rem; }
  .field-row { grid-template-columns: 1fr; }
}

/* =========================================================
   HUMAN TOUCH LAYER
   Everything below is an additive "personality" pass — grain,
   handwriting, slight tilt, washi tape, hand-drawn underline.
   Delete this whole block to return to the clean look.
   ========================================================= */

/* Subtle paper grain over the whole page — kills the flat "digital" feel */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Handwriting accents — instantly reads "a person made this" */
.hand-note {
  font-family: var(--hand);
  font-size: 1.35rem;
  line-height: 1.2;
  color: var(--red);
  transform: rotate(-1.5deg);
}
.hero .hand-note { margin-top: 1.6rem; opacity: 0.92; }

.eyebrow {
  font-family: var(--hand);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: none;
}

/* Drop the sterile foil accent bar on panels */
.panel::before { display: none; }

/* =========================================================
   VINTAGE TOPPS THEME
   Light "wax-pack" pass: flattens the glossy gradients and
   maps accents to faded teal + tomato red on aged cream.
   Delete this block to drop the vintage recolor.
   ========================================================= */

/* Flat printed panels with a card-stock border instead of gloss */
.panel {
  background: var(--panel);
  border: 2px solid var(--line-strong);
  box-shadow: 0 10px 22px rgba(70, 50, 25, 0.16);
}

/* Tri-color wordmark: Should = red, I = gold, Slab = teal (matches the mark) */
.brand-should { color: var(--red); }
.brand-i { color: var(--text); }
.brand-accent { color: var(--teal); }

.btn-ghost:hover { border-color: var(--teal); background: var(--teal-soft); }

/* Eyebrow: plain red-pen scrawl, no pill */
.eyebrow {
  padding: 0;
  border: none;
  background: none;
  color: var(--teal-deep);
}

/* Chips + small accents go teal */
.chip { color: var(--teal-deep); background: var(--teal-soft); }
.results-empty-icon { color: var(--teal-deep); background: var(--teal-soft); }

/* Inputs: warm focus ring */
input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }

/* Primary action: flat tomato "stamp" button */
#btn-Submit {
  background: var(--red);
  color: #fdf6e6;
  box-shadow: 0 4px 0 var(--red-deep);
}
#btn-Submit:hover { filter: brightness(1.04); box-shadow: 0 4px 0 var(--red-deep); }
#btn-Submit:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-deep); }
#btn-Submit:focus-visible { box-shadow: 0 4px 0 var(--red-deep), 0 0 0 3px var(--teal-soft); }

/* Verdict banners recolored to the vintage green / red */
#results.is-good .verdict {
  background: rgba(63, 158, 99, 0.13);
  border: 1px solid rgba(63, 158, 99, 0.42);
}
#results.is-bad .verdict {
  background: rgba(207, 68, 54, 0.13);
  border: 1px solid rgba(207, 68, 54, 0.42);
}
#results.is-good .verdict-tag { color: #fdf6e6; }

/* Net-by-grade rows: faint ink tint + teal grade labels */
.ladder-row { background: rgba(47, 40, 32, 0.05); }
.ladder-grade { color: var(--teal-deep); }
.stat--hero { border: 1px solid var(--line); }

/* =========================================================
   V2 REDESIGN — search grid, card verdict, grade rows
   ========================================================= */

/* --- search bar --- */
.search-bar { display: flex; gap: 0.6rem; }
.search-bar input { flex: 1; }
.search-bar button {
  flex: none;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  color: #fdf6e6;
  cursor: pointer;
  padding: 0.72rem 1.3rem;
  border: none;
  border-radius: var(--r-sm);
  background: var(--teal);
  box-shadow: 0 4px 0 var(--teal-deep);
  transition: transform 0.08s ease, filter 0.15s ease;
}
.search-bar button:hover { filter: brightness(1.05); }
.search-bar button:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--teal-deep); }

/* --- pick grid --- */
.pick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 1.1rem;
  padding: 0.15rem;
}
.pick-status {
  grid-column: 1 / -1;
  color: var(--faint);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.4rem 0.5rem;
}
.pick-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: left;
  cursor: pointer;
  padding: 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--inset);
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.pick-card:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 8px 16px rgba(70, 50, 25, 0.16); }
.pick-card.is-selected { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.pick-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(47, 40, 32, 0.05);
}
.pick-name { font-size: 0.92rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.pick-set { font-size: 0.8rem; color: var(--faint); }

/* --- assumptions --- */
.assumptions { margin-top: 1.3rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.assumptions-label {
  display: block;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.7rem;
}
.assumptions-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 0.85rem; }

/* --- manual fallback --- */
.manual-fallback { margin-top: 1.1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.manual-fallback summary {
  cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--teal-deep);
  list-style: none;
}
.manual-fallback summary::-webkit-details-marker { display: none; }
.manual-fallback summary::before { content: "＋ "; font-weight: 700; }
.manual-fallback[open] summary::before { content: "－ "; }
.manual-fallback #cardInput { margin-top: 1rem; }

/* --- verdict head (card image + verdict banner) --- */
.verdict-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1.3rem;
  animation: dealIn 0.35s ease-out;
}
#results.is-good .verdict-head { background: rgba(63, 158, 99, 0.13); border: 1px solid rgba(63, 158, 99, 0.42); }
#results.is-bad .verdict-head  { background: rgba(207, 68, 54, 0.13); border: 1px solid rgba(207, 68, 54, 0.42); }
.verdict-card-img {
  width: 150px; flex: none; border-radius: var(--r-sm);
  box-shadow: 0 6px 14px rgba(70, 50, 25, 0.22); background: var(--inset);
}
.verdict-head-text { flex: 1; }
.verdict-card-name { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 0.5rem; line-height: 1.3; }
.verdict-head .verdict-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; padding: 0.28rem 0.7rem; border-radius: 999px; margin-bottom: 0.5rem;
}
#results.is-good .verdict-head .verdict-tag { color: #fdf6e6; background: var(--green); }
#results.is-bad .verdict-head .verdict-tag  { color: #fff; background: var(--red); }
#results.is-good .verdict-msg { color: var(--green-deep); }
#results.is-bad .verdict-msg  { color: var(--red-deep); }
.verdict-raw { display: block; margin-top: 0.6rem; font-size: 0.8rem; color: var(--faint); }

/* The gem rate WITH its sample size. A percentage on its own is the thing this
   whole build exists to stop shipping. */
.gem-block {
  display: block; margin-top: 0.7rem; padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--teal); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(47, 40, 32, 0.045);
}
.gem-block--assumed { border-left-color: var(--gold-deep); }
.gem-rate { display: block; font-size: 0.95rem; font-weight: 700; color: var(--teal-deep); }
.gem-block--assumed .gem-rate { color: var(--gold-deep); }
.gem-n   { display: block; margin-top: 0.15rem; font-size: 0.78rem; color: var(--muted); }
.gem-src { display: block; margin-top: 0.25rem; font-size: 0.7rem; color: var(--faint); }

/* --- condition selector + examples dialog --- */
.help-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem; margin-left: 0.3rem; padding: 0;
  font-size: 0.68rem; font-weight: 700; line-height: 1; cursor: pointer;
  color: var(--teal-deep); background: var(--teal-soft, rgba(70,120,115,0.16));
  border: none; border-radius: 50%;
}
.help-dot:hover { background: var(--teal); color: #fff; }

.cond-dialog {
  /* inset:0 + margin:auto is what actually centres a modal <dialog> on both
     axes — the UA default only reliably centres horizontally. */
  inset: 0; margin: auto;
  max-width: 46rem; width: calc(100% - 3rem);
  max-height: 88vh; overflow-y: auto;
  padding: 1.75rem 2rem; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--inset); color: var(--text);
  box-shadow: var(--shadow);
}
.cond-dialog::backdrop { background: rgba(47, 40, 32, 0.45); }
.cond-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.cond-head h3 { margin: 0; font-size: 1.45rem; color: var(--teal-deep); }
.cond-close {
  padding: 0 0.2rem; font-size: 1.4rem; line-height: 1; cursor: pointer;
  color: var(--faint); background: none; border: none;
}
.cond-sub { margin: 0.4rem 0 1.1rem; font-size: 0.95rem; color: var(--muted); }

/* Diagram beside the checklist; stacks on narrow screens. */
.cond-body { display: flex; gap: 1.6rem; align-items: flex-start; margin-bottom: 1rem; }
.cond-art { flex: 0 0 11rem; }
.cond-svg { display: block; width: 100%; height: auto; }
.cond-body .cond-list { flex: 1; margin: 0; }
@media (max-width: 34rem) {
  .cond-dialog { padding: 1.25rem; }
  .cond-body { flex-direction: column; align-items: center; gap: 1rem; }
  .cond-art { flex: none; width: 10rem; }
}

.cond-ref { margin: 0 0 0.6rem; font-size: 0.78rem; color: var(--faint); }
.cond-ref a { color: var(--teal-deep); }

.cond-list { margin: 0 0 0.8rem; padding-left: 1.1rem; }
.cond-list li { margin-bottom: 0.5rem; font-size: 0.92rem; line-height: 1.5; color: var(--text); }
.cond-effect {
  margin: 0 0 1rem; padding: 0.7rem 0.9rem; font-size: 0.88rem; color: var(--muted);
  border-left: 3px solid var(--teal); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(47, 40, 32, 0.045);
}
.cond-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.cond-nav button {
  padding: 0.35rem 0.7rem; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  color: var(--teal-deep); background: none;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
}
.cond-nav button:disabled { opacity: 0.35; cursor: default; }
.cond-dots { display: flex; gap: 0.3rem; }
.cond-dot {
  width: 0.4rem; height: 0.4rem; border-radius: 50%;
  background: var(--line-strong);
}
.cond-dot.is-on { background: var(--teal); }
.cond-pick {
  width: 100%; margin-top: 1rem; padding: 0.65rem; cursor: pointer;
  font-size: 0.95rem; font-weight: 700; color: #fff;
  background: var(--teal); border: none; border-radius: var(--r-sm);
}

/* The confidence band. Given equal weight to the rate itself on purpose — a
   percentage without its interval is the claim this app exists to stop making. */
.gem-band {
  display: block; margin-top: 0.2rem;
  font-size: 0.78rem; font-variant-numeric: tabular-nums; color: var(--teal-deep);
}
/* What the population actually said, before any haircut. */
.gem-cut {
  display: block; margin-top: 0.1rem;
  font-size: 0.75rem; color: var(--gold-deep);
}

/* --- grade rows (price + count + net) --- */
.grade-row {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem; border-radius: var(--r-sm);
  background: rgba(47, 40, 32, 0.05); margin-bottom: 0.4rem;
}

/* The odds of landing on this rung. Deliberately as prominent as the price —
   a grade multiple means nothing without the chance of hitting it. */
.grade-odds {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem; font-weight: 700; color: var(--muted);
  min-width: 3.4em;
}

/* Everything below the bottom rung — real outcomes, not a gap. */
.grade-row--below { background: rgba(47, 40, 32, 0.03); opacity: 0.85; }
.grade-row--below .grade-tag { color: var(--faint); }

/* An interpolated price. Must never read like a measured comp. */
.est-flag {
  display: inline-block; margin-left: 0.35rem; padding: 0.05rem 0.35rem;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em;
  border-radius: 3px; cursor: help;
  color: var(--gold-deep); background: rgba(180, 140, 40, 0.14);
}
.grade-row--empty { opacity: 0.6; }
.grade-tag { font-weight: 700; font-size: 0.85rem; color: var(--teal-deep); letter-spacing: 0.5px; }
.grade-comp { font-size: 0.8rem; color: var(--muted); }
.grade-net { font-weight: 700; font-size: 0.9rem; text-align: right; white-space: nowrap; }
.grade-net.pos { color: var(--green-deep); }
.grade-net.neg { color: var(--red); }

/* --- thin data: too few sales to call it a market price --- */
.grade-row--thin { background: var(--gold-soft); }
.thin-flag {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem;
  border: 1px solid var(--gold-deep); border-radius: var(--r-sm);
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--gold-deep); vertical-align: middle;
}
.thin-note {
  margin-top: 0.7rem; padding: 0.55rem 0.7rem;
  background: var(--gold-soft); border-left: 3px solid var(--gold-deep);
  border-radius: var(--r-sm);
  font-size: 0.78rem; line-height: 1.45; color: var(--muted);
}
.thin-note strong { color: var(--gold-deep); }

@media (max-width: 480px) {
  .assumptions-row { grid-template-columns: 1fr; }
  .verdict-card-img { width: 108px; }
}

/* --- single-view flow: search OR verdict, never both --- */
.app { grid-template-columns: 1fr; max-width: min(900px, calc(100% - 3rem)); padding: 0; }
.panel--results { display: none; }
.app.viewing-verdict .panel--find { display: none; }
.app.viewing-verdict .panel--results { display: block; position: static; }

.search-again {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.2rem;
  font-family: "Inter", sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--teal-deep);
  cursor: pointer;
  padding: 0.62rem 1.15rem;
  border: 1px solid var(--teal-soft);
  border-radius: 999px;
  background: var(--teal-soft);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.search-again:hover {
  border-color: var(--teal);
  background: rgba(44, 131, 120, 0.2);
  transform: translateY(-1px);
}

/* --- free-tier demo disclosure --- */
/* Teal, not warning-gold. This used to apologise for averaged prices and mixed
   parallels — both fixed by the provider migration — so it now reads as guidance
   rather than a caveat, and shouldn't wear the warning colour. */
.search-note {
  margin-top: 0.8rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  background: var(--teal-soft);
  border-left: 3px solid var(--teal);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 0.6rem 0.8rem;
}
.search-note strong { color: var(--teal-deep); }
