@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800;900&display=swap');

:root {
  --bg: #262626;
  --bg-soft: #2b2b2b;
  --surface: #2f2f2f;
  --surface-2: #3a3a3a;
  --text: #f5f1ea;
  --text-muted: #b6ada0;
  --accent: #ff7f11;
  --accent-dark: #e57008;
  --sage: #869d7a;
  --sage-dark: #6f8563;
  --danger: #e2534f;
  --radius: 24px;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.55);
  --font: "Vazirmatn", "Segoe UI", Tahoma, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html { direction: rtl; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(circle at 82% 8%, rgba(255, 127, 17, 0.14), transparent 42%),
    radial-gradient(circle at 8% 92%, rgba(134, 157, 122, 0.16), transparent 45%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

::selection { background: var(--accent); color: #262626; }

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  background: #2a2a2a;
  border-bottom: 4px solid var(--accent);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo {
  font-weight: 900;
  font-size: 1.45rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.logo-emoji {
  display: inline-block;
  margin-inline-end: 6px;
  color: var(--accent);
  animation: wiggle 2.6s ease-in-out infinite;
}

.logo:hover .logo-emoji { animation: bounceY 0.6s ease-in-out infinite; }

.vote-counter {
  margin-inline-start: auto;
  font-size: 0.85rem;
  color: var(--text);
  background: rgba(134, 157, 122, 0.18);
  border: 2px solid var(--sage);
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
  font-weight: 700;
}

.vote-counter::before { content: "🗳️ "; }

.nav-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid transparent;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s, border-color 0.15s;
}

.nav-link:hover {
  background: rgba(255, 127, 17, 0.14);
  border-color: var(--accent);
  transform: scale(1.06) rotate(-2deg);
}

/* ---------- Layout ---------- */

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

/* ---------- Voting page ---------- */

.tagline {
  text-align: center;
  font-size: clamp(1.9rem, 6vw, 3.1rem);
  font-weight: 900;
  margin: 10px 0 6px;
  color: var(--accent);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}

.hint {
  text-align: center;
  color: var(--text-muted);
  margin: 0 0 34px;
  font-size: 1.05rem;
  line-height: 1.9;
}

.hint strong { color: var(--accent); }

/* Voting pair */
.pair {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: stretch;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 80px 0;
  font-size: 1.15rem;
}

.loading a { color: var(--accent); font-weight: 700; }

.loader-emoji {
  display: inline-block;
  margin-inline-end: 10px;
  animation: bounceY 1.1s ease-in-out infinite;
  font-size: 1.4rem;
}

.person-card {
  position: relative;
  background: linear-gradient(165deg, #343434 0%, #2b2b2b 100%);
  border: 3px solid #404040;
  border-radius: 30px;
  box-shadow: var(--shadow);
  padding: 30px 20px 26px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.18s ease, box-shadow 0.18s ease;
}

.person-card::after {
  content: "👆";
  position: absolute;
  top: 14px;
  inset-inline-end: 16px;
  font-size: 1.3rem;
  opacity: 0;
  transform: rotate(8deg);
  transition: opacity 0.18s ease;
}

.person-card:hover {
  border-color: var(--accent);
  transform: translateY(-8px) rotate(-1deg) scale(1.02);
  box-shadow: 0 20px 46px rgba(255, 127, 17, 0.25);
  z-index: 2;
}

.person-card:hover::after { opacity: 1; }

.person-card .avatar {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 5px solid #404040;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
  margin-bottom: 18px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.person-card:hover .avatar {
  transform: scale(1.04);
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(255, 127, 17, 0.3);
}

.person-name {
  font-size: 1.5rem;
  font-weight: 900;
}

.person-meta {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 8px;
  font-weight: 600;
}

.provisional-tag {
  color: var(--sage);
  background: rgba(134, 157, 122, 0.15);
  border: 1px solid rgba(134, 157, 122, 0.4);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: help;
  margin-inline-start: 8px;
}

/* Vote states */
.person-card.win {
  border-color: var(--sage);
  box-shadow: 0 0 0 5px rgba(134, 157, 122, 0.35), var(--shadow-lg);
  animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.person-card.lose {
  filter: grayscale(1);
  opacity: 0.3;
}

.person-card.voted { pointer-events: none; }

.vs-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-10deg);
  background: linear-gradient(150deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-weight: 900;
  font-size: 1.5rem;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45), 0 0 0 6px #262626;
  z-index: 4;
  animation: wiggle 3s ease-in-out infinite;
}

/* ---------- Toast ---------- */

[hidden] { display: none !important; }

.toast {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(18, 18, 18, 0.74);
  backdrop-filter: blur(6px);
  z-index: 50;
  animation: fadeIn 0.18s ease;
  padding: 24px;
  cursor: pointer;
}

.toast-card {
  background: linear-gradient(165deg, #343434 0%, #262626 100%);
  border: 3px solid var(--accent);
  border-radius: 30px;
  padding: 26px 30px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 460px;
  width: 100%;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: default;
}

.toast-pop {
  font-size: 3.2rem;
  animation: wiggle 1.6s ease-in-out infinite;
}

.toast h2 {
  margin: 6px 0 16px;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 900;
}

.toast-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feedback-card {
  background: #2e2e2e;
  border: 2px solid #3c3c3c;
  border-radius: 16px;
  padding: 12px 16px;
  text-align: center;
}

.feedback-card.up { border-color: rgba(134, 157, 122, 0.55); }

.feedback-card.down { border-color: rgba(226, 83, 79, 0.4); }

.feedback-card .fb-tag { font-size: 0.8rem; font-weight: 800; margin-bottom: 2px; }

.feedback-card.up .fb-tag { color: var(--sage); }

.feedback-card.down .fb-tag { color: var(--danger); }

.feedback-card .fb-name { font-weight: 900; font-size: 1.05rem; }

.feedback-card .fb-change { font-weight: 900; font-size: 1.3rem; direction: ltr; }

.feedback-card.up .fb-change { color: var(--sage); }

.feedback-card.down .fb-change { color: var(--danger); }

.feedback-card .fb-rank { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }

.toast-next {
  margin-top: 14px;
  background: linear-gradient(150deg, var(--accent), var(--accent-dark));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 30px;
  font-family: var(--font);
  font-weight: 900;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(255, 127, 17, 0.4);
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-next:hover { transform: scale(1.07) rotate(-1deg); }

/* ---------- Confetti ---------- */

.confetti {
  position: fixed;
  top: -24px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  z-index: 60;
  animation-name: confettiFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

/* ---------- Leaderboard ---------- */

.page-title {
  margin: 0 0 22px;
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}

.climber-banner {
  background: linear-gradient(100deg, #3b2c1b, #2f2416);
  border: 3px solid var(--accent);
  border-radius: 26px;
  padding: 16px 22px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 28px rgba(255, 127, 17, 0.18);
  overflow: hidden;
  animation: popIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.climber-banner img.thumb {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}

.climber-label {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.climber-name { font-weight: 900; font-size: 1.2rem; color: var(--text); }

.climber-up { color: var(--sage); font-weight: 900; margin-inline-start: 8px; }

.leaderboard {
  background: #2e2e2e;
  border: 3px solid #3b3b3b;
  border-radius: 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 64px 58px 1fr 110px 96px;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 2px dashed #3a3a3a;
  animation: slideUp 0.45s ease backwards;
  transition: background 0.15s ease;
}

.leaderboard-row:hover { background: #353535; }

.leaderboard-row:last-child { border-bottom: none; }

.rank {
  font-weight: 900;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
}

.leaderboard-row.top-1 .rank,
.leaderboard-row.top-2 .rank,
.leaderboard-row.top-3 .rank { font-size: 1.5rem; }

.thumb {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 3px solid #4a4a4a;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.leaderboard-row:hover .thumb { transform: scale(1.1) rotate(-4deg); }

.top-1 .thumb { border-color: #f5c542; }
.top-2 .thumb { border-color: #c9c9c9; }
.top-3 .thumb { border-color: #cd8a5e; }

.row-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-rating {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 800;
}

.row-meta { font-size: 0.85rem; color: var(--text-muted); text-align: left; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes pop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(6deg); }
}

@keyframes bounceY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

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

@keyframes confettiFall {
  to {
    transform: translate(var(--dx), 110vh) rotate(var(--dr));
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .pair {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .pair .person-card { width: 100%; }

  .vs-badge {
    position: static;
    transform: rotate(-8deg);
    margin: 2px 0;
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  .person-card { padding: 22px 16px 20px; }

  .person-card .avatar { width: 140px; height: 140px; }

  .leaderboard-row {
    grid-template-columns: 48px 50px 1fr;
    padding: 12px 14px;
  }

  .row-rating, .row-meta { display: none; }
}



/* (All existing styles remain. Add these at the end.) */

.vote-closed {
  text-align: center;
  padding: 20px 10px;
}

.closed-card {
  background: linear-gradient(165deg, #343434 0%, #262626 100%);
  border: 3px solid var(--accent);
  border-radius: 30px;
  padding: 30px 24px;
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  margin: 0 auto;
}

.closed-emoji {
  font-size: 3.6rem;
  display: block;
  margin-bottom: 4px;
}

.closed-card h2 {
  font-size: 1.7rem;
  margin: 6px 0 12px;
  color: var(--accent);
}

.closed-card p {
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text-muted);
  margin: 10px 0;
}

.closed-card strong {
  color: var(--text);
}

.donation-link {
  display: inline-block;
  background: linear-gradient(150deg, var(--accent), var(--accent-dark));
  color: #fff;
  padding: 12px 36px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 900;
  font-size: 1.15rem;
  box-shadow: 0 10px 22px rgba(255, 127, 17, 0.35);
  transition: transform 0.15s ease;
  margin: 8px 0 6px;
}

.donation-link:hover {
  transform: scale(1.06) rotate(-1deg);
}

.closed-sub {
  margin-top: 16px;
}

.leaderboard-link {
  color: var(--sage);
  font-weight: 800;
  text-decoration: none;
  border: 2px solid var(--sage);
  padding: 6px 18px;
  border-radius: 999px;
  transition: background 0.15s, transform 0.15s;
  display: inline-block;
}

.leaderboard-link:hover {
  background: rgba(134, 157, 122, 0.15);
  transform: scale(1.05);
}