/* ========== PECS карточки ========== */
.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--card-size);
  background: var(--color-surface);
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-normal);
  box-shadow: var(--shadow-card);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border: 1px solid rgba(61, 50, 68, 0.06);
  border-top: 3px solid var(--card-accent-color, #e0e0e0);
  user-select: none;
  padding: 0;
}

.card[data-category='food'],
.card[data-category='activities'],
.card[data-category='items'] {
  --card-accent-color: var(--color-want);
}

.card[data-category='places'] {
  --card-accent-color: var(--color-places);
}

.card[data-category='emotions'] {
  --card-accent-color: var(--color-feelings);
}

.card[data-category='pain'] {
  --card-accent-color: var(--color-feelings);
}

.card[data-category='people'] {
  --card-accent-color: var(--color-people);
}

.card:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-card-hover);
}

.card__image-wrapper {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #f8f4ff;
  position: relative;
}

.card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  transition: transform var(--transition-normal);
}

.card:active .card__image {
  transform: scale(1.05);
}

.card__label {
  padding: 8px 6px;
  font-size: var(--font-card);
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  line-height: 1.2;
  width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--color-accent);
  color: white;
  font-size: 11px;
  font-weight: 800;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(74, 144, 217, 0.3);
}

.card.card-enter {
  animation: cardPop var(--transition-bounce) forwards;
  opacity: 0;
}

@keyframes cardPop {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(15px);
  }
  60% {
    transform: scale(1.05) translateY(-3px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.card.card-enter:nth-child(1) {
  animation-delay: 0ms;
}
.card.card-enter:nth-child(2) {
  animation-delay: 40ms;
}
.card.card-enter:nth-child(3) {
  animation-delay: 80ms;
}
.card.card-enter:nth-child(4) {
  animation-delay: 120ms;
}
.card.card-enter:nth-child(5) {
  animation-delay: 160ms;
}
.card.card-enter:nth-child(6) {
  animation-delay: 200ms;
}
.card.card-enter:nth-child(7) {
  animation-delay: 240ms;
}
.card.card-enter:nth-child(8) {
  animation-delay: 280ms;
}
.card.card-enter:nth-child(9) {
  animation-delay: 320ms;
}
.card.card-enter:nth-child(10) {
  animation-delay: 360ms;
}
.card.card-enter:nth-child(11) {
  animation-delay: 400ms;
}
.card.card-enter:nth-child(12) {
  animation-delay: 440ms;
}

.card--small {
  width: 88px;
}

.card--small .card__image-wrapper {
  aspect-ratio: 1;
  max-height: 72px;
}

.card--small .card__image {
  border-radius: 12px;
}

.card--large {
  width: 140px;
}

.card--large .card__label {
  font-size: var(--font-card-large);
}

/* ========== Главная сетка категорий ========== */
.home-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 8px 16px 24px;
  max-width: 360px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

@media (min-width: 500px) {
  .home-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 500px;
    gap: 20px;
  }
}

.category-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  aspect-ratio: 1;
  max-width: var(--category-btn-size);
  margin: 0 auto;
  border-radius: var(--card-radius-large);
  border: none;
  cursor: pointer;
  color: white;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}

.category-btn--want {
  background: var(--gradient-want);
  box-shadow: var(--shadow-glow-want);
}

.category-btn--places {
  background: var(--gradient-places);
  box-shadow: var(--shadow-glow-places);
}

.category-btn--schedule {
  background: var(--gradient-schedule);
  box-shadow: var(--shadow-glow-schedule);
}

.category-btn--feelings {
  background: var(--gradient-feelings);
  box-shadow: var(--shadow-glow-feelings);
}

.category-btn--people {
  background: var(--gradient-people);
  box-shadow: var(--shadow-glow-people);
}

.category-btn--vision {
  background: var(--gradient-vision);
  box-shadow: var(--shadow-glow-vision);
}

.category-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: var(--card-radius-large) var(--card-radius-large) 0 0;
  pointer-events: none;
}

.category-btn:active {
  transform: scale(0.92);
  box-shadow: none;
}

.category-btn::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: radial-gradient(
    circle at var(--ripple-x, 50%) var(--ripple-y, 50%),
    rgba(255, 255, 255, 0.3) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 300ms;
  pointer-events: none;
}

.category-btn:active::after {
  opacity: 1;
}

.category-btn__icon {
  font-size: 44px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.category-btn__label {
  font-size: 15px;
  font-weight: 800;
  color: white;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-btn .vision-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.3);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 8px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.category-btn.appear {
  animation: categoryAppear var(--transition-bounce) forwards;
  opacity: 0;
}

.category-btn.appear:nth-child(1) {
  animation-delay: 0ms;
}
.category-btn.appear:nth-child(2) {
  animation-delay: 60ms;
}
.category-btn.appear:nth-child(3) {
  animation-delay: 120ms;
}
.category-btn.appear:nth-child(4) {
  animation-delay: 180ms;
}
.category-btn.appear:nth-child(5) {
  animation-delay: 240ms;
}
.category-btn.appear:nth-child(6) {
  animation-delay: 300ms;
}

@keyframes categoryAppear {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ========== QuickBar ========== */
.quick-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  gap: 6px;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-quickbar);
  border-radius: 24px 24px 0 0;
}

.quick-bar__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: var(--quick-btn-height);
  min-height: 48px;
  border-radius: 18px;
  padding: 6px 8px;
  color: white;
  flex: 1;
  max-width: 72px;
  position: relative;
  overflow: hidden;
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.quick-bar__btn--yes {
  background: linear-gradient(135deg, #56d880, #36b85c);
  box-shadow: 0 3px 10px rgba(67, 192, 109, 0.3);
}

.quick-bar__btn--no {
  background: linear-gradient(135deg, #ff7171, #e54545);
  box-shadow: 0 3px 10px rgba(242, 85, 85, 0.3);
}

.quick-bar__btn--toilet {
  background: linear-gradient(135deg, #ffb55c, #f59a1b);
  box-shadow: 0 3px 10px rgba(255, 159, 67, 0.3);
}

.quick-bar__btn--drink {
  background: linear-gradient(135deg, #6bc1ff, #3a9fe5);
  box-shadow: 0 3px 10px rgba(77, 171, 245, 0.3);
}

.quick-bar__btn--help {
  background: linear-gradient(135deg, #f278ad, #d84890);
  box-shadow: 0 3px 10px rgba(232, 67, 147, 0.3);
}

.quick-bar__btn--more {
  background: linear-gradient(135deg, #be93e4, #9660c8);
  box-shadow: 0 3px 10px rgba(166, 109, 212, 0.3);
}

.quick-bar__btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 18px 18px 0 0;
  pointer-events: none;
}

.quick-bar__btn:active {
  transform: scale(0.88);
  box-shadow: none;
}

.quick-bar__btn--bounce {
  animation: quickBtnBounce 400ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes quickBtnBounce {
  0% {
    transform: scale(1);
  }
  30% {
    transform: scale(0.85);
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.quick-bar__icon {
  font-size: 24px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.quick-bar__label {
  font-size: 11px;
  font-weight: 800;
  margin-top: 3px;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.3px;
}

.quick-bar__btn--active {
  transform: scale(1.02);
}

@media (max-width: 380px) {
  .quick-bar {
    padding: 8px 4px;
    gap: 4px;
  }

  .quick-bar__btn {
    min-width: 46px;
    height: 52px;
    border-radius: 14px;
  }

  .quick-bar__icon {
    font-size: 20px;
  }

  .quick-bar__label {
    font-size: 9px;
  }
}

@media (min-width: 600px) {
  .quick-bar {
    max-width: 500px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 24px 24px 0 0;
  }

  .quick-bar__btn {
    max-width: 80px;
    height: 64px;
    border-radius: 20px;
  }

  .quick-bar__icon {
    font-size: 28px;
  }

  .quick-bar__label {
    font-size: 12px;
  }
}

/* ========== Маршруты ========== */
.route-card {
  width: 100%;
  max-width: 400px;
  margin: 12px auto;
  padding: 20px;
  background: var(--color-surface);
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.route-card:active {
  transform: scale(0.98);
}

.route-viewer {
  text-align: center;
  padding: 12px 0;
}

.route-viewer__image-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto 16px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-card-hover);
}

.route-viewer__image {
  width: 100%;
  height: auto;
  aspect-ratio: 4/3;
  object-fit: cover;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  display: block;
}

.route-viewer__step-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--color-accent);
  color: white;
  font-size: 14px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
}

.route-viewer__meta {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.route-viewer__label {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--color-text);
  line-height: 1.3;
}

.route-viewer__nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
}

.route-viewer__btn {
  width: 68px;
  height: 68px;
  min-width: 68px;
  min-height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  border: none;
  cursor: pointer;
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  color: white;
  background: var(--gradient-want);
  box-shadow: var(--shadow-glow-want);
  position: relative;
}

.route-viewer__btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.25), transparent);
  border-radius: 50% 50% 0 0;
  pointer-events: none;
}

.route-viewer__btn:active:not(:disabled) {
  transform: scale(0.88);
  box-shadow: none;
}

.route-viewer__btn:disabled {
  background: #d8d4e0;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.5;
}

.route-viewer__btn:disabled::before {
  display: none;
}

.route-viewer__dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}

.route-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d8d4e0;
  transition: all var(--transition-bounce);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.route-dot--active {
  background: var(--color-accent);
  transform: scale(1.4);
  box-shadow: 0 0 0 4px rgba(74, 144, 217, 0.2);
}

.route-dot--passed {
  background: var(--color-success);
}

.route-viewer__speak {
  margin-top: 16px;
  padding: 14px 28px;
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow-card);
  font-size: 18px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform var(--transition-bounce);
}

.route-viewer__speak:active {
  transform: scale(0.95);
}

/* ========== Эмоции ========== */
.emotion-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 400px;
  margin: 16px auto;
}

.emotion-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 24px;
  border: none;
  cursor: pointer;
  transition:
    transform var(--transition-bounce),
    box-shadow var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.emotion-btn--happy {
  background: #e8f9e8;
  box-shadow: 0 4px 12px rgba(67, 192, 109, 0.15);
}

.emotion-btn--sad {
  background: #e0ecff;
  box-shadow: 0 4px 12px rgba(74, 144, 217, 0.15);
}

.emotion-btn--angry {
  background: #ffe8e8;
  box-shadow: 0 4px 12px rgba(242, 85, 85, 0.15);
}

.emotion-btn--scared {
  background: #f5e6ff;
  box-shadow: 0 4px 12px rgba(166, 109, 212, 0.15);
}

.emotion-btn--tired {
  background: #fff5e0;
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.15);
}

.emotion-btn--sick,
.emotion-btn--pain {
  background: #ffe0e0;
  box-shadow: 0 4px 12px rgba(255, 100, 100, 0.15);
}

.emotion-btn--hug {
  grid-column: span 2;
  background: linear-gradient(135deg, #ffe0f0, #fff0e5);
  box-shadow: 0 4px 16px rgba(208, 105, 158, 0.15);
  padding: 20px;
  flex-direction: row;
  gap: 12px;
}

.emotion-btn:active {
  transform: scale(0.92);
  box-shadow: none;
}

.emotion-btn--selected {
  border: 3px solid var(--color-feelings);
  box-shadow: 0 0 0 4px rgba(208, 105, 158, 0.15);
}

.emotion-emoji,
.emotion-btn__icon {
  font-size: 40px;
  line-height: 1;
}

.emotion-btn--hug .emotion-emoji,
.emotion-btn--hug .emotion-btn__icon {
  font-size: 48px;
}

.emotion-btn__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

.emotion-btn--hug .emotion-btn__label {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-feelings);
}

.emotion-btn--wide:not(.emotion-btn--hug) {
  grid-column: span 3;
  min-height: 72px;
}

.pain-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  max-width: 360px;
  margin: 16px auto 0;
}

.pain-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 8px;
  border-radius: 20px;
  background: white;
  box-shadow: var(--shadow-card);
  border: 2px solid #ffd4d4;
  cursor: pointer;
  transition: transform var(--transition-bounce);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.pain-btn:active {
  transform: scale(0.92);
  background: #ffe8e8;
}

.pain-btn__icon {
  font-size: 36px;
}

.pain-btn__label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
}

/* ========== Чувства: переход «Где болит» ========== */
.feelings-stage {
  position: relative;
  min-height: 120px;
}

.feelings-main {
  transition:
    opacity var(--transition-normal),
    transform var(--transition-normal);
  position: relative;
}

.feelings-main--hidden {
  opacity: 0;
  transform: translateX(-20px);
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
}

.feelings-pain {
  transition:
    opacity var(--transition-normal),
    transform var(--transition-normal);
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
}

.feelings-pain--visible {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
  position: relative;
}

.feelings-pain .pain-grid {
  margin-top: 0;
}

.pain-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 16px;
  background: white;
  box-shadow: var(--shadow-card);
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  border: none;
  cursor: pointer;
  margin-bottom: 16px;
  font-family: inherit;
  transition: transform var(--transition-bounce);
  -webkit-tap-highlight-color: transparent;
}

.pain-back-btn:active {
  transform: scale(0.95);
}

/* ========== Люди — круглые карточки ========== */
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 20px;
  justify-items: center;
  padding: 16px;
}

.person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform var(--transition-bounce);
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  font-family: inherit;
  padding: 0;
}

.person-card:active {
  transform: scale(0.92);
}

.person-card__photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
  border: 4px solid white;
  box-shadow:
    0 4px 16px rgba(155, 111, 209, 0.15),
    0 0 0 3px rgba(155, 111, 209, 0.1);
  transition: box-shadow var(--transition-normal);
}

.person-card:active .person-card__photo {
  box-shadow: 0 2px 8px rgba(155, 111, 209, 0.1);
}

.person-card__name {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
}

.person-card__role {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-light);
  margin-top: -6px;
}

.person-card.appear {
  animation: personAppear 400ms var(--transition-bounce) forwards;
  opacity: 0;
}

.person-card.appear:nth-child(1) {
  animation-delay: 0ms;
}
.person-card.appear:nth-child(2) {
  animation-delay: 80ms;
}
.person-card.appear:nth-child(3) {
  animation-delay: 160ms;
}
.person-card.appear:nth-child(4) {
  animation-delay: 240ms;
}
.person-card.appear:nth-child(5) {
  animation-delay: 320ms;
}
.person-card.appear:nth-child(6) {
  animation-delay: 400ms;
}

@keyframes personAppear {
  0% {
    opacity: 0;
    transform: scale(0.6) translateY(15px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ========== Пустые состояния ========== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 16px;
}

.empty-state__icon {
  font-size: 64px;
  animation: emptyBounce 2s ease-in-out infinite;
}

@keyframes emptyBounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.empty-state__title {
  font-size: 20px;
  font-weight: 800;
  color: var(--color-text);
}

.empty-state__text {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-light);
  max-width: 260px;
  line-height: 1.4;
}
