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

body {
    background: #0e141b;
    color: #e6f0fa;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    overflow-x: hidden;
}

.wrap {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}
/* iOS/Android: корректная динамическая высота вьюпорта */
@supports (height: 100dvh) {
    .wrap { min-height: 100dvh; }
}


.el {
    position: absolute;
    box-sizing: border-box;
    transition: none;
}

/* Текстовые элементы */
.el.text {
    min-height: 30px;           /* как в редакторе (страховка) */
    line-height: 1.3;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    overflow-y: auto;           /* скролл внутри блока */
}
.el.text p,
.el.text h1,
.el.text h2,
.el.text h3,
.el.text h4,
.el.text h5,
.el.text h6,
.el.text ul,
.el.text ol { margin: 0; padding: 0; }
.el.text li { margin: 0 0 .35em; }
.el.text p + p { margin-top: .35em; }
.el.text a { color: inherit; }


/* Изображения */
.el.image {
    overflow: hidden;
}

.el img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: inherit;
    display: block;
}

/* Видео */
.el.video {
    overflow: hidden;
}

.el video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

/* Блоки */
.el.box {
    pointer-events: none;
}

/* Кнопки */
.el.linkbtn,
.el.filebtn {
    overflow: hidden;
    cursor: pointer;
}

.el.linkbtn a, 
.el.filebtn a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    gap: 8px;
}

.el.filebtn a:hover {
    transform: scale(1.02);
}

.el.linkbtn a:active,
.el.filebtn a:active {
    transform: scale(0.98);
}

/* Языковой переключатель (как в редакторе) */
.el.langbadge { background: transparent !important; border: none !important; padding: 0 !important; }
.lang-selector { position: relative; cursor: pointer; display: inline-block; }
.lang-chip { padding: 8px 16px; border-radius: 12px; border: 1px solid #2ea8ff; background: #0f1723; color: #fff; transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 8px; }
.lang-chip:hover { background: #2ea8ff; transform: scale(1.05); }
.lang-flag { font-size: 20px; line-height: 1; }
.lang-dropdown { position: absolute; top: calc(100% + 8px); left: 0; display: none; min-width: 220px; max-height: 280px; overflow-y: auto; background: rgba(12, 18, 26, 0.96); border: 1px solid rgba(46,168,255,0.25); border-radius: 12px; padding: 10px; box-shadow: 0 8px 24px rgba(46,168,255,0.2); backdrop-filter: blur(8px); z-index: 9999; }
.lang-dropdown.show { display: block !important; }
.lang-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: #e8f2ff; transition: background .2s ease; }
.lang-option:hover { background: rgba(46, 168, 255, 0.12); }
.lang-option.active { background: #2ea8ff; color: #fff; }
.lang-dropdown::-webkit-scrollbar { width: 8px; }
.lang-dropdown::-webkit-scrollbar-track { background: #0b111a; border-radius: 4px; }
.lang-dropdown::-webkit-scrollbar-thumb { background: #2a3f5f; border-radius: 4px; }
.lang-dropdown::-webkit-scrollbar-thumb:hover { background: #3a5070; }
/* Встраиваемый контент */
.el.embed {
    overflow: hidden;
}

.el.embed iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: inherit;
}

/* Адаптивность для планшетов */
@media (max-width: 768px) and (min-width: 481px) {
    .wrap {
        min-height: 100vh;
    }
    
    .el.text {
        font-size: calc(100% - 2px) !important;
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
/* скрыть сцену, пока не применим позиции (как в index.php) */
.wrap.pack-pending { visibility: hidden; }
    .wrap {
        min-height: 100vh;
    }
    
    .el {
        transition: none !important;
    }
    
    .el.text {
        font-size: max(14px, calc(100% - 4px)) !important;
        line-height: 1.4 !important;
    }
    
    .el.langbadge .lang-chip {
        font-size: 14px !important;
        padding: 6px 12px !important;
    }
}

/* Анимации при загрузке */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.el {
    animation: fadeIn 0.5s ease-out;
}

/* Печать */
@media print {
    .el.langbadge {
        display: none !important;
    }
    
    .wrap {
        min-height: auto;
    }
}/* === Модуль "кнопка – ссылка" (linkbtn): стили и анимации === */
.el.linkbtn .bl-linkbtn{
  --bl-bg:#3b82f6; --bl-color:#ffffff; --bl-radius:12px;
  display:flex; align-items:center; justify-content:center;
  width:100%; height:100%; box-sizing:border-box;
  padding:var(--bl-py,10px) var(--bl-px,16px);
  min-height:0;
  background:var(--bl-bg); color:var(--bl-color); border-radius:var(--bl-radius);
  text-decoration:none; font-weight:600; line-height:1;
  font-size:var(--bl-font-size,1em);
  box-shadow:0 2px 6px rgba(0,0,0,.12);
  transition:transform .2s ease, filter .2s ease;
}
.el.linkbtn .bl-linkbtn:hover{ transform:scale(1.03); filter:brightness(1.08); }

@keyframes bl-pulse{0%{transform:scale(1)}50%{transform:scale(1.03)}100%{transform:scale(1)}}
@keyframes bl-shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-2px)}75%{transform:translateX(2px)}}
@keyframes bl-fade{0%{opacity:.7}100%{opacity:1}}
@keyframes bl-slide{0%{transform:translateY(0)}50%{transform:translateY(-2px)}100%{transform:translateY(0)}}

.bl-anim-none{}
.bl-anim-pulse{animation:bl-pulse 1.6s ease-in-out infinite;}
.bl-anim-shake{animation:bl-shake .6s linear infinite;}
.bl-anim-fade{animation:bl-fade 1.4s ease-in-out infinite;}
.bl-anim-slide{animation:bl-slide 1.4s ease-in-out infinite;}
/* === Модуль "кнопка – файл" (filebtn): стили и анимации === */
.el.filebtn .bf-filebtn{
  --bf-bg:#10b981; --bf-color:#ffffff; --bf-radius:12px; --bf-font-size:1em;
  display:flex; align-items:center; justify-content:center;
  width:100%; height:100%; box-sizing:border-box;
  padding:var(--bf-py,10px) var(--bf-px,16px);
  min-height:0; gap:8px;
  background:var(--bf-bg); color:var(--bf-color); border-radius:var(--bf-radius);
  text-decoration:none; font-weight:600; line-height:1;
  font-size:var(--bf-font-size);
  box-shadow:0 2px 6px rgba(0,0,0,.12);
  transition:transform .2s ease, filter .2s ease;
  will-change: transform, opacity, filter;
}
.el.filebtn .bf-filebtn:hover{ transform:scale(1.03); filter:brightness(1.08); }
.el.filebtn .bf-icon{ font-size:1.2em; line-height:1; }

/* Анимации для filebtn (используют те же keyframes что и linkbtn) */
.bf-anim-none{}
.bf-anim-pulse{animation:bl-pulse 1.6s ease-in-out infinite; -webkit-animation:bl-pulse 1.6s ease-in-out infinite;}
.bf-anim-shake{animation:bl-shake .6s linear infinite; -webkit-animation:bl-shake .6s linear infinite;}
.bf-anim-fade{animation:bl-fade 1.4s ease-in-out infinite; -webkit-animation:bl-fade 1.4s ease-in-out infinite;}
.bf-anim-slide{animation:bl-slide 1.4s ease-in-out infinite; -webkit-animation:bl-slide 1.4s ease-in-out infinite;}
/* === /filebtn === */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    background: #0e141b;
    color: #e6f0fa;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    overflow-x: hidden;
}

.wrap {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}
/* iOS/Android: корректная динамическая высота вьюпорта */
@supports (height: 100dvh) {
    .wrap { min-height: 100dvh; }
}


.el {
    position: absolute;
    box-sizing: border-box;
    transition: none;
}

/* Текстовые элементы */
.el.text {
    min-height: 30px;           /* как в редакторе (страховка) */
    line-height: 1.3;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    overflow-y: auto;           /* скролл внутри блока */
}
.el.text p,
.el.text h1,
.el.text h2,
.el.text h3,
.el.text h4,
.el.text h5,
.el.text h6,
.el.text ul,
.el.text ol { margin: 0; padding: 0; }
.el.text li { margin: 0 0 .35em; }
.el.text p + p { margin-top: .35em; }
.el.text a { color: inherit; }


/* Изображения */
.el.image {
    overflow: hidden;
}

.el img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: inherit;
    display: block;
}

/* Видео */
.el.video {
    overflow: hidden;
}

.el video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

/* Блоки */
.el.box {
    pointer-events: none;
}

/* Кнопки */
.el.linkbtn,
.el.filebtn {
    overflow: hidden;
    cursor: pointer;
}

.el.linkbtn a, 
.el.filebtn a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    gap: 8px;
}

.el.filebtn a:hover {
    transform: scale(1.02);
}

.el.linkbtn a:active,
.el.filebtn a:active {
    transform: scale(0.98);
}

/* Языковой переключатель (как в редакторе) */
.el.langbadge { background: transparent !important; border: none !important; padding: 0 !important; }
.lang-selector { position: relative; cursor: pointer; display: inline-block; }
.lang-chip { padding: 8px 16px; border-radius: 12px; border: 1px solid #2ea8ff; background: #0f1723; color: #fff; transition: all 0.3s ease; display: inline-flex; align-items: center; gap: 8px; }
.lang-chip:hover { background: #2ea8ff; transform: scale(1.05); }
.lang-flag { font-size: 20px; line-height: 1; }
.lang-dropdown { position: absolute; top: calc(100% + 8px); left: 0; display: none; min-width: 220px; max-height: 280px; overflow-y: auto; background: rgba(12, 18, 26, 0.96); border: 1px solid rgba(46,168,255,0.25); border-radius: 12px; padding: 10px; box-shadow: 0 8px 24px rgba(46,168,255,0.2); backdrop-filter: blur(8px); z-index: 9999; }
.lang-dropdown.show { display: block !important; }
.lang-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: #e8f2ff; transition: background .2s ease; }
.lang-option:hover { background: rgba(46, 168, 255, 0.12); }
.lang-option.active { background: #2ea8ff; color: #fff; }
.lang-dropdown::-webkit-scrollbar { width: 8px; }
.lang-dropdown::-webkit-scrollbar-track { background: #0b111a; border-radius: 4px; }
.lang-dropdown::-webkit-scrollbar-thumb { background: #2a3f5f; border-radius: 4px; }
.lang-dropdown::-webkit-scrollbar-thumb:hover { background: #3a5070; }
/* Встраиваемый контент */
.el.embed {
    overflow: hidden;
}

.el.embed iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: inherit;
}

/* Адаптивность для планшетов */
@media (max-width: 768px) and (min-width: 481px) {
    .wrap {
        min-height: 100vh;
    }
    
    .el.text {
        font-size: calc(100% - 2px) !important;
    }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 480px) {
/* скрыть сцену, пока не применим позиции (как в index.php) */
.wrap.pack-pending { visibility: hidden; }
    .wrap {
        min-height: 100vh;
    }
    
    .el {
        transition: none !important;
    }
    
    .el.text {
        font-size: max(14px, calc(100% - 4px)) !important;
        line-height: 1.4 !important;
    }
    
    .el.langbadge .lang-chip {
        font-size: 14px !important;
        padding: 6px 12px !important;
    }
}

/* Анимации при загрузке */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.el {
    animation: fadeIn 0.5s ease-out;
}

/* Печать */
@media print {
    .el.langbadge {
        display: none !important;
    }
    
    .wrap {
        min-height: auto;
    }
} .= <<<CSS
/* === Дополнительные анимации для кнопок === */

/* Bounce - отскок */
@keyframes bl-bounce{
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-6px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-3px); }
}
@-webkit-keyframes bl-bounce{
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-6px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-3px); }
}

/* Glow - свечение */
@keyframes bl-glow{
  0%, 100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.4); }
}
@-webkit-keyframes bl-glow{
  0%, 100% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 30px rgba(59, 130, 246, 0.4); }
}

/* Rotate - вращение */
@keyframes bl-rotate{
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}
@-webkit-keyframes bl-rotate{
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}

/* Применение анимаций для linkbtn */
.bl-anim-bounce{animation:bl-bounce 1s ease-in-out infinite; -webkit-animation:bl-bounce 1s ease-in-out infinite;}
.bl-anim-glow{animation:bl-glow 1.5s ease-in-out infinite; -webkit-animation:bl-glow 1.5s ease-in-out infinite;}
.bl-anim-rotate{animation:bl-rotate 1.2s ease-in-out infinite; -webkit-animation:bl-rotate 1.2s ease-in-out infinite;}

/* Применение анимаций для filebtn */
.bf-anim-bounce{animation:bl-bounce 1s ease-in-out infinite; -webkit-animation:bl-bounce 1s ease-in-out infinite;}
.bf-anim-glow{animation:bl-glow 1.5s ease-in-out infinite; -webkit-animation:bl-glow 1.5s ease-in-out infinite;}
.bf-anim-rotate{animation:bl-rotate 1.2s ease-in-out infinite; -webkit-animation:bl-rotate 1.2s ease-in-out infinite;}

/* === Модуль "кнопка – ссылка" (linkbtn): стили и анимации === */
.el.linkbtn .bl-linkbtn{
  --bl-bg:#3b82f6; --bl-color:#ffffff; --bl-radius:12px;
  display:flex; align-items:center; justify-content:center;
  width:100%; height:100%; box-sizing:border-box;
  padding:var(--bl-py,10px) var(--bl-px,16px);
  min-height:0;
  background:var(--bl-bg); color:var(--bl-color); border-radius:var(--bl-radius);
  text-decoration:none; font-weight:600; line-height:1;
  font-size:var(--bl-font-size,1em);
  box-shadow:0 2px 6px rgba(0,0,0,.12);
  transition:transform .2s ease, filter .2s ease;
  will-change: transform, opacity, filter;
}
.el.linkbtn .bl-linkbtn:hover{ transform:scale(1.03); filter:brightness(1.08); }

@keyframes bl-pulse{0%{transform:scale(1)}50%{transform:scale(1.03)}100%{transform:scale(1)}}
@-webkit-keyframes bl-pulse{0%{transform:scale(1)}50%{transform:scale(1.03)}100%{transform:scale(1)}}

@keyframes bl-shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-2px)}75%{transform:translateX(2px)}}
@-webkit-keyframes bl-shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-2px)}75%{transform:translateX(2px)}}

@keyframes bl-fade{0%{opacity:.7}100%{opacity:1}}
@-webkit-keyframes bl-fade{0%{opacity:.7}100%{opacity:1}}

@keyframes bl-slide{0%{transform:translateY(0)}50%{transform:translateY(-2px)}100%{transform:translateY(0)}}
@-webkit-keyframes bl-slide{0%{transform:translateY(0)}50%{transform:translateY(-2px)}100%{transform:translateY(0)}}

.bl-anim-none{}
.bl-anim-pulse{animation:bl-pulse 1.6s ease-in-out infinite; -webkit-animation:bl-pulse 1.6s ease-in-out infinite;}
.bl-anim-shake{animation:bl-shake .6s linear infinite; -webkit-animation:bl-shake .6s linear infinite;}
.bl-anim-fade{animation:bl-fade 1.4s ease-in-out infinite; -webkit-animation:bl-fade 1.4s ease-in-out infinite;}
.bl-anim-slide{animation:bl-slide 1.4s ease-in-out infinite; -webkit-animation:bl-slide 1.4s ease-in-out infinite;}
/* === /linkbtn === */
/* === Text Animations (для анимированного текста из мини-редактора) === */
.ta { display: inline; }
@keyframes ta-appear-kf {
  from { opacity: 0; transform: translateY(0.35em); }
  to   { opacity: 1; transform: none; }
}
.ta-appear { animation: ta-appear-kf .6s ease both; }

@keyframes ta-blink-kf {
  0%, 49% { opacity: 1; }
  50%,100%{ opacity: 0; }
}
.ta-blink { animation: ta-blink-kf 1s step-start infinite; }

@keyframes ta-colorcycle-kf {
  0%   { color: var(--ta-origin, currentColor); }
  25%  { color: #ff1744; }
  50%  { color: #ff9100; }
  75%  { color: #2979ff; }
  100% { color: var(--ta-origin, currentColor); }
}
.ta-colorcycle { animation: ta-colorcycle-kf 2s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  .ta-appear, .ta-blink, .ta-colorcycle { animation: none !important; }
}