* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-dark: #0a0a0a;
  --neon-yellow: #ccff00;
  --white: #ffffff;
  --text-secondary: #999999;
  --accent-blue: #0066ff;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
}

body {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #1a1a1a 100%);
  color: var(--white);
  font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  position: relative;
}

/* Геометрические фоновые элементы */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(204, 255, 0, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  left: -5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(0, 102, 255, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}

/* Концентрические круги на фоне */
.geometric-background {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1200px;
  height: 1200px;
  pointer-events: none;
  z-index: 0;
}

.geometric-background svg {
  width: 100%;
  height: 100%;
  opacity: 0.15;
}

/* Контент */
.container {
  position: relative;
  z-index: 1;
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Заголовок */
header {
  text-align: center;
  margin-bottom: 60px;
  animation: slideDown 0.8s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.festival-title {
  font-family: 'Montserrat', 'Inter', sans-serif;
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--neon-yellow) 0%, #ffff99 50%, var(--white) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 30px rgba(204, 255, 0, 0.6)) drop-shadow(0 0 60px rgba(204, 255, 0, 0.3));
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% {
    filter: drop-shadow(0 0 30px rgba(204, 255, 0, 0.6)) drop-shadow(0 0 60px rgba(204, 255, 0, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 40px rgba(204, 255, 0, 0.8)) drop-shadow(0 0 80px rgba(204, 255, 0, 0.5));
  }
}

.festival-subtitle {
  font-family: 'Caveat', 'Pacifico', cursive;
  font-size: clamp(1.2rem, 4vw, 2rem);
  color: var(--neon-yellow);
  font-weight: 700;
  letter-spacing: 0.02em;
  filter: drop-shadow(0 0 10px rgba(204, 255, 0, 0.4));
}

/* Лидерборд */
.leaderboard {
  flex: 1;
  animation: fadeIn 0.8s ease-out 0.2s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.leaderboard-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 30px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--white);
}

.teams-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.team-item {
  display: grid;
  grid-template-columns: 50px 1fr 150px;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: rgba(15, 15, 15, 0.6);
  border: 1px solid rgba(204, 255, 0, 0.2);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  animation: slideInLeft 0.5s ease-out both;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.team-item:nth-child(1) {
  animation-delay: 0.1s;
}
.team-item:nth-child(2) {
  animation-delay: 0.2s;
}
.team-item:nth-child(3) {
  animation-delay: 0.3s;
}
.team-item:nth-child(4) {
  animation-delay: 0.4s;
}
.team-item:nth-child(5) {
  animation-delay: 0.5s;
}

.team-item:hover {
  background: rgba(20, 20, 20, 0.8);
  border-color: rgba(204, 255, 0, 0.4);
  transform: translateX(5px);
  box-shadow: 0 0 20px rgba(204, 255, 0, 0.15);
}

.team-position {
  font-size: 1.8rem;
  font-weight: 900;
  text-align: center;
  min-width: 50px;
}

.team-position.gold {
  color: #ffd700;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

.team-position.silver {
  color: #c0c0c0;
  filter: drop-shadow(0 0 8px rgba(192, 192, 192, 0.5));
}

.team-position.bronze {
  color: #cd7f32;
  filter: drop-shadow(0 0 8px rgba(205, 127, 50, 0.5));
}

.team-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  word-break: break-word;
}

.team-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.team-score {
  text-align: right;
}

.score-value {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--neon-yellow);
  text-shadow: 0 0 15px rgba(204, 255, 0, 0.4),
               0 0 30px rgba(204, 255, 0, 0.2);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.score-value.pulse {
  animation: scorePulse 0.6s ease-out;
}

@keyframes scorePulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
    text-shadow: 0 0 20px rgba(204, 255, 0, 0.6),
                 0 0 40px rgba(204, 255, 0, 0.3);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 0 15px rgba(204, 255, 0, 0.4),
                 0 0 30px rgba(204, 255, 0, 0.2);
  }
}

.score-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 5px;
}

/* Нет команд */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1.1rem;
}

/* Footer */
footer {
  margin-top: 60px;
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(204, 255, 0, 0.1);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

footer a {
  color: var(--neon-yellow);
  text-decoration: none;
  transition: all 0.3s ease;
  filter: drop-shadow(0 0 5px rgba(204, 255, 0, 0.3));
}

footer a:hover {
  text-decoration: underline;
  filter: drop-shadow(0 0 10px rgba(204, 255, 0, 0.5));
}

/* Адаптив */
@media (max-width: 768px) {
  .container {
    padding: 20px 15px;
  }

  header {
    margin-bottom: 40px;
  }

  .festival-title {
    font-size: 2rem;
  }

  .festival-subtitle {
    font-size: 1rem;
  }

  .team-item {
    grid-template-columns: 40px 1fr 100px;
    gap: 15px;
    padding: 15px;
  }

  .team-position {
    font-size: 1.4rem;
    min-width: 40px;
  }

  .team-name {
    font-size: 1rem;
  }

  .score-value {
    font-size: 2rem;
  }

  .teams-list {
    gap: 10px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 15px 10px;
  }

  .festival-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }

  .festival-subtitle {
    font-size: 0.9rem;
  }

  .team-item {
    grid-template-columns: 35px 1fr 80px;
    gap: 10px;
    padding: 12px;
  }

  .team-position {
    font-size: 1.1rem;
    min-width: 35px;
  }

  .team-name {
    font-size: 0.95rem;
  }

  .score-value {
    font-size: 1.5rem;
  }

  .score-label {
    font-size: 0.75rem;
  }

  .leaderboard-title {
    font-size: 1.1rem;
    margin-bottom: 20px;
  }
}

/* Загрузка */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(204, 255, 0, 0.3);
  border-radius: 50%;
  border-top-color: var(--neon-yellow);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Admin стили */
.admin-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

.admin-section {
  background: rgba(15, 15, 15, 0.6);
  border: 1px solid rgba(204, 255, 0, 0.2);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  backdrop-filter: blur(10px);
}

.admin-section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--neon-yellow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.form-group label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--white);
}

.form-group input,
.form-group textarea {
  padding: 12px 15px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(204, 255, 0, 0.2);
  border-radius: 8px;
  color: var(--white);
  font-family: inherit;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--neon-yellow);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 15px rgba(204, 255, 0, 0.2);
}

.form-group input::placeholder {
  color: var(--text-secondary);
}

.btn {
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--neon-yellow) 0%, #b8e600 100%);
  color: #000;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 0 15px rgba(204, 255, 0, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(204, 255, 0, 0.5);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: rgba(204, 255, 0, 0.1);
  color: var(--neon-yellow);
  border: 1px solid var(--neon-yellow);
  box-shadow: 0 0 10px rgba(204, 255, 0, 0.2);
}

.btn-secondary:hover {
  background: rgba(204, 255, 0, 0.2);
  box-shadow: 0 0 20px rgba(204, 255, 0, 0.4);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.btn-danger {
  background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
  color: var(--white);
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 0 25px rgba(255, 68, 68, 0.5);
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-team-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 15px;
  padding: 20px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(204, 255, 0, 0.15);
  border-radius: 8px;
  margin-bottom: 15px;
}

.admin-team-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-team-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
}

.admin-team-score {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-team-score-value {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--neon-yellow);
  min-width: 60px;
}

.admin-team-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.form-group-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.form-group-inline input {
  flex: 1;
  max-width: 100px;
  padding: 8px 12px;
  margin: 0;
}

.form-group-inline .btn {
  padding: 8px 12px;
  font-size: 0.85rem;
  margin: 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 30px;
  color: var(--neon-yellow);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  filter: drop-shadow(0 0 5px rgba(204, 255, 0, 0.3));
}

.back-link:hover {
  transform: translateX(-5px);
  filter: drop-shadow(0 0 10px rgba(204, 255, 0, 0.5));
}

@media (max-width: 768px) {
  .admin-team-item {
    grid-template-columns: 1fr;
  }

  .admin-team-controls {
    align-items: stretch;
  }

  .quick-actions {
    gap: 6px;
  }

  .btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .form-group-inline {
    flex-direction: column;
  }

  .form-group-inline input {
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 20px 12px;
  }

  .admin-section {
    padding: 16px 12px;
    margin-bottom: 20px;
    border-radius: 8px;
  }

  .admin-section-title {
    font-size: 1.1rem;
    margin-bottom: 15px;
  }

  header {
    margin-bottom: 30px;
  }

  .festival-title {
    font-size: clamp(1.8rem, 6vw, 3rem);
  }

  .quick-actions {
    flex-direction: column;
    gap: 8px;
  }

  .quick-actions .btn-small {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .admin-team-item {
    padding: 15px 12px;
    margin-bottom: 12px;
  }

  .admin-team-name {
    font-size: 1rem;
  }

  .admin-team-score-value {
    font-size: 1.2rem;
  }

  .admin-team-controls {
    width: 100%;
  }

  .form-group-inline {
    flex-direction: column;
    gap: 8px;
  }

  .form-group-inline input {
    width: 100%;
    max-width: 100%;
    padding: 10px 12px;
  }

  .form-group-inline .btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .btn {
    padding: 12px 16px;
    font-size: 0.95rem;
    width: 100%;
  }

  .form-group input,
  .form-group textarea {
    padding: 12px 12px;
    font-size: 16px;
  }

  .back-link {
    font-size: 0.95rem;
    margin-bottom: 20px;
  }

  .form-group {
    margin-bottom: 15px;
  }

  .btn-small {
    padding: 10px 12px;
    font-size: 0.85rem;
  }
}

/* ========== МОБИЛЬНАЯ АДАПТАЦИЯ - COLLAPSIBLE И PROTECT ========== */

.admin-team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(204, 255, 0, 0.15);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.admin-team-header:hover {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(204, 255, 0, 0.3);
}

.admin-team-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 20px;
}

.admin-team-toggle {
  font-size: 1.2rem;
  transition: transform 0.3s ease;
  color: var(--neon-yellow);
  flex-shrink: 0;
}

.admin-team-controls-wrapper {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.admin-team-controls-wrapper.expanded {
  max-height: 500px;
}

.admin-team-controls {
  padding: 16px;
  border-left: 2px solid var(--neon-yellow);
  margin-left: 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Группировка кнопок */
.action-group {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-radius: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.action-group-positive {
  border: 2px solid rgba(76, 175, 80, 0.4);
  background: rgba(76, 175, 80, 0.05);
}

.action-group-negative {
  border: 2px solid rgba(244, 67, 54, 0.4);
  background: rgba(244, 67, 54, 0.05);
}

.btn-positive {
  background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
  color: white;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
  min-width: 48px;
  min-height: 48px;
}

.btn-positive:hover {
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
}

.btn-negative {
  background: linear-gradient(135deg, #F44336 0%, #D32F2F 100%);
  color: white;
  box-shadow: 0 0 10px rgba(244, 67, 54, 0.3);
  min-width: 48px;
  min-height: 48px;
}

.btn-negative:hover {
  box-shadow: 0 0 20px rgba(244, 67, 54, 0.5);
}

/* Toast (snackbar) */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--neon-yellow);
  border-radius: 8px;
  padding: 14px 20px;
  color: var(--white);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideUp 0.3s ease;
  box-shadow: 0 0 20px rgba(204, 255, 0, 0.3);
}

.toast-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toast-message {
  font-weight: 600;
  font-size: 0.95rem;
}

.toast-undo-btn {
  background: var(--neon-yellow);
  color: #000;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.toast-undo-btn:hover {
  background: #ffff99;
  transform: scale(1.05);
}

.toast-undo-btn:active {
  transform: scale(0.95);
}

.toast.fade-out {
  animation: slideDown 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Confirm Dialog */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
  padding: 20px;
}

.confirm-dialog {
  background: rgba(15, 15, 15, 0.95);
  border: 1px solid rgba(204, 255, 0, 0.3);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 0 40px rgba(204, 255, 0, 0.2);
  animation: popIn 0.3s ease;
}

.confirm-message {
  color: var(--white);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.confirm-buttons .btn {
  min-width: 100px;
  padding: 12px 20px;
}

.confirm-ok {
  background: linear-gradient(135deg, var(--neon-yellow) 0%, #b8e600 100%);
  color: #000;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Tablet adaptation */
@media (max-width: 768px) {
  .admin-team-header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-team-score {
    width: 100%;
  }

  .quick-actions {
    width: 100%;
  }

  .action-group {
    width: 100%;
  }

  .toast {
    bottom: 16px;
    left: 16px;
    right: 16px;
    transform: none;
  }
}

/* Mobile adaptation */
@media (max-width: 480px) {
  .admin-team-item {
    padding: 0;
    border: none;
    background: transparent;
  }

  .admin-team-header {
    padding: 14px;
    border-radius: 6px;
    margin-bottom: 12px;
  }

  .admin-team-controls-wrapper.expanded {
    max-height: 800px;
  }

  .admin-team-controls {
    padding: 12px;
    margin-left: 0;
    border-left: none;
    border-top: 2px solid var(--neon-yellow);
    gap: 12px;
  }

  .action-group {
    padding: 10px;
    gap: 6px;
  }

  .btn-positive,
  .btn-negative {
    flex: 1;
    min-width: 45px;
    min-height: 45px;
    padding: 8px;
    font-size: 0.8rem;
  }

  .form-group-inline {
    flex-direction: column;
    gap: 10px;
  }

  .form-group-inline input,
  .form-group-inline .btn {
    width: 100%;
    min-height: 48px;
    padding: 12px;
    font-size: 16px;
  }

  .toast {
    bottom: 12px;
    left: 12px;
    right: 12px;
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .toast-content {
    flex-direction: column;
    gap: 10px;
  }

  .toast-undo-btn {
    width: 100%;
    padding: 10px;
  }

  .confirm-dialog {
    padding: 20px;
    max-width: 90vw;
  }

  .confirm-message {
    font-size: 0.95rem;
    margin-bottom: 16px;
  }

  .confirm-buttons {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .confirm-buttons .btn {
    width: 100%;
    min-height: 48px;
    padding: 12px;
  }
}
