/* ============================================================
   Beauty Academy Mini App — базовые стили
   Дизайнер (Алёна) приведёт к финальному виду
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg: #735EFF;
  --color-surface: #ffffff;
  --color-primary: #8b5a6e;
  --color-primary-light: #c48fa5;
  --color-text: #1a1a1a;
  --color-text-muted: #6b6b6b;
  --color-border: #e8e0dc;
  --color-nav-bg: #ffffff;
  --color-nav-active: #8b5a6e;
  --color-nav-inactive: #aaa;
  --color-tag-bg: #f0e8ec;
  --color-tag-text: #8b5a6e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --transition: .2s ease;
  --bottom-nav-height: 64px;
}

html, body {
  height: 100%;
  font-family: 'Geologica', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  overflow-x: hidden;
}

/* ---- Welcome screen ---- */

.welcome-block {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px 16px 20px;
  gap: 12px;
  background: #735EFF;
  border-radius: 16px;
  margin: 8px;
  overflow: visible;
}
.welcome-block::before {
  content: '';
  position: absolute;
  top: -60px;
  left: -40px;
  right: -40px;
  bottom: -60px;
  background: url('../assets/f1.png') no-repeat 70% top / 80%;
  pointer-events: none;
}

.welcome-block-title, .welcome-block-texts { position: relative; z-index: 1; }
.welcome-block-title {
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  line-height: 110%;
  letter-spacing: -0.02em;
  margin-top: 40px;
  text-transform: uppercase;
}

.welcome-block-texts {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-block-text {
  font-size: 16px;
  font-weight: 400;
  color: #fff;
  line-height: 1.4;
}

/* ---- Layout ---- */

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-bg);
}

#page-content {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  overscroll-behavior-y: contain;
}

/* ---- Bottom navigation ---- */

#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-radius: 20px 20px 0 0;
  display: flex;
  z-index: 100;
  box-shadow: 0 -4px 24px rgba(115, 94, 255, .08);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: #735EFF;
  transition: color .2s ease;
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  padding: 0;
  position: relative;
}

.nav-item.active { color: #735EFF; }

.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 3px;
  background: #735EFF;
  border-radius: 0 0 3px 3px;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg {
  display: block;
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .2px;
}

/* ---- Common components ---- */

.page {
  display: flex;
  flex-direction: column;
  padding-top: 10px;
  padding-bottom: 10px;
  width: 100%;
  min-width: 0;
}
.page:first-child {
  padding-top: calc(80px + env(safe-area-inset-top, 0px));
}
/* Subpage mode: мгновенно скрываем все секции кроме активной через CSS */
#page-content.subpage-mode ~ #bottom-nav { display: none !important; }
#page-content.subpage-mode { padding-bottom: 0; }
#page-content.subpage-mode .page { display: none !important; }
#page-content.subpage-mode .page.subpage-active {
  display: flex !important;
  padding-top: calc(80px + env(safe-area-inset-top, 0px));
  background: url('../assets/ff.png') no-repeat top center / 100% auto;
  animation: subpageFadeIn .25s ease;
}

@keyframes subpageFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-header {
  padding: 0 16px 24px;
}

.page-title {
  font-size: 40px;
  font-weight: 600;
  color: #fff;
  line-height: 110%;
  letter-spacing: -0.04em;
}

.page-subtitle {
  font-size: 18px;
  color: #fff;
  margin-top: 10px;
  white-space: pre-line;
  word-wrap: break-word;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 12px;
}

.card-body { padding: 16px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--color-text); margin-bottom: 6px; }
.card-text { font-size: 14px; color: var(--color-text-muted); line-height: 1.5; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), transform var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(.97); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-outline { background: transparent; border: 1.5px solid var(--color-primary); color: var(--color-primary); }
.btn-full { width: 100%; }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
}

.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-gray { background: #f0f0f0; color: #666; }
.badge-online { background: #fee2e2; color: #dc2626; font-weight: 600; letter-spacing: .2px; }

.list-padded { padding: 0 16px; }

.divider { height: 1px; background: var(--color-border); margin: 8px 0; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  background: var(--color-tag-bg);
  color: var(--color-tag-text);
  margin-right: 4px;
  margin-bottom: 4px;
}

/* ---- Loading / empty states ---- */

.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 120px auto;
}
.spinner span {
  display: block;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 3.59px;
  transform: rotate(45deg) scale(.7);
  opacity: .2;
  animation: diamondPulse .9s ease-in-out infinite;
}
.spinner span:nth-child(2) { animation-delay: .15s; }
.spinner span:nth-child(3) { animation-delay: .3s; }

@keyframes diamondPulse {
  0%, 100% { opacity: .2; transform: rotate(45deg) scale(.7); }
  50% { opacity: 1; transform: rotate(45deg) scale(1); }
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--color-text-muted);
}
.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

.error-banner {
  background: #fff3f3;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 8px 16px;
  font-size: 14px;
}

/* ---- Page: Courses — фиолетовый фон + карусель ---- */

.courses-page-bg {
  padding: 0 0 24px;
  min-width: 0;
}

.courses-page-title {
  font-size: 40px;
  font-weight: 600;
  color: #fff;
  line-height: 110%;
  letter-spacing: -0.04em;
  margin-bottom: 40px;
  padding: 0 16px;
}

.courses-page-subtitle {
  font-size: 18px;
  font-weight: 400;
  color: #fff;
  line-height: 1.4;
  padding: 0 16px;
  margin-top: -30px;
  margin-bottom: 24px;
  white-space: pre-line;
  word-wrap: break-word;
}

/* Горизонтальный скролл карточек */
.stages-carousel {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 16px;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 12px;
  scrollbar-width: none;
  width: 100%;
}
.stages-carousel::-webkit-scrollbar { display: none; }
.stages-carousel .stage-card:last-child { margin-right: 16px; }

/* Карточка этапа — новый дизайн */
.stage-card {
  width: 75vw;
  min-width: 75vw;
  height: 362px;
  background: #fff;
  border-radius: 30px;
  overflow: hidden;
  scroll-snap-align: start;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.stage-card:active { transform: scale(.98); }

.stage-card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

/* Бейдж "Этап N" с иконкой-ромбом */
.stage-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #735EFF;
  border-radius: 270px;
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  line-height: 1.2;
  height: 27px;
}
.stage-badge-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage-badge-icon::before {
  content: '';
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 3.59px;
  transform: rotate(45deg);
}

/* Светлый вариант бейджа (для фиолетового фона) */
.stage-badge--light {
  background: #fff;
  color: #735EFF;
}
.stage-badge--light .stage-badge-icon::before {
  background: #735EFF;
}

.stage-card-title {
  font-size: 28px;
  font-weight: 500;
  color: #181818;
  line-height: 1.2;
}

/* Картинка в карточке */
.stage-card-image {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  background: linear-gradient(135deg, #E8D5F5 0%, #D4B8E8 50%, #F0E0F7 100%);
  width: 100%;
  height: 202px;
  flex-shrink: 0;
  margin-top: auto;
  padding: 10px;
  display: flex;
  align-items: flex-end;
}
.stage-card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 15px;
}

/* Кнопка "Читать" */
.stage-read-btn {
  position: relative;
  background: #735EFF;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 19px;
  font-family: 'Geologica', sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: opacity .15s ease;
}
.stage-read-btn:active {
  opacity: .85;
}

/* Stage detail — header (фиолетовый фон) */
.stage-detail-header {
  padding: 0 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.stage-detail-title {
  font-size: 38px;
  font-weight: 500;
  color: #fff;
  line-height: 120%;
  letter-spacing: 0;
}

/* Stage detail — white content block */
.stage-detail-content {
  background: #fff;
  border-radius: 30px 30px 0 0;
  padding: 16px 16px calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 24px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 30px;
  flex: 1;
  min-height: calc(100vh - 200px);
}
.stage-detail-content > .event-register-btn { align-self: stretch; }

.stage-detail-image,
.stage-detail-image img {
  width: 100%;
  height: 251px;
  border-radius: 15px;
  object-fit: cover;
}

.video-wrapper {
  background: #f0f0f0;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
  padding-top: 54.06%; /* 428 × 231.38 */
  width: 100%;
}
.video-wrapper iframe,
.video-wrapper video {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
  object-fit: cover;
  border-radius: 15px;
}

.video-poster {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: pointer;
  border-radius: 15px;
  overflow: hidden;
  background: #1a1a1a;
}
.video-poster img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.video-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  background: rgba(0,0,0,.55);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.video-play-btn svg { width: 28px; height: 28px; margin-left: 3px; }
.video-poster:active .video-play-btn { background: rgba(0,0,0,.75); }

.stage-detail-subtitle {
  font-size: 24px;
  font-weight: 500;
  color: #181818;
  line-height: 120%;
  letter-spacing: 0;
}

.stage-description-subtitle {
  font-size: 18px;
  font-weight: 500;
  color: #181818;
  line-height: 140%;
}

.stage-detail-section { width: 100%; display: flex; flex-direction: column; gap: 15px; }

.stage-points-detail { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 15px; }
.stage-points-detail li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 18px;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.5;
}
.stage-points-detail li strong { font-weight: 600; letter-spacing: -0.01em; }
.stage-points-detail li::before {
  content: '';
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  background: #181818;
  border-radius: 3.59px;
  transform: rotate(45deg);
  margin-top: 8px;
}

.checklist-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-top: 4px;
  cursor: pointer;
}
.checklist-link:active { opacity: .7; }

.checklist-icon {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  background: #735EFF;
  border-radius: 3.59px;
  transform: rotate(45deg);
  margin-top: 8px;
}

.checklist-text {
  font-size: 18px;
  font-weight: 400;
  color: #735EFF;
  line-height: 1.5;
  text-decoration: underline;
  text-decoration-color: rgba(115, 94, 255, .4);
  text-underline-offset: 3px;
}

/* ---- Page: Events ---- */

/* Вертикальный список карточек встреч */
.events-vertical {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0 16px;
}

/* Горизонтальная карусель карточек встреч */
.events-carousel {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 16px;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 12px;
  scrollbar-width: none;
}
.events-carousel::-webkit-scrollbar { display: none; }
.events-carousel .event-card-new {
  width: 85vw;
  min-width: 85vw;
  max-width: 400px;
  scroll-snap-align: start;
  flex-shrink: 0;
}
.events-carousel .event-card-new:only-child {
  width: 100%;
  min-width: 100%;
  max-width: none;
  margin-right: 0;
}
.events-carousel .event-card-new:last-child { margin-right: 16px; }

.event-card-new {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
  padding: 20px;
  background: #fff;
  border-radius: 30px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease;
}
.event-card-new:active { transform: scale(.98); }

.event-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.event-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #735EFF;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 270px;
}

.event-image-new {
  width: 100%;
  border-radius: 15px;
  overflow: hidden;
  aspect-ratio: 360 / 202;
}
.event-image-new img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.event-image-placeholder-new {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #E8D5F5 0%, #D4B8E8 50%, #F0E0F7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}

.event-card-title {
  font-size: 24px;
  font-weight: 500;
  color: #181818;
  line-height: 1.2;
  margin-top: -20px;
}

.event-register-btn {
  width: 100%;
  height: 52px;
  background: #735EFF;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .15s;
}
.event-register-btn:active { opacity: .85; }
.event-register-btn:disabled { background: #aaa; cursor: default; opacity: 1; }
.event-register-btn--done { background: #735EFF; color: #fff; }

#page-events .stage-points-detail { gap: 10px; }

/* Event detail page */
.event-detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.event-detail-description {
  font-size: 18px;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.5;
  white-space: pre-line;
}

.event-detail-speaker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: #f7f5ff;
  border-radius: 15px;
  width: 100%;
}


.speaker-block {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.speaker-photo {
  width: 48px; height: 48px;
  border-radius: 50%; object-fit: cover;
  background: var(--color-border);
  flex-shrink: 0;
}
.speaker-name { font-size: 14px; font-weight: 600; }
.speaker-pos { font-size: 13px; color: var(--color-text-muted); }

/* Registration form */
.form-overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: flex-end;
  z-index: 200;
  animation: formOverlayIn .2s ease;
  overscroll-behavior: none;
}
@keyframes formOverlayIn { from { opacity: 0; } to { opacity: 1; } }

/* Lock background when form is open */
html.form-open,
html.form-open body {
  overflow: hidden !important;
  height: 100% !important;
}
html.form-open #page-content {
  overflow: hidden !important;
}
.form-sheet {
  position: relative;
  background: var(--color-surface);
  border-radius: 30px 30px 0 0;
  width: 100%;
  max-height: 85%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px 40px;
  animation: slideUp .25s ease;
  display: flex;
  flex-direction: column;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }

.form-sheet-title { font-size: 19px; font-weight: 700; margin-bottom: 20px; }
.form-sheet-heading { font-size: 22px; font-weight: 700; color: var(--color-text); line-height: 1.3; margin-bottom: 24px; text-align: center; }
.form-consent-note { font-size: 12px; color: var(--color-text-muted); line-height: 1.5; text-align: center; margin-bottom: 16px; }
.form-consent-note a { color: #735EFF; text-decoration: underline; }
.form-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--color-text-muted); z-index: 1; }

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: #fff;
  color: var(--color-text);
  transition: border-color var(--transition);
  -webkit-appearance: none;
}
.form-input:focus { outline: none; border-color: #735EFF; }
.form-input--error { border-color: #e53935 !important; }
.form-field-error { font-size: 12px; color: #e53935; margin-top: 4px; min-height: 0; }

.form-checkbox { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; cursor: pointer; }
.form-checkbox input { margin-top: 3px; accent-color: #735EFF; }
.form-checkbox-text { font-size: 13px; color: var(--color-text-muted); line-height: 1.5; }
.form-checkbox-text a { color: #735EFF; }

.form-sheet .btn-primary { background: #735EFF; }

.form-success {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 100%;
  flex: 1;
  padding: 40px 16px;
}
.form-success-icon { margin-bottom: 4px; }
.form-success p {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}
.form-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: #735EFF;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
  text-decoration: none;
  margin-top: 8px;
  transition: opacity .15s;
}
.form-download-btn:hover { opacity: .9; }

/* ---- Page: Stories ---- */

.stories-carousel {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 16px;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 12px;
  scrollbar-width: none;
  width: 100%;
}
.stories-carousel::-webkit-scrollbar { display: none; }
.stories-carousel .story-card-new:last-child { margin-right: 16px; }

.story-card-new {
  width: 72vw;
  min-width: 72vw;
  max-width: 400px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 30px;
  padding: 12px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease;
}
.story-card-new:active { transform: scale(.97); }

.story-card-image img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 20px;
  display: block;
}

.story-card-body {
  padding: 12px 8px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.story-card-name {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.story-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  order: -1;
}

.story-card-position {
  font-size: 14px;
  color: var(--color-text-muted);
  line-height: 1.3;
}

.story-card-desc {
  font-size: 15px;
  color: var(--color-text);
  line-height: 1.4;
}

.story-detail-position {
  font-size: 18px;
  font-weight: 400;
  color: #fff;
  line-height: 1.4;
  margin-top: 10px;
}

.story-blocks {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.story-block-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: 8px;
}
.story-block-text {
  font-size: 17px;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.5;
  white-space: pre-line;
}

/* ---- Page: Services — карточки ---- */

.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  grid-auto-rows: 1fr;
}

.service-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #fff;
  border-radius: 20px;
  padding-top: 8px;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s ease;
}
.service-card:active { transform: scale(.97); }

.service-card-image {
  padding: 0 8px;
}
.service-card-image img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

.service-image-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f0e8ec 0%, #e8d5df 100%);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
}

.service-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 20px;
}

.service-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  background: #735EFF;
  white-space: nowrap;
}

.service-card-body {
  padding: 0 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.service-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.service-card-desc {
  font-size: 12px;
  color: #181818;
  line-height: 1.4;
}

.service-card-price {
  padding: 0 20px 20px;
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text);
  margin-top: auto;
}

/* ---- Service detail page ---- */

.service-detail-subtitle {
  font-size: 18px;
  font-weight: 400;
  color: #fff;
  line-height: 1.4;
  margin-top: 10px;
}

.service-detail-image {
  width: calc(100% - 32px);
  margin: 0 16px;
  height: 251px;
  border-radius: 15px;
  object-fit: cover;
  display: block;
}

.service-detail-body {
  padding: 40px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.service-detail-body .stage-description-subtitle {
  color: #fff;
  margin-top: 8px;
}

.service-features-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 16px;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px;
  scrollbar-width: none;
}
.service-features-grid::-webkit-scrollbar { display: none; }

.service-feature-card {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 20px 20px 0;
  width: 260px;
  min-width: 260px;
  min-height: 370px;
  flex-shrink: 0;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  overflow: hidden;
}
.service-feature-card:last-child { margin-right: 16px; }

.service-feature-text {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.service-feature-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.service-feature-subtitle {
  font-size: 14px;
  color: #181818;
  line-height: 1.4;
}

.service-connect-btn {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
  gap: 10px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: var(--color-text);
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  line-height: 120%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}
.service-connect-btn:active { opacity: .85; }

.service-feature-svg {
  align-self: flex-end;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  margin-top: auto;
}

/* ---- Modals & toasts ---- */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 448px;
  background: #333;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 14px;
  z-index: 300;
  animation: slideUp .2s ease;
  text-align: center;
}
.toast.success { background: #2e7d32; }
.toast.error { background: #c62828; }

/* ---- Web CTA block ---- */
.web-cta-block {
  padding: 48px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.web-cta-title {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}
.web-cta-text {
  font-size: 16px;
  font-weight: 400;
  color: rgba(255,255,255,.8);
  max-width: 600px;
  line-height: 1.6;
}
.web-cta-btn {
  display: inline-block;
  padding: 14px 32px;
  background: #fff;
  color: #735EFF;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
  text-decoration: none;
  margin-top: 8px;
  transition: opacity .15s;
}
.web-cta-btn:hover {
  opacity: .9;
}

/* ---- Web mode (non-Telegram) ---- */
.web-mode .page { padding-top: 0 !important; }
.web-mode #page-content { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
.web-mode #page-content.subpage-mode { padding-bottom: 0; }
.web-mode #page-content.subpage-mode .page.subpage-active {
  padding-top: calc(70px + env(safe-area-inset-top, 0px)) !important;
}
.web-mode .stage-detail-content {
  padding-bottom: 24px;
  min-height: auto;
}

/* ---- Web back button ---- */
#desktop-back-btn {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 16px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, .15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  color: #fff;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 14px 6px 10px;
  border-radius: 20px;
  transition: background .15s;
}
#desktop-back-btn:hover {
  background: rgba(255, 255, 255, .25);
}
#desktop-back-btn svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* ============================================================
   Desktop adaptation (>768px)
   Ключевое: #app full-width, скролл на body, навигация на весь экран.
   Контент ограничивается через inner max-width.
   ============================================================ */

@media (min-width: 768px) {
  /* --- Core layout: full-width, скролл через body --- */
  #app {
    max-width: none;
    height: auto;
    overflow: visible;
    min-height: 100vh;
  }

  #page-content {
    overflow: visible;
    padding-bottom: calc(var(--bottom-nav-height) + 16px);
  }

  /* --- Bottom navigation: скрыть на десктопе --- */
  #bottom-nav {
    display: none;
  }

  #page-content {
    padding-bottom: 0;
  }

  /* --- Content: на всю ширину --- */
  .page {
    max-width: none;
    width: 100%;
  }
  /* Subpage — handled below in detail section */

  /* --- Form overlay: full screen --- */
  .form-overlay {
    max-width: none;
    left: 0;
    transform: none;
    width: 100%;
    align-items: center;
    background: rgba(0,0,0,.5);
  }
  .form-sheet {
    max-height: 80vh;
    max-width: 520px;
    margin: auto;
    border-radius: 24px;
    padding: 32px 28px 40px;
  }

  /* --- Top padding --- */
  .page:first-child {
    padding-top: 0;
  }
  #page-content.subpage-mode .page.subpage-active {
    padding-top: 0;
  }

  /* --- Welcome block: на всю ширину, картинка у правого края --- */
  .welcome-block {
    padding: 56px 64px 60px;
    margin: 0;
    border-radius: 0;
  }
  .welcome-block::before {
    background: url('../assets/f1.png') no-repeat right top / contain;
    left: auto;
    right: -5px;
    top: -40px;
    bottom: -40px;
    width: 40%;
  }
  .welcome-block-title {
    font-size: 48px;
    margin-top: 64px;
  }
  .welcome-block-text {
    font-size: 17px;
    max-width: 640px;
  }

  /* --- Section titles --- */
  .courses-page-title {
    font-size: 48px;
    padding: 0 32px;
    margin-bottom: 32px;
  }
  .courses-page-subtitle {
    padding: 0 32px;
    font-size: 18px;
  }
  .page-title {
    font-size: 48px;
  }
  .page-header {
    padding: 0 32px 28px;
  }

  /* --- Desktop carousels: horizontal scroll with styled scrollbar --- */
  .stages-carousel,
  .events-carousel,
  .events-vertical,
  .stories-carousel {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 0 32px 16px;
    gap: 24px;
    scrollbar-width: thin;
    scrollbar-color: #735EFF rgba(200, 200, 220, .3);
  }
  .stages-carousel::-webkit-scrollbar,
  .events-carousel::-webkit-scrollbar,
  .events-vertical::-webkit-scrollbar,
  .stories-carousel::-webkit-scrollbar { height: 6px; }
  .stages-carousel::-webkit-scrollbar-track,
  .events-carousel::-webkit-scrollbar-track,
  .events-vertical::-webkit-scrollbar-track,
  .stories-carousel::-webkit-scrollbar-track { background: rgba(200, 200, 220, .3); border-radius: 3px; }
  .stages-carousel::-webkit-scrollbar-thumb,
  .events-carousel::-webkit-scrollbar-thumb,
  .events-vertical::-webkit-scrollbar-thumb,
  .stories-carousel::-webkit-scrollbar-thumb { background: #735EFF; border-radius: 3px; }

  .stages-carousel .stage-card:last-child,
  .events-carousel .event-card-new:last-child,
  .events-vertical .event-card-new:last-child,
  .stories-carousel .story-card-new:last-child { margin-right: 0; }

  /* --- Courses cards --- */
  .stage-card {
    min-width: 320px;
    width: 320px;
    flex-shrink: 0;
    height: auto;
    min-height: 340px;
  }
  .stage-card-title {
    font-size: 22px;
  }

  /* --- Event cards --- */
  .events-carousel .event-card-new,
  .events-vertical .event-card-new {
    min-width: 380px;
    width: 380px;
    flex-shrink: 0;
  }

  /* --- Story cards --- */
  .story-card-new {
    min-width: 300px;
    width: 300px;
    flex-shrink: 0;
  }

  /* --- Services: horizontal scroll --- */
  .services-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    gap: 24px;
    padding: 0 0 16px;
    scrollbar-width: thin;
    scrollbar-color: #735EFF rgba(200, 200, 220, .3);
  }
  .services-grid::-webkit-scrollbar { height: 6px; }
  .services-grid::-webkit-scrollbar-track { background: rgba(200, 200, 220, .3); border-radius: 3px; }
  .services-grid::-webkit-scrollbar-thumb { background: #735EFF; border-radius: 3px; }
  .services-grid .service-card {
    min-width: 240px;
    width: 240px;
    flex-shrink: 0;
  }
  .list-padded {
    padding: 0 32px;
  }

  /* --- Service features: grid --- */
  .service-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    overflow-x: visible;
    scroll-snap-type: none;
    gap: 24px;
    padding: 0 32px;
  }
  .service-feature-card {
    min-width: 0;
    width: 100%;
  }
  .service-feature-card:last-child {
    margin-right: 0;
  }

  /* --- Web CTA block desktop --- */
  .web-cta-block {
    padding: 64px 32px 80px;
  }
  .web-cta-title {
    font-size: 40px;
  }
  .web-cta-text {
    font-size: 18px;
    max-width: 700px;
  }

  /* --- Carousel arrows + gradient --- */
  .carousel-wrap {
    position: relative;
  }
  .carousel-wrap::before,
  .carousel-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 6px;
    width: 60px;
    pointer-events: none;
    z-index: 2;
    transition: opacity .2s;
  }
  .carousel-wrap::before {
    left: 0;
    background: linear-gradient(to right, var(--color-bg), transparent);
    opacity: 0;
  }
  .carousel-wrap::after {
    right: 0;
    background: linear-gradient(to left, var(--color-bg), transparent);
  }
  .carousel-wrap[data-at-start="true"]::before { opacity: 0; }
  .carousel-wrap[data-at-start="false"]::before { opacity: 1; }
  .carousel-wrap[data-at-end="true"]::after { opacity: 0; }
  .carousel-wrap[data-at-end="false"]::after { opacity: 1; }
  .carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .15s;
  }
  .carousel-wrap:hover .carousel-arrow { opacity: 1; }
  .carousel-arrow:hover { background: #fff; }
  .carousel-arrow[disabled] { opacity: 0 !important; }
  .carousel-arrow--left { left: 8px; }
  .carousel-arrow--right { right: 8px; }
  .carousel-arrow svg { width: 20px; height: 20px; color: #333; }

  /* --- Desktop back button --- */

  /* --- Detail pages: полноширинный layout --- */
  #page-content.subpage-mode .page.subpage-active {
    max-width: none;
    margin: 0;
    padding-top: 0;
    background: url('../assets/ff.png') no-repeat top center / 100% auto;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
  }

  .stage-detail-header {
    padding: 48px calc((100% - 1100px) / 2 + 40px) 36px;
    position: relative;
    overflow: hidden;
    border-radius: 0;
  }
  .stage-detail-header::before,
  .stage-detail-header::after {
    display: none;
  }
  .stage-detail-title {
    font-size: 36px;
    position: relative;
    z-index: 1;
    max-width: 1100px;
  }
  .stage-badge--light,
  .stage-badge {
    position: relative;
    z-index: 1;
  }

  .stage-detail-content {
    border-radius: 0;
    padding: 36px calc((100% - 1100px) / 2 + 40px) 48px;
    min-height: auto;
    flex: none;
    align-items: center;
  }
  .stage-detail-content > * {
    max-width: 1100px;
    width: 100%;
  }
  .stage-detail-image,
  .stage-detail-image img {
    height: 400px;
    max-width: 1100px;
  }

  /* --- Toast --- */
  .toast {
    max-width: 520px;
  }

  /* --- Mailing consent popup: full-width --- */
  #mailing-consent-overlay {
    max-width: none !important;
    left: 0 !important;
    transform: none !important;
    width: 100% !important;
  }
}

/* ============================================================
   Large desktop (>1200px)
   ============================================================ */

@media (min-width: 1200px) {
  .page {
    max-width: none;
  }
}
