/* ========================================
   main.css — Основные стили
   ======================================== */

/* ----- Подключение шрифта ----- */
@import url('https://fonts.googleapis.com/css2?family=Fredoka+One&family=Nunito:wght@400;600;700;800&display=swap');

/* ----- CSS Variables ----- */
:root {
  /* Цвета прикольной темы */
  --color-primary: #FF6B6B;
  --color-secondary: #FFD93D;
  --color-accent: #6BCB77;
  --color-bg: #FFF8E7;
  --color-bg-secondary: #FFEAA7;
  --color-text: #2D3436;
  --color-text-light: #636E72;
  --color-card: #FFFFFF;
  --color-nav: #FF6B6B;
  --color-nav-hover: #FFD93D;
  
  /* Размеры */
  --header-height: 70px;
  --border-radius: 16px;
  --border-radius-sm: 8px;
  
  /* Шрифты */
  --font-display: 'Fredoka One', cursive;
  --font-body: 'Nunito', sans-serif;
  
  /* Тени */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* ----- Reset & Base ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.5s ease, color 0.5s ease;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctext y='28' font-size='28'%3E%F0%9F%8E%89%3C/text%3E%3C/svg%3E") 16 16, auto;
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all 0.3s ease;
}

button:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ----- Custom Scrollbar ----- */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 6px;
  border: 3px solid var(--color-bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-secondary);
}

/* ----- Header & Navigation ----- */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  transition: background-color 0.5s ease;
}

.header__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header__logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-primary);
  transition: transform 0.3s ease;
}

.header__logo:hover {
  transform: scale(1.1) rotate(-5deg);
}

/* ----- Navigation ----- */
.nav__list {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--color-text);
  background: transparent;
  transition: all 0.3s ease;
  position: relative;
}

/* Забавные анимации при наведении */
.nav__link:hover {
  background: var(--color-secondary);
  color: var(--color-text);
  transform: translateY(-3px) scale(1.05);
  box-shadow: var(--shadow-md);
}

.nav__link:nth-child(1):hover { transform: translateY(-3px) scale(1.05) rotate(-3deg); }
.nav__link:nth-child(2):hover { transform: translateY(-3px) scale(1.05) rotate(3deg); }
.nav__link:nth-child(3):hover { transform: translateY(-5px) scale(1.08); }
.nav__link:nth-child(4):hover { transform: translateY(-3px) scale(1.05) rotate(-2deg); }
.nav__link:nth-child(5):hover { transform: translateY(-3px) scale(1.05) rotate(2deg); }
.nav__link:nth-child(6):hover { transform: translateY(-4px) scale(1.06) rotate(-3deg); }
.nav__link:nth-child(7):hover { transform: translateY(-3px) scale(1.05) rotate(3deg); }

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav__link:hover::after {
  width: 60%;
}

/* ----- Main Content ----- */
.main {
  padding-top: var(--header-height);
  overflow: hidden;
}

/* ----- Section Styling ----- */
.section {
  padding: 80px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.section__title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  text-align: center;
  margin-bottom: 40px;
  color: var(--color-primary);
  position: relative;
}

.section__title::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  border-radius: 2px;
  margin: 12px auto 0;
}

/* ----- Hero Section ----- */
.hero {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-bg) 50%, var(--color-accent) 100%);
  position: relative;
  overflow: hidden;
  transition: background 0.5s ease;
}

.hero__title {
  font-family: var(--font-display);
  font-size: 3.5rem;
  color: var(--color-text);
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

.hero__slogan {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 40px;
  opacity: 0.9;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: 50px;
  font-weight: 800;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary), #FF8E53);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn--primary:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5);
}

.btn--primary:active {
  transform: translateY(0) scale(0.98);
}

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

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

.btn--small {
  padding: 10px 20px;
  font-size: 0.9rem;
}

.btn--accent {
  background: var(--color-accent);
  color: #fff;
}

.btn--accent:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: var(--shadow-md);
}

/* Бум-эффект при клике */
.btn:active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  animation: ripple 0.6s ease-out;
  transform: translate(-50%, -50%);
}

/* ----- Counter ----- */
.counter {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  padding: 16px 32px;
  background: var(--color-card);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
}

.counter__label {
  font-weight: 700;
  font-size: 1.1rem;
}

.counter__value {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--color-primary);
  min-width: 60px;
  text-align: center;
}

/* ----- Joke Block ----- */
.joke {
  background: var(--color-card);
  border-radius: var(--border-radius);
  padding: 40px;
  box-shadow: var(--shadow-md);
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.joke__text {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 24px;
  min-height: 60px;
  line-height: 1.5;
}

.joke__btn {
  margin-top: 8px;
}

/* ----- Theme Switcher ----- */
.theme-switcher {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
}

.theme-switcher__toggle {
  position: relative;
  width: 60px;
  height: 30px;
  background: var(--color-text);
  border-radius: 15px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.theme-switcher__toggle::after {
  content: '🎉';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  background: var(--color-card);
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 26px;
}

.theme-switcher__toggle--serious::after {
  content: '😐';
  transform: translateX(30px);
}

.theme-switcher__toggle--serious {
  background: #666;
}

.theme-switcher__label {
  font-weight: 700;
  font-size: 0.9rem;
}

/* ----- Cards Grid (for interactive sections) ----- */
.grid {
  display: grid;
  gap: 30px;
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ----- Cards ----- */
.card {
  background: var(--color-card);
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card__title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 16px;
  color: var(--color-primary);
}

.card__text {
  color: var(--color-text-light);
  margin-bottom: 20px;
}

/* ----- Clicker (Антистресс) ----- */
.clicker {
  width: 100%;
  max-width: 400px;
  height: 300px;
  margin: 0 auto;
  background: var(--color-bg-secondary);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 0.3s ease;
  user-select: none;
  border: 3px dashed var(--color-primary);
}

.clicker:hover {
  background: var(--color-secondary);
}

.clicker__text {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-primary);
  pointer-events: none;
  z-index: 1;
}

/* Particles (confetti, emoji) */
.particle {
  position: absolute;
  pointer-events: none;
  font-size: 24px;
  animation: particleFly 1.5s ease-out forwards;
  z-index: 2;
}

/* Ripple effect for clicker */
.clicker__ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  animation: ripple 0.6s ease-out forwards;
  transform: translate(-50%, -50%);
  z-index: 1;
}

/* ----- Meme Generator ----- */
.meme {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.meme__canvas {
  position: relative;
  max-width: 500px;
  width: 100%;
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: var(--color-card);
}

.meme__image {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  transition: background-image 0.5s ease;
}

.meme__text-top,
.meme__text-bottom {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.8rem;
  text-shadow: 2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  text-align: center;
  width: 90%;
  word-wrap: break-word;
  pointer-events: none;
}

.meme__text-top {
  top: 16px;
}

.meme__text-bottom {
  bottom: 16px;
}

/* ----- Sound Panel ----- */
.sound-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.sound-btn {
  padding: 20px 16px;
  border-radius: var(--border-radius);
  font-size: 2rem;
  background: var(--color-card);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 2px solid transparent;
}

.sound-btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.sound-btn:active {
  transform: scale(0.95);
}

.sound-btn__label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text);
}

/* ----- Wheel of Fortune ----- */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.wheel-wrapper {
  position: relative;
  display: inline-block;
}

.wheel {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

.wheel__canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.wheel__pointer {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2.5rem;
  z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  pointer-events: none;
  animation: pointerBounce 2s ease-in-out infinite;
}

.wheel__result {
  font-family: var(--font-display);
  font-size: 1.3rem;
  text-align: center;
  min-height: 40px;
  color: var(--color-primary);
}

/* ----- Footer ----- */
.footer {
  background: var(--color-text);
  color: var(--color-card);
  padding: 40px 20px;
  text-align: center;
}

.footer__text {
  font-size: 0.9rem;
  opacity: 0.8;
}

.footer__emoji {
  font-size: 1.2rem;
}

/* ----- Utility ----- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.text-center {
  text-align: center;
}

.mt-20 { margin-top: 20px; }
.mt-40 { margin-top: 40px; }
.mb-20 { margin-bottom: 20px; }
.mb-40 { margin-bottom: 40px; }

/* ----- Responsive ----- */

/* Планшеты */
@media (max-width: 1024px) {
  .hero__title {
    font-size: 2.8rem;
  }
  
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .header__container {
    padding: 0 12px;
  }
  
  .nav__list {
    gap: 4px;
  }
  
  .nav__link {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .hero__title {
    font-size: 2.2rem;
  }
  
  .hero__slogan {
    font-size: 1.1rem;
  }
  
  .section {
    padding: 60px 16px;
  }
  
  .section__title {
    font-size: 1.8rem;
  }
  
  .grid--2,
  .grid--3 {
    grid-template-columns: 1fr;
  }
  
  .counter {
    padding: 12px 20px;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .joke {
    padding: 24px;
  }
  
  .joke__text {
    font-size: 1.1rem;
  }
  
  .meme__text-top,
  .meme__text-bottom {
    font-size: 1.3rem;
  }
  
  .wheel {
    width: 240px;
    height: 240px;
  }
}

@media (max-width: 480px) {
  .header__logo {
    font-size: 1.1rem;
  }
  
  .nav__link {
    padding: 4px 8px;
    font-size: 0.7rem;
    gap: 3px;
  }
  
  .hero__title {
    font-size: 1.8rem;
  }
  
  .hero__slogan {
    font-size: 1rem;
  }
  
  .btn {
    padding: 12px 24px;
    font-size: 0.95rem;
  }
  
  .section__title {
    font-size: 1.5rem;
  }
  
  .sound-panel {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  
  .sound-btn {
    padding: 14px 10px;
    font-size: 1.5rem;
  }
  
  .wheel {
    width: 200px;
    height: 200px;
  }
}

@media (max-width: 375px) {
  .nav__list {
    gap: 2px;
  }
  
  .nav__link {
    padding: 4px 6px;
    font-size: 0.65rem;
  }
  
  .sound-panel {
    grid-template-columns: repeat(2, 1fr);
  }
}
