.levels {
  position: relative;
  padding: 60px 0 60px;
  overflow: hidden;
  background: #fff;
  min-height: 700px;
}

.levels-bg {
  position: absolute;
  inset: 0;
  background: url("/assets/bg-waves.svg") bottom center / cover no-repeat;
  opacity: .35;
  pointer-events: none;
}

.levels-header {
  text-align: center;
  max-width: 900px;
  margin: 0 auto 120px;
}

.levels-header h2 {
  font-size: 48px;
  line-height: 1.15;
  margin-bottom: 10px;
}

.levels-header span {
  color: #1790c9;
}

.levels-header p {
  font-size: 20px;
  margin-bottom: 54px;
  opacity: .85;
}

.levels-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 440px;
  position: relative;
}

.level {
  flex: 1;
  background: linear-gradient(180deg, #1bb3e8, #1685c5);
  /* border-radius: 16px 16px 0 0; */
  position: relative;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: .6s cubic-bezier(.2,.8,.2,1);
  cursor: pointer;
}

.level::before {
  content: attr(data-label);
  position: absolute;
  top: 10px;
  width: 100%;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
}

/* .level:first-child::before {
  content: attr(data-label-pre) " " attr(data-label-main);
  top: -44px;
} */

.level.first-level {
  position: relative;
}

.level.first-level .label-pre {
  position: absolute;
  top: -56px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1rem;
  font-weight: 700;
  color: inherit;
  z-index: 3;
}

.level.first-level::before {
  content: attr(data-label-main);
  position: absolute;
  top: -44px;
  width: 100%;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;
}

.level::after {
  content: attr(data-text);
  position: absolute;
  line-height: 15px;
  bottom: 16px;
  width: 100%;
  text-align: center;
  font-size: 14px;
  opacity: .9;
  white-space: pre-line;
}

.pre-a1 { height: 18%; background:linear-gradient(180deg,#f7c14d,#f9a11b); }
.a1 { height: 26%; background:linear-gradient(180deg,#b9deef,#8fc8e2); }
.a2 { height: 36%; background:linear-gradient(180deg,#a8d7ec,#6fb9da); }
.a2plus { height: 48%; }
.b1 { height: 60%; }
.b1plus { height: 70%; }
.b2 { height: 80%; }
.b2plus { height: 85%; }
.c1 { height: 95%; }
.c2 { height: 100%; }

.level:hover {
  filter: brightness(1.1);
  transform: scaleY(1.02);
}

.mascot {
  position: absolute;
  bottom: 0;
  width: 170px;
  z-index: 2;
}

.mascot-left { 
  left: -44px; 
  top: 214px;
  max-height: 200px;
  max-width: 100px;
}
.mascot-center { 
  left: 13%;
  top: 150px;
  max-height: 180px;
  max-width: 90px;
}
.mascot-right { 
  left: 50%; 
  top: -115px;
  max-height: 260px;
  max-width: 160px;
}

.levels-mobile {
  display: none;
}

/* Mobile UX */
.desktop-only {
  display: block;
}

.mobile-only {
  display: none;
}

.levels-groups {
  display: flex;
  margin-top: 28px;
  /* border-radius: 14px; */
  overflow: hidden;
  height: 56px;
  gap: 12px;
}

.group {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 18px;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
}

.group strong {
  font-size: 16px;
}

/* Пропорции под ступени */

.preschool {
  flex: 1;
  background: #f9b233;
  max-width: 180px;
}

.kids {
  flex: 1;
  background: #b8dced;
  min-width: 290px;
}

.teens {
  flex: 7;
  background: #1685c5;
  color: #fff;
}

/* Контейнер для графика делаем относительным */
.levels-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 440px;
  position: relative;
  margin-top: 60px; /* Место для подсказки сверху */
  margin-bottom: 20px;
}

/* Область подсказки в левом верхнем углу */
.levels-tooltip-area {
  position: absolute;
  top: -140px; /* Сдвигаем вверх за пределы графика */
  left: 20; /* Фиксируем слева */
  width: 320px; /* Фиксированная ширина */
  background: white;
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 2px 5px rgba(0,0,0,0.05);
  border: 1px solid #e9edf2;
  z-index: 50;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none; /* Чтобы не мешать наведению */
  display: flex;
  align-items: flex-start;
  gap: 15px;
  backdrop-filter: blur(2px);
  border-left: 4px solid #1790c9;
}

.levels-tooltip-area.show {
  opacity: 1;
  transform: translateY(0);
}

/* Блок с уровнем (крупно) */
.tooltip-level-badge {
  font-weight: 800;
  font-size: 42px;
  line-height: 1;
  color: #1790c9;
  min-width: 90px;
  text-align: left;
  letter-spacing: -0.5px;
}

.tooltip-level-badge small {
  font-size: 14px;
  font-weight: 400;
  color: #64748b;
  display: block;
  margin-top: 4px;
  letter-spacing: normal;
}

/* Блок с описанием */
.tooltip-description {
  font-size: 15px;
  line-height: 1.5;
  color: #1e293b;
  flex: 1;
  border-left: 1px solid #e2e8f0;
  padding-left: 15px;
}

.tooltip-level-sub {
  font-size: 13px;
  color: #1790c9;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 5px;
}

/* Затемняем текст на уровне при наведении */
.level:hover::after {
  opacity: 0.4;
}

/* Анимация для активного уровня */
.level.active-tooltip {
  filter: brightness(1.1);
  transform: scaleY(1.02);
  box-shadow: 0 -5px 15px rgba(23,144,201,0.2);
  z-index: 2;
}

/* Адаптация для планшетов */
@media (max-width: 1100px) {
  .levels-tooltip-area {
    width: 350px;
  }
  
  .tooltip-level-badge {
    font-size: 36px;
    min-width: 70px;
  }
}

@media (max-width: 900px) {
  .levels-tooltip-area {
    display: none; /* На мобилке используем карточки */
  }
}

/* Стили для аккордеона */
.levels-mobile {
  margin: 20px 0 40px;
}

.accordion-item {
  background: #fff;
  border-radius: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border: 1px solid #e9edf2;
  overflow: hidden;
  transition: all 0.3s ease;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  cursor: pointer;
  transition: background 0.2s;
}

.accordion-header:hover {
  background: linear-gradient(135deg, #f1f5f9, #e9edf2);
}

.accordion-header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.level-badge {
  font-weight: 800;
  font-size: 24px;
  color: #1790c9;
  min-width: 70px;
}

.level-badge small {
  font-size: 12px;
  font-weight: 400;
  color: #64748b;
  display: block;
  margin-top: 2px;
}

.level-sub {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.level-sub small {
  font-size: 13px;
  font-weight: 400;
  color: #64748b;
  display: block;
  margin-top: 4px;
}

.accordion-icon {
  font-size: 24px;
  color: #1790c9;
  transition: transform 0.3s;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  padding: 0 20px;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease;
  background: white;
}

.accordion-item.active .accordion-content {
  max-height: 300px; /* Достаточно для описания */
  padding: 0 20px 20px;
}

.level-description {
  padding: 15px 0 5px;
  color: #334155;
  line-height: 1.6;
  font-size: 15px;
  border-top: 1px dashed #e2e8f0;
}

.level-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.skill-tag {
  background: #f1f5f9;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: #1e293b;
}

/* Цвета для уровней в аккордеоне */
.accordion-item[data-level="pre-a1"] .level-badge { color: #f9a11b; }
.accordion-item[data-level="a1"] .level-badge { color: #6fb9da; }
.accordion-item[data-level="a2"] .level-badge { color: #6fb9da; }
.accordion-item[data-level="a2plus"] .level-badge { color: #1685c5; }
.accordion-item[data-level="b1"] .level-badge { color: #1685c5; }
.accordion-item[data-level="b1plus"] .level-badge { color: #1685c5; }
.accordion-item[data-level="b2"] .level-badge { color: #0f5b8a; }
.accordion-item[data-level="b2plus"] .level-badge { color: #0f5b8a; }
.accordion-item[data-level="c1"] .level-badge { color: #0a3a5a; }
.accordion-item[data-level="c2"] .level-badge { color: #0a3a5a; }

@media (max-width: 900px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block !important;
  }

  .levels-groups {
    display: none !important;
  }

  .levels-header h2 {
    font-size: 30px;
  }

  .levels-header {
    margin: 0 auto 20px;
  }

  .levels-header p {
    margin-bottom: 0px;
  }

  .levels-mobile {
    display: grid;
    gap: 14px;
  }

  .level-card {
    background: linear-gradient(135deg,#1790c9,#1bb3e8);
    border-radius: 16px;
    padding: 18px 20px;
    color:#fff;
    display:flex;
    justify-content:space-between;
    align-items:center;
  }

  .level-card span {
    font-weight:700;
  }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
  .mobile-only {
    display: block !important;
  }
}