/* ============ Сброс ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none; /* и мышь, и тач — без скролла и зума */
  background: linear-gradient(180deg,
    #06121f 0%,
    #0f2a47 35%,
    #1b4763 65%,
    #2a6485 100%);
  font-family: 'Georgia', 'Times New Roman', serif;
  position: fixed;
  inset: 0;
  cursor: crosshair;
}

/* ============ Звёзды ============ */
.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50%      { opacity: 1;   transform: scale(1.2); }
}

/* ============ Луна ============ */
.moon {
  position: absolute;
  top: max(6%, env(safe-area-inset-top));
  right: 12%;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,
    #fffef0, #e8e0b0 60%, #c9bf88);
  box-shadow:
    0 0 50px 15px rgba(255, 250, 200, 0.30),
    0 0 100px 40px rgba(255, 250, 200, 0.12);
  pointer-events: none;
  animation: moonGlow 6s ease-in-out infinite alternate;
}
@keyframes moonGlow {
  from {
    box-shadow:
      0 0 50px 15px rgba(255, 250, 200, 0.25),
      0 0 100px 40px rgba(255, 250, 200, 0.10);
  }
  to {
    box-shadow:
      0 0 70px 25px rgba(255, 250, 200, 0.40),
      0 0 140px 60px rgba(255, 250, 200, 0.18);
  }
}

/* ============ Лунная дорожка ============ */
.moonpath {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 45%;
  background: radial-gradient(ellipse at center bottom,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(200, 230, 255, 0.04) 40%,
    transparent 70%);
  pointer-events: none;
}

/* ============ Волны ============ */
.wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 100px;
  background: repeating-linear-gradient(90deg,
    transparent 0px,
    rgba(150, 200, 240, 0.05) 30px,
    transparent 60px);
  animation: waveMove 10s linear infinite;
  pointer-events: none;
}
@keyframes waveMove {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ============ Подсказка ============ */
.hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: clamp(20px, 5.5vw, 28px);
  letter-spacing: 2px;
  text-align: center;
  text-shadow: 0 0 20px rgba(150, 200, 255, 0.8);
  pointer-events: none;
  animation: hintPulse 2.5s ease-in-out infinite;
  transition: opacity 0.8s ease, transform 0.8s ease;
  padding: 0 20px;
  width: 100%;
  max-width: 460px;
}
.hint.hidden {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.9);
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
.hint .tap-icon {
  display: block;
  font-size: 1.6em;
  margin-bottom: 10px;
  animation: tapAnim 1.5s ease-in-out infinite;
}
.hint .hint-title {
  display: block;
  margin-bottom: 4px;
}
.hint small {
  display: block;
  font-size: clamp(12px, 3.4vw, 14px);
  margin-top: 14px;
  letter-spacing: 1.2px;
  color: rgba(200, 220, 255, 0.65);
  font-style: italic;
  line-height: 1.7;
}
@keyframes tapAnim {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(0.85); }
}

/* ============ Счётчик ============ */
.counter {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  color: rgba(200, 230, 255, 0.85);
  font-size: clamp(14px, 3.8vw, 16px);
  letter-spacing: 1.5px;
  text-shadow: 0 0 10px rgba(150, 200, 255, 0.6);
  pointer-events: none;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(200, 230, 255, 0.12);
}

/* ============ Инфо о действии ============ */
.gesture-info {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: rgba(200, 230, 255, 0.55);
  font-size: clamp(12px, 3.3vw, 14px);
  letter-spacing: 1.5px;
  font-style: italic;
  pointer-events: none;
  padding: 6px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  transition: opacity 0.4s ease;
}

/* ============ Легенда клавиш (только ПК) ============ */
.keys-legend {
  position: absolute;
  bottom: max(60px, calc(env(safe-area-inset-bottom) + 40px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(200, 230, 255, 0.55);
  font-size: 12px;
  letter-spacing: 1px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease 1.5s;
}
.keys-legend.visible {
  opacity: 1;
}
.keys-legend__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(200, 230, 255, 0.15);
  box-shadow: 0 2px 0 rgba(200, 230, 255, 0.08);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13px;
  color: rgba(220, 240, 255, 0.85);
}
.keys-legend__wide {
  padding: 0 12px;
  font-size: 11px;
}
.keys-legend__text {
  margin-left: 8px;
  font-style: italic;
}

/* ============ Лебедь ============ */
.swan {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(180, 220, 255, 0.6));
  will-change: transform, left, top, opacity;
}
.swan svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============ Круги на воде ============ */
.ripple {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(200, 230, 255, 0.6);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: rippleExpand 2.2s cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
@keyframes rippleExpand {
  0%   { width: 8px;   height: 4px;  opacity: 0.8; border-width: 2.5px; }
  100% { width: 200px; height: 70px; opacity: 0;   border-width: 0.5px; }
}

/* ============ Перо ============ */
.feather {
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0.9;
  will-change: transform, opacity;
}
.feather svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============ Вспышка ============ */
.tap-pulse {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(180, 220, 255, 0.9);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: tapPulse 0.7s ease-out forwards;
}
@keyframes tapPulse {
  0%   { width: 20px;  height: 20px;  opacity: 1; }
  100% { width: 120px; height: 120px; opacity: 0; }
}

/* ============ Подсказка курсора-след (только ПК) ============ */
@media (hover: hover) and (pointer: fine) {
  /* Можно добавить кастомный курсор, но оставим кроссхейр */
}

/* ============ Адаптация под ландшафт смартфона ============ */
@media (max-height: 500px) and (orientation: landscape) {
  .hint {
    font-size: 18px;
  }
  .hint small {
    display: none;
  }
  .moon {
    width: 50px;
    height: 50px;
  }
}