/* Prompt Autopsy — clinical report styling. No web fonts, no images, no requests. */

:root {
  --bg: #0a0a0b;
  --surface: #111114;
  --surface-2: #17171b;
  --line: #26262c;
  --line-2: #34343d;
  --ink: #f4f4f2;
  --ink-dim: #a4a4ad;
  --ink-faint: #6d6d77;
  --accent: #ff4d1c;
  --accent-soft: #ff7a4d;
  --data: #c8ff2f;
  --warn: #ffb020;
  --good: #6ee7a8;
  --radius: 3px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  background-image:
    radial-gradient(900px 600px at 12% -10%, rgba(255, 77, 28, 0.10), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(200, 255, 47, 0.05), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 44px);
  background-attachment: fixed;
}

main { max-width: 1060px; margin: 0 auto; padding: 0 20px 80px; }

a { color: var(--accent-soft); }
code { font-family: var(--mono); font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 2px; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
/* Narrowest phones: shrink both halves rather than let the flex row push the
   document wider than the viewport. */
@media (max-width: 400px) {
  .topbar { padding: 10px 14px; gap: 8px; }
  .wordmark { font-size: 11px; letter-spacing: 0.1em; gap: 6px; }
  .wordmark .mark { font-size: 13px; }
  .privacy-badge { font-size: 10px; padding: 3px 8px; }
}
.wordmark {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; font-weight: 700;
}
.wordmark .mark { color: var(--accent); font-size: 15px; }
.privacy-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--ink-dim); border: 1px solid var(--line-2); border-radius: 999px;
  padding: 4px 10px; white-space: nowrap;
}
.privacy-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 8px currentColor; }
.privacy-badge.ok .dot { background: var(--good); }
.privacy-badge.bad .dot { background: var(--accent); }
/* Exactly one suffix is visible at any width. Doing this in CSS rather than by
   measuring the viewport in JS keeps the badge from ever forcing the sticky
   header — and therefore the whole document — wider than the screen. */
.privacy-badge .suffix { display: none; }
.privacy-badge .s-long { display: inline; }
@media (max-width: 699px) {
  .privacy-badge .s-long { display: none; }
  .privacy-badge .s-mid { display: inline; }
}
@media (max-width: 399px) {
  .privacy-badge .s-mid { display: none; }
  .privacy-badge .s-short { display: inline; }
}

/* ---------- hero ---------- */

.hero { padding: 64px 0 40px; }
.kicker {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 18px;
}
h1 {
  margin: 0 0 20px;
  font-size: clamp(2.5rem, 8.5vw, 4.6rem);
  line-height: 0.94; letter-spacing: -0.035em; font-weight: 800;
}
h1 em { font-style: normal; color: var(--accent); position: relative; }
h1 em::after {
  content: ""; position: absolute; left: -2px; right: -2px; bottom: 0.06em; height: 0.08em;
  background: var(--accent); opacity: 0.4;
}
.lede { font-size: 1.06rem; color: var(--ink-dim); max-width: 62ch; margin: 0 0 14px; }
.lede.small { font-size: 0.92rem; color: var(--ink-faint); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

/* ---------- buttons ---------- */

.btn {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase;
  font-weight: 700; padding: 12px 18px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { border-color: var(--ink-faint); background: #1d1d22; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #170601; }
.btn.primary:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.btn.ghost { background: transparent; }
.btn:focus-visible, .linkbtn:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid var(--data); outline-offset: 2px;
}
.linkbtn {
  background: none; border: 0; padding: 0; color: var(--accent-soft); cursor: pointer;
  font: inherit; font-size: 0.88rem; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- panels ---------- */

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), #0e0e11);
  border-radius: var(--radius);
  padding: 26px 24px;
  margin: 0 0 22px;
}
.panel h2 {
  margin: 0 0 14px;
  font-size: clamp(1.15rem, 3.4vw, 1.5rem); letter-spacing: -0.02em; font-weight: 800;
  display: flex; align-items: baseline; gap: 12px;
}
.panel h2 .num {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; color: var(--accent);
  border: 1px solid var(--line-2); border-radius: 2px; padding: 3px 7px;
}
.panel h4 {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--data); margin: 22px 0 8px;
}
.panel h4:first-child { margin-top: 0; }
.panel p { margin: 0 0 12px; }
.hint { color: var(--ink-faint); font-size: 0.92rem; max-width: 74ch; }
.hint.tiny { font-size: 0.78rem; }
.two-col { display: grid; gap: 8px 34px; }
/* Grid and flex children default to min-width:auto, so the nowrap cells in the
   saturation table forced this column wider than the viewport and gave the
   whole page a horizontal scrollbar on 360px phones. */
.two-col > * { min-width: 0; }
@media (min-width: 760px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* ---------- input ---------- */

.drop { position: relative; margin: 18px 0 14px; }
textarea {
  width: 100%; min-height: 210px; resize: vertical;
  background: #08080a; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 16px; font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
}
textarea::placeholder { color: #4d4d57; }
.drop.over textarea { border-color: var(--accent); }
.drop-overlay {
  position: absolute; inset: 0; display: none; place-items: center;
  background: rgba(255, 77, 28, 0.10); border: 2px dashed var(--accent); border-radius: var(--radius);
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-soft); pointer-events: none;
}
.drop.over .drop-overlay { display: grid; }

/* ---------- notice ---------- */

.notice {
  margin: 14px 0 0; padding: 11px 14px;
  border: 1px solid var(--line-2); border-left: 3px solid var(--warn);
  border-radius: var(--radius); background: #0c0c0f;
  font-size: 0.88rem; color: var(--ink-dim);
}
.notice.bad { border-left-color: var(--accent); color: var(--ink); }

.warn-hint { border-left: 2px solid var(--warn); padding-left: 12px; color: var(--ink-dim); }

.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--ink-dim); cursor: pointer; }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.sample-row { font-size: 0.85rem; color: var(--ink-faint); display: inline-flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- detection ---------- */

.detect { margin-top: 18px; border-top: 1px dashed var(--line-2); padding-top: 16px; }
.detect-head {
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: baseline;
  font-family: var(--mono); font-size: 12.5px; margin-bottom: 12px;
}
.detect-head b { color: var(--data); font-size: 15px; }
.detect-head .warn { color: var(--warn); }
.turnlist { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #08080a; }
.turn {
  display: grid; grid-template-columns: 78px 1fr; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid #16161a; font-size: 12.5px; font-family: var(--mono);
}
.turn:last-child { border-bottom: 0; }
.turn .role { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }
.turn.mine { background: rgba(255, 77, 28, 0.05); }
.turn.mine .role { color: var(--accent); }
.turn .body { color: var(--ink-dim); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- verdict ---------- */

.verdict-wrap { display: grid; gap: 20px; }
@media (min-width: 880px) { .verdict-wrap { grid-template-columns: 1.55fr 1fr; } }
.verdict {
  position: relative; border: 1px solid var(--line-2); border-left: 4px solid var(--accent);
  background: #0c0c0f; border-radius: var(--radius); padding: 26px 24px 22px;
  overflow: hidden;
}
.verdict-emoji { font-size: 46px; line-height: 1; }
.verdict h3 {
  margin: 10px 0 6px; font-size: clamp(1.7rem, 5.6vw, 2.6rem); line-height: 1;
  letter-spacing: -0.035em; font-weight: 800;
}
.verdict .tagline { color: var(--data); font-family: var(--mono); font-size: 0.9rem; margin: 0 0 16px; }
.verdict .blurb { color: var(--ink-dim); font-size: 0.98rem; margin: 0 0 18px; max-width: 52ch; }
.verdict .rel {
  margin: 0; padding-top: 14px; border-top: 1px dashed var(--line-2);
  font-size: 1rem; color: var(--ink);
}
.verdict .rel::before {
  content: "RELATIONSHIP STATUS"; display: block; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.16em; color: var(--ink-faint); margin-bottom: 6px;
}
.verdict .runnerup { color: var(--ink-faint); margin: 14px 0 0; font-family: var(--mono); font-size: 11.5px; }
.stamp {
  position: absolute; top: 14px; right: -6px; transform: rotate(6deg);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); border: 1.5px solid var(--accent); border-radius: 2px; padding: 4px 10px;
  opacity: 0.85;
}

.headline { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; align-content: start; }
.headline .cell { background: #0c0c0f; padding: 16px 14px; }
.headline .k { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.headline .v { font-size: clamp(1.4rem, 4.4vw, 1.9rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; margin-top: 4px; }
.headline .v.small { font-size: 1rem; font-weight: 600; letter-spacing: 0; }

/* ---------- metrics ---------- */

.metrics { list-style: none; margin: 4px 0 0; padding: 0; }
.metric { padding: 18px 0; border-bottom: 1px solid var(--line); }
.metric:last-child { border-bottom: 0; }
.metric-top { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; }
.metric-name { font-weight: 700; letter-spacing: -0.01em; }
.metric-val { font-family: var(--mono); font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.metric-val .of { font-size: 0.6em; color: var(--ink-faint); }
.metric-stat { font-family: var(--mono); font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; }
.bar { height: 7px; background: #1a1a1f; border-radius: 4px; margin: 11px 0 12px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--warn)); border-radius: 4px; transition: width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
.metric.hot .bar i { background: linear-gradient(90deg, var(--accent), #ff2d55); }
.metric.cool .bar i { background: linear-gradient(90deg, #4b8f6b, var(--good)); }
.metric-evidence { color: var(--ink-dim); font-size: 0.94rem; margin: 0; }
.metric-joke { color: var(--ink); font-size: 0.94rem; margin: 8px 0 0; padding-left: 14px; border-left: 2px solid var(--line-2); }

/* ---------- exhibits ---------- */

.exhibits { display: grid; gap: 16px; }
@media (min-width: 820px) { .exhibits { grid-template-columns: 1fr 1fr; } }
.exhibit { border: 1px solid var(--line-2); background: #0c0c0f; border-radius: var(--radius); padding: 18px; }
.exhibit h5 {
  margin: 0 0 10px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent);
}
.exhibit blockquote {
  margin: 0; font-family: var(--mono); font-size: 13.5px; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 190px; overflow: auto;
}
.exhibit .note { font-size: 0.86rem; color: var(--ink-faint); margin: 12px 0 0; }

/* ---------- saturation table ---------- */

.sat { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 0.86rem; }
.sat th, .sat td { text-align: left; padding: 7px 10px 7px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; overflow-wrap: anywhere; }
.sat th { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }
.sat td.axis { color: var(--ink); font-weight: 600; white-space: nowrap; }
.sat td.num { font-family: var(--mono); color: var(--data); white-space: nowrap; }
/* Below the two-column breakpoint the table gets a third of a phone's width,
   so nowrap axis names would push the panel past the viewport. */
@media (max-width: 759px) {
  .sat td.axis, .sat td.num { white-space: normal; }
}
.sat td.unit { color: var(--ink-faint); }
.sat tr:last-child td { border-bottom: 0; }
.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;
}

/* ---------- share ---------- */

.share-grid { display: grid; gap: 20px; margin-top: 18px; }
@media (min-width: 900px) { .share-grid { grid-template-columns: 1.6fr 1fr; align-items: start; } }
#cardCanvas {
  width: 100%; height: auto; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: #08080a; display: block;
}
.share-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.share-actions .btn { justify-content: center; }

/* ---------- gallery ---------- */

.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-top: 16px; }
.gcard { border: 1px solid var(--line); background: #0c0c0f; border-radius: var(--radius); padding: 15px; }
.gcard .ge { font-size: 24px; }
.gcard .gn { font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.01em; font-size: 0.98rem; }
.gcard .gt { font-size: 0.82rem; color: var(--ink-faint); font-family: var(--mono); }
.gcard.you { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.gcard.you .gn::after { content: " — you"; color: var(--accent); }

/* ---------- footer ---------- */

footer { padding: 30px 0 0; color: var(--ink-faint); font-size: 0.88rem; max-width: 76ch; }
footer strong { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar i { transition: none; }
  .stamp { transform: none; }
}
