/* Highway Hop - How to Play Page Styles */

/* How-to Hero */
.hhp-91-howto-hero {
  background: linear-gradient(135deg, var(--hhp-91-amber) 0%, var(--hhp-91-orange) 100%);
  color: white;
  padding: var(--hhp-91-space-2xl) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hhp-91-howto-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 70%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
}

.hhp-91-howto-hero h1 {
  color: white;
  margin-bottom: var(--hhp-91-space-md);
}

/* Step Cards */
.hhp-91-step-card {
  background: white;
  border-radius: var(--hhp-91-radius-xl);
  padding: var(--hhp-91-space-xl);
  box-shadow: var(--hhp-91-shadow-lg);
  position: relative;
  overflow: hidden;
  transition: var(--hhp-91-transition);
}

.hhp-91-step-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--hhp-91-teal), var(--hhp-91-amber));
}

.hhp-91-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--hhp-91-amber), var(--hhp-91-orange));
  color: white;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--hhp-91-space-md);
  box-shadow: var(--hhp-91-shadow-md);
}

.hhp-91-step-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--hhp-91-shadow-lg);
}

/* Mistake Warning Cards */
.hhp-91-mistake-card {
  background: linear-gradient(135deg, #fef3cd, #fde68a);
  border: 2px solid var(--hhp-91-amber);
  border-radius: var(--hhp-91-radius-lg);
  padding: var(--hhp-91-space-lg);
  margin: var(--hhp-91-space-md) 0;
  position: relative;
}

.hhp-91-mistake-card::before {
  content: '⚠️';
  position: absolute;
  top: -10px;
  left: var(--hhp-91-space-lg);
  background: var(--hhp-91-amber);
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Visual Hints Grid */
.hhp-91-hints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--hhp-91-space-lg);
  margin: var(--hhp-91-space-xl) 0;
}

.hhp-91-hint-item {
  background: white;
  border-radius: var(--hhp-91-radius-lg);
  padding: var(--hhp-91-space-lg);
  box-shadow: var(--hhp-91-shadow-sm);
  text-align: center;
  transition: var(--hhp-91-transition);
  position: relative;
  overflow: hidden;
}

.hhp-91-hint-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--hhp-91-teal), var(--hhp-91-amber));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.hhp-91-hint-item:hover::after {
  transform: scaleX(1);
}

.hhp-91-hint-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--hhp-91-shadow-md);
}

.hhp-91-hint-icon {
  width: 50px;
  height: 50px;
  background: var(--hhp-91-teal);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--hhp-91-space-md);
  font-size: 1.25rem;
}

/* Control Demonstration */
.hhp-91-control-demo {
  background: var(--hhp-91-gray-light);
  border-radius: var(--hhp-91-radius-xl);
  padding: var(--hhp-91-space-xl);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hhp-91-control-demo::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.1) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

.hhp-91-hand-demo {
  position: relative;
  z-index: 1;
  font-size: 4rem;
  margin-bottom: var(--hhp-91-space-md);
  animation: tap-demo 1.5s ease-in-out infinite;
}

@keyframes tap-demo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Troubleshooting Section */
.hhp-91-trouble-item {
  background: white;
  border-left: 4px solid var(--hhp-91-teal);
  border-radius: var(--hhp-91-radius-md);
  padding: var(--hhp-91-space-lg);
  margin-bottom: var(--hhp-91-space-md);
  box-shadow: var(--hhp-91-shadow-sm);
  transition: var(--hhp-91-transition-fast);
}

.hhp-91-trouble-item:hover {
  border-left-color: var(--hhp-91-amber);
  box-shadow: var(--hhp-91-shadow-md);
}

.hhp-91-trouble-title {
  color: var(--hhp-91-teal);
  font-weight: 600;
  margin-bottom: var(--hhp-91-space-xs);
}

/* Pictogram Dictionary */
.hhp-91-pictogram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--hhp-91-space-md);
  margin: var(--hhp-91-space-xl) 0;
}

.hhp-91-pictogram-item {
  background: white;
  border-radius: var(--hhp-91-radius-lg);
  padding: var(--hhp-91-space-md);
  text-align: center;
  box-shadow: var(--hhp-91-shadow-sm);
  transition: var(--hhp-91-transition);
}

.hhp-91-pictogram-item:hover {
  transform: scale(1.05);
  box-shadow: var(--hhp-91-shadow-md);
}

.hhp-91-pictogram-symbol {
  font-size: 2rem;
  margin-bottom: var(--hhp-91-space-xs);
  display: block;
}

.hhp-91-pictogram-label {
  font-size: 0.875rem;
  color: var(--hhp-91-gray-medium);
  font-weight: 500;
}

/* Animation Keyframes */
@keyframes spiral-in {
  0% {
    opacity: 0;
    transform: rotate(-180deg) scale(0.5);
  }
  100% {
    opacity: 1;
    transform: rotate(0deg) scale(1);
  }
}

@keyframes wave-reveal {
  0% {
    opacity: 0;
    clip-path: circle(0% at 50% 50%);
  }
  100% {
    opacity: 1;
    clip-path: circle(100% at 50% 50%);
  }
}

@keyframes bounce-in {
  0% {
    opacity: 0;
    transform: translateY(-50px) scale(0.8);
  }
  50% {
    transform: translateY(10px) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slide-cascade {
  0% {
    opacity: 0;
    transform: translateX(-100px) rotate(-10deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
  }
}

@keyframes zoom-focus {
  0% {
    opacity: 0;
    transform: scale(2) blur(5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) blur(0px);
  }
}

@keyframes typewriter {
  0% {
    width: 0;
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    width: 100%;
    opacity: 1;
  }
}

@keyframes flip-card {
  0% {
    opacity: 0;
    transform: rotateY(-90deg);
  }
  100% {
    opacity: 1;
    transform: rotateY(0deg);
  }
}

/* Animation Classes */
[data-anim="spiral-in"].is-visible {
  animation: spiral-in 0.8s ease-out forwards;
}

[data-anim="wave-reveal"].is-visible {
  animation: wave-reveal 1s ease-out forwards;
}

[data-anim="bounce-in"].is-visible {
  animation: bounce-in 0.6s ease-out forwards;
}

[data-anim="slide-cascade"].is-visible {
  animation: slide-cascade 0.8s ease-out forwards;
}

[data-anim="zoom-focus"].is-visible {
  animation: zoom-focus 1s ease-out forwards;
}

[data-anim="typewriter"].is-visible {
  animation: typewriter 1.2s ease-out forwards;
  overflow: hidden;
  white-space: nowrap;
}

[data-anim="flip-card"].is-visible {
  animation: flip-card 0.6s ease-out forwards;
}

[data-anim="stagger-up"] .hhp-91-stagger-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-anim="stagger-up"] .hhp-91-stagger-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
  .hhp-91-hints-grid {
    grid-template-columns: 1fr;
  }
  
  .hhp-91-pictogram-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  
  .hhp-91-step-card {
    padding: var(--hhp-91-space-lg);
  }
  
  .hhp-91-control-demo {
    padding: var(--hhp-91-space-lg);
  }
  
  .hhp-91-hand-demo {
    font-size: 3rem;
  }
}

@media (max-width: 480px) {
  .hhp-91-howto-hero {
    padding: var(--hhp-91-space-xl) 0;
  }
  
  .hhp-91-step-number {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  .hhp-91-pictogram-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  
  .hhp-91-pictogram-symbol {
    font-size: 1.5rem;
  }
  
  .hhp-91-hand-demo {
    font-size: 2.5rem;
  }
}
/* --- FIX: allow wrapping inside typewriter sections --- */
[data-anim="typewriter"].is-visible { 
  white-space: normal;       /* возвращаем переносы для всей секции */
}

/* Оставляем «typewriter» только для заголовка секции */
[data-anim="typewriter"].is-visible h2 {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  animation: typewriter 1.2s ease-out forwards;
}

/* Доп. защита от «длинных» слов/URL внутри карточек */
.hhp-91-trouble-item p,
.hhp-91-mistake-card p,
.hhp-91-step-card p {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
  min-width: 0;
}
/* ===== Spacing ===== */
.mt-xl { margin-top: var(--hhp-91-space-xl); }
.mt-lg { margin-top: var(--hhp-91-space-lg); }
.mt-md { margin-top: var(--hhp-91-space-md); }
.mb-xl { margin-bottom: var(--hhp-91-space-xl); }

/* ===== Inline offsets ===== */
.ml-md { margin-left: var(--hhp-91-space-md); }

/* ===== Narrow blocks ===== */
.narrow-600 { max-width: 600px; margin-inline: auto; }
.narrow-700 { max-width: 700px; margin-inline: auto; }
.narrow-800 { max-width: 800px; margin-inline: auto; }

/* ===== Flex helpers ===== */
.wrap { flex-wrap: wrap; }

/* ===== Accessible skip-link (вместо инлайна) ===== */
.hhp-91-skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 8px 12px;
  background: var(--hhp-91-amber);
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 12%);
}
.hhp-91-skip-link:focus {
  left: 12px;
  top: 12px;
  outline: 2px solid #fff;
  outline-offset: 2px;
}
