/* Feebas — calm & friendly. Tokens first; everything else uses them. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --text: #14171c;
  --muted: #5f6672;
  --line: #e3e6ea;
  --line-strong: #c9ced5;
  --accent: #0f766e;
  --accent-hover: #0c5f58;
  --accent-text: #ffffff;
  --accent-tint: #e6f4f2;
  --self: #b45309;
  --self-tint: #fdf1e3;
  --notice: #0f766e;
  --notice-tint: #e6f4f2;
  --warning: #b7791f;
  --warning-tint: #fdf6e7;
  --danger: #c2413b;
  --danger-hover: #a3342f;
  --danger-tint: #fcecea;
  --shadow: 0 1px 2px rgb(20 23 28 / 0.04), 0 4px 16px rgb(20 23 28 / 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e232a;
    --text: #e8eaed;
    --muted: #9aa3ae;
    --line: #2a3038;
    --line-strong: #3a424c;
    --accent: #34b3a5;
    --accent-hover: #4cc6b8;
    --accent-text: #08201d;
    --accent-tint: #13302d;
    --self: #f0a44b;
    --self-tint: #33250f;
    --notice: #34b3a5;
    --notice-tint: #13302d;
    --warning: #e2b045;
    --warning-tint: #2d2513;
    --danger: #e26d66;
    --danger-hover: #ec8a84;
    --danger-tint: #33191a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 16px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

/* --- base --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem); font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-underline-offset: 3px; }
small, .small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 4px 0 12px; }
.center { text-align: center; }
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.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;
}

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* --- shell -------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark { width: 28px; height: 28px; color: var(--accent); }
.lang { display: flex; gap: 2px; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.lang a {
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}
.lang a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

main { flex: 1; width: 100%; margin: 0 auto; padding: 28px 16px 56px; }
main.narrow { max-width: 720px; }
main.wide { max-width: 1040px; }

.footer {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--line);
}

/* --- building blocks ---------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 0 0 16px;
}
.card-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; margin-bottom: 12px; }
.card-center { text-align: center; padding: 36px 24px; max-width: 520px; margin: 24px auto; }
.card-center h1 { margin-bottom: 10px; }
.card-center .btn { margin-top: 8px; }
.num {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  flex: none;
}

.field { display: block; margin: 0 0 14px; font-weight: 550; font-size: 0.95rem; }
.field small { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; }
.row-2, .row-3 { display: grid; gap: 0 16px; }
@media (min-width: 640px) {
  .row-2 { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: 0.7fr 1fr 1fr; }
}

input:not([type="radio"]):not([type="checkbox"]), textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
textarea { resize: vertical; min-height: 4.5rem; }
input[type="number"] { max-width: 9rem; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-lg { min-height: 50px; padding: 12px 24px; font-size: 1.02rem; }
.btn-block { width: 100%; }
.linklike {
  border: 0; background: none; padding: 0; font: inherit; color: var(--accent);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

.callout {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 16px;
  border: 1px solid transparent;
}
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout-title { font-weight: 650; margin-bottom: 4px; }
.callout ul { margin: 4px 0 0; padding-left: 20px; }
.callout-notice { background: var(--notice-tint); border-color: color-mix(in srgb, var(--notice) 30%, transparent); }
.callout-info { background: var(--self-tint); border-color: color-mix(in srgb, var(--self) 30%, transparent); }
.callout-warning { background: var(--warning-tint); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.callout-error { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.callout .btn { margin-top: 10px; }

.success-mark, .lock-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin-bottom: 14px;
  background: var(--accent-tint);
  color: var(--accent);
}
.success-mark svg, .lock-mark svg { width: 28px; height: 28px; }

/* --- landing ------------------------------------------------------------ */

.hero { text-align: center; padding: 28px 0 8px; }
.hero h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); font-weight: 750; letter-spacing: -0.03em; }
.hero-lead { max-width: 36rem; margin: 14px auto 22px; color: var(--muted); font-size: 1.1rem; }
.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 24px 0 0; }
.chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
.chip::before { content: "✓"; color: var(--accent); font-weight: 700; margin-right: 6px; }

.steps { list-style: none; padding: 0; margin: 40px 0; display: grid; gap: 12px; }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.step h2 { font-size: 1.05rem; margin: 10px 0 4px; }
.step p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.step-n {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 0.9rem;
}

.section-title { font-size: 1.5rem; margin: 8px 0 16px; scroll-margin-top: 80px; }

.create-grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) {
  .create-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
  .create-side { position: sticky; top: 76px; }
}
.create-side .preview { margin: 0; }
.preview-comment { margin: 12px 0 0; color: var(--accent); font-size: 0.9rem; font-weight: 550; }
/* One preview per screen size: beside the form on wide screens, inside the
   scale card on phones and tablets. */
.preview-inline {
  margin-top: 4px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
@media (min-width: 900px) { .preview-inline { display: none; } }
@media (max-width: 899px) { .create-side { display: none; } }

/* Label editor (built by app.js on top of the textarea). */
.label-editor { list-style: none; padding: 0; margin: 6px 0 8px; display: grid; gap: 8px; }
.label-row { display: block; }
.label-main { display: flex; gap: 6px; align-items: center; }
.label-row .label-n { width: 1.6rem; flex: none; color: var(--muted); font-size: 0.85rem; text-align: right; }
.label-main input { margin: 0 !important; }
.q-scale { display: none; }
.per-question .label-row { padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.per-question .q-scale {
  display: grid;
  grid-template-columns: 6.5rem 1fr 1fr;
  gap: 8px;
  margin: 8px 0 0 calc(1.6rem + 6px);
}
.q-field { margin: 0; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.q-field input { margin-top: 3px !important; padding: 7px 9px; max-width: none; }
.icon-btn {
  flex: none;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}
.icon-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn.remove:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }

/* --- rating scale ------------------------------------------------------- */

.question-label { font-size: 1.12rem; font-weight: 650; margin: 0 0 14px; }
.scale { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px; }
@media (max-width: 520px) { .scale-many { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.pill { position: relative; display: block; margin: 0; }
.pill input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.pill span {
  display: grid;
  place-items: center;
  min-height: 46px;
  padding: 6px 4px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pill:hover span { border-color: var(--accent); }
.pill input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.pill input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.pill-quiet { display: inline-block; margin-top: 10px; }
.pill-quiet span {
  min-height: 36px;
  padding: 6px 14px;
  border-style: dashed;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
}
.pill-quiet input:checked + span { background: var(--surface-2); color: var(--text); border-style: solid; border-color: var(--text); }
.scale-ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 0.82rem; }
.scale-ends span:last-child { text-align: right; }

/* --- respondent form ---------------------------------------------------- */

.form-head h1 { margin-bottom: 8px; }
.form-head .intro { white-space: pre-line; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.form-head p:last-child { margin-bottom: 0; }
fieldset.question { border: 1px solid var(--line); min-width: 0; }
.comment { margin-top: 12px; }
.comment summary {
  display: inline-block;
  color: var(--accent);
  font-weight: 550;
  font-size: 0.92rem;
  cursor: pointer;
  list-style: none;
}
.comment summary::-webkit-details-marker { display: none; }
.comment summary::before { content: "+ "; }
.comment[open] summary::before { content: "− "; }
.comment .field { margin: 10px 0 0; }
.draft-note { text-align: center; color: var(--muted); font-size: 0.85rem; }

body.has-bottombar main { padding-bottom: 110px; }
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.bottombar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.progress { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.progress.is-complete { color: var(--accent); font-weight: 600; }

/* --- created ------------------------------------------------------------ */

.page-head { text-align: center; margin: 8px 0 24px; }
.page-head h1 { margin-bottom: 6px; }
.copyrow { display: flex; gap: 8px; margin-top: 6px; }
.copyrow input { margin: 0 !important; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.88rem; }
.copyrow .btn { flex: none; }
@media (max-width: 480px) { .copyrow { flex-direction: column; } }
.link-card .hint { margin-top: -6px; }
.invite { font-size: 0.93rem; margin-bottom: 10px; }
.qr-card { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.qr { width: 148px; flex: none; }
.qr svg { display: block; width: 100%; height: auto; border-radius: 8px; }
.qr-card > div:last-child { flex: 1; min-width: 200px; }
.summary { text-align: center; font-size: 0.88rem; }

/* --- results ------------------------------------------------------------ */

.results-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-open { background: var(--accent-tint); color: var(--accent); }
.status-closed { background: var(--surface-2); color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.tile-label { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.tile-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile-value-text { font-size: 1.2rem; padding: 6px 0 4px; }
.tile-hint { color: var(--muted); font-size: 0.8rem; }

.meter { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--notice) 15%, transparent); margin-top: 12px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--notice); border-radius: inherit; }

.results-grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .results-grid { grid-template-columns: 1fr 1fr; } }
.result { margin: 0; display: flex; flex-direction: column; }
.result-title { font-size: 1.08rem; margin-bottom: 8px; }
.mean { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.mean-value { font-size: 2.2rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }

.track { position: relative; height: 34px; margin: 4px 8px 12px; }
.track-line { position: absolute; left: 0; right: 0; top: 10px; height: 6px; border-radius: 999px; background: var(--surface-2); }
.track-ends { position: absolute; left: -4px; right: -4px; top: 18px; display: flex; justify-content: space-between; color: var(--muted); font-size: 0.75rem; }
.marker { position: absolute; top: 5px; width: 16px; height: 16px; transform: translateX(-50%); }
.marker-mean { border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.marker-self { background: var(--self); transform: translateX(-50%) rotate(45deg) scale(0.8); border: 2px solid var(--surface); }

.dist { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.dist th { width: 1.8rem; padding: 2px 8px 2px 0; text-align: right; color: var(--muted); font-weight: 500; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.dist td { padding: 2px 0; }
.dist .bar { display: block; height: 12px; min-width: 3px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 75%, transparent); }
.dist td.n { width: 2.4rem; text-align: right; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.dist tr.is-self th { color: var(--self); font-weight: 700; }

.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
.self-fact { color: var(--self); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.self-dot { width: 9px; height: 9px; background: var(--self); transform: rotate(45deg); display: inline-block; }

.comments { list-style: none; padding: 0; margin: 4px 0 0; }
.comments li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.93rem; display: flex; gap: 10px; align-items: baseline; }
.tag {
  flex: none;
  min-width: 1.9rem;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.tag-self { background: var(--self-tint); color: var(--self); }

.individual { margin-top: 16px; }
.individual summary { cursor: pointer; font-weight: 650; }
.response { padding: 14px 0; border-top: 1px solid var(--line); }
.response:first-of-type { margin-top: 12px; }
.response h3 { font-size: 0.98rem; margin-bottom: 8px; }
.response h3 small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.response.is-self h3 { color: var(--self); }
.response dl { margin: 0; display: grid; gap: 6px; }
.response dl > div { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr; gap: 12px; }
.response dt { color: var(--muted); font-size: 0.9rem; }
.response dd { margin: 0; font-size: 0.93rem; }
.response-comment { display: block; color: var(--muted); }
@media (max-width: 520px) { .response dl > div { grid-template-columns: 1fr; gap: 0; } }

.keep { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.keep .hint { margin: 0; }
.keep .card-title { margin-bottom: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.manage-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.manage-row .hint { margin: 0; flex: 1; min-width: 200px; }
.check { display: flex; gap: 10px; align-items: flex-start; flex: 1; min-width: 220px; font-size: 0.93rem; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--danger); width: 16px; height: 16px; }

.login form { text-align: left; margin-top: 16px; }

/* --- motion & print ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

@media print {
  :root { --bg: #fff; --surface: #fff; --shadow: none; }
  body { font-size: 11pt; }
  .topbar, .footer, .no-print, .bottombar, .lang { display: none !important; }
  main { padding: 0; max-width: none; }
  .card, .tile { box-shadow: none; break-inside: avoid; }
  .results-grid { grid-template-columns: 1fr 1fr; }
  .individual summary { display: none; }
  .dist .bar, .marker, .meter span, .self-dot { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* --- phones & touch ------------------------------------------------------ */

/* Fingers need ~44px targets; mice do not. */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .lang a { padding: 8px 14px; }
  .lang { padding: 2px; }
}

@media (max-width: 640px) {
  .per-question .q-scale { grid-template-columns: 1fr 1fr; margin-left: 0; }
  .per-question .q-scale .q-field:first-child { grid-column: 1 / -1; }
  .per-question .q-scale .q-field:first-child input { max-width: 8rem; }

  /* 16px keeps iOS from zooming in when a field is tapped. */
  input:not([type="radio"]):not([type="checkbox"]), textarea, select,
  .copyrow input { font-size: 16px; }

  /* Reordering is a desk task; on a phone the arrows only squeeze the field. */
  .label-row .icon-btn.move { display: none; }
  .label-row .label-n { width: 1.2rem; }

  /* Compact tiles: the count spans the row, the rest sit side by side. */
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile:first-child, .tile:last-child:nth-child(2) { grid-column: 1 / -1; }
  .tile-value { font-size: 1.4rem; }
  .tile-value-text { font-size: 1.05rem; padding: 4px 0 2px; }

  .card { padding: 16px; }
  .results-head { margin-bottom: 14px; }
}

/* --- v3: header actions, footer, templates, name, charts, about ------------ */

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.support {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #d9546a;
  background: var(--surface-2);
}
.support svg { width: 18px; height: 18px; }
.support:hover { background: color-mix(in srgb, #d9546a 14%, var(--surface-2)); }
.footer p { margin: 0 0 4px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

.presets { margin-bottom: 14px; }
.field-label { font-weight: 550; font-size: 0.95rem; margin-bottom: 6px; }
.preset-list { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip-button { display: inline-block; text-decoration: none; color: var(--text); cursor: pointer; }
.chip-button::before { content: none; }
.chip-button:hover { border-color: var(--accent); color: var(--accent); }

.toggle { margin: 4px 0 14px; align-items: flex-start; }
.toggle input { accent-color: var(--accent); }
.toggle span { font-weight: 550; }
.toggle small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }

.respondent-name .field { margin: 0; }
.comment-name { color: var(--muted); font-style: italic; white-space: nowrap; }
.respondent {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Overview: a line through the questions (rows), value left to right. */
.profile-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.legend { display: flex; gap: 14px; margin: 0; color: var(--muted); font-size: 0.85rem; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 18px; height: 3px; border-radius: 2px; vertical-align: middle; }
.key-others { background: var(--accent); }
.key-self { background: repeating-linear-gradient(90deg, var(--self) 0 5px, transparent 5px 8px); }
.profile-grid {
  display: grid;
  grid-template-columns: minmax(7rem, 34%) minmax(0, 1fr) auto;
  grid-template-rows: repeat(var(--rows), 44px) auto;
  column-gap: 16px;
  margin-top: 8px;
}
.profile-label {
  grid-column: 1;
  align-self: center;
  font-size: 0.9rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-value {
  grid-column: 3;
  align-self: center;
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  white-space: nowrap;
}
.self-value { color: var(--self); margin-left: 8px; display: inline-flex; align-items: center; gap: 4px; }
.profile-plot { grid-column: 2; position: relative; margin: 0 8px; }
.profile-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.profile-plot .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.profile-plot polyline { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.line-others { stroke: var(--accent); }
.line-self { stroke: var(--self); stroke-dasharray: 5 4; }
.pdot { position: absolute; width: 12px; height: 12px; transform: translate(-50%, -50%); }
.pdot-others { border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--accent); }
.pdot-self { background: var(--self); border: 2px solid var(--surface); transform: translate(-50%, -50%) rotate(45deg) scale(0.85); }
.profile-axis { grid-column: 2; position: relative; height: 22px; margin: 4px 8px 0; color: var(--muted); font-size: 0.75rem; }
.profile-axis span { position: absolute; top: 0; transform: translateX(-50%); }
@media (max-width: 520px) {
  .profile-grid { grid-template-columns: minmax(5.5rem, 36%) minmax(0, 1fr) auto; column-gap: 8px; }
  .profile-label { font-size: 0.82rem; }
  .profile-value { font-size: 0.8rem; line-height: 1.15; }
  .self-value { display: flex; margin: 0; justify-content: flex-end; }
}

.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin: 0 0 16px;
  border-radius: 999px;
  background: var(--surface-2);
}
.view-switch a {
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.view-switch a[aria-current] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
@media (pointer: coarse) { .view-switch a { padding: 10px 18px; } }

.radar-card { display: grid; gap: 20px; align-items: center; }
@media (min-width: 820px) { .radar-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.radar-wrap { max-width: 440px; width: 100%; margin: 0 auto; }
.radar { display: block; width: 100%; height: auto; overflow: visible; }
.radar-ring { fill: none; stroke: var(--line); }
.radar-spoke { stroke: var(--line); }
.radar-tick { fill: var(--muted); font-size: 11px; }
.radar-label { fill: var(--text); font-size: 15px; font-weight: 700; }
.radar-others { fill: color-mix(in srgb, var(--accent) 22%, transparent); stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.radar-self { fill: none; stroke: var(--self); stroke-width: 2.5; stroke-dasharray: 6 4; stroke-linejoin: round; }
.radar-others-dot { fill: var(--accent); }
.radar-self-dot { fill: var(--self); }
.radar-legend { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.radar-legend th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.8rem; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.radar-legend td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.radar-legend .num-col { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.radar-legend th .key { margin-right: 6px; }

.manage-row-first { border-top: 0; padding-top: 0; }
.manage-row-first .card-title { margin-bottom: 4px; }

.prose { max-width: 42rem; }
.prose h1 { margin-bottom: 12px; }
.prose h2 { margin: 28px 0 8px; font-size: 1.15rem; }
.prose ol, .prose ul { padding-left: 22px; margin: 0 0 12px; }
.prose li { margin-bottom: 8px; }
.prose code { font-size: 0.88em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.lead-text { font-size: 1.1rem; color: var(--muted); }
.pre-line { white-space: pre-line; }

@media print {
  .view-switch, .support { display: none !important; }
  .profile-plot polyline, .pdot, .radar-others, .radar-self { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
