/* Shared poll list cards — home + community */

.poll-card,
.poll-empty-card {
  min-height: 280px;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid rgba(94, 130, 174, 0.24);
  background: #15181f;
  box-shadow: none;
  backdrop-filter: blur(18px);
}

/* List tiles ignore the large default; size is set on .kw-poll-tile / .is-compact below. */
.poll-card.kw-poll-tile,
.poll-card.is-compact,
.poll-empty-card.kw-poll-tile {
  min-height: var(--kw-poll-tile-h);
}

body.light .poll-card,
body.light .poll-empty-card {
  border-color: rgba(151, 168, 194, 0.38);
  background: linear-gradient(180deg, rgba(245, 247, 250, 0.88), rgba(234, 239, 246, 0.92));
  box-shadow:
    0 12px 24px rgba(42, 59, 89, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.poll-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 12px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.poll-card:hover {
  transform: translateY(-2px);
  border-color: rgba(83, 200, 255, 0.22);
  background: linear-gradient(180deg, rgba(35, 39, 48, 0.96), rgba(25, 29, 38, 0.97));
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.22),
    0 0 12px rgba(83, 200, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.poll-card.is-ended {
  border-color: rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(27, 31, 39, 0.88), rgba(19, 23, 31, 0.94));
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.poll-card.is-ended::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(3, 5, 9, 0.08), rgba(3, 5, 9, 0.16)),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.05) 0 10px,
      rgba(255, 255, 255, 0) 10px 20px
    );
  pointer-events: none;
}

body.light .poll-card.is-ended {
  border-color: rgba(176, 185, 201, 0.28);
  background: linear-gradient(180deg, rgba(233, 237, 244, 0.86), rgba(222, 228, 238, 0.9));
}

body.light .poll-card.is-ended::after {
  background:
    linear-gradient(180deg, rgba(146, 156, 173, 0.06), rgba(146, 156, 173, 0.12)),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.16) 0 10px,
      rgba(255, 255, 255, 0) 10px 20px
    );
}

.poll-card.is-ended:hover {
  transform: translateY(-1px);
  border-color: rgba(170, 178, 194, 0.22);
}

.poll-card-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.poll-card-category {
  color: rgba(158, 176, 203, 0.92);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

body.light .poll-card-category {
  color: #5e6d85;
}

.poll-card-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.poll-card-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}

.poll-card-state.is-active {
  background: rgba(46, 204, 113, 0.14);
  color: #45d483;
}

.poll-card-state.is-active .poll-card-state-icon:empty {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(69, 212, 131, 0.45);
  animation: poll-card-status-pulse 1.8s ease infinite;
}

@keyframes poll-card-status-pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(69, 212, 131, 0.35);
  }

  50% {
    opacity: 0.72;
    box-shadow: 0 0 0 5px rgba(69, 212, 131, 0);
  }
}

.poll-card-state.is-ended {
  background: rgba(120, 130, 148, 0.16);
  color: rgba(186, 194, 208, 0.88);
}

body.light .poll-card-state.is-ended {
  background: rgba(123, 135, 156, 0.14);
  color: #5e6d85;
}

.poll-card-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
}

.poll-card.is-active.is-deadline-urgent {
  border-color: rgba(255, 176, 84, 0.3);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(255, 176, 84, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.poll-card.is-active.is-deadline-urgent:hover {
  border-color: rgba(255, 196, 120, 0.42);
}

body.light .poll-card.is-active.is-deadline-urgent {
  border-color: rgba(230, 126, 34, 0.28);
}

.poll-card-time {
  color: var(--sub, rgba(158, 176, 203, 0.88));
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.poll-card-time.is-urgent {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 176, 84, 0.14);
  color: #ffb865;
  font-weight: 850;
  letter-spacing: -0.01em;
  box-shadow: 0 0 0 0 rgba(255, 176, 84, 0.24);
  animation: poll-card-deadline-urgent-pulse 2.2s ease infinite;
}

body.light .poll-card-time.is-urgent {
  background: rgba(230, 126, 34, 0.12);
  color: #c77712;
  box-shadow: none;
}

@keyframes poll-card-deadline-urgent-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 176, 84, 0.18);
  }

  50% {
    box-shadow: 0 0 0 4px rgba(255, 176, 84, 0);
  }
}

.poll-card-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -0.03em;
  color: #f7fbff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.light .poll-card-title {
  color: #1b2433;
}

.poll-card-meta-line {
  position: relative;
  z-index: 1;
  margin: -4px 0 0;
  color: rgba(158, 176, 203, 0.88);
  font-size: 12px;
  line-height: 1.45;
}

.poll-card-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

body.light .poll-card-meta-line {
  color: #5e6d85;
}

.poll-card-options {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  align-content: start;
}

.poll-card-option {
  display: grid;
  gap: 5px;
}

.poll-card-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.poll-card-option-label {
  min-width: 0;
  color: rgba(231, 240, 255, 0.94);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.light .poll-card-option-label {
  color: #243247;
}

.poll-card-option-percent {
  flex: 0 0 auto;
  color: rgba(158, 176, 203, 0.92);
  font-size: 11px;
  font-weight: 800;
}

.poll-card-option-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

body.light .poll-card-option-track {
  background: rgba(47, 128, 255, 0.08);
}

.poll-card-option-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(83, 200, 255, 0.55), rgba(103, 232, 249, 0.82));
  transition: width 0.24s ease;
}

.poll-card.is-ended .poll-card-option-fill,
.poll-card.is-ended .poll-card-option.is-leading .poll-card-option-fill {
  background: linear-gradient(90deg, rgba(146, 156, 173, 0.45), rgba(176, 186, 201, 0.72));
}

.poll-card-option.is-selected .poll-card-option-label {
  color: #9ef0ff;
}

.poll-card-option.is-selected .poll-card-option-fill {
  background: linear-gradient(90deg, rgba(69, 212, 131, 0.55), rgba(103, 232, 249, 0.88));
}

.poll-card-options-more {
  margin: 0;
  color: rgba(158, 176, 203, 0.82);
  font-size: 11px;
  font-weight: 700;
}

.poll-card-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.poll-card-foot-info {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.poll-card-foot-participants {
  color: rgba(255, 196, 120, 0.92);
  font-size: 12px;
  font-weight: 800;
}

body.light .poll-card-foot-participants {
  color: #c77712;
}

.poll-card-foot-extra {
  color: rgba(158, 176, 203, 0.9);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.poll-card-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(69, 212, 131, 0.92), rgba(45, 190, 120, 0.92));
  color: #062116;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 18px rgba(45, 190, 120, 0.18);
}

.poll-card-cta.is-outline {
  background: rgba(83, 200, 255, 0.1);
  color: #9ef0ff;
  border: 1px solid rgba(83, 200, 255, 0.24);
  box-shadow: none;
}

.poll-card-cta.is-muted {
  background: rgba(120, 130, 148, 0.18);
  color: rgba(220, 226, 236, 0.88);
  border: 1px solid rgba(150, 160, 178, 0.18);
  box-shadow: none;
}

body.light .poll-card-cta {
  color: #0f5130;
}

body.light .poll-card-cta.is-outline {
  color: #1f6fd1;
  background: rgba(47, 128, 255, 0.08);
  border-color: rgba(47, 128, 255, 0.18);
}

body.light .poll-card-cta.is-muted {
  color: #5e6d85;
  background: rgba(123, 135, 156, 0.12);
}

.poll-card.is-ended .poll-card-title,
.poll-card.is-ended .poll-card-meta-line,
.poll-card.is-ended .poll-card-time,
.poll-card.is-ended .poll-card-option-label,
.poll-card.is-ended .poll-card-foot-extra {
  opacity: 0.84;
}

.poll-empty-card {
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--sub, rgba(158, 176, 203, 0.88));
  grid-column: 1 / -1;
}

.poll-empty-card strong {
  color: var(--text, #f7fbff);
  font-size: 16px;
}

.poll-empty-card p {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

/*
 * Shared home poll tile — fixed px size on home AND community.
 * Parent panel width must NOT change the card box.
 * Row width = 4*250 + 3*12 = 1036px so headers/더보기 end with the last card.
 */
:root {
  --kw-poll-tile: 250px;
  --kw-poll-gap: 12px;
  --kw-poll-row: calc(4 * var(--kw-poll-tile) + 3 * var(--kw-poll-gap));
  --kw-poll-row-2: calc(2 * var(--kw-poll-tile) + 1 * var(--kw-poll-gap));
  /* Tall enough for 2 options + "+N more" row on every tile. */
  --kw-poll-tile-h: 228px;
  --kw-poll-options-min-h: 108px;
}

.home-poll-grid,
.poll-card-grid {
  display: grid;
  grid-template-columns: repeat(4, var(--kw-poll-tile));
  justify-content: start;
  align-items: stretch;
  gap: var(--kw-poll-gap);
  width: 100%;
  max-width: var(--kw-poll-row);
  min-width: 0;
  box-sizing: border-box;
}

/* Community section heads — home head uses full section width + panel padding. */
.poll-section-head {
  width: var(--kw-poll-row);
  max-width: 100%;
  box-sizing: border-box;
}

body[data-page="index"] .home-poll-section-head {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  box-sizing: border-box;
}

/* Center the fixed-width four-card row inside the wider home panel. */
body[data-page="index"] .home-poll-grid {
  justify-content: center;
  margin-inline: auto;
}

/* Fixed tile box — every card same height whether or not "+N more" is shown. */
.poll-card.kw-poll-tile,
.poll-card.is-compact {
  width: var(--kw-poll-tile) !important;
  min-width: var(--kw-poll-tile) !important;
  max-width: var(--kw-poll-tile) !important;
  height: var(--kw-poll-tile-h) !important;
  min-height: var(--kw-poll-tile-h) !important;
  max-height: var(--kw-poll-tile-h) !important;
  flex: 0 0 var(--kw-poll-tile) !important;
  box-sizing: border-box !important;
  padding: 14px 12px 12px;
  border-radius: 16px;
  display: flex !important;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.poll-card.kw-poll-tile .poll-card-head,
.poll-card.is-compact .poll-card-head {
  margin: 0;
}

.poll-card.kw-poll-tile .poll-card-title,
.poll-card.is-compact .poll-card-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
  min-height: 0;
  max-height: 2.7em;
  letter-spacing: -0.02em;
}

.poll-card.kw-poll-tile .poll-card-category,
.poll-card.kw-poll-tile .poll-card-time,
.poll-card.is-compact .poll-card-category,
.poll-card.is-compact .poll-card-time {
  font-size: 10px;
}

.poll-card.kw-poll-tile .poll-card-options,
.poll-card.is-compact .poll-card-options {
  gap: 8px;
  flex: 1 1 auto;
  min-height: var(--kw-poll-options-min-h);
  margin: 0;
  align-content: start;
  display: flex;
  flex-direction: column;
}

.poll-card.kw-poll-tile .poll-card-option,
.poll-card.is-compact .poll-card-option {
  position: relative;
  gap: 0;
  border: 1px solid rgba(94, 130, 174, 0.2);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

body.light .poll-card.kw-poll-tile .poll-card-option,
body:not(.dark) .poll-card.kw-poll-tile .poll-card-option,
body.light .poll-card.is-compact .poll-card-option,
body:not(.dark) .poll-card.is-compact .poll-card-option {
  border-color: rgba(151, 168, 194, 0.34);
  background: rgba(0, 0, 0, 0.03);
}

.poll-card.kw-poll-tile .poll-card-option-top,
.poll-card.is-compact .poll-card-option-top {
  position: relative;
  z-index: 1;
  padding: 8px 10px;
}

.poll-card.kw-poll-tile .poll-card-option-label,
.poll-card.is-compact .poll-card-option-label {
  font-size: 12px;
  color: rgba(231, 240, 255, 0.94);
}

.poll-card.kw-poll-tile .poll-card-option.is-selected .poll-card-option-label,
.poll-card.is-compact .poll-card-option.is-selected .poll-card-option-label {
  color: #9ef0ff;
}

.poll-card.kw-poll-tile .poll-card-option-percent,
.poll-card.is-compact .poll-card-option-percent {
  font-size: 10px;
  color: rgba(158, 176, 203, 0.92);
}

/* Keep fill clipped to the same 10px frame as the option shell (no pill mismatch). */
.poll-card.kw-poll-tile .poll-card-option-track,
.poll-card.is-compact .poll-card-option-track {
  position: absolute;
  inset: 0;
  height: auto;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
}

.poll-card.kw-poll-tile .poll-card-option-fill,
.poll-card.is-compact .poll-card-option-fill {
  height: 100%;
  border-radius: 0;
  opacity: 0.55;
}

.poll-card.kw-poll-tile .poll-card-options-more,
.poll-card.is-compact .poll-card-options-more {
  margin: 0;
  font-size: 10px;
  line-height: 14px;
  min-height: 14px;
  flex: 0 0 14px;
}

.poll-card.kw-poll-tile .poll-card-options-more.is-placeholder,
.poll-card.is-compact .poll-card-options-more.is-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.poll-card.kw-poll-tile .poll-card-foot,
.poll-card.is-compact .poll-card-foot {
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 0;
  flex: 0 0 auto;
}

.poll-card.kw-poll-tile .poll-card-foot-participants,
.poll-card.is-compact .poll-card-foot-participants {
  font-size: 11px;
}

.poll-card.kw-poll-tile .poll-card-cta.is-chevron,
.poll-card.is-compact .poll-card-cta.is-chevron {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #8b5cf6;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

body.light .poll-card.kw-poll-tile .poll-card-cta.is-chevron,
body:not(.dark) .poll-card.kw-poll-tile .poll-card-cta.is-chevron,
body.light .poll-card.is-compact .poll-card-cta.is-chevron,
body:not(.dark) .poll-card.is-compact .poll-card-cta.is-chevron {
  background: transparent;
  color: #7c4dff;
}

body:not(.dark) .home-poll-grid .poll-card,
body:not(.dark) .poll-card-grid .poll-card {
  border-color: rgba(152, 183, 233, 0.28);
  background:
    radial-gradient(circle at right top, rgba(103, 215, 255, 0.1), transparent 36%),
    linear-gradient(180deg, rgba(253, 255, 255, 0.96), rgba(239, 246, 255, 0.96));
}

body:not(.dark) .home-poll-grid .poll-card.is-ended,
body:not(.dark) .poll-card-grid .poll-card.is-ended {
  background: linear-gradient(180deg, rgba(241, 244, 250, 0.96), rgba(230, 236, 246, 0.96));
}

@media (max-width: 1280px) {
  .home-poll-grid,
  .poll-card-grid {
    grid-template-columns: repeat(2, var(--kw-poll-tile));
    width: var(--kw-poll-row-2);
  }

  .poll-section-head {
    width: var(--kw-poll-row-2);
  }
}

@media (max-width: 560px) {
  .home-poll-grid,
  .poll-card-grid {
    grid-template-columns: repeat(2, var(--kw-poll-tile));
    width: var(--kw-poll-row-2);
    gap: 10px;
    overflow-x: auto;
  }
}
