#pollButton {
  position: relative;
  display: none;
  min-width: 118px;
  height: 38px;
  padding: 0 15px;
  overflow: hidden;
  border: 1px solid rgba(255, 209, 86, .9);
  border-radius: 9px;
  color: #181004;
  background: linear-gradient(120deg, #f0b126, #ffe078, #df8518, #f0b126);
  background-size: 260% 100%;
  box-shadow: 0 0 0 0 rgba(255, 193, 59, .58), 0 6px 18px rgba(0, 0, 0, .28);
  font: 900 12px/1 Arial, sans-serif;
  letter-spacing: .035em;
  text-transform: uppercase;
  cursor: pointer;
  animation: treePollFlash 1.15s ease-in-out infinite, treePollSweep 3s linear infinite;
}

#pollButton[hidden] { display: none !important; }
#pollButton.is-active { display: inline-block; }
#pollButton:hover { filter: brightness(1.08); transform: translateY(-1px); }
#pollButton:focus-visible, .tree-poll-dialog button:focus-visible, .tree-poll-dialog a:focus-visible {
  outline: 3px solid rgba(255, 205, 77, .5);
  outline-offset: 2px;
}

@keyframes treePollFlash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 59, .56), 0 6px 18px rgba(0, 0, 0, .28); }
  50% { box-shadow: 0 0 0 7px rgba(255, 193, 59, 0), 0 7px 24px rgba(224, 139, 22, .52); }
}

@keyframes treePollSweep {
  from { background-position: 100% 0; }
  to { background-position: -160% 0; }
}

.tree-poll-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: none;
  place-items: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(2, 7, 8, .8);
  backdrop-filter: blur(7px);
}
.tree-poll-overlay.is-open { display: grid; }

.tree-poll-dialog {
  width: min(590px, 96vw);
  max-height: min(780px, 94dvh);
  overflow: auto;
  box-sizing: border-box;
  border: 1px solid rgba(238, 178, 55, .5);
  border-radius: 18px;
  color: #eaf2f0;
  background:
    radial-gradient(circle at 92% 0, rgba(230, 172, 56, .15), transparent 36%),
    linear-gradient(145deg, #172225, #0c1315);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .64);
  font: 14px/1.5 Arial, sans-serif;
}
.tree-poll-dialog * { box-sizing: border-box; }
.tree-poll-dialog [hidden] { display: none !important; }

.tree-poll-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 21px 22px 17px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.tree-poll-kicker { color: #eab44b; font-size: 10px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.tree-poll-header h2 { margin: 3px 0 0; color: #fff; font-size: 23px; line-height: 1.25; overflow-wrap: anywhere; }
#treePollClose {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  color: #dce8e5;
  background: #263235;
  font-size: 23px;
  cursor: pointer;
}
.tree-poll-body { padding: 21px 22px 24px; }
.tree-poll-time {
  display: inline-flex;
  padding: 7px 10px;
  border: 1px solid rgba(33, 170, 159, .3);
  border-radius: 999px;
  color: #8ee2d8;
  background: rgba(23, 121, 113, .15);
  font-size: 11px;
  font-weight: 900;
}
.tree-poll-time.is-closed { border-color: rgba(255,255,255,.14); color: #9ba8a6; background: rgba(255,255,255,.05); }
.tree-poll-question { margin: 18px 0; color: #f0f5f3; font-size: 18px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.tree-poll-login {
  margin: 0 0 15px;
  padding: 12px 13px;
  border: 1px solid rgba(240, 177, 38, .34);
  border-radius: 10px;
  color: #dccca8;
  background: rgba(132, 84, 18, .18);
}
.tree-poll-login a { display: inline-block; margin-left: 5px; color: #ffd56f; font-weight: 900; }
.tree-poll-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.tree-poll-choice {
  display: inline-flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 56px;
  padding: 10px 13px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 11px;
  color: #fff;
  background: #293638;
  font: 900 16px/1.2 Arial, sans-serif;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  cursor: pointer;
  transition: transform .14s ease, filter .14s ease, border-color .14s ease;
}
.tree-poll-choice-mark { flex: 0 0 auto; font-size: 19px; }
.tree-poll-choice > span:last-child { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
.tree-poll-choice.is-yes { border-color: rgba(43, 195, 142, .48); background: linear-gradient(135deg, #126a50, #1b8b69); }
.tree-poll-choice.is-no { border-color: rgba(224, 93, 99, .48); background: linear-gradient(135deg, #7e2a31, #a23a43); }
.tree-poll-choice:not(:disabled):hover { filter: brightness(1.13); transform: translateY(-1px); }
.tree-poll-choice:disabled { cursor: not-allowed; filter: saturate(.58); opacity: .56; }
.tree-poll-choice.is-selected { opacity: 1; border-color: #ffe080; box-shadow: 0 0 0 3px rgba(255, 207, 76, .18); }
.tree-poll-status { min-height: 23px; margin-top: 10px; color: #89a09c; font-size: 12px; }
.tree-poll-status.is-success { color: #7ce1b9; }
.tree-poll-status.is-error { color: #ff9ea3; }
.tree-poll-results { margin-top: 13px; padding: 16px; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(5, 11, 12, .5); }
.tree-poll-result-row + .tree-poll-result-row { margin-top: 14px; }
.tree-poll-result-row > div:first-child { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 6px; }
.tree-poll-result-row strong { min-width: 0; color: #f5f8f7; overflow-wrap: anywhere; word-break: break-word; }
.tree-poll-result-row span { flex: 0 0 auto; color: #9badaa; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tree-poll-track { height: 9px; overflow: hidden; border-radius: 999px; background: #253234; }
.tree-poll-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #23a778, #60ddb0); transition: width .35s ease; }
.tree-poll-track.is-no > span { background: linear-gradient(90deg, #a63b43, #ec7379); }
.tree-poll-total { margin-top: 13px; color: #d7e1df; font-size: 12px; font-weight: 900; text-align: center; }

@media screen and (max-width: 860px) {
  #pollButton { width: 42px; min-width: 42px; padding: 0; font-size: 0; }
  #pollButton::after { content: "📊"; font-size: 17px; }
}

@media screen and (max-width: 520px) {
  .tree-poll-overlay { padding: 0; align-items: end; }
  .tree-poll-dialog { width: 100vw; max-height: 94dvh; border-width: 1px 0 0; border-radius: 18px 18px 0 0; }
  .tree-poll-header, .tree-poll-body { padding-left: 16px; padding-right: 16px; }
  .tree-poll-choices { grid-template-columns: 1fr; }
  .tree-poll-choice { min-height: 52px; }
  .tree-poll-result-row > div:first-child { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  #pollButton { animation: none; }
  .tree-poll-choice, .tree-poll-track > span { transition: none; }
}
