/* poll/css/poll.css — the Poll host + student pages, and the teacher
   portal's create form (bottom of the file).

   The pages use the shared game board (css/game-board.css: .gb-play HUD,
   .gb-stage, .ge-end cards); this file styles the answer buttons, the
   results bars and the code/QR. Answer colours: .pl-c0 … .pl-c5. */

:root {
  --poll-1: #E53E3E;
  --poll-2: #3182CE;
  --poll-3: #2F9E44;
  --poll-4: #D4760A;
  --poll-5: #8B5CF6;
  --poll-6: #DB2777;
}
.pl-c0 { --pc: var(--poll-1); }
.pl-c1 { --pc: var(--poll-2); }
.pl-c2 { --pc: var(--poll-3); }
.pl-c3 { --pc: var(--poll-4); }
.pl-c4 { --pc: var(--poll-5); }
.pl-c5 { --pc: var(--poll-6); }

.pl-question {
  margin: 0;
  text-align: center;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 900;
  line-height: 1.3;
  color: var(--gb-ink, var(--btn-text));
  overflow-wrap: anywhere;
}
.gb-hud-icon .bi { font-size: 18px; line-height: 1; }
.pl-letter {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .25);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

/* ── Student: vote ── */
.gb-board.pl-board { width: 680px; align-items: stretch; gap: 18px; padding: 30px; }
.pl-board .ge-kicker { text-align: center; }
.pl-options { display: flex; flex-direction: column; gap: 12px; }
.pl-options.is-two-col { display: grid; grid-template-columns: 1fr 1fr; }
.pl-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 18px 12px 14px;
  border: 0;
  border-radius: 20px;
  background: var(--pc);
  color: #fff;
  font: inherit;
  font-size: 19px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18);
  transition: transform .08s, opacity .2s;
  -webkit-tap-highlight-color: transparent;
}
.pl-opt:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); }
.pl-opt:disabled { cursor: default; }
.pl-opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pl-options.has-pick .pl-opt { opacity: .35; }
.pl-options.has-pick .pl-opt.is-picked { opacity: 1; box-shadow: 0 0 0 4px var(--gb-card, #fff), 0 0 0 7px var(--gb-ink, #1E1B3A), inset 0 -5px 0 rgba(0, 0, 0, .18); }

/* Waiting / voted / ended cards */
.pl-badge, .pl-done {
  width: 84px;
  height: 84px;
  padding: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--gb-accent, #0D9488);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--gb-accent, #0D9488) 35%, transparent);
}
.pl-badge svg, .pl-done svg { width: 100%; height: 100%; }
.pl-done { background: var(--gb-good, #2F8F46); box-shadow: 0 10px 24px color-mix(in srgb, var(--gb-good, #2F8F46) 35%, transparent); }
.pl-my-vote {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 18px;
  border-radius: 16px;
  background: var(--gb-key, var(--surface-2));
  font-size: 17px;
  font-weight: 800;
  color: var(--gb-ink, var(--btn-text));
}
.pl-my-vote[hidden] { display: none; }
.pl-dot { width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--pc); }
.ge-card .gb-msg .spinner { display: inline-block; }

/* ── Results: one horizontal bar per answer (teacher) ── */
.pl-bars { display: flex; flex-direction: column; gap: clamp(10px, 1.8vmin, 18px); width: 100%; }
.pl-bar { display: flex; flex-direction: column; gap: 6px; }
.pl-bar-head { display: flex; align-items: center; gap: 10px; }
.pl-bar .pl-letter { background: var(--pc); width: clamp(30px, 4vmin, 42px); height: clamp(30px, 4vmin, 42px); font-size: clamp(15px, 2vmin, 20px); }
.pl-bar-label { flex: 1; min-width: 0; font-size: clamp(16px, 2.3vmin, 26px); font-weight: 800; color: var(--gb-ink, var(--btn-text)); overflow-wrap: anywhere; }
.pl-bar-num { flex: none; display: flex; align-items: baseline; gap: 8px; }
.pl-bar-num b { font-size: clamp(20px, 3vmin, 34px); font-weight: 900; color: var(--gb-ink, var(--btn-text)); font-variant-numeric: tabular-nums; }
.pl-bar-num small { min-width: 44px; text-align: right; font-size: clamp(13px, 1.8vmin, 18px); font-weight: 800; color: var(--gb-muted, var(--text-muted)); }
.pl-bar-track { height: clamp(16px, 2.6vmin, 28px); border-radius: 999px; background: var(--gb-key, var(--surface-2)); overflow: hidden; }
.pl-bar-fill { height: 100%; width: 0; border-radius: inherit; background: var(--pc); transition: width .6s ease; }
html[data-reduce-motion] .pl-bar-fill { transition: none; }
.pl-bar.is-top .pl-bar-label::after { content: " \2605"; color: #F59E0B; }   /* a star on the leading answer */

/* Teacher: code + QR */
.pl-code { font-family: monospace; font-size: 46px; font-weight: 900; letter-spacing: .14em; color: var(--purple, #534AB7); line-height: 1.1; }
.pl-code.is-small { font-size: 26px; }
.pl-qr { display: flex; justify-content: center; }
.pl-qr img, .pl-qr canvas { border-radius: 10px; border: 6px solid #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.pl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pl-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; background: var(--gb-key, var(--surface-2)); font-size: 16px; font-weight: 700; color: var(--gb-ink, var(--btn-text)); }
.pl-list .pl-letter { background: var(--pc); width: 30px; height: 30px; font-size: 14px; }
.ge-btn.pl-danger { color: #B42318; }
.ge-btn i { margin-right: 4px; }

/* Teacher live: the results beside a QR card (hideable from the HUD) */
.gb-stage.pl-live-stage { align-items: stretch; }
.gb-board.pl-results-card { flex: 1 1 auto; width: auto; justify-content: center; gap: clamp(18px, 3vmin, 32px); }
.gb-board.pl-qr-card { width: 260px; flex: none; align-items: center; justify-content: center; gap: 10px; text-align: center; }
.gb-board.pl-qr-card[hidden] { display: none; }
.pl-qr-card b { font-size: 18px; font-weight: 800; }
.pl-qr-card small { font-size: 13px; font-weight: 700; color: var(--gb-muted, var(--text-muted)); word-break: break-all; }
.gb-hud-btn.is-on { background: var(--gb-accent, #0D9488); color: #fff; }
.pl-live-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #16A34A; vertical-align: 1px; animation: plPulse 1.4s ease-in-out infinite; }
@keyframes plPulse { 50% { opacity: .3; } }
html[data-reduce-motion] .pl-live-dot { animation: none; }
.pl-end-card { align-items: stretch; text-align: left; }
.pl-end-card .ge-kicker, .pl-end-card .gb-msg { text-align: center; }
.pl-bar-label { text-align: left; }

/* ── Tablet / phone ── */
@media (max-width: 899px) {
  .gb-stage.pl-live-stage { flex-direction: column; }
  .gb-board.pl-qr-card { width: auto; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 699px) {
  .gb-board.pl-board { padding: 20px 14px 14px; gap: 14px; flex: 0 0 auto; margin: auto 0; }
  .pl-options.is-two-col { grid-template-columns: 1fr; }
  .pl-opt { min-height: 62px; font-size: 17px; }
  .pl-code { font-size: 36px; }}

/* ── Dashboard panel: create form + poll list ────────────────── */
.poll-option-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.poll-option-input-row input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 14px;
  box-sizing: border-box;
  font-family: inherit;
}
.poll-option-input-row input:focus { outline: 2px solid var(--purple); border-color: transparent; }
.poll-option-remove-btn {
  background: none;
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  width: 36px;
  flex-shrink: 0;
}
.poll-option-remove-btn:hover { background: #fee2e2; color: #dc2626; border-color: #fca5a5; }

.poll-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.poll-row {
  background: var(--surface);
  border: 1px solid var(--toolbar-border);
  border-radius: 10px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.poll-row-info { flex: 1; min-width: 0; }
.poll-row-question { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.poll-row-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.poll-row-meta span + span::before { content: ' · '; }
.poll-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.poll-status-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.poll-status-badge.waiting { background: #fef3c7; color: #92400e; }
.poll-status-badge.live    { background: #dcfce7; color: #15803d; }
.poll-status-badge.ended   { background: #e5e7eb; color: #4b5563; }
