/* The homeowners' ballot page. Phone first, large text, high contrast. */
:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --ink: #1d2024;
  --muted: #555b61;
  --line: #d9d4cb;
  --accent: #3e5a4a;
  --accent-ink: #ffffff;
  --warn: #8f3422;
  --warn-bg: #fbeee9;
  --ok-bg: #e9f3ec;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
main { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0; }
h2 { font-size: 20px; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.warn { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 12px 14px; }
.ok { background: var(--ok-bg); color: var(--accent); border-radius: 8px; padding: 12px 14px; }
.note { font-size: 16px; color: var(--muted); border-left: 4px solid var(--line); padding-left: 10px; }
button { font: inherit; min-height: 48px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button:disabled { opacity: .45; cursor: default; }
button.small { min-height: 40px; padding: 6px 12px; font-size: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
input.code { font: inherit; font-size: 26px; letter-spacing: 3px; text-transform: uppercase; font-family: ui-monospace, Menlo, Consolas, monospace; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; width: 100%; max-width: 320px; }
input.code:focus { border-color: var(--accent); outline: none; }

/* Ranking */
.ranked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ranked li { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.ranked .num { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; }
.ranked .name { flex: 1; min-width: 0; font-weight: 600; }
.ranked .moves { display: flex; gap: 4px; flex: none; }
.ranked .moves button { min-height: 40px; min-width: 40px; padding: 0; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; background: #e7e3dc; }
.pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.choice { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.choice .pic { width: 100%; height: auto; min-height: 120px; background: #e7e3dc; border: 0; padding: 0; cursor: zoom-in; display: block; } /* whole board, uncropped */
.choice .body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.choice .label { font-weight: 700; }
.pic-btn { padding: 0; border: 0; min-height: 0; border-radius: 0; background: none; display: block; width: 100%; }

/* Follow-ups */
.fu-q { display: flex; flex-direction: column; gap: 8px; }
.fu-prompt { font-weight: 600; }
.fu-opt { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfaf8; flex-wrap: wrap; }
.fu-pics { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.fu-pics img { width: 100%; height: auto; border-radius: 8px; background: #e7e3dc; cursor: zoom-in; display: block; }
.fu-opt input { width: 24px; height: 24px; flex: none; accent-color: var(--accent); }
.fu-opt label { flex: 1; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 32px; }
.swatch { width: 28px; height: 28px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); flex: none; }
textarea { font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }

/* Full-screen pictures */
.gallery { position: fixed; inset: 0; background: #111; color: #fff; z-index: 10; display: flex; flex-direction: column; }
.gallery .top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.gallery .top .title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery .stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y pinch-zoom; }
.gallery .stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.gallery .bottom { display: flex; align-items: center; gap: 10px; padding: 10px 12px 16px; }
.gallery button { background: #2a2a2a; color: #fff; border-color: #444; }
.gallery button.primary { background: var(--accent); border-color: var(--accent); }
.gallery .count { flex: 1; text-align: center; font-size: 16px; color: #ccc; }

/* Compare: Without / With switch */
.flip { display: flex; border: 2px solid var(--accent); border-radius: 12px; overflow: hidden; }
.flip button { flex: 1; border: 0; border-radius: 0; background: var(--panel); color: var(--accent); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.flip button.on { background: var(--accent); color: var(--accent-ink); }
/* A picture still being made (preview) or loading: hold its place with a gray box */
img:not([src]) { min-height: 160px; background: #e7e3dc; }

/* Formatted text from the Board: welcome, thank-you, question instructions */
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich h2 { font-size: 22px; margin: 14px 0 6px; }
.rich h3 { font-size: 19px; margin: 12px 0 4px; }
.rich p { margin: 0 0 10px; }
.rich ul { margin: 0 0 10px; padding-left: 24px; }
.rich a { color: var(--accent); }
.fu-intro { background: #f7f5f1; border-radius: 10px; padding: 12px 14px; }
.fu-intro summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.fu-intro[open] summary { margin-bottom: 8px; }
.center, .rich .center { text-align: center; }

/* Ballot card: each follow-up answer is a tappable line that jumps to that question */
.answer-lines { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.answer-line { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left; min-height: 0; padding: 8px 10px; font-size: 16px; background: #fbfaf8; }
.answer-line .muted { grid-column: 1; font-size: 14px; }
.answer-line > span:nth-child(2) { grid-column: 1; font-weight: 600; }
.answer-line .edit { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--accent); font-weight: 600; }

/* Pick any number (2026-11-19) */
.choice.picked { border: 2px solid var(--accent); }
.choice .body button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
