@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Playfair+Display:wght@600;700;800&display=swap');

:root {
  --primary: #006064;
  --primary-light: #00838F;
  --primary-dark: #0097A7;
  --secondary: #00BCD4;
  --accent: #E0F7FA;
  --accent-light: #FCD34D;
  --success: #10B981;
  --danger: #EF4444;
  --bg: #F5F3FF;
  --bg-card: #FFFFFF;
  --bg-dark: #1E1B4B;
  --text-primary: #1E1B4B;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-light: #F3F4F6;
  --shadow-sm: 0 1px 3px rgba(108, 60, 225, 0.06);
  --shadow-md: 0 4px 12px rgba(108, 60, 225, 0.1);
  --shadow-lg: 0 8px 30px rgba(108, 60, 225, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

::selection {
  background: var(--primary-light);
  color: white;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ========== LOADING ========== */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 1rem;
  color: var(--text-secondary);
}

.loading-pulse {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ========== APP SHELL ========== */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.back-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.back-btn:hover {
  background: var(--bg);
}

.app-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--secondary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.admin-toggle input {
  accent-color: var(--primary);
}

.toggle-label {
  font-weight: 500;
}

.user-badge {
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  white-space: nowrap;
}

.app-main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ========== BUTTONS ========== */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--border-light);
}

.btn-upload-trigger {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.btn-upload-trigger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.delete-btn-small {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  line-height: 1;
}

.delete-btn-small:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ========== SECTION TITLES ========== */
.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--secondary);
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

/* ========== FILTER BAR ========== */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.45rem 1rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--text-secondary);
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.filter-chip:hover:not(.active) {
  border-color: var(--primary-light);
  color: var(--primary);
}

/* ========== CONTEST LIST ========== */
.contest-list-view {
  animation: fadeIn 0.4s ease;
}

.list-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

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

.contest-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  animation: fadeInUp 0.5s ease both;
}

.contest-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.contest-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1rem 0;
}

.contest-card-body {
  padding: 0.75rem 1rem 1.25rem;
}

.contest-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: var(--secondary);
}

.contest-theme {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.contest-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.meta-item {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ========== STATUS BADGES ========== */
.status-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-open {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.status-voting {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
}

/* ========== CREATE CONTEST ========== */
.create-contest-view {
  max-width: 560px;
  margin: 0 auto;
  animation: fadeIn 0.4s ease;
}

.create-contest-view .section-title {
  margin-bottom: 1.5rem;
}

.create-form {
  background: var(--bg-card);
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-input {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 44px;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 60, 225, 0.12);
}

.form-textarea {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg);
  color: var(--text-primary);
}

.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 60, 225, 0.12);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ========== CONTEST DETAIL ========== */
.contest-detail-view {
  animation: fadeIn 0.4s ease;
}

.detail-hero {
  background: linear-gradient(135deg, var(--secondary), var(--primary-dark));
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 1.5rem;
  color: white;
  position: relative;
  overflow: hidden;
}

.detail-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3), transparent);
  border-radius: 50%;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-content .status-badge {
  margin-bottom: 0.75rem;
}

.detail-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.detail-theme {
  font-size: 1rem;
  opacity: 0.85;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.detail-description {
  font-size: 0.88rem;
  opacity: 0.7;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.detail-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.82rem;
  opacity: 0.8;
  flex-wrap: wrap;
}

/* ========== UPLOAD ========== */
.upload-section {
  margin-bottom: 1.5rem;
}

.upload-modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  animation: slideUp 0.3s ease;
}

.upload-modal h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.upload-area {
  margin-bottom: 1rem;
}

.file-drop-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg);
}

.file-drop-zone:hover {
  border-color: var(--primary);
  background: rgba(108, 60, 225, 0.04);
}

.file-input-hidden {
  display: none;
}

.drop-content {
  text-align: center;
  color: var(--text-secondary);
}

.drop-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.drop-content p {
  font-size: 0.88rem;
}

.preview-container {
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 300px;
}

.upload-preview {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

.already-submitted {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--success);
  font-weight: 500;
  font-size: 0.9rem;
}

/* ========== ENTRIES GALLERY ========== */
.entries-section {
  margin-top: 0.5rem;
}

.entries-section .section-title {
  margin-bottom: 1rem;
}

.entries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.entry-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  animation: fadeInUp 0.5s ease both;
  transition: transform 0.2s, box-shadow 0.2s;
}

.entry-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.entry-image-wrap {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--border-light);
}

.entry-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.entry-card:hover .entry-image {
  transform: scale(1.03);
}

.entry-info {
  padding: 0.85rem 1rem;
}

.entry-caption {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.entry-author {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.entry-delete {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== VOTING ========== */
.voting-section {
  animation: fadeIn 0.4s ease;
}

.voting-header {
  margin-bottom: 1.25rem;
}

.voting-header .section-subtitle {
  margin-top: 0.4rem;
}

.leaderboard {
  background: linear-gradient(135deg, var(--accent), #F97316);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  color: white;
}

.leaderboard-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.leader-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.leader-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.leader-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.leader-caption {
  font-weight: 700;
  font-size: 0.95rem;
}

.leader-author {
  font-size: 0.8rem;
  opacity: 0.85;
}

.leader-votes {
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.9;
}

.voting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.vote-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  overflow: hidden;
  position: relative;
  animation: fadeInUp 0.5s ease both;
  transition: all 0.25s ease;
}

.vote-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.vote-card.voted {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 60, 225, 0.12);
}

.vote-card.winner {
  border-color: var(--accent);
}

.winner-ribbon {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  font-size: 1.5rem;
  z-index: 2;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.vote-image-wrap {
  aspect-ratio: 4/3;
  overflow: hidden;
  position: relative;
  background: var(--border-light);
}

.vote-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.vote-card:hover .vote-image {
  transform: scale(1.03);
}

.vote-overlay {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
}

.vote-count-badge {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.vote-card-body {
  padding: 0.85rem 1rem;
}

.vote-caption {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.vote-author {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.75rem;
}

.vote-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.vote-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: var(--text-secondary);
  flex: 1;
}

.vote-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(108, 60, 225, 0.06);
}

.vote-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.vote-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vote-bar-container {
  height: 3px;
  background: var(--border-light);
}

.vote-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 0 3px 3px 0;
  transition: width 0.4s ease;
}

/* ========== EMPTY STATE ========== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

.empty-state h3 {
  font-family: 'Playfair Display', serif;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.empty-state p {
  font-size: 0.88rem;
}

/* ========== SKELETON ========== */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.skeleton-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  height: 180px;
  animation: shimmer 1.5s infinite;
}

.skeleton-card.tall {
  height: 280px;
}

@keyframes shimmer {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  .app-header {
    padding: 0.75rem 1rem;
  }

  .app-title {
    font-size: 1.1rem;
  }

  .app-main {
    padding: 1rem;
  }

  .detail-hero {
    padding: 1.5rem;
  }

  .detail-title {
    font-size: 1.4rem;
  }

  .contest-grid,
  .entries-grid,
  .voting-grid {
    grid-template-columns: 1fr;
  }

  .list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn-primary,
  .form-actions .btn-secondary {
    width: 100%;
    text-align: center;
  }

  .leader-card {
    flex-direction: column;
    text-align: center;
  }

  .leader-image {
    width: 100px;
    height: 100px;
  }

  .detail-stats {
    flex-direction: column;
    gap: 0.4rem;
  }

  .user-badge {
    display: none;
  }
}

@media (max-width: 380px) {
  .filter-bar {
    gap: 0.35rem;
  }

  .filter-chip {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
  }
}
```

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to Photo Contest! This is where you'll browse all active and past contests.", "view": "visitor", "highlight_selector": ".contest-list-view", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Toggle Admin mode to create and manage contests. As admin, you'll see the 'New Contest' button.", "view": "admin", "highlight_selector": ".admin-toggle", "wait_for": "tap_to_continue"},
  {"step": 3, "narration": "Create a contest by setting a title, theme, and submission deadline.", "view": "admin", "highlight_selector": ".create-form", "wait_for": "tap_to_continue"},
  {"step": 4, "narration": "Click any contest card to view its details and entries.", "view": "visitor", "highlight_selector": ".contest-card", "wait_for": "user_interaction"},
  {"step": 5, "narration": "While submissions are open, upload your photo with a caption.", "view": "visitor", "highlight_selector": ".btn-upload-trigger", "wait_for": "user_interaction"},
  {"step": 6, "narration": "After the deadline passes, voting opens automatically. Tap the heart to vote for your favorite!", "view": "visitor", "highlight_selector": ".vote-btn", "wait_for": "user_interaction"},
  {"step": 7, "narration": "The leaderboard shows the current front-runner. Vote bars show relative standings.", "view": "visitor", "highlight_selector": ".leaderboard", "wait_for": "tap_to_continue"}
]
-->

.auth-gate {
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.auth-btn {
  margin-top: 1rem;
}

.auth-status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(108, 60, 225, 0.1);
  color: var(--primary-dark);
  border: 1px solid rgba(108, 60, 225, 0.15);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.auth-signout-btn {
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
}

.deadline-timer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.deadline-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.deadline-chip.active {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.18);
}

.deadline-chip.expired {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.18);
}

.deadline-countdown {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.reaction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.reaction-btn:hover:not(:disabled) {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(108, 60, 225, 0.06);
}

.reaction-btn.active {
  border-color: rgba(108, 60, 225, 0.22);
  background: rgba(108, 60, 225, 0.12);
  color: var(--primary-dark);
}

.reaction-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.reaction-emoji {
  font-size: 0.95rem;
  line-height: 1;
}

.reaction-count {
  min-width: 0.9rem;
  text-align: center;
}

.auth-notice {
  background: rgba(108, 60, 225, 0.08);
  border: 1px solid rgba(108, 60, 225, 0.14);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.active-voters-panel {
  margin-top: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm);
}

.active-voters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}

.active-voters-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
}

.active-voters-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.active-voters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.active-voter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(108, 60, 225, 0.08);
  border: 1px solid rgba(108, 60, 225, 0.12);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.active-voter-chip.more {
  background: var(--bg);
  color: var(--text-secondary);
  border-color: var(--border);
}

.active-voter-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
  flex-shrink: 0;
}

.active-voters-empty {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.auth-gate {
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.auth-btn {
  margin-top: 1rem;
}

.auth-status-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(108, 60, 225, 0.1);
  color: var(--primary-dark);
  border: 1px solid rgba(108, 60, 225, 0.15);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.auth-signout-btn {
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
}

.deadline-timer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.deadline-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.deadline-chip.active {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.18);
}

.deadline-chip.expired {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.18);
}

.deadline-countdown {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.contest-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.1rem;
}

.chart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.chart-panel-header {
  margin-bottom: 0.85rem;
}

.chart-panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-panel-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.chart-panel-body {
  min-height: 120px;
}

.votes-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.votes-chart-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.votes-chart-label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.votes-chart-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.votes-chart-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.votes-chart-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
}

.votes-chart-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 999px;
}

.trend-chart {
  width: 100%;
}

.trend-chart-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 0.7rem;
  align-items: end;
  min-height: 150px;
}

.trend-chart-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.trend-chart-bar-wrap {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: end;
  justify-content: center;
  background: linear-gradient(180deg, rgba(108, 60, 225, 0.04), rgba(108, 60, 225, 0));
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0.35rem;
}

.trend-chart-bar {
  width: 100%;
  max-width: 28px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  min-height: 8px;
}

.trend-chart-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.trend-chart-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}

.chart-empty {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.voting-summary {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.voting-summary-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(108, 60, 225, 0.08);
  color: var(--primary-dark);
  border: 1px solid rgba(108, 60, 225, 0.12);
  font-size: 0.78rem;
  font-weight: 600;
}

.reaction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.reaction-btn:hover:not(:disabled) {
  border-color: var(--primary-light);
  color: var(--primary);
  background: rgba(108, 60, 225, 0.06);
}

.reaction-btn.active {
  border-color: rgba(108, 60, 225, 0.22);
  background: rgba(108, 60, 225, 0.12);
  color: var(--primary-dark);
}

.reaction-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.reaction-emoji {
  font-size: 0.95rem;
  line-height: 1;
}

.reaction-count {
  min-width: 0.9rem;
  text-align: center;
}

.auth-notice {
  background: rgba(108, 60, 225, 0.08);
  border: 1px solid rgba(108, 60, 225, 0.14);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.active-voters-panel {
  margin-top: 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm);
}

.active-voters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
  flex-wrap: wrap;
}

.active-voters-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-primary);
}

.active-voters-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.active-voters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.active-voter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(108, 60, 225, 0.08);
  border: 1px solid rgba(108, 60, 225, 0.12);
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.active-voter-chip.more {
  background: var(--bg);
  color: var(--text-secondary);
  border-color: var(--border);
}

.active-voter-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
  flex-shrink: 0;
}

.active-voters-empty {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .contest-charts-grid {
    grid-template-columns: 1fr;
  }

  .trend-chart-bars {
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  }
}

.winner-certificate-section {
  margin: 1.25rem 0 1.5rem;
}

.winner-certificate-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.winner-certificate-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.winner-certificate-card {
  background: linear-gradient(135deg, #fffdfa, #fff7ed);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.winner-certificate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(245, 158, 11, 0.12);
  color: #9a3412;
  border: 1px solid rgba(245, 158, 11, 0.18);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.winner-certificate-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  color: var(--secondary);
  margin-bottom: 0.25rem;
}

.winner-certificate-theme {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.winner-certificate-winning-entry {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(245, 158, 11, 0.16);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.winner-certificate-image {
  width: 120px;
  height: 90px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.winner-certificate-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.winner-certificate-winning-entry h4 {
  font-size: 1.05rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.winner-certificate-winning-entry p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}

.winner-certificate-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.84rem;
}

@media (max-width: 640px) {
  .winner-certificate-controls {
    width: 100%;
  }

  .winner-certificate-controls .btn-primary,
  .winner-certificate-controls .btn-secondary {
    flex: 1;
  }

  .winner-certificate-meta {
    grid-template-columns: 1fr;
  }
}

.share-results-card {
  margin: 0.9rem 0 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow-sm);
}

.share-results-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.share-results-link {
  font-size: 0.82rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.share-results-message {
  margin-top: 0.45rem;
  font-size: 0.86rem;
  color: var(--primary-dark);
  font-weight: 600;
}

@media (max-width: 640px) {
  .winner-certificate-controls {
    width: 100%;
  }

  .winner-certificate-controls .btn-primary,
  .winner-certificate-controls .btn-secondary {
    flex: 1;
  }

  .winner-certificate-meta {
    grid-template-columns: 1fr;
  }

  .share-results-link {
    font-size: 0.78rem;
  }
}
