/* Responsive */
@media (max-width: 860px) {
  .ide-tree { display: none; }
  .site-header { align-items: stretch; flex-direction: column; gap: 12px; }
  .header-right { flex-wrap: wrap; }
  .progress-wrap { flex: 1 1 100%; overflow-x: auto; }
  .progress-bar { min-width: 0; }
  #progressLabel { text-align: left; }
  .theory-card { padding: 22px 20px 18px; }
  .ide-menu span:nth-child(n+5) { display: none; }
  .dg-arrows { gap: 60px; }
  main { flex-direction: column; }
}

@media (max-width: 600px) {
  body { overflow-x: hidden; }
  html, body { width: 100%; max-width: 100%; }
  main { width: 100%; max-width: 100vw; padding: 0 14px 48px; overflow-x: hidden; }
  .site-header { width: 100%; max-width: 100vw; padding: 10px 14px 8px; gap: 8px; }
  .brand-dot { width: 30px; height: 30px; flex-basis: 30px; border-radius: 9px; }
  .brand-text .brand-title { font-size: 14px; }
  .brand-text .brand-sub { font-size: 10px; }
  .header-right { align-items: stretch; flex-direction: column; gap: 7px; max-width: 100%; }
  .gamification-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 12px;
  }
  .game-stat { min-width: 0; font-size: 12px; }
  .lives { justify-content: flex-end; font-size: 12px; letter-spacing: 0; }
  .game-sep { display: none; }
  .unit-badge { align-self: flex-start; }
  .progress-wrap {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    max-height: 48px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0 4px;
    background: rgba(245,243,255,0.82);
    border-radius: 14px;
    backdrop-filter: blur(14px);
  }
  .progress-bar {
    flex-direction: row;
    align-items: center;
    gap: 0;
    min-width: max-content;
    padding: 4px 8px;
  }
  .prog-connector {
    width: 18px;
    height: 2px;
    min-width: 0;
    flex: 0 0 18px;
    margin-left: 0;
  }
  .progress-seg { width: 28px; height: 28px; flex-basis: 28px; font-size: 11px; }
  .theory-card { width: calc(100vw - 28px); max-width: calc(100vw - 28px); padding: 18px 16px 16px; border-radius: 16px; overflow: hidden; }
  .theory-card-header { gap: 12px; margin-bottom: 14px; }
  .step-num-circle { width: 36px; height: 36px; flex-basis: 36px; border-radius: 11px; }
  .theory-card h2 { font-size: 20px; }
  .theory-body { max-width: min(100%, 300px); font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
  .theory-body p, .theory-body li { max-width: 100%; }
  .diagram, .dg-class, .dg-objects { max-width: 100%; }
  .dg-class { width: min(280px, 100%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Keyframes ---------- */

@keyframes xpFloat {
  0%   { opacity: 0; transform: translate(-50%, 8px) scale(.9); }
  18%  { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -38px) scale(1.04); }
}

@keyframes lifeHit {
  0%, 100% { color: inherit; filter: none; transform: scale(1); }
  35% { color: var(--error); filter: drop-shadow(0 0 8px rgba(244,63,94,.7)); transform: scale(1.06); }
  70% { color: var(--error); filter: drop-shadow(0 0 4px rgba(244,63,94,.45)); transform: scale(.98); }
}

/* Card entrance */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.theory-card { animation: cardIn .38s cubic-bezier(.2,.8,.4,1); }

@keyframes lifeHit {
  0%, 100% { color: inherit; filter: none; transform: scale(1); }
  35% { color: #e11d48; filter: drop-shadow(0 0 6px rgba(225,29,72,.55)); transform: scale(1.1); }
  70% { color: #e11d48; filter: drop-shadow(0 0 3px rgba(225,29,72,.35)); transform: scale(.98); }
}
