/* SPDX-License-Identifier: Apache-2.0 */
:root {
  --bg: #f5f3fb;
  --bg-glow: #ebe2fb;
  --panel: #ffffff;
  --panel-2: #faf8ff;
  --ink: #16204a;
  --muted: #5d6585;
  --line: #e2def0;
  --accent: #8b4fe0;
  --accent-ink: #ffffff;
  --accent-soft: #f1e8fe;
  --accent-line: #c7a6f5;
  --ok: #1f8f5a;
  --bad: #c43d3d;
  --shadow: 0 1px 2px rgb(22 32 74 / 6%), 0 8px 24px rgb(22 32 74 / 6%);
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070a16;
    --bg-glow: #1a1236;
    --panel: #0e1428;
    --panel-2: #121a33;
    --ink: #e9ebf5;
    --muted: #9aa3bb;
    --line: #232c49;
    --accent: #cb95fa;
    --accent-ink: #16204a;
    --accent-soft: #221a3e;
    --accent-line: #6d4fa8;
    --ok: #3ccf8e;
    --bad: #ff7b7b;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 500px at 50% -120px, var(--bg-glow), transparent 70%) no-repeat, var(--bg);
  color: var(--ink);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 860px; margin: 0 auto; padding: 0 16px 120px; }
a { color: var(--accent); text-underline-offset: 2px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }

/* ---- top bar and hero ---- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 18px 0 8px; font-weight: 650; letter-spacing: 0.01em; }
.topbar img { width: 30px; height: 30px; object-fit: contain; }
.topbar span { color: var(--muted); font-weight: 500; }
.hero { padding: 28px 28px 20px; }
.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.15; margin: 0 0 14px; letter-spacing: -0.01em; }
.hero .lead { font-size: 1.05rem; }
.hero .strip { display: block; margin: 18px 0 6px; padding: 0; border: 0; background: none; cursor: zoom-in; width: 100%; font: inherit; }
.hero .strip img { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; transition: transform 0.2s; }
.hero .strip:hover img { transform: scale(1.015); }
.hero .strip-caption { display: block; text-align: center; font-size: 0.88rem; color: var(--accent); margin-bottom: 14px; }
.note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 0.92rem;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 0.85rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---- cards and questions ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 18px 0;
}
.qhead { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.qnum {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
.card.done .qnum { background: var(--accent); color: var(--accent-ink); }
h2 { font-size: 1.15rem; line-height: 1.35; margin: 2px 0 0; }
.qmeta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.qmeta b { color: var(--bad); font-weight: 600; }
.help { margin: 8px 0 0 42px; color: var(--muted); }
.figures { display: grid; gap: 12px; margin: 14px 0 0; }
.figure { margin: 0; }
.figure button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #05070f;
  cursor: zoom-in;
}
.figure img { display: block; width: 100%; height: auto; }
.figure figcaption { margin-top: 6px; font-size: 0.82rem; color: var(--muted); }
.options { display: grid; gap: 8px; margin-top: 16px; }
.option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.option:hover { border-color: var(--accent-line); }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1.5px solid var(--accent-line);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}
.option.round .mark { border-radius: 50%; }
.option:not(.round):not(:has(input:checked)) .mark { color: transparent; }
.option:has(input:checked) .mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.option .body { min-width: 0; padding-top: 2px; }
.option .label { font-weight: 550; }
.option .shots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.option .shots a {
  font-size: 0.78rem;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.option .shots a:hover { color: var(--accent); border-color: var(--accent-line); }
textarea {
  display: block;
  width: 100%;
  min-height: 120px;
  margin-top: 14px;
  padding: 12px 14px;
  font: inherit;
  color: inherit;
  background: var(--panel-2);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent); }

/* ---- the send bar ---- */
.sendbar {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  row-gap: 8px;
  margin-top: 24px;
  padding: 12px 14px 12px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.progress { flex: 1; min-width: 0; }
.progress .track { height: 6px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; margin-top: 6px; }
.progress .fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.25s; }
.progress small { color: var(--muted); }
button.primary {
  font: inherit;
  font-weight: 650;
  padding: 11px 22px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
button.primary:disabled { opacity: 0.55; cursor: default; }
button.quiet {
  font: inherit;
  font-size: 0.9rem;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
button.quiet:hover { color: var(--ink); border-color: var(--accent-line); }
button.quiet.danger { color: var(--bad); border-color: var(--bad); }
button[hidden] { display: none; }
.polls { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.polls a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.polls a:hover { border-color: var(--accent); }
.polls small { color: var(--muted); font-weight: 500; white-space: nowrap; }
.status { width: 100%; font-size: 0.92rem; }
.status:empty { display: none; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
footer { text-align: center; color: var(--muted); font-size: 0.82rem; margin-top: 32px; }

/* ---- the picture viewer ---- */
dialog.viewer {
  width: min(96vw, 1400px);
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / 45%);
}
dialog.viewer::backdrop { background: rgb(5 7 15 / 70%); backdrop-filter: blur(3px); }
dialog.viewer .vbar { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
dialog.viewer .vbar span { flex: 1; font-size: 0.9rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dialog.viewer .vbar a { font-size: 0.85rem; white-space: nowrap; }
dialog.viewer .close {
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink);
  cursor: pointer;
}
dialog.viewer .pic { overflow: auto; max-height: calc(94vh - 58px); background: #05070f; }
dialog.viewer img { display: block; width: 100%; height: auto; }

/* ---- results ---- */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input[type="password"] {
  font: inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  color: inherit;
  min-width: 0;
  flex: 1;
}
.bar { display: grid; grid-template-columns: minmax(0, 1fr) 3.5em; gap: 8px; align-items: center; margin: 6px 0; }
.bar .track { position: relative; height: 28px; border-radius: 8px; background: var(--accent-soft); overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); opacity: 0.55; }
.bar .label { position: relative; padding: 3px 10px; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .count { text-align: right; font-variant-numeric: tabular-nums; }
.texts { margin: 8px 0 0; padding-left: 18px; }
.texts li { margin: 6px 0; white-space: pre-wrap; }

@media (max-width: 560px) {
  .hero { padding: 22px 18px 16px; }
  .card { padding: 18px 16px; }
  .help { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
