:root {
  color-scheme: light;
  --background: #f4f5f7;
  --surface: #fff;
  --ink: #17212e;
  --muted: #505d6e;
  --line: #dbe1e8;
  --accent: #184f84;
  --accent-hover: #133e69;
  --accent-soft: #e7eff9;
  font: 16px/1.5 system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}

:root[data-brand="general-assembly"] {
  --accent: #a51d2d;
  --accent-hover: #821324;
  --accent-soft: #fae8e9;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p { margin: 0; }
.wrap { max-width: 1160px; margin-inline: auto; padding-inline: clamp(12px, 4vw, 36px); }
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead-inner, .brand { display: flex; align-items: center; gap: 10px; }
.masthead-inner { min-height: 62px; justify-content: space-between; }
.brand { font-weight: 750; font-size: .92rem; }
.local-label { font-size: .76rem; color: var(--muted); }
.intro { margin-block: clamp(22px, 5vw, 44px) clamp(16px, 3vw, 26px); }
h1 { font-size: clamp(1.58rem, 5vw, 2.75rem); line-height: 1.13; letter-spacing: -.035em; }
.intro p { margin-top: 8px; color: var(--muted); max-width: 60ch; }
h2 { font-size: 1rem; line-height: 1.25; }
.workspace { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(8px, 2vw, 20px); align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 10px clamp(9px, 2vw, 18px); }
.pill { border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 700; padding: 2px 9px; white-space: nowrap; }
.viewfinder { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: #15212f; }
.viewfinder video { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: contain; }
.viewfinder-placeholder { display: grid; place-items: center; color: #a6b7c9; }
.camera-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: clamp(8px, 2vw, 16px); }
button { min-height: 44px; border: 1px solid transparent; border-radius: 8px; background: var(--accent); color: white; padding: 6px 12px; font: inherit; font-size: .84rem; font-weight: 720; cursor: pointer; }
button:not(:disabled):hover { background: var(--accent-hover); }
button.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
button.secondary:not(:disabled):hover { background: var(--accent-soft); }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.camera-message, .empty, .saved .panel-heading p, footer { color: var(--muted); font-size: .85rem; }
.camera-message { padding: 0 clamp(8px, 2vw, 16px) 12px; }
.answer-chart {
  --mean-marker: #923f09;
  flex: none;
  margin: 0;
  padding: 8px clamp(9px, 2vw, 18px);
  border-top: 1px solid var(--line);
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
}
.answer-chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; }
.answer-chart-mean { color: var(--mean-marker); white-space: nowrap; }
.answer-chart-counts, .answer-chart-plot, .answer-chart-scores {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  justify-items: center;
}
.answer-chart-counts { color: var(--muted); font-size: .75rem; margin-top: 4px; }
.answer-chart-scores { font-weight: 650; }
.answer-chart-plot {
  position: relative;
  height: 64px;
  border-bottom: 1px solid var(--muted);
  background: repeating-linear-gradient(to top, var(--line) 0 1px, transparent 1px 20%);
}
.answer-chart-bar {
  width: 64%;
  max-width: 52px;
  height: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 340ms ease-out;
}
.answer-chart-marker {
  position: absolute;
  inset: 0 auto 0 50%;
  width: 2px;
  background: var(--mean-marker);
  box-shadow: 0 0 0 1px var(--surface);
  transform: translateX(-50%);
  opacity: 0;
  transition: left 340ms ease-out, opacity 220ms ease-out;
}
.answer-chart-marker.visible { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .answer-chart-bar, .answer-chart-marker { transition: none; }
}
.live-results { max-height: 62vh; overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; font-variant-numeric: tabular-nums; }
th, td { border-top: 1px solid var(--line); padding: 7px clamp(8px, 2vw, 18px); }
th { font-size: .78rem; background: #f7f8fa; }
.live-results thead { position: sticky; top: 0; }
tfoot { background: #f7f8fa; }
td { font-weight: 650; }
td:last-child { white-space: nowrap; }
.elapsed-note { border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; padding: 8px clamp(9px, 2vw, 18px); }
.empty { padding: 14px clamp(9px, 2vw, 18px); }
.saved { margin-top: clamp(12px, 3vw, 24px); }
.saved .panel-heading { border-bottom: 1px solid var(--line); }
.saved .panel-heading p { margin-top: 4px; }
.saved .panel-heading button { flex: 0 0 auto; }
.save-status:not(:empty) { padding: 10px clamp(9px, 2vw, 18px) 0; font-size: .85rem; color: var(--accent); }
#captures { list-style: none; margin: 0; padding: 0; }
#captures li { display: grid; grid-template-columns: auto 1fr; border-top: 1px solid var(--line); align-items: start; padding-inline: clamp(9px, 2vw, 18px); }
#captures li:first-child { border-top: 0; }
.capture-select { width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; }
.capture-select input { width: 18px; height: 18px; accent-color: var(--accent); }
summary { cursor: pointer; padding-block: 10px; font-size: .9rem; }
.capture-count { margin-inline-start: 7px; color: var(--muted); }
.copy-fallback { margin: 12px clamp(9px, 2vw, 18px); font-size: .85rem; }
textarea { display: block; width: 100%; margin-top: 4px; }
footer { padding-block: 16px 28px; }
a { color: var(--accent); }
footer a { display: inline-block; margin-top: 4px; }
.landing-intro {
  display: grid;
  gap: clamp(20px, 3vw, 32px);
  padding-block: clamp(24px, 4vw, 48px);
}
.landing h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
.landing-lead { margin-block: 12px; font-size: clamp(1.12rem, 2.5vw, 1.5rem); font-weight: 630; }
.landing-intro p { max-width: 68ch; }
.landing-intro p:not(.landing-lead), .landing-uses dd { color: var(--muted); }
.landing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 22px; }
.landing .primary-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 15px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 720;
  text-decoration: none;
}
.landing .primary-link:hover { background: var(--accent-hover); }
.landing-hero { margin: 0; }
.landing-hero img { width: 100%; height: auto; display: block; border-radius: 14px; }
.landing-hero figcaption { margin-top: 6px; font-size: .85rem; }
.landing-uses { border-top: 1px solid var(--line); padding-top: 20px; }
.landing-uses h2 { font-size: 1.35rem; }
.landing-uses dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.landing-uses dt { font-weight: 700; }
.landing-uses dd { margin: 4px 0 0; }
.landing-deck dl { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.scanner-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
@media (max-width: 660px) {
  .workspace { grid-template-columns: 1fr; }
  .landing-uses dl { grid-template-columns: 1fr; }
}
.pairing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.pairing-panel { display: grid; gap: 10px; align-content: start; justify-items: start; padding: 18px; }
.pairing-panel p { color: var(--muted); }
.pairing-panel img { max-width: 100%; height: auto; image-rendering: pixelated; }
.pairing-panel textarea { margin: 0; }
.pairing-code { display: block; color: var(--ink); }
.code-form { display: grid; gap: 8px; justify-items: start; }
.code-form input {
  width: min(100%, 26rem);
  min-height: 44px;
  padding: 6px 9px;
  border: 1px solid var(--muted);
  border-radius: 6px;
  font: inherit;
}
#display-code-form { padding: 0 18px 14px; }
.pairing-actions { display: flex; align-items: center; gap: 16px; padding-block: 12px; }
.display-page { padding: 10px; }
.display-page > main { display: flex; flex-direction: column; max-height: calc(100dvh - 20px); }
.display-page h1 { font-size: clamp(1.25rem, 4vw, 1.85rem); }
.display-page .panel-heading { flex: none; }
#display-status { color: var(--muted); font-size: .85rem; text-align: right; }
.display-results { min-height: 0; overflow: auto; }
.display-results tr > :nth-child(3) { display: none; }
.display-results thead { position: sticky; top: 0; }
.earlier-means { display: flex; flex-wrap: wrap; gap: 0 12px; margin-top: 3px; color: var(--muted); }
.display-controls { display: flex; align-items: center; gap: 8px; }
.embedded-display { height: 100dvh; padding: 0; }
.embedded-display > main { height: 100%; max-height: none; position: relative; }
.embedded-display .display-results { flex: 1; }
.embedded-display .answer-chart { padding-block: 5px; }
.embedded-display .answer-chart-plot { height: 44px; }
.embedded-display .panel-heading { min-height: 42px; padding-block: 5px; }
.embedded-display #pair-phone { min-height: 32px; padding: 2px 7px; white-space: nowrap; }
#embedded-pairing { position: absolute; inset: 42px 0 0; overflow: auto; background: var(--surface); text-align: center; padding: 10px; }
#embedded-qr { display: block; margin: 0 auto; max-width: 100%; height: auto; image-rendering: pixelated; }
#new-survey-pairing { display: block; min-height: 32px; margin: 8px auto 0; }
@media (max-width: 320px) {
  .embedded-display .panel-heading { gap: 3px; padding-inline: 5px; }
  .embedded-display h1 { font-size: .9rem; white-space: nowrap; }
  .embedded-display #display-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .embedded-display #pair-phone { font-size: .7rem; }
  .embedded-display th, .embedded-display td { font-size: .7rem; padding: 4px 5px; }
}

@media (max-width: 460px) {
  .camera-actions > button { width: 100%; }
  .camera-message { font-size: .75rem; }
  th, td { padding-inline: 5px; }
  .panel { border-radius: 10px; }
}
