:root {
  --primary-color: #3a7bd5;
  --secondary-color: #00d2ff;
  --accent-color: #ff7e5f;
  --dark-color: #2c3e50;
  --light-color: #ecf0f1;
  --success-color: #2ecc71;
  --warning-color: #f39c12;
  --error-color: #e74c3c;
  --mountain-color-1: #8e9eab;
  --mountain-color-2: #6a85b6;
  --mountain-color-3: #4b6cb7;
  --sky-color: #a1c4fd;
  --sun-color: #f9d423;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Montserrat", sans-serif;
  color: var(--dark-color);
  background: #d4e9f5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  background-image: url(/background.jpeg);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
}

.header {
  text-align: center;
  margin: 40px 0;
  position: relative;
  animation: fadeInDown 1s ease-out;
  padding-top: 50px;
}

.title {
  font-size: clamp(1.5rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
  font-size: 1.2rem;
  color: coral;
  opacity: 0.8;
  font-family: "Open Sans", sans-serif;
}

.main-content {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
}

.counter-section {
  min-width: 300px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  padding: 30px;
  backdrop-filter: blur(5px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeInUp 0.8s ease-out;
}

.counter-title,
.comments-title {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--primary-color);
  text-align: center;
  position: relative;
}

.counter-title:after,
.comments-title:after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  margin: 10px auto;
  border-radius: 3px;
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 50;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: white;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  text-align: center;
  position: relative;
  animation: modalAppear 0.4s ease-out;
}

@keyframes modalAppear {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal h2 {
  font-family: "Montserrat", sans-serif;
  color: #1a2a6c;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.modal p {
  margin-bottom: 25px;
  font-size: 1.1rem;
  color: #444;
}

.modal-input {
  width: 100%;
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  margin-bottom: 20px;
  text-align: center;
  transition: border-color 0.3s;
}

.modal-input:focus {
  border-color: #1a2a6c;
  outline: none;
  box-shadow: 0 0 0 3px rgba(26, 42, 108, 0.1);
}

.modal-buttons {
  display: flex;
  gap: 15px;
}

.modal-btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 50px;
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.modal-btn.confirm {
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
}

.modal-btn.cancel {
  background: #f0f0f0;
  color: #444;
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #777;
  cursor: pointer;
  transition: color 0.3s;
}

.close-modal:hover {
  color: #b21f1f;
}

.peak-flag {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  background: var(--accent-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 10;
  animation: bounce 2s infinite;
}

.counter-wrapper {
  position: relative;
  margin: 30px 0;
}

.counter {
  font-size: 4rem;
  font-weight: 700;
  text-align: center;
  color: var(--primary-color);
  position: relative;
  z-index: 2;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  animation: pulse 2s infinite;
}

.counter-shadow {
  position: absolute;
  top: 10px;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, var(--secondary-color), transparent);
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.5;
  z-index: 1;
}

.click-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: row;
  height: 70px;
  width: 100%;
  padding: 15px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  border-radius: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 20px 0;
  box-shadow: 0 4px 15px rgba(58, 123, 213, 0.4);
  position: relative;
  overflow: hidden;
}

.click-btn:disabled {
  display: none;
}

.click-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(58, 123, 213, 0.6);
}

.click-btn:active {
  transform: translateY(1px);
}

.click-btn:before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: 0.5s;
}

.click-btn:hover:before {
  left: 100%;
}

.click-btn i {
  margin-right: 10px;
}

.clicked-message {
  text-align: center;
  color: var(--success-color);
  font-weight: 600;
  margin: 20px 0;
  display: none;
  animation: fadeIn 0.5s ease-out;
}

.clicked-message i {
  margin-right: 8px;
}

.user-badge,
.fa-user,
#userNameDisplay {
  display: none;
}

.fa-mountain {
  font-size: 25px;
}

.footer {
  text-align: center;
  padding: 20px;
  color: #00d2ff;
  opacity: 0.7;
  font-size: 0.9rem;
  margin-top: 50px;
  position: relative;
}

.qr-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 15px;
  border-radius: 50px;
  margin-top: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  font-weight: 600;
  color: var(--primary-color);
  animation: pulse 2s infinite;
}

.qr-badge i {
  margin-right: 8px;
  font-size: 1.2rem;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success-color);
  color: white;
  padding: 12px 25px;
  border-radius: 50px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  z-index: 999;
}

.toast.error {
  background: var(--error-color);
}

.toast i {
  margin-right: 10px;
  font-size: 1.2rem;
}

/* Анимации */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0) translateX(-50%);
  }
  50% {
    transform: translateY(-15px) translateX(-50%);
  }
}

@keyframes clouds-move {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 1000px 0;
  }
}

@keyframes sun-glow {
  from {
    box-shadow: 0 0 50px var(--sun-color);
  }
  to {
    box-shadow: 0 0 70px var(--sun-color);
  }
}

@keyframes snow-fall {
  to {
    transform: translateY(100vh);
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  .title {
    font-size: clamp(2rem, 4vw, 3rem);
  }

  .subtitle {
    font-size: 1rem;
  }

  .counter {
    font-size: 3rem;
  }

  .counter-title,
  .comments-title {
    font-size: 1.3rem;
  }

  .sun {
    width: 60px;
    height: 60px;
    top: 30px;
    right: 30px;
  }
  .podium-date {
    display: none;
  }
  .leader-date {
    display: none;
  }
}

@media (max-width: 480px) {
  body {
    background: rgba(255, 255, 255, 0.9);
  }
  br {
    display: none;
  }

  .container {
    padding: 0;
  }

  .header {
    margin: 20px 0;
    padding-top: 10px;
  }

  .title {
    font-size: 1.8rem;
  }

  .main-content {
    margin: 30px 0;
    border-radius: 0;
    padding: 0 10px;
  }

  .counter-section {
    padding: 20px;
  }
}

.leaderboard-container {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 15px;
  padding: 30px;
  margin: 50px 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation: fadeInUp 0.8s ease-out 0.2s both;
}

.leaderboard-title {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--primary-color);
  position: relative;
}

.leaderboard-title:after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  margin: 10px auto;
  border-radius: 3px;
}

.empty-leaderboard {
  text-align: center;
  padding: 60px 20px;
  color: var(--dark-color);
  opacity: 0.7;
}

.empty-leaderboard i {
  font-size: 3rem;
  color: var(--accent-color);
  margin-bottom: 20px;
  display: block;
}

.podium-place {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.leader-item {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.podium-place:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.podium-name {
  flex: 1;
  text-align: left;
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--dark-color);
}

.podium-date {
  left: 50%;
  transform: translateX(-50%);
  position: absolute;
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: #7f8c8d;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
  width: 100%;
}

.leader-name {
  flex: 1;
  text-align: left;
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--dark-color);
}

.leader-date {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: #7f8c8d;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
  .leader-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

.podium-avatar {
  display: none;
}

.leader-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.podium-rank {
  background: #2a5298;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}
.leader-rank {
  background: #2a5298;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  position: absolute;
  right: 18px;
  top: 10px;
}

.leader-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: bold;
  margin: 0 15px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.leader-info {
  flex: 1;
}

.leader-badge {
  background: rgba(58, 123, 213, 0.1);
  border-radius: 20px;
  padding: 5px 15px;
  font-weight: bold;
  color: var(--primary-color);
}

.fa-mountain_leader {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin-top: -30px;
  color: var(--primary-color);
}

.no-data {
  text-align: center;
  margin-top: 85px;
  color: var(--dark-color);
}

/* Анимация для топ-1 */

.empty-leaderboard {
  text-align: center;
  padding: 60px 20px;
  color: var(--dark-color);
  opacity: 0.7;
}

.empty-leaderboard i {
  font-size: 3rem;
  color: var(--accent-color);
  margin-bottom: 20px;
  display: block;
}
