.polls-container {
  width: 100%;
  box-sizing: border-box;
  padding: 0;
}

.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.cat-button {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-s);
  color: var(--text-body);
  background: var(--body-primary);
  padding: 6px 16px;
  text-decoration: none;
  border: 1px solid var(--body-secondary);
  text-transform: lowercase;
}

.cat-button:hover,
.cat-button.active {
  background: var(--bg-accent);
  color: var(--text-accent);
  border-color: var(--bg-accent);
}

.page-title,
.page-subtitle,
.category-filter,
.empty-state {
  width: 100%;
}

.polls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  width: 100%;
}

@media (min-width: 2500px) {
  .polls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    width: 100%;
  }
}

.poll-card {
  background: var(--bg-wrappers);
  padding: 24px;
  border: 1px solid var(--body-secondary);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.poll-card-link-wrapper {
  text-decoration: none;
  display: block;
  color: inherit;
}

.poll-question a {
  color: inherit;
}

.single-view-mode .polls-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  align-items: start;
  gap: 24px;
  width: 100%;
}

.single-view-mode .poll-card {
  flex: none;
  width: 100%;
  margin: 0;
}

.single-view-discussion {
  box-sizing: border-box;
  border-left: 1px solid var(--body-secondary);
  padding-left: 24px;
  display: flex;
  flex-direction: column;
  height: 70vh;
  align-self: start;
}

.single-view-discussion h4 {
  font-family: var(--font-family-secondary);
  font-size: var(--font-size-s);
  color: var(--text-headers);
  margin-bottom: 14px;
  flex-shrink: 0;
}

.single-view-discussion .comment-notice-wrap {
  flex-shrink: 0;
}

.single-view-discussion .comment-tree {
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding-right: 8px;
}

.single-view-discussion .comment-form {
  flex-shrink: 0;
  margin-bottom: 16px;
}

@media (max-width: 760px) {
  .single-view-mode .polls-grid {
    grid-template-columns: 1fr;
  }

  .single-view-discussion {
    border-left: none;
    border-top: 1px solid var(--body-secondary);
    padding-left: 0;
    padding-top: 20px;
    max-height: none;
  }

  .single-view-discussion .comment-tree {
    max-height: 300px;
  }
}

.poll-navigation-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 15px;
}

.poll-pager {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pager-link {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  color: var(--text-links);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.pager-link:hover {
  color: var(--text-links-hover);
}

.pager-link.disabled {
  display: none;
}

@media (max-width: 480px) {
  .poll-navigation-wrap {
    flex-direction: column;
    align-items: stretch;
  }
  .poll-pager {
    justify-content: space-between;
  }
}


.poll-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.poll-form {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.poll-header {
  margin-bottom: 10px;
}

.polls-grid .poll-question {
  line-height: 1.2;
  text-align: center;
  width: 100%;
  font-weight: bold;
}

.poll-description {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  color: var(--text-body);
  margin-top: 2px;
  opacity: 0.85;
}

.poll-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 20px;
  flex-grow: 1;
  text-transform: lowercase;
}

.poll-actions {
  display: flex;
  gap: 12px;
  margin-top: auto;
  justify-content: center;
}

.poll-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--border-form-fields);
  cursor: pointer;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-s);
  color: var(--text-wrappers);
  border-radius: 12px;
  border: 1.5px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.poll-option:hover {
  background: var(--body-primary);
  border-color: var(--bg-accent);
}

.poll-option:has(input:checked) {
  background: var(--bg-secondary);
  border-color: var(--bg-accent);
  color: var(--text-secondary);
}

.poll-option input[type="radio"],
.poll-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  place-content: center;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 2px solid var(--body-secondary);
  background: var(--bg-wrappers);
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.poll-option input[type="radio"] {
  border-radius: 50%;
}

.poll-option input[type="checkbox"] {
  border-radius: 5px;
}

.poll-option input[type="radio"]:checked,
.poll-option input[type="checkbox"]:checked {
  background: var(--bg-accent);
  border-color: var(--bg-accent);
}

.poll-option input[type="radio"]::after {
  content: '';
  width: 6px;
  height: 6px;
  background: transparent;
  border-radius: 50%;
  transition: background 0.15s ease;
}

.poll-option input[type="radio"]:checked::after {
  background: #fff;
}

.poll-option input[type="checkbox"]::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2.5px solid transparent;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: border-color 0.15s ease;
}

.poll-option input[type="checkbox"]:checked::after {
  border-color: #fff;
}

.poll-option input[type="radio"]:focus-visible,
.poll-option input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--bg-accent);
  outline-offset: 2px;
}

.vote-button,
.results-button,
.comment-submit,
.reply-cancel {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  padding: 4px 12px;
  border: none;
  cursor: pointer;
  text-transform: lowercase;
}

.vote-button {
  background: var(--body-secondary);
  color: var(--text-body);
  transition: background 0.2s ease, color 0.2s ease;
}

.vote-button.has-selection {
  background: var(--bg-accent);
  color: var(--text-accent);
}

.comment-submit {
  background: var(--bg-accent);
  color: var(--text-accent);
}

.results-button,
.reply-cancel {
  background: var(--body-secondary);
  color: var(--text-body);
}

.vote-button:hover,
.results-button:hover,
.comment-submit:hover,
.reply-cancel:hover {
  opacity: 0.9;
}

.vote-button:active,
.results-button:active,
.comment-submit:active,
.reply-cancel:active {
  transform: scale(0.98);
}

.vote-button:disabled,
.results-button:disabled,
.comment-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 15px 0;
}

.result-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  word-break: break-word;
  text-transform: lowercase;
}

.result-top span:last-child {
  white-space: nowrap;
  text-align: right;
  flex-shrink: 0;
}

.user-voted .r-label {
  font-weight: bold;
}

.user-voted .result-top {
  font-size: var(--font-size-s);
}

.vote-count {
  font-size: var(--font-size-xs);
}

.bar-track {
  background: var(--bg-form-fields);
  height: 6px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  background: var(--bg-accent);
  height: 100%;
  width: 0%;
  border-radius: 10px;
  transition: width 0.8s cubic-bezier(0.1, 1, 0.1, 1);
}

.voted-badge {
  display: inline-block;
  font-family: var(--font-family-secondary);
  font-size: var(--font-size-s);
  color: var(--bg-accent);
  margin-top: 2px;
}

.result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.poll-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
  padding-top: 6px;
  font-size: var(--font-size-xs);
  text-transform: lowercase;
  opacity: 0.7;
}

.footer-meta-side {
  display: flex;
  align-items: center;
  gap: 8px;
}

.comments-link {
  text-decoration: none;
  color: var(--text-links);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  padding: 1px 5px;
  background: var(--body-secondary);
  transition: color 0.2s ease;
}

.comments-link:hover,
.comments-link.active {
  color: var(--text-links-hover);
}

.polls-grid .poll-footer .comments-link {
  background: transparent;
  padding: 0;
}

.notice,
.comments-notice,
.no-comments {
  padding: 6px 10px;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  max-width: 200px;
  margin: 10px auto;
  text-align: center;
}

.no-comments {
  background: var(--bg-form-fields);
  color: var(--text-form-fields);
}

.comment-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.comment-lastname-wrapper,
.comment-lastname {
  display:none !important; 
  position: absolute;
  left:-9999px;
}

.privacy-toggle-button {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--font-size-xs);
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.privacy-toggle-button:hover {
  opacity: 1;
}

.privacy-toggle-button .toggle-arrow {
  transition: transform 0.2s ease;
  font-size: 0.9em;
}

.privacy-toggle-button.is-active .toggle-arrow {
  transform: rotate(180deg);
}

.comment-privacy-notice {
  font-size: var(--font-size-xs);
  opacity: 0.7;
  margin-top: 6px;
  line-height: 1.4;
}

.comment {
  background: var(--bg-wrappers);
  border: 1px solid var(--body-secondary);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comment.is-reply {
  margin-left: 16px;
  border-left: 2px solid var(--bg-accent);
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--font-size-xs);
}

.comment-author {
  font-family: var(--font-family-secondary);
  color: var(--text-headers);
}

.comment-date {
  color: var(--text-body);
  opacity: 0.6;
}

.comment-text {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  color: var(--text-wrappers);
  line-height: 1.5;
  word-break: break-word;
}

.comment-reply-button {
  background: none;
  border: none;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  color: var(--text-links);
  cursor: pointer;
  padding: 0;
  margin-top: 2px;
  align-self: flex-end;
}

.comment-reply-button:hover {
  color: var(--text-links-hover);
}

.comment-form,
.reply-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--body-primary);
  padding: 14px;
  border: 1px solid var(--body-secondary);
}

.reply-form-wrap {
  display: none;
  margin-top: 6px;
}

.reply-form-wrap.open {
  display: flex;
}

.comment-form-row {
  display: flex;
  gap: 6px;
}

.comment-name,
.reply-name,
.comment-body,
.reply-body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  background: var(--bg-wrappers);
  color: var(--text-wrappers);
  border: 1px solid var(--body-secondary);
  border-radius:12px;
  padding: 7px 10px;
  outline: none;
}

.comment-name:focus,
.reply-name:focus,
.comment-body:focus,
.reply-body:focus {
  border-color: var(--bg-accent);
}

.comment-name,
.reply-name {
  flex: 1;
}

.comment-body,
.reply-body {
  width: 100%;
  height: 80px;
  resize: vertical;
  box-sizing: border-box;
}

.reply-form-wrap .reply-name {
  flex: none;
  width: 100%;
  box-sizing: border-box;
}