/* Built for reading outdoors: pure black on white, thick borders, very large type. */
:root {
  --ink: #000;
  --paper: #fff;
  --muted: #333;
  --line: #000;
  --bar: #ffd600; /* yellow percentage bar, black text stays readable on it */
  --danger: #b00020;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; }

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

h1 { font-size: 1.8rem; margin: 0.4em 0; }
h2 { font-size: 1.4rem; margin: 1.2em 0 0.5em; }
p { line-height: 1.45; }
a { color: var(--ink); font-weight: 700; }

button, .btn {
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-height: 56px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  touch-action: manipulation;
}
button:active, .btn:active { transform: scale(0.98); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 4px solid var(--bar);
  outline-offset: 2px;
}
button.primary, .btn.primary { background: var(--ink); color: var(--paper); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.small { min-height: 44px; padding: 8px 12px; font-size: 0.9rem; }
button:disabled { opacity: 0.4; }
.full { width: 100%; }

input, textarea, select {
  font: inherit;
  font-size: 1.1rem;
  width: 100%;
  padding: 12px;
  border: 3px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
}
label { display: block; font-weight: 700; margin: 12px 0 6px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; }
.stack { display: grid; gap: 12px; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 700; }
.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.topbar .title { font-weight: 800; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* ---- Interview ---- */
.progress { font-size: 1rem; font-weight: 700; color: var(--muted); margin: 4px 0 8px; }

.question {
  font-size: clamp(2rem, 8.5vw, 3rem);
  line-height: 1.12;
  font-weight: 900;
  margin: 0.2em 0 0.7em;
  overflow-wrap: anywhere;
}

.answers { display: grid; gap: 14px; }

.answer {
  display: flex;
  min-height: 84px;
  border: 4px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.answer.selected { box-shadow: 0 0 0 4px var(--bar); }
.answer .pick {
  flex: 1;
  border: 0;
  border-radius: 0;
  justify-content: flex-start;
  text-align: left;
  font-size: clamp(1.4rem, 6vw, 1.9rem);
  font-weight: 800;
  padding: 12px 16px;
  background: transparent;
  position: relative;
  z-index: 1;
}
.answer.selected .pick::before { content: "✓"; margin-right: 4px; }
.answer .pct {
  width: 76px;
  flex: none;
  border: 0;
  border-left: 4px solid var(--line);
  border-radius: 0;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 0;
  background: var(--paper);
  position: relative;
  z-index: 1;
}
.answer .bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--bar);
  width: 0;
  transition: width 0.3s ease;
}
.answer.show .pct { background: var(--bar); }

.other-box { margin-top: 14px; }
.other-box textarea { font-size: 1.3rem; min-height: 90px; }

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}
.controls button { padding: 10px 6px; font-size: 1rem; }
.count { text-align: center; margin-top: 14px; font-weight: 700; }

.done {
  font-size: clamp(2.2rem, 10vw, 3.4rem);
  font-weight: 900;
  margin: 1em 0 0.5em;
}
.next-person { min-height: 96px; font-size: 1.8rem; width: 100%; }

/* ---- Lists / editor ---- */
.survey-item { display: flex; flex-direction: column; gap: 10px; }
.survey-item .name { font-size: 1.4rem; font-weight: 900; }

.q-edit { border: 3px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.q-edit .opt { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.q-edit .opt input { flex: 1; }
.q-edit .tag { font-weight: 800; font-size: 0.85rem; padding: 4px 8px; border: 2px solid var(--line); border-radius: 6px; }
.cond { margin-top: 10px; padding: 10px; border: 2px dashed var(--line); border-radius: 10px; }
.cond .checks label { display: flex; gap: 8px; align-items: center; font-weight: 600; margin: 6px 0; }
.cond .checks input { width: 26px; height: 26px; }

.qr { background: #fff; padding: 12px; border: 3px solid var(--line); border-radius: var(--radius); max-width: 320px; margin: 12px auto; }
.qr svg { width: 100%; height: auto; display: block; }
.link-box { word-break: break-all; font-size: 0.85rem; }

.toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: var(--paper);
  padding: 14px 16px;
  border-radius: var(--radius);
  font-weight: 700;
  z-index: 10;
}
