/* Стили игры Дзен-Кликкер */
:root {
  --font-primary: 'Outfit', sans-serif;
  --font-secondary: 'Roboto', sans-serif;
  
  --bg-app: #08090d;
  --text-primary: #ffffff;
  --text-secondary: #8c92a2;
  --text-muted: #4e5362;
  
  --neon-pink: #ee0979;
  --neon-orange: #ff6a00;
  --neon-glow: rgba(238, 9, 121, 0.4);
  
  --grad-neon: linear-gradient(135deg, #ff6a00 0%, #ee0979 100%);
  --transition-smooth: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Сброс стилей для PWA на iOS */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 16px;
  
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.app-container {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding-top: env(safe-area-inset-top, 20px);
  padding-bottom: env(safe-area-inset-bottom, 20px);
  padding-left: env(safe-area-inset-left, 16px);
  padding-right: env(safe-area-inset-right, 16px);
}

/* Шапка игры */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: var(--transition-smooth);
}

.back-link:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.05);
}

.back-icon {
  width: 18px;
  height: 18px;
}

/* Кнопка ритм-машины */
.rhythm-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.rhythm-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.05);
}

.rhythm-icon {
  width: 16px;
  height: 16px;
}

/* Играющий статус дзен-ритма */
.rhythm-btn.playing {
  color: var(--neon-cyan);
  background: rgba(0, 242, 254, 0.1);
  border-color: rgba(0, 242, 254, 0.2);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.1);
  animation: pulseGlow 1.8s infinite alternate;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 8px rgba(0, 242, 254, 0.05); }
  100% { box-shadow: 0 0 18px rgba(0, 242, 254, 0.25); }
}

/* Статистика на бэйдже */
.local-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  font-family: var(--font-secondary);
}

.stats-value {
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--grad-neon);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px var(--neon-glow));
}

/* Игровая область */
.game-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: none; /* Блокируем системный зум и жесты прокрутки */
}

.clicker-area {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  touch-action: none; /* Блокируем системный зум и жесты прокрутки */
}

/* Динамический узел кнопки-кликера */
.clicker-node {
  position: absolute;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  z-index: 10;
  transition: transform 0.15s ease, opacity 0.15s ease;
  touch-action: none;
}

/* Состояние перетаскивания кнопки */
.clicker-node.dragging {
  opacity: 0.8;
  transform: translate(-50%, -50%) scale(1.1);
  z-index: 100;
}

/* Кнопка находится над корзиной - сжимается перед удалением */
.clicker-node.over-trash {
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0.5;
}

/* Кольцо регулировки тона вокруг кнопки */
.tone-ring {
  position: absolute;
  width: 154px;
  height: 154px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.08);
  pointer-events: auto; /* Должен перехватывать жесты кручения */
  cursor: grab;
  z-index: 2;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tone-ring:active {
  cursor: grabbing;
}

/* Свечение кольца при регулировке */
.tone-ring.adjusting {
  border-color: rgba(0, 242, 254, 0.4);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.15);
}

/* Бегунок на кольце */
.tone-handle {
  position: absolute;
  top: -7px;
  left: calc(50% - 6px);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 
    0 0 8px #ffffff,
    0 0 15px var(--neon-cyan);
  pointer-events: none; /* Тап летит на кольцо */
}

/* Сама кнопка-кликер */
.neon-button {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: none;
  outline: none;
  background: var(--grad-neon);
  box-shadow: 
    0 0 25px var(--neon-glow),
    0 6px 20px rgba(0, 0, 0, 0.4),
    inset 0 3px 8px rgba(255, 255, 255, 0.3),
    inset 0 -3px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  position: relative;
  z-index: 3;
  transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.neon-button::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

/* Эффект при клике / автоклике */
.neon-button.active-tap {
  transform: scale(0.92);
  box-shadow: 
    0 0 40px var(--neon-glow),
    0 4px 15px rgba(0, 0, 0, 0.5),
    inset 0 2px 5px rgba(255, 255, 255, 0.2),
    inset 0 -2px 5px rgba(0, 0, 0, 0.4);
}

/* Пульсация при физическом соударении */
.neon-button.hit-pulse {
  animation: hitPulse 0.18s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@keyframes hitPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 25px var(--neon-glow);
  }
  30% {
    transform: scale(0.93);
    box-shadow: 0 0 40px var(--neon-glow);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 25px var(--neon-glow);
  }
}


/* Зона удаления кнопок */
.trash-zone {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 90px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(240, 10, 80, 0) 0%, rgba(240, 10, 80, 0.15) 100%);
  border-top: 1px dashed rgba(240, 10, 80, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
  z-index: 50;
  pointer-events: none;
}

/* Зона активна при перетаскивании */
.trash-zone.active {
  opacity: 1;
  transform: translateY(0);
}

.trash-dashed-border {
  width: 100%;
  height: 100%;
  border: 1.5px dashed rgba(240, 10, 80, 0.4);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(240, 10, 80, 0.8);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.trash-icon {
  width: 20px;
  height: 20px;
  animation: shake 2.5s ease infinite;
}

/* Кнопка находится над корзиной */
.trash-zone.hovered .trash-dashed-border {
  border-color: rgba(250, 20, 90, 1);
  background: rgba(240, 10, 80, 0.1);
  color: rgba(250, 20, 90, 1);
  box-shadow: 0 0 20px rgba(240, 10, 80, 0.2);
}

@keyframes shake {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-5deg); }
  40%, 80% { transform: rotate(5deg); }
}

/* Вылетающие цифры +1 */
.floating-num {
  position: absolute;
  font-family: var(--font-primary);
  font-size: 1.8rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 
    0 0 8px var(--neon-pink),
    0 0 15px var(--neon-orange);
  pointer-events: none;
  animation: floatUp 0.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  z-index: 10;
  
  /* Исключаем выделение текста */
  -webkit-user-select: none;
  user-select: none;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8) translateY(-100px);
  }
}
