/* ════════════════════════════════════════════════════════════════════
   TypeArena — GAME INTERFACE POLISH v5
   Красивый интерфейс для самих игр, overlay, статистика во время игры
   ════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  /* ─────── GAME HEADER ─────── */
  .game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.1), transparent);
    border-bottom: 1px solid var(--border);
    gap: 8px;
  }

  .game-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
  }

  .game-mode-badge {
    padding: 4px 10px;
    background: rgba(88, 166, 255, 0.2);
    border: 1px solid rgba(88, 166, 255, 0.4);
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
  }

  /* ─────── HUD (Heads-Up Display) ─────── */
  .game-hud {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
  }

  .hud-panel {
    background: rgba(13, 17, 23, 0.85);
    border: 1px solid rgba(88, 166, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.8rem;
    pointer-events: auto;
  }

  .hud-label {
    font-size: 0.65rem;
    color: var(--text2);
    font-weight: 600;
    margin-bottom: 2px;
  }

  .hud-value {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--accent);
  }

  /* ─────── TIMER ─────── */
  .game-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--text);
  }

  .game-timer.danger {
    color: #ff6464;
    animation: pulse 0.5s ease-in-out infinite;
  }

  /* ─────── PROGRESS BAR IN GAME ─────── */
  .game-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bg2);
    border-radius: 0;
  }

  .game-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #58a6ff);
    border-radius: 0;
    transition: width 0.3s ease;
  }

  /* ─────── SCORE DISPLAY ─────── */
  .score-display {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
    text-shadow: 0 2px 8px rgba(88, 166, 255, 0.2);
  }

  /* ─────── MULTIPLIER ─────── */
  .multiplier-display {
    padding: 6px 12px;
    background: rgba(255, 200, 50, 0.2);
    border: 2px solid rgba(255, 200, 50, 0.4);
    border-radius: 8px;
    color: #ffc832;
    font-weight: 800;
    font-size: 0.9rem;
    text-align: center;
    animation: pulse 0.6s ease-in-out infinite;
  }

  .multiplier-display.high {
    animation: multiplierPulse 0.4s ease-in-out infinite;
  }

  @keyframes multiplierPulse {
    0%, 100% {
      transform: scale(1);
      background: rgba(255, 200, 50, 0.2);
    }
    50% {
      transform: scale(1.05);
      background: rgba(255, 200, 50, 0.3);
    }
  }

  /* ─────── GAME BUTTONS ─────── */
  .game-btn {
    padding: 10px 16px;
    background: var(--bg2);
    border: 2px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .game-btn:active {
    transform: scale(0.95);
    border-color: var(--accent);
  }

  .game-btn.primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
  }

  /* ─────── PAUSE MENU ─────── */
  .pause-menu {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 500;
  }

  .pause-menu-title {
    font-size: 2rem;
    font-weight: 900;
    color: white;
    margin-bottom: 8px;
  }

  .pause-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 200px;
  }

  .pause-btn {
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
  }

  .pause-btn:active {
    transform: scale(0.95);
  }

  .pause-btn.secondary {
    background: var(--bg2);
    color: var(--text);
    border: 1px solid var(--border);
  }

  /* ─────── GAME OVER SCREEN ─────── */
  .game-over-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(88, 166, 255, 0.1));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    z-index: 600;
    padding: 20px;
    text-align: center;
    animation: fadeIn 0.4s ease;
  }

  .game-over-icon {
    font-size: 4rem;
    animation: bounce 0.6s ease-in-out infinite;
  }

  .game-over-title {
    font-size: 2rem;
    font-weight: 900;
    color: white;
  }

  .game-over-subtitle {
    font-size: 1rem;
    color: var(--text2);
  }

  .game-over-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 280px;
    margin: 16px 0;
  }

  .stat-item {
    padding: 12px;
    background: rgba(88, 166, 255, 0.1);
    border: 1px solid rgba(88, 166, 255, 0.2);
    border-radius: 8px;
  }

  .stat-label {
    font-size: 0.8rem;
    color: var(--text2);
    margin-bottom: 4px;
  }

  .stat-value {
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent);
  }

  .game-over-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
  }

  .game-over-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
  }

  .game-over-btn.primary {
    background: var(--accent);
    color: white;
  }

  .game-over-btn.secondary {
    background: var(--bg2);
    color: var(--text);
    border: 1px solid var(--border);
  }

  /* ─────── LEVEL UP ANIMATION ─────── */
  .level-up-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    font-weight: 900;
    color: #ffc832;
    z-index: 700;
    pointer-events: none;
    animation: levelUpFloat 1.5s ease-out forwards;
  }

  @keyframes levelUpFloat {
    0% {
      opacity: 1;
      transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
      opacity: 0;
      transform: translate(-50%, -150%) scale(1.5);
    }
  }

  /* ─────── COMBO COUNTER ─────── */
  .combo-counter {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 900;
    color: #ffc832;
    z-index: 50;
    pointer-events: none;
  }

  .combo-counter.active {
    animation: comboPulse 0.3s ease-out;
  }

  @keyframes comboPulse {
    0% {
      transform: translate(-50%, -50%) scale(1);
      opacity: 1;
    }
    100% {
      transform: translate(-50%, -50%) scale(1.2);
      opacity: 1;
    }
  }

  /* ─────── CRITICAL HIT ─────── */
  .critical-hit {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 900;
    color: #ff6464;
    z-index: 70;
    pointer-events: none;
    animation: criticalFloat 0.8s ease-out forwards;
  }

  @keyframes criticalFloat {
    0% {
      opacity: 1;
      transform: translate(-50%, -50%) scale(0.5) rotate(-20deg);
    }
    100% {
      opacity: 0;
      transform: translate(-50%, -150%) scale(1) rotate(20deg);
    }
  }

  /* ─────── DAMAGE NUMBER ─────── */
  .damage-number {
    position: absolute;
    font-weight: 900;
    font-size: 1.4rem;
    pointer-events: none;
    z-index: 40;
  }

  .damage-number.enemy {
    color: #4ade80;
  }

  .damage-number.player {
    color: #ff6464;
  }

  .damage-number.floating {
    animation: damageFloat 1s ease-out forwards;
  }

  @keyframes damageFloat {
    0% {
      opacity: 1;
      transform: translateY(0);
    }
    100% {
      opacity: 0;
      transform: translateY(-40px);
    }
  }

  /* ─────── FLOATING TEXT ─────── */
  .floating-text {
    position: absolute;
    pointer-events: none;
    font-weight: 700;
    font-size: 1rem;
    animation: floatUp 2s ease-out forwards;
  }

  @keyframes floatUp {
    0% {
      opacity: 1;
      transform: translateY(0) translateX(0);
    }
    100% {
      opacity: 0;
      transform: translateY(-60px) translateX(20px);
    }
  }

  /* ─────── KEYBOARD HINT ─────── */
  .keyboard-hint {
    position: absolute;
    padding: 4px 8px;
    background: rgba(88, 166, 255, 0.2);
    border: 1px solid rgba(88, 166, 255, 0.4);
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent);
    pointer-events: none;
  }

  /* ─────── SKILL INDICATOR ─────── */
  .skill-indicator {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    display: inline-block;
    margin: 0 4px;
    animation: skillPulse 1s ease-in-out infinite;
  }

  @keyframes skillPulse {
    0%, 100% {
      background: var(--accent);
      box-shadow: 0 0 8px var(--accent);
    }
    50% {
      background: rgba(88, 166, 255, 0.5);
      box-shadow: 0 0 12px var(--accent);
    }
  }

  /* ─────── RESPONSE TIMES FOR LOW GRAPHICS ─────── */
  body[data-graphics="low"] .level-up-animation,
  body[data-graphics="low"] .critical-hit,
  body[data-graphics="low"] .damage-number.floating,
  body[data-graphics="low"] .floating-text {
    animation: none;
  }

  body[data-graphics="low"] .multiplier-display,
  body[data-graphics="low"] .skill-indicator {
    animation: none;
  }

  body[data-graphics="low"] .hud-panel {
    backdrop-filter: none;
  }

  body[data-graphics="low"] .pause-menu {
    backdrop-filter: none;
  }

  body[data-graphics="low"] .game-over-screen {
    animation: none;
  }

  /* ─────── HIGH GRAPHICS ENHANCEMENTS ─────── */
  body[data-graphics="high"] .hud-panel {
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.2);
  }

  body[data-graphics="high"] .score-display {
    text-shadow: 0 2px 12px rgba(88, 166, 255, 0.3),
                 0 0 20px rgba(88, 166, 255, 0.2);
  }

  body[data-graphics="high"] .game-progress-fill {
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.4);
  }

  /* ─────── RESPONSIVENESS ─────── */
  @media (max-width: 480px) {
    .game-hud {
      flex-direction: column;
      align-items: flex-start;
    }

    .pause-menu-buttons {
      max-width: 100%;
    }

    .game-over-stats {
      grid-template-columns: 1fr;
    }

    .game-over-buttons {
      flex-direction: column;
    }
  }
}
