/* 투표·설문 - 어두운 테마 기본, html[data-theme="light"] 로 밝은 테마. 고대비·포커스 표시·동작 줄이기 대응. */
:root {
  --bg: #12151b;
  --panel: #1b2029;
  --text: #f2f5f9;
  --muted: #b4bdca;
  --line: #4a5565;
  --accent: #6cb4ff;
  --accent-text: #08121f;
  --bar: #2a3342;
  --fill: #6cb4ff;
  --danger: #ff9a9a;
  --ok: #8fe0a2;
  --focus: #ffd24a;
}
html[data-theme="light"] {
  --bg: #ffffff;
  --panel: #f3f5f8;
  --text: #10141a;
  --muted: #3d4756;
  --line: #6b7686;
  --accent: #0b57c4;
  --accent-text: #ffffff;
  --bar: #dde3ec;
  --fill: #0b57c4;
  --danger: #a30f0f;
  --ok: #0c6a26;
  --focus: #b35a00;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "Malgun Gothic", "Noto Sans KR", sans-serif;
}
[hidden] { display: none !important; }

main { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.05rem; margin: 0 0 12px; color: var(--muted); font-weight: 600; }
h2 { font-size: 1.25rem; margin: 0 0 8px; overflow-wrap: anywhere; }
.plain { padding: 24px 16px; text-align: center; }

.notice {
  max-width: 720px; margin: 8px auto 0; padding: 8px 12px;
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  background: var(--panel); border-radius: 6px;
}

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.meta { color: var(--muted); font-size: 0.9rem; margin: 0 0 10px; }
.err { color: var(--danger); margin: 6px 0; min-height: 1.5em; }
.okmsg { color: var(--ok); }

label { display: inline-block; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 14px; padding: 10px 12px; min-width: 0; }
legend { padding: 0 6px; font-weight: 600; }
.field { margin-bottom: 14px; }
.field > label { font-weight: 600; margin-bottom: 4px; }

input[type="text"] {
  width: 100%; padding: 8px 10px; font: inherit;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
}
.optrow { display: flex; gap: 8px; margin-bottom: 8px; }
.optrow input { flex: 1 1 auto; min-width: 0; }

.choice { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--accent); }
.choice label { flex: 1 1 auto; overflow-wrap: anywhere; cursor: pointer; }
.inline { display: inline-flex; align-items: center; gap: 8px; margin-right: 18px; }
.inline input { width: 18px; height: 18px; accent-color: var(--accent); }

.btn {
  font: inherit; padding: 8px 16px; min-height: 40px; border-radius: 6px; cursor: pointer;
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.small { padding: 4px 10px; min-height: 36px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* 결과 막대 */
.bars { margin: 8px 0; }
.bar { margin-bottom: 12px; }
.barhead { display: flex; justify-content: space-between; gap: 12px; }
.barhead .lab { overflow-wrap: anywhere; }
.barhead .num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.track { height: 14px; background: var(--bar); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; margin-top: 4px; }
.fill { height: 100%; width: 0; background: var(--fill); transition: width 0.25s ease; }
.voters { margin-top: 4px; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .fill { transition: none; }
  * { scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .fill { background: Highlight; }
  .track { border-color: CanvasText; }
}
