/* Keep page-header compatible with theme (don't break site header) */
.page-header.contest-page-header {
  background: linear-gradient(135deg, #0f3d2e 0%, #1b6b4a 55%, #2d9f6f 100%);
  position: relative;
  overflow: hidden;
}

.contest-content {
  min-height: 200px;
}

.contest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.contest-card {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.contest-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 61, 46, 0.14);
  color: inherit;
  text-decoration: none;
}

.contest-card-cover {
  position: relative;
  height: 140px;
  background: center/cover no-repeat #1b6b4a;
}

.contest-card-cover--empty {
  background: linear-gradient(135deg, #0f3d2e, #2d9f6f);
}

.contest-card-cover-badges {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.contest-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.contest-card h3 {
  font-size: 1.1rem;
  margin: 0 0 8px;
  line-height: 1.3;
}

.contest-card-desc {
  color: #667;
  font-size: 0.9rem;
  min-height: 2.5em;
  margin-bottom: 12px;
  flex: 1;
}

.contest-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: #445;
  margin-bottom: 8px;
}

.contest-card-stats i {
  color: #1b6b4a;
  margin-right: 4px;
}

.contest-card-meta {
  font-size: 12px;
  color: #778;
}

.contest-card-score {
  margin-top: 8px;
  font-size: 13px;
  color: #0f3d2e;
}

/* Countdown */
.contest-countdown {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(15, 61, 46, 0.06), rgba(45, 159, 111, 0.1));
  border: 1px solid rgba(27, 107, 74, 0.12);
}

.contest-countdown-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #1b6b4a;
  margin-bottom: 8px;
}

.contest-countdown-digits {
  display: flex;
  align-items: center;
  gap: 4px;
}

.contest-countdown-unit {
  flex: 1;
  min-width: 0;
  text-align: center;
  background: #fff;
  border-radius: 8px;
  padding: 6px 4px 5px;
  box-shadow: 0 1px 2px rgba(15, 61, 46, 0.06);
}

.contest-countdown-unit span {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.1;
  color: #0f3d2e;
  font-variant-numeric: tabular-nums;
}

.contest-countdown-unit small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: #778;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.contest-countdown-sep {
  font-weight: 700;
  color: #1b6b4a;
  opacity: 0.45;
  padding-bottom: 12px;
}

.contest-countdown--card {
  margin-top: 10px;
}

.contest-countdown--hero {
  margin: 0 0 18px;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
}

.contest-countdown--hero .contest-countdown-label {
  color: rgba(255, 255, 255, 0.92);
}

.contest-countdown--hero .contest-countdown-unit {
  background: rgba(255, 255, 255, 0.95);
}

.contest-countdown--hero .contest-countdown-sep {
  color: #fff;
  opacity: 0.7;
}

.contest-countdown--timeline {
  margin-top: 10px;
  padding: 8px 10px;
}

.contest-countdown--static {
  padding: 8px 12px;
}

.contest-countdown--static .contest-countdown-label {
  margin-bottom: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 600;
}

.contest-countdown--expired .contest-countdown-label {
  color: #778;
}

.contest-badge {
  background: rgba(255, 255, 255, 0.92);
  color: #0f3d2e;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}

.contest-hashtag-pill {
  background: rgba(15, 61, 46, 0.85);
  color: #fff;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* Detail hero */
.contest-hero {
  position: relative;
  min-height: 280px;
  border-radius: 14px;
  overflow: hidden;
  background: center/cover no-repeat #0f3d2e;
  color: #fff;
}

.contest-hero--plain {
  background: linear-gradient(135deg, #0f3d2e 0%, #1b6b4a 50%, #2d9f6f 100%);
}

.contest-hero-overlay {
  position: relative;
  z-index: 1;
  min-height: 280px;
  padding: 28px 28px 24px;
  background: linear-gradient(180deg, rgba(8, 28, 22, 0.25) 0%, rgba(8, 28, 22, 0.78) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.contest-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.contest-hero-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 6px;
  font-weight: 800;
  line-height: 1.2;
}

.contest-hero-sub {
  opacity: 0.9;
  margin-bottom: 16px;
}

.contest-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 18px;
}

.contest-hero-stats strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1.1;
}

.contest-hero-stats span {
  font-size: 12px;
  opacity: 0.85;
}

.contest-hashtag-banner {
  background: #e8f5ef;
  border-left: 4px solid #1b6b4a;
  padding: 12px 14px;
  border-radius: 6px;
}

/* Timeline rail */
.contest-timeline-rail {
  list-style: none;
  margin: 0;
  padding: 4px 0 0;
  position: relative;
}

.contest-timeline-step {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding-bottom: 22px;
}

.contest-timeline-step:last-child {
  padding-bottom: 0;
}

.contest-timeline-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 22px;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(27, 107, 74, 0.35), rgba(27, 107, 74, 0.08));
}

.contest-timeline-step--done:not(:last-child)::before {
  background: #1b6b4a;
}

.contest-timeline-marker {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #c5ddd2;
  background: #fff;
  box-shadow: 0 0 0 4px #f3faf7;
  position: relative;
  z-index: 1;
}

.contest-timeline-step--done .contest-timeline-marker {
  border-color: #1b6b4a;
  background: #1b6b4a;
  box-shadow: 0 0 0 4px rgba(27, 107, 74, 0.12);
}

.contest-timeline-step--done .contest-timeline-marker::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 3px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.contest-timeline-step--current .contest-timeline-marker,
.contest-timeline-step--next .contest-timeline-marker {
  border-color: #1b6b4a;
  background: #e8f5ef;
  box-shadow: 0 0 0 4px rgba(45, 159, 111, 0.18);
  animation: contest-pulse 1.8s ease-in-out infinite;
}

.contest-timeline-step--current .contest-timeline-marker {
  background: #2d9f6f;
  border-color: #2d9f6f;
}

.contest-timeline-step--empty .contest-timeline-marker {
  opacity: 0.45;
}

@keyframes contest-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(45, 159, 111, 0.16); }
  50% { box-shadow: 0 0 0 7px rgba(45, 159, 111, 0.08); }
}

.contest-timeline-body {
  min-width: 0;
  padding-top: 1px;
}

.contest-timeline-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 700;
  color: #0f3d2e;
  margin-bottom: 4px;
  line-height: 1.3;
}

.contest-timeline-step--upcoming .contest-timeline-title,
.contest-timeline-step--empty .contest-timeline-title {
  color: #667;
  font-weight: 600;
}

.contest-timeline-dates {
  font-size: 12px;
  color: #667;
  line-height: 1.45;
}

.contest-timeline-arrow {
  display: inline-block;
  margin: 0 4px;
  opacity: 0.5;
}

.contest-timeline-chip {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: #2d9f6f;
  color: #fff;
  border-radius: 999px;
  padding: 2px 7px;
}

.contest-timeline-chip--next {
  background: #0f3d2e;
}

.contest-timeline-chip--done {
  background: rgba(27, 107, 74, 0.12);
  color: #1b6b4a;
  padding: 2px 6px;
}

.contest-timeline-step--current .contest-timeline-body {
  background: #f3faf7;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(27, 107, 74, 0.12);
}

.contest-timeline-step--next .contest-timeline-body {
  background: #fafcfb;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px dashed rgba(27, 107, 74, 0.22);
}

.contest-delta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.contest-delta-grid > div {
  background: #f7faf8;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.contest-delta-grid span {
  display: block;
  font-size: 12px;
  color: #778;
}

.contest-prize-list {
  padding-left: 18px;
  margin-bottom: 0;
}

.contest-prize-list li + li {
  margin-top: 8px;
}

.contest-post-item {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
}

.contest-post-item:last-child {
  margin-bottom: 0;
}

.contest-post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.contest-claim-box {
  border: 1px solid #cfe9dc;
  background: #f3fbf7;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
}

.contest-richtext p:last-child {
  margin-bottom: 0;
}

.contest-richtext img {
  max-width: 100%;
  height: auto;
}

.contest-howto-list {
  padding-left: 1.2rem;
  margin-bottom: 0;
}

.contest-howto-list li {
  margin-bottom: 0.45rem;
}

.contest-related {
  margin-top: 8px;
}

.contest-related .contest-grid {
  margin-top: 4px;
}

@media (max-width: 767.98px) {
  .contest-hero-overlay {
    padding: 20px 16px 18px;
    min-height: 240px;
  }

  .contest-countdown--hero {
    max-width: none;
  }

  .contest-countdown-unit span {
    font-size: 0.95rem;
  }
}
