/* ===========================================
   АБСУРДНАЯ ИГРА - СТИЛИ 2024
   ========================================== */

:root {
  --bg: #0b0b0f;
  --panel: #15151c;
  --text: #e9e9ee;
  --text-muted: #9ca3af;
  --accent: #ff3c8e;
  --accent-2: #7df9ff;
  --accent-hover: #ff4d9a;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 40px rgba(0,0,0,.5);
  --shadow-sm: 0 4px 15px rgba(0,0,0,.2);
  --gradient: linear-gradient(135deg, var(--accent-2) 0%, var(--accent) 100%);
  --gradient-dark: linear-gradient(135deg, rgba(255,60,142,0.1) 0%, rgba(125,249,255,0.1) 100%);
}

/* ===========================================
   БАЗОВЫЕ СТИЛИ
   ========================================== */

html {
  scroll-behavior: smooth;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===========================================
   LOADING SCREEN
   ========================================== */

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(125,249,255,0.3);
  border-top: 3px solid var(--accent-2);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-screen p {
  font-size: 18px;
  color: var(--text-muted);
  margin: 0;
}

/* ===========================================
   КОНТЕЙНЕРЫ И МАКЕТ
   ========================================== */

.container {
  width: min(900px, 96vw);
  margin: 30px auto;
  padding: 36px 24px;
  background: rgba(21,21,28,0.88);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  border: 1px solid rgba(255,255,255,0.1);
}

.page-section {
  min-height: calc(100vh - 200px);
  padding: 40px 0;
}

.page-section .container {
  margin-top: 0;
  text-align: left;
}

.hidden-section {
  display: none;
}

.hidden-section.active {
  display: block;
}

/* ===========================================
   ТИПОГРАФИКА
   ========================================== */

.neon-title, h1.neon {
  font-size: clamp(32px, 6vw, 64px);
  color: var(--accent-2);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 16px var(--accent-2),
    0 0 64px var(--accent-2),
    0 0 4px #fff,
    0 0 60px var(--accent);
  animation: neon-pulse 2.8s infinite alternate cubic-bezier(.68,.13,.81,.99);
  margin: 0 0 20px 0;
  text-align: center;
}

@keyframes neon-pulse {
  0% { text-shadow: 0 0 32px var(--accent-2), 0 0 100px var(--accent); }
  100% { text-shadow: 0 0 20px var(--accent-2), 0 0 60px var(--accent), 0 0 8px #fff; }
}

.subtitle {
  font-size: 18px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 40px;
  font-weight: 400;
}

.section-title {
  font-size: 24px;
  color: var(--accent-2);
  text-align: center;
  margin-bottom: 30px;
  font-weight: 600;
}

.section-header {
  text-align: center;
  margin-bottom: 50px;
}

.content-block {
  max-width: 800px;
  margin: 0 auto;
}

/* ===========================================
   ИГРОВАЯ ОБЛАСТЬ
   ========================================== */

.game-header {
  text-align: center;
  margin-bottom: 50px;
}

.genre-section {
  margin-bottom: 50px;
}

.genres-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.genre-btn {
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 18px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(.83,-0.12,.62,1.15);
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.genre-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient);
  transition: left 0.3s ease;
}

.genre-btn:hover::before {
  left: 0;
}

.genre-btn:hover,
.genre-btn.active {
  color: #fff;
  border-color: var(--accent-2);
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(125,249,255,0.4);
  text-shadow: 0 0 8px rgba(255,255,255,0.8);
}

.genre-btn span {
  position: relative;
  z-index: 2;
}

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

.current-genre {
  background: var(--gradient-dark);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  margin-bottom: 30px;
  font-weight: 600;
  color: var(--accent-2);
  display: inline-block;
}

.phrase-container {
  margin-bottom: 40px;
}

.phrase-box {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 40px 30px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.phrase-box:hover {
  box-shadow: 0 0 30px rgba(125,249,255,0.2);
  border-color: rgba(125,249,255,0.3);
}

.phrase-text {
  font-size: clamp(18px, 2.5vw, 28px);
  line-height: 1.5;
  color: #fff;
  text-align: center;
  word-wrap: break-word;
}

.game-controls {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.game-stats {
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-top: 30px;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  color: var(--accent-2);
  font-weight: 600;
  font-size: 18px;
}

/* ===========================================
   КНОПКИ
   ========================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(.83,-0.12,.62,1.15);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 4px 15px rgba(255,60,142,0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255,60,142,0.6);
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.2);
  transform: translateY(-2px);
}

.btn-back {
  background: rgba(125,249,255,0.1);
  color: var(--accent-2);
  border: 1px solid rgba(125,249,255,0.3);
}

.btn-back:hover {
  background: rgba(125,249,255,0.2);
  box-shadow: 0 4px 15px rgba(125,249,255,0.3);
}

.btn-icon {
  font-size: 18px;
}

/* Старые стили для совместимости */
.new-phrase-btn {
  background: var(--gradient);
  border: none;
  padding: 16px 36px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255,60,142,0.4);
  transition: all 0.3s cubic-bezier(.83,-0.12,.62,1.15);
}

.new-phrase-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255,60,142,0.6);
}

/* ===========================================
   КАРТОЧКИ И КОНТЕНТ
   ========================================== */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin: 40px 0;
}

.feature-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(125,249,255,0.3);
}

.feature-icon {
  font-size: 48px;
  margin-bottom: 20px;
  display: block;
}

.feature-card h3 {
  color: var(--accent-2);
  margin: 0 0 15px 0;
  font-size: 20px;
}

.feature-card p {
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

.rules-list {
  max-width: 600px;
  margin: 0 auto;
}

.rule-item {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  align-items: flex-start;
}

.rule-number {
  background: var(--gradient);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.rule-content h3 {
  margin: 0 0 10px 0;
  color: var(--accent-2);
  font-size: 18px;
}

.rule-content p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.contact-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius);
  padding: 40px;
  border: 1px solid rgba(255,255,255,0.1);
}

.contact-info h3 {
  color: var(--accent-2);
  margin-bottom: 20px;
}

.contact-item {
  margin-bottom: 15px;
  font-size: 16px;
}

.contact-item strong {
  color: var(--accent-2);
}

.contact-item a {
  color: var(--accent);
  text-decoration: none;
}

.contact-item a:hover {
  text-decoration: underline;
}

.privacy-content ul {
  list-style: none;
  padding: 0;
}

.privacy-content li {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.privacy-content li:last-child {
  border-bottom: none;
}

/* ===========================================
   ФОРМЫ
   ========================================== */

.contact-form h3 {
  color: var(--accent-2);
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(125,249,255,0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* ===========================================
   ЧАТ ВИДЖЕТ
   ========================================== */

.chat-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.chat-toggle-btn {
  background: var(--gradient);
  color: #fff;
  border: none;
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

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

.chat-icon {
  font-size: 20px;
}

.chat-text {
  font-size: 16px;
}

.chat-container {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 380px;
  height: 500px;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-container.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(21, 21, 28, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--text);
}

.bot-avatar {
  font-size: 20px;
}

.chat-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.chat-close:hover {
  color: var(--text);
  background: rgba(255,255,255,0.1);
}

.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chat-body::-webkit-scrollbar {
  width: 6px;
}

.chat-body::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 3px;
}

.chat-body::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.1);
}

.chat-message {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  max-width: 85%;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.bot-message {
  background: rgba(125,249,255,0.2);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.user-message {
  background: var(--accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-input-area {
  display: flex;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-input {
  flex: 1;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

#chat-input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(125,249,255,0.2);
}

.chat-send-btn {
  background: var(--accent-2);
  border: none;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
}

.chat-send-btn:hover {
  background: var(--accent);
  transform: scale(1.05);
}

/* ===========================================
   ФУТЕР
   ========================================== */

.main-footer {
  margin-top: auto;
  padding: 40px 0 20px;
  background: rgba(21,21,28,0.5);
  border-top: 1px solid rgba(255,255,255,0.1);
}

.footer-content {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  padding: 0 20px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
}

.footer-link:hover {
  color: var(--accent-2);
  background: rgba(255,255,255,0.05);
}

.footer-info {
  color: var(--text-muted);
  font-size: 14px;
}

.footer-info p {
  margin: 0;
}

/* ===========================================
   АНИМАЦИИ
   ========================================== */

.reveal {
  animation: fadeUp 0.6s cubic-bezier(.86,.15,.71,1.02) forwards;
}

@keyframes fadeUp {
  from { 
    opacity: 0; 
    transform: translateY(20px) scale(0.95);
  }
  to { 
    opacity: 1; 
    transform: none; 
  }
}

.fade-in {
  animation: fadeIn 0.5s ease forwards;
}

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

/* ===========================================
   АДАПТИВНОСТЬ
   ========================================== */

@media (max-width: 768px) {
  .container {
    margin: 20px auto;
    padding: 24px 16px;
    width: calc(100vw - 40px);
  }
  
  .contact-card {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 30px 20px;
  }
  
  .game-controls {
    flex-direction: column;
    align-items: center;
  }
  
  .btn {
    width: 100%;
    max-width: 300px;
  }
  
  .genres-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .footer-links {
    flex-direction: column;
    gap: 15px;
  }
}

@media (max-width: 480px) {
  .chat-container {
    width: calc(100vw - 40px);
    height: 70vh;
    right: 20px;
    max-height: 500px;
  }
  
  .phrase-box {
    padding: 20px 15px;
    min-height: 100px;
  }
  
  .phrase-text {
    font-size: 16px;
  }
  
  .rule-item {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }
  
  .rule-number {
    align-self: center;
  }
}

/* ===========================================
   ACCESSIBILITY
   ========================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-color-scheme: light) {
  /* Можно добавить светлую тему в будущем */
}

/* ===========================================
   УТИЛИТЫ
   ========================================== */

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

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }

.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.hidden { display: none !important; }
.visible { display: block !important; }
