/* Community polls (2026-11-11): poll cards, create form and the comment side panel. Loaded after theme.css, uses its tokens. */
.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; }

.poll-tabs { display: flex; gap: 6px; margin: 4px 0 12px; overflow-x: auto; scrollbar-width: none; }
.poll-tabs button { flex: none; min-height: 36px; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--muted); font: 600 13px/1 var(--font); cursor: pointer; }
.poll-tabs button:hover { color: var(--ink); background: var(--surface-hover); }
.poll-tabs button.active { background: var(--ink); color: var(--bg); }
.poll-filter { display: flex; gap: 6px; margin: 0 0 16px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px; }
.poll-filter .chip { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 4px 10px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--surface); color: var(--muted); font: 600 12px/1 var(--font); cursor: pointer; }
.poll-filter .chip.active { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.poll-filter .chip small { color: var(--subtle); font-weight: 700; }
.poll-filter-game .game-art { width: 38px; height: 20px; border-radius: 5px; }
.poll-quota { margin: -6px 0 14px; color: var(--subtle); font-size: 12px; }

.poll-list { display: grid; gap: 14px; }
.poll-home { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-bottom: 30px; align-items: start; }
.poll-focus { margin-bottom: 18px; }
.poll-focus .poll-card { box-shadow: 0 0 0 1px var(--accent); }
.poll-empty { display: grid; gap: 10px; justify-items: center; padding: 26px; }
.poll-empty p { margin: 0; }
.poll-home + .poll-empty, .people-after-pins + .poll-empty { margin-bottom: 30px; }

.poll-card { position: relative; display: grid; gap: 10px; padding: 18px; border-radius: var(--radius); background: var(--surface); min-width: 0; transition: box-shadow .2s var(--ease); }
.poll-card.is-commenting { box-shadow: 0 0 0 1px #ff9e5766; }
.poll-card.is-compact { padding: 16px; }
.poll-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.poll-avatar { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; }
.poll-who { display: grid; min-width: 0; flex: 1; }
.poll-who-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.poll-author-name, .poll-group-name { padding: 0; border: 0; background: none; color: var(--ink); font: 700 14px/1.3 var(--font); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; text-decoration: none; }
span.poll-author-name { cursor: default; }
.poll-who small { color: var(--subtle); font-size: 12px; display: flex; gap: 4px; align-items: baseline; min-width: 0; }
.poll-who small .poll-author-name { font-size: 12px; font-weight: 600; color: var(--muted); }
.poll-author-name:hover, .poll-group-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.poll-group-logo { flex: none; width: 36px; height: 36px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: var(--surface-2); color: var(--ink); font-weight: 750; text-decoration: none; }
.poll-group-logo img { width: 100%; height: 100%; object-fit: cover; }
.poll-group-tag { font-style: normal; font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; flex: none; }
.poll-status { flex: none; font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.poll-status.is-ended { color: var(--muted); background: var(--surface-2); }

.poll-games { display: flex; flex-wrap: wrap; gap: 6px; }
.poll-games:empty { display: none; }
.poll-game { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 3px 9px 3px 3px; border: 0; border-radius: 9px; background: var(--surface-2); color: var(--muted); font: 600 12px/1.2 var(--font); cursor: pointer; }
.poll-game:hover { color: var(--ink); background: var(--surface-hover); }
.poll-game .game-art { width: 44px; height: 22px; border-radius: 6px; flex: none; }
.poll-game span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poll-game.is-chosen b { color: var(--subtle); margin-left: 2px; }

.poll-question { margin: 2px 0 0; font: 700 18px/1.3 var(--font-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.poll-card.is-compact .poll-question { font-size: 16px; }
.poll-details { margin: -4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

.poll-choices { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.poll-choice { position: relative; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface-2); cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease); }
.poll-choice:hover { background: var(--surface-hover); }
.poll-choice input { position: absolute; opacity: 0; pointer-events: none; }
.poll-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.poll-mark { flex: none; width: 18px; height: 18px; border: 2px solid var(--subtle); border-radius: 50%; display: grid; place-items: center; }
.poll-choice input[type="checkbox"] + .poll-mark { border-radius: 5px; }
.poll-choice.is-picked { border-color: var(--accent); background: var(--accent-soft); }
.poll-choice.is-picked .poll-mark { border-color: var(--accent); background: var(--accent); }
.poll-choice.is-picked .poll-mark::after { content: ''; width: 6px; height: 10px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.poll-choice-text { min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.poll-vote-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 2px; }
.poll-vote-row .btn { min-height: 38px; padding: 8px 18px; }
.poll-vote-row small { color: var(--subtle); font-size: 12px; }

.poll-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.poll-result { position: relative; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); overflow: hidden; isolation: isolate; }
.poll-bar { position: absolute; inset: 0 auto 0 0; width: var(--pct); background: #fff2e814; z-index: -1; border-radius: inherit; transition: width .5s var(--ease); }
.poll-result.is-mine .poll-bar { background: #ff9e5733; }
.poll-result.is-top .poll-bar { background: #ff9e5740; }
.poll-result-text { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.poll-result b { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--muted); }
.poll-result.is-mine b, .poll-result.is-top b { color: var(--ink); }
.poll-mine { font-style: normal; color: var(--accent); font-weight: 800; }

.poll-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.poll-meta { color: var(--subtle); font-size: 12px; }
.poll-foot-spacer { flex: 1; }
.poll-change { padding: 0; font-size: 12px; }
.poll-more-wrap { position: relative; }
.poll-more { width: 33px; height: 33px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--muted); font: 700 16px/1 var(--font); cursor: pointer; }
.poll-more:hover, .poll-more[aria-expanded="true"] { color: var(--ink); background: var(--surface-hover); }
.poll-menu { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 20; min-width: 180px; display: grid; padding: 6px; border-radius: 12px; background: #2b2430; box-shadow: 0 18px 40px #0008; }
.poll-menu button { padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: 600 13px/1.2 var(--font); text-align: left; cursor: pointer; }
.poll-menu button:hover { background: #ffffff0f; }
.poll-menu button.is-armed { color: #ff8a7a; }

/* Create form */
.poll-form .field { margin: 12px 0; }
.poll-options-field { border: 0; padding: 0; min-width: 0; }
.poll-options-field legend, .poll-toggle legend, .poll-games-field > span { display: block; font-size: 11px; font-weight: 800; margin-bottom: 6px; padding: 0; }
.poll-options-field legend small { font-weight: 500; color: var(--subtle); margin-left: 4px; }
#poll-options { display: grid; gap: 6px; margin-bottom: 6px; }
.poll-option-row { display: flex; gap: 6px; }
.poll-option-row input { flex: 1; min-width: 0; }
.poll-option-remove { flex: none; width: 40px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 18px; cursor: pointer; }
.poll-option-remove:hover { color: var(--ink); }
.poll-options-field .text-link { padding: 4px 0; font-size: 12px; }
.poll-form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; align-items: start; }
.poll-toggle { border: 0; padding: 0; min-width: 0; }
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; min-width: 64px; padding: 8px 14px; border-radius: 8px; text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; margin: 0; }
.segmented input:checked + span { background: var(--ink); color: var(--bg); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.poll-hint { display: block; margin-top: 6px; color: var(--subtle); font-size: 12px; line-height: 1.4; }
.poll-games-field .poll-games { margin: 8px 0; }
.poll-game-hits { display: grid; gap: 4px; margin-top: 6px; max-height: 220px; overflow-y: auto; }
.poll-game-hit { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--ink); font: 600 13px/1.2 var(--font); text-align: left; cursor: pointer; }
.poll-game-hit:hover:not(:disabled) { background: var(--surface-hover); }
.poll-game-hit:disabled { opacity: .55; cursor: default; }
.poll-game-hit .game-art { width: 64px; height: 30px; border-radius: 6px; flex: none; }
.poll-game-hit span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poll-game-hit b { color: var(--accent); }

/* Comment side panel: full height on the right, folds into a slim tab. */
.poll-side { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(400px, 100vw); height: 100vh; height: 100dvh; display: flex; background: var(--surface); border-left: 1px solid var(--hairline); box-shadow: -24px 0 60px #0006; animation: poll-side-in .22s var(--ease); }
.poll-side[hidden] { display: none; }
.poll-side.is-collapsed { width: 48px; background: transparent; border: 0; box-shadow: none; pointer-events: none; animation: none; }
@keyframes poll-side-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.poll-side-inner { display: flex; flex-direction: column; width: 100%; min-width: 0; height: 100%; }
.poll-side-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--hairline); }
.poll-side-head > div { flex: 1; min-width: 0; display: grid; gap: 3px; }
.poll-side-head strong { font: 700 16px/1.25 var(--font); }
.poll-side-head strong span { color: var(--subtle); font-weight: 600; }
.poll-side-head small { color: var(--muted); font-size: 12px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.poll-side-collapse { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 9px; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.poll-side-collapse:hover { color: var(--ink); background: var(--surface-hover); }
.poll-side-head .dialog-close { flex: none; background: var(--surface-2); color: var(--muted); }
.poll-side-list.comment-list { flex: 1; max-height: none; min-height: 0; overflow-y: auto; padding: 14px 16px; align-content: start; }
.poll-side-foot { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--hairline); background: var(--surface); }
.poll-side-foot .comment-login { width: 100%; }
.poll-side-tab { pointer-events: auto; position: absolute; top: 50%; right: 0; transform: translateY(-50%); display: grid; justify-items: center; gap: 8px; width: 44px; padding: 14px 0; border: 1px solid var(--hairline); border-right: 0; border-radius: 14px 0 0 14px; background: var(--surface-2); color: var(--ink); box-shadow: -10px 0 30px #0005; cursor: pointer; }
.poll-side-tab:hover { background: var(--surface-hover); }
.poll-side-tab span { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 12px/1 var(--font); letter-spacing: .02em; }
.poll-side-tab b { min-width: 22px; padding: 2px 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; }
.poll-side-tab .comment-icon { color: var(--accent); }

/* The friends button moves aside while the panel is open. */
body.poll-side-open .fd { right: 424px; }
body.poll-side-docked .fd { right: 68px; }

/* Wide screens: the open panel takes the place of the right column instead of covering the page. */
@media (min-width: 1100px) {
  body.poll-side-open .app-shell { margin-right: 400px; grid-template-columns: 248px minmax(0, 1fr); }
  body.poll-side-open .app-shell > .right { display: none; }
  body.poll-side-docked .app-shell { padding-right: 60px; }
}
@media (max-width: 730px) {
  body.poll-side-open .fd, body.poll-side-docked .fd { right: 16px; }
  .poll-card { padding: 15px; }
  .poll-home { grid-template-columns: minmax(0, 1fr); }
  .poll-question { font-size: 17px; }
  .poll-foot .comment-toggle { order: 5; flex: 1 1 100%; justify-content: center; }
  .poll-foot-spacer { display: none; }
  .poll-more-wrap { margin-left: auto; }
  .poll-form-row { grid-template-columns: minmax(0, 1fr); }
  .poll-side { width: 100vw; z-index: 60; border-left: 0; }
  .poll-side.is-collapsed { width: 44px; z-index: 45; }
  .poll-side-tab { top: auto; bottom: calc(84px + env(safe-area-inset-bottom)); transform: none; }
  .poll-status { font-size: 11px; padding: 3px 8px; }
}
@media (prefers-reduced-motion: reduce) { .poll-side { animation: none; } .poll-bar { transition: none; } }
.poll-option-remove[hidden], .poll-options-field .text-link[hidden] { display: none; }
