:root {
  --pp-cream: #faf3e3;
  --pp-ink: #1c1c1c;
  --pp-muted: #6b5f5e;
  --pp-line: rgba(28, 28, 28, 0.12);
  --pp-orange: #f2a154;
  --pp-peach: #f6a98a;
  --pp-teal: #b5d857;
  --pp-red: #cf4520;
  --pp-gold: #e3a72e;
  --pp-panel: #fffdf8;
  --pp-panel-2: #f3ebda;
  --pp-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pp-display: "Fraunces", Georgia, serif;
  --pp-mono: "DM Mono", ui-monospace, monospace;
  --pp-radius: 18px;
  --pp-nav-h: 58px;
  --pp-rail-w: 260px;
  --pp-builder-w: 300px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--pp-cream);
  color: var(--pp-ink);
  font-family: var(--pp-font);
  font-size: 15px;
  line-height: 1.45;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(242, 161, 84, 0.22), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(181, 216, 87, 0.18), transparent 50%),
    linear-gradient(180deg, #f7efe0 0%, var(--pp-cream) 40%, #f4ead6 100%);
}

@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

a { color: var(--pp-red); }
.serif { font-family: var(--pp-display); font-weight: 600; }
.mono { font-family: var(--pp-mono); }

.pp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1.5px solid var(--pp-line);
  backdrop-filter: blur(8px);
  background: rgba(250, 243, 227, 0.92);
  position: sticky;
  top: 0;
  z-index: 20;
}

.pp-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pp-nav-logo,
.pp-nav-section {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--pp-ink);
}

.pp-nav-logo {
  font-family: var(--pp-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.65;
}

.pp-nav-logo:hover { opacity: 1; }

.pp-nav-section {
  font-family: var(--pp-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.pp-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--pp-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.pp-nav-links a {
  color: var(--pp-ink);
  text-decoration: none;
  opacity: 0.55;
  min-height: 44px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
}

.pp-nav-links a:hover { opacity: 1; }

/* ── App shell: fixed question rail, scrolling work area ─ */

.pp-app {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 40px;
  padding-bottom: max(40px, calc(20px + env(safe-area-inset-bottom)));
  display: grid;
  grid-template-columns: var(--pp-rail-w) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* The rail owns its own scroll so the question list can be long without
   pushing the query and its answer off the screen. */
.pp-rail {
  position: sticky;
  top: calc(var(--pp-nav-h) + 12px);
  max-height: calc(100vh - var(--pp-nav-h) - 26px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1.5px solid var(--pp-ink);
  border-radius: var(--pp-radius);
  background: var(--pp-panel);
  padding: 16px 14px 0;
}

/* Sprocket seam between the rail and the work area — the film-strip edge
   the panels used to carry, kept where it doesn't crowd the content. */
.pp-rail::after {
  content: "";
  position: absolute;
  top: var(--pp-radius);
  bottom: var(--pp-radius);
  right: 0;
  width: 9px;
  background:
    repeating-linear-gradient(
      to bottom,
      var(--pp-ink) 0 10px,
      transparent 10px 18px
    );
  opacity: 0.12;
  pointer-events: none;
}

.pp-rail-head { flex: 0 0 auto; }

.pp-rail-questions {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 -14px;
  padding: 0 14px 14px;
}

.pp-rail-heading {
  font-family: var(--pp-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pp-muted);
  margin: 14px 0 8px;
  position: sticky;
  top: 0;
  background: var(--pp-panel);
  padding: 4px 0;
  z-index: 2;
}

.pp-work { min-width: 0; }

.pp-work-heading {
  font-family: var(--pp-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pp-muted);
  margin: 0 0 8px;
}

.pp-results-col { min-width: 0; }



.pp-kicker {
  font-family: var(--pp-mono);
  font-size: 0.58rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--pp-muted);
  margin: 0 0 6px;
}

.pp-brand {
  font-family: var(--pp-display);
  font-size: 1.9rem;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.pp-lede {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--pp-muted);
  margin: 0 0 12px;
}

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

.pp-btn {
  appearance: none;
  border: 1.5px solid var(--pp-ink);
  background: var(--pp-ink);
  color: var(--pp-cream);
  font-family: var(--pp-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 12px 16px;
  min-height: 44px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.pp-btn--sm {
  font-size: 0.64rem;
  padding: 8px 12px;
  min-height: 36px;
}

.pp-btn:hover { transform: translateY(-2px); }
.pp-btn--ghost {
  background: transparent;
  color: var(--pp-ink);
}


.pp-featured {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.pp-feature {
  border: 1.5px solid var(--pp-ink);
  border-radius: 10px;
  padding: 9px 11px;
  text-align: left;
  cursor: pointer;
  background: var(--pp-panel);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
  -webkit-tap-highlight-color: transparent;
}

.pp-feature:hover {
  transform: translateX(2px);
  box-shadow: -3px 3px 0 rgba(28, 28, 28, 0.12);
}

/* The generated spec line is useful beside a wide card, but in a narrow rail
   it buries the question. The provenance panel carries it after a run. */
.pp-feature .pp-feature-meta { display: none; }

.pp-feature[data-accent="orange"] { background: color-mix(in srgb, var(--pp-orange) 55%, white); }
.pp-feature[data-accent="teal"] { background: color-mix(in srgb, var(--pp-teal) 50%, white); }
.pp-feature[data-accent="red"] { background: color-mix(in srgb, var(--pp-red) 42%, white); color: #2a120c; }
.pp-feature[data-accent="peach"] { background: color-mix(in srgb, var(--pp-peach) 60%, white); }

.pp-feature-title {
  font-family: var(--pp-display);
  font-size: 0.92rem;
  line-height: 1.2;
  margin: 0;
}

.pp-feature-blurb {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.75;
}

.pp-feature-meta {
  font-family: var(--pp-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
}

.pp-explorer-grid {
  display: grid;
  grid-template-columns: var(--pp-builder-w) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}


/* ── Builder form ──────────────────────────────────────── */

.pp-builder { min-width: 0; }

.pp-fieldset {
  border: 1.5px solid var(--pp-line);
  border-radius: 12px;
  padding: 10px 12px 4px;
  margin: 0 0 10px;
  background: rgba(255, 255, 255, 0.45);
}

.pp-fieldset legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--pp-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 6px;
  color: var(--pp-ink);
}

.pp-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--pp-ink);
  color: var(--pp-cream);
  font-size: 0.6rem;
}

.pp-optional {
  font-size: 0.58rem;
  color: var(--pp-muted);
  letter-spacing: 0.06em;
}

.pp-fieldset .pp-field:last-child { margin-bottom: 0; }

.pp-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pp-filter-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.pp-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 0.9fr) 36px;
  gap: 6px;
  align-items: center;
}

.pp-filter-row select,
.pp-filter-row input {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--pp-line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  min-height: 44px;
  font: inherit;
  font-size: 16px;
  color: var(--pp-ink);
}

.pp-filter-row [data-role="remove"] {
  border: 1.5px solid var(--pp-line);
  border-radius: 10px;
  background: #fff;
  min-height: 44px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--pp-red);
}

.pp-filter-empty {
  margin: 0 0 10px;
  font-family: var(--pp-mono);
  font-size: 0.66rem;
  color: var(--pp-muted);
}

.pp-btn--sm {
  font-size: 0.64rem;
  padding: 8px 12px;
  min-height: 40px;
}

.pp-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

#spec-preview {
  border-left: 2px solid var(--pp-orange);
  padding-left: 10px;
  color: var(--pp-ink);
}

.pp-provenance-note {
  margin: 10px 0 0;
  font-family: var(--pp-mono);
  font-size: 0.64rem;
  line-height: 1.5;
  color: var(--pp-muted);
  border-top: 1px solid var(--pp-line);
  padding-top: 10px;
}

.pp-prov-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pp-field { margin-bottom: 10px; }

/* A checkbox reads as a sentence, not as a labelled control above a box.
   Selectors are doubled up because the generic `.pp-field input` rule below
   is equally specific and later in the file — it would otherwise stretch the
   box to full width and 40px tall. */
.pp-field.pp-field--check label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--pp-font);
  font-size: 0.78rem;
  color: var(--pp-ink);
  cursor: pointer;
}

.pp-field.pp-field--check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  flex: 0 0 auto;
  accent-color: var(--pp-red);
  margin: 0;
  padding: 0;
  border-radius: 4px;
}
.pp-field label {
  display: block;
  font-family: var(--pp-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pp-muted);
  margin-bottom: 4px;
}

.pp-field select,
.pp-field input {
  width: 100%;
  border: 1.5px solid var(--pp-ink);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  min-height: 40px;
  font: inherit;
  font-size: 16px; /* prevents iOS focus zoom */
  color: var(--pp-ink);
}

.pp-field select:focus,
.pp-field input:focus {
  outline: 2px solid color-mix(in srgb, var(--pp-orange) 70%, var(--pp-ink));
  outline-offset: 1px;
}

.pp-search-wrap { position: relative; }

.pp-suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1.5px solid var(--pp-ink);
  border-radius: 12px;
  /* Twelve results is taller than the panel, so the list scrolls itself
     rather than running off the bottom of the page. */
  max-height: min(320px, 50vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 20;
  box-shadow: 0 14px 30px rgba(28, 28, 28, 0.12);
  display: none;
}

.pp-suggest.open { display: block; }

/* Options, not buttons: the list is an ARIA listbox driven by arrow keys and
   `aria-activedescendant`, so the highlight follows `.active` rather than
   :hover or :focus. */
.pp-suggest [role="option"] {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--pp-line);
  background: #fff;
  text-align: left;
  padding: 12px;
  min-height: 56px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  font: inherit;
}

.pp-suggest [role="option"]:last-child { border-bottom: 0; }
.pp-suggest [role="option"]:hover,
.pp-suggest [role="option"].active { background: var(--pp-panel-2); }

.pp-suggest-error {
  padding: 12px;
  font-size: 0.78rem;
  color: var(--pp-red);
}

.pp-suggest img,
.pp-avatar {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--pp-panel-2);
  flex-shrink: 0;
}

.pp-suggest-name { font-weight: 600; display: block; }
.pp-suggest-meta {
  font-family: var(--pp-mono);
  font-size: 0.62rem;
  color: var(--pp-muted);
}

.pp-selected {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 12px;
  background: var(--pp-panel-2);
  margin-bottom: 14px;
  min-height: 74px;
}

.pp-selected.empty {
  color: var(--pp-muted);
  font-family: var(--pp-mono);
  font-size: 0.72rem;
}

.pp-run-note {
  font-family: var(--pp-mono);
  font-size: 0.62rem;
  color: var(--pp-muted);
  margin: 10px 0 0;
  line-height: 1.5;
}

.pp-results-pane { min-width: 0; }

.pp-provenance {
  border: 1.5px solid var(--pp-ink);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(242, 161, 84, 0.16), transparent 45%),
    var(--pp-panel);
  padding: 13px 15px;
  margin-bottom: 10px;
}

.pp-provenance h3 {
  font-family: var(--pp-display);
  font-size: 1.35rem;
  margin: 0 0 8px;
  line-height: 1.15;
}

.pp-provenance-desc {
  margin: 0 0 12px;
  color: var(--pp-muted);
  font-size: 0.9rem;
}

.pp-prov-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}


.pp-prov-item dt {
  font-family: var(--pp-mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pp-muted);
}

.pp-prov-item dd {
  margin: 2px 0 0;
  font-size: 0.88rem;
}

.pp-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pp-stat {
  border: 1.5px solid var(--pp-line);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.55);
  font-family: var(--pp-mono);
  font-size: 0.68rem;
}

.pp-stat strong { font-family: var(--pp-display); font-size: 0.95rem; margin-right: 4px; }

.pp-status {
  padding: 28px 8px;
  color: var(--pp-muted);
  font-family: var(--pp-mono);
  font-size: 0.78rem;
}

.pp-status.error { color: var(--pp-red); }

.pp-rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pp-rank-item {
  display: grid;
  grid-template-columns: 30px 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1.5px solid var(--pp-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
  animation: pp-rise 0.45s ease both;
}

.pp-rank-item:nth-child(1) { animation-delay: 0.02s; }
.pp-rank-item:nth-child(2) { animation-delay: 0.05s; }
.pp-rank-item:nth-child(3) { animation-delay: 0.08s; }
.pp-rank-item:nth-child(4) { animation-delay: 0.11s; }
.pp-rank-item:nth-child(5) { animation-delay: 0.14s; }

.pp-rank-num {
  font-family: var(--pp-display);
  font-size: 1.35rem;
  text-align: center;
}

.pp-rank-name {
  font-weight: 650;
  margin: 0 0 4px;
}

.pp-rank-meta {
  font-family: var(--pp-mono);
  font-size: 0.62rem;
  color: var(--pp-muted);
}

.pp-metric {
  font-family: var(--pp-display);
  font-size: 1.4rem;
  text-align: right;
}

.pp-metric span {
  display: block;
  font-family: var(--pp-mono);
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pp-muted);
}

/* The value the row was actually sorted on, shown whenever it differs from
   the displayed one — otherwise a confidence-weighted list looks mis-sorted. */
.pp-metric-weighted {
  margin-top: 2px;
  text-transform: none !important;
  letter-spacing: 0 !important;
  opacity: 0.75;
}

.pp-film-strip {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-top: 6px;
  grid-column: 2 / -1;
}

.pp-film-chip {
  flex: 0 0 auto;
  width: 36px;
}

/* Posters carry intrinsic width/height attributes for layout stability;
   let the chip width win so the strip can tighten. */
.pp-film-chip img,
.pp-film-chip > span {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 2 / 3;
}

.pp-film-chip img {
  width: 42px;
  height: 63px;
  object-fit: cover;
  border-radius: 5px;
  background: var(--pp-panel-2);
  display: block;
}

.pp-film-chip figcaption {
  font-family: var(--pp-mono);
  font-size: 0.5rem;
  color: var(--pp-muted);
  margin-top: 3px;
  max-width: 42px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pp-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1.5px solid var(--pp-line);
  font-family: var(--pp-mono);
  font-size: 0.62rem;
  color: var(--pp-muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

.pp-footer a { color: inherit; }

/* ── The question composer ─────────────────────────────── */

.pp-ask {
  flex: 0 0 auto;
  padding: 11px 12px;
  border: 1.5px solid var(--pp-ink);
  border-radius: 12px;
  background: var(--pp-panel-2);
}

.pp-ask-label {
  display: block;
  font-family: var(--pp-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--pp-muted);
  margin-bottom: 6px;
}

.pp-ask select {
  width: 100%;
  font: inherit;
  font-size: 0.78rem;
  padding: 8px 10px;
  border: 1.5px solid var(--pp-line);
  border-radius: 10px;
  background: var(--pp-cream);
  color: var(--pp-ink);
}

.pp-ask-question {
  font-family: var(--pp-display);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.25;
  margin: 9px 0 0;
}

/* The variable inside the sentence: reads as text, behaves as a control. */
.pp-slot {
  font: inherit;
  color: var(--pp-red);
  background: color-mix(in srgb, var(--pp-orange) 26%, transparent);
  border: 0;
  border-bottom: 2px dashed currentColor;
  border-radius: 6px 6px 0 0;
  padding: 0 4px;
  cursor: pointer;
}

.pp-slot:hover,
.pp-slot:focus-visible { background: color-mix(in srgb, var(--pp-orange) 46%, transparent); }

.pp-ask-search { margin-top: 12px; }

.pp-ask-search input {
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS focus zoom */
  padding: 10px 12px;
  border: 1.5px solid var(--pp-ink);
  border-radius: 10px;
  background: #fff;
  color: var(--pp-ink);
}

/* These sit outside .pp-field, so without this they get the browser's
   default blue focus ring instead of the page's. */
.pp-ask select:focus,
.pp-ask input:focus {
  outline: 2px solid color-mix(in srgb, var(--pp-orange) 70%, var(--pp-ink));
  outline-offset: 1px;
}

.pp-ask .pp-cta-row { margin-top: 10px; gap: 6px; }

/* ── Question gallery ──────────────────────────────────── */

.pp-question-groups {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pp-question-group-title {
  font-family: var(--pp-mono);
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pp-muted);
  margin: 0 0 5px;
  opacity: 0.8;
}

/* ── Findings ──────────────────────────────────────────── */

.pp-findings {
  margin: 12px 0 4px;
  padding: 11px 14px;
  border-left: 3px solid var(--pp-red);
  background: var(--pp-panel-2);
  border-radius: 0 12px 12px 0;
}

.pp-finding {
  margin: 0 0 6px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.pp-finding:last-child { margin-bottom: 0; }

.pp-finding--lead {
  font-family: var(--pp-display);
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.35;
}

/* ── Distance from the film-set baseline ───────────────── */

.pp-delta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.pp-delta-track {
  flex: 1;
  min-width: 40px;
  max-width: 120px;
  height: 4px;
  border-radius: 2px;
  background: var(--pp-panel-2);
  overflow: hidden;
}

.pp-delta-bar {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--pp-muted);
}

.pp-delta-bar[data-sign="up"] { background: var(--pp-teal); }
.pp-delta-bar[data-sign="down"] { background: var(--pp-red); }

.pp-delta-label {
  font-family: var(--pp-mono);
  font-size: 0.6rem;
  color: var(--pp-muted);
  white-space: nowrap;
}

/* ── Misc form + provenance ────────────────────────────── */

.pp-field-hint {
  margin: 4px 0 0;
  font-size: 0.66rem;
  line-height: 1.35;
  color: var(--pp-muted);
}

.pp-prov-details { margin-top: 10px; }

.pp-prov-details > summary {
  cursor: pointer;
  font-family: var(--pp-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pp-muted);
  padding: 4px 0;
}

.pp-prov-details > summary:hover { color: var(--pp-ink); }
.pp-prov-details .pp-prov-grid { margin-top: 10px; }

@keyframes pp-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ── Narrower desktop: shrink the rail before stacking ── */
@media (max-width: 1240px) {
  :root { --pp-rail-w: 230px; --pp-builder-w: 280px; }
}

/* ── Tablet: builder above results, rail still beside ─── */
@media (max-width: 1080px) {
  .pp-explorer-grid { grid-template-columns: 1fr; }
}

/* ── Stack the rail on top and let the page scroll as one ── */
@media (max-width: 860px) {
  .pp-app {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .pp-rail {
    position: static;
    max-height: none;
    padding: 16px 14px;
  }

  .pp-rail::after { display: none; }

  .pp-rail-questions {
    overflow-y: visible;
    max-height: none;
    padding-bottom: 0;
  }

  .pp-rail-heading { position: static; }

  /* With full width available the cards can breathe again. */
  .pp-featured { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pp-brand { font-size: 2.2rem; }
  .pp-lede { font-size: 0.9rem; }
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 720px) {
  .pp-app {
    width: calc(100% - 20px);
    padding-top: 12px;
  }

  .pp-nav {
    padding-left: 12px;
    padding-right: 8px;
    gap: 8px;
  }

  .pp-nav-brand { gap: 8px; }
  .pp-nav-logo-text { display: none; }
  .pp-nav-section {
    font-size: 1.05rem;
    gap: 6px;
  }
  .pp-nav-section img { width: 20px; height: 20px; }

  .pp-nav-links {
    gap: 0;
    font-size: 0.64rem;
  }
  .pp-nav-links a {
    padding: 0 8px;
    min-width: 44px;
    justify-content: center;
  }

  .pp-rail { padding: 18px 14px; }

  .pp-brand {
    font-size: clamp(2rem, 10vw, 2.6rem);
    margin-bottom: 10px;
  }

  .pp-lede {
    font-size: 0.92rem;
    margin-bottom: 14px;
  }

  .pp-cta-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pp-btn { width: 100%; }

  .pp-featured {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .pp-feature { padding: 12px 13px; }
  .pp-feature-title { font-size: 1.02rem; }
  .pp-feature-blurb { font-size: 0.82rem; }

  .pp-field label {
    font-size: 0.68rem;
    margin-bottom: 7px;
  }

  .pp-run-note { font-size: 0.68rem; }

  .pp-selected.empty { font-size: 0.78rem; }

  .pp-fieldset { padding: 12px 12px 14px; }
  .pp-fieldset legend { font-size: 0.68rem; }

  /* Stacked so the three filter controls stay tappable on narrow screens. */
  .pp-filter-row {
    grid-template-columns: minmax(0, 1fr) 40px;
    grid-template-areas:
      "field remove"
      "op    op"
      "value value";
    gap: 6px;
    padding: 10px;
    border: 1.5px solid var(--pp-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
  }

  .pp-filter-row [data-role="field"] { grid-area: field; }
  .pp-filter-row [data-role="op"] { grid-area: op; }
  .pp-filter-row [data-role="value"] { grid-area: value; }
  .pp-filter-row [data-role="remove"] { grid-area: remove; }

  .pp-filter-empty { font-size: 0.72rem; }

  #run-query { width: 100%; margin-top: 2px; }

  .pp-results-pane { margin-top: 4px; }

  .pp-provenance {
    padding: 14px;
    border-radius: 12px;
  }

  .pp-provenance h3 { font-size: 1.15rem; }

  .pp-prov-grid { grid-template-columns: 1fr; }

  .pp-prov-item dt { font-size: 0.62rem; }
  .pp-prov-item dd { font-size: 0.92rem; }

  .pp-stats { gap: 6px; }
  .pp-stat {
    font-size: 0.72rem;
    padding: 7px 11px;
  }

  .pp-rank-item {
    grid-template-columns: 28px 40px minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding: 12px 10px;
    align-items: start;
  }

  .pp-rank-num {
    font-size: 1.15rem;
    padding-top: 8px;
  }

  .pp-rank-item .pp-avatar {
    width: 40px;
    height: 60px;
    margin-top: 2px;
  }

  .pp-rank-name { font-size: 0.98rem; }
  .pp-rank-meta { font-size: 0.68rem; }

  .pp-metric {
    font-size: 1.2rem;
    padding-top: 4px;
  }

  .pp-film-strip {
    grid-column: 1 / -1;
    padding-top: 4px;
    margin: 0 -2px;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  .pp-film-chip { scroll-snap-align: start; }

  .pp-footer {
    flex-direction: column;
    gap: 6px;
    font-size: 0.68rem;
  }
}

@media (max-width: 380px) {
  .pp-nav-links a:last-child { display: none; }
  .pp-brand { font-size: 2.2rem; }
}
