@import url('https://fonts.googleapis.com/css2?family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Alegreya:ital,wght@0,400..900;1,400..900&family=Google+Sans:ital,opsz,wght@0,17..18,400..700;1,17..18,400..700&family=Huninn&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

*,
*::before,
*::after {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

:root {
    --sky: #050507;
    --accent-2: #d042e3;
}

html {
    background: var(--sky);
}

html, body {
    width: 100%;
    min-width: 100%;
    overflow-x: clip; 
}

body {
    background-color: var(--sky);
    font-family: 'Google Sans', 'Open Sans', 'Roboto', sans-serif;
    margin: 0;
    position: relative;
}

/* Vanity background 1-in-1 */
.bg {
    z-index: 0;
    pointer-events: none;
    background: var(--sky);
    position: fixed;
    inset: 0;
    overflow: hidden;
}

.bg canvas {
    width: 100%;
    height: 100%;
    display: block;
    position: absolute;
    inset: 0;
}

.bg .grain {
    opacity: .35;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
    position: absolute;
    inset: 0;
}

.bg .vignette {
    background: radial-gradient(120% 90% at 50% 10%, #0000 25%, #050507e6 100%);
    position: absolute;
    inset: 0;
}

.navbar,
.container,
.container-m,
.catalog-container {
    position: relative;
    z-index: 1;
}

.navbar{
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-left{
    display: flex;
    align-items: center;
    max-width: 15rem;
    transition: opacity 0.35s ease;
}

.logo{
    width: clamp(3.25rem, 4.5vw, 5.85rem);
    height: auto;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.2, 0, 0, 1);
}

.logo:hover {
    transform: scale(1.06) rotate(-2deg);
}

.title{
    font-family: "SoDo Sans SemiBold", Arial, Helvetica, sans-serif;
    color: rgb(225, 225, 225);
    font-size: clamp(0.85rem, 2.5vw, 1.65rem);
    padding: 5px 10px 5px 10px;
    text-transform: uppercase;
}

.navbar-right{
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem 0.5rem 1rem;
    margin-right: 1rem;
}

.links{
    display: flex;
    align-items: center;
    gap: 5px;
}

.links a {
    font-weight: 700;
    font-size: 1.35rem;
    text-decoration: none;
    color: rgb(225, 225, 225);
    background-color: rgb(34, 34, 39, 0.6);
    padding: 5px 15px;
    border: 1px solid rgb(59, 59, 59);
    z-index: 2;
    
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.channel-link{
    border-radius: 50px 16px 16px 50px;
    position: relative;
    overflow: hidden;
    z-index: 1;
    text-align: center;
}

.channel-link::before{
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(208, 66, 227, 0.95);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    z-index: -1;
}

.channel-link:hover::before{
    width: 300px;
    height: 300px;
}

.profile-link{
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.profile-link span {
    position: relative;
    z-index: 2;
}

.profile-link::before{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 28' preserveAspectRatio='none'%3E%3Cpath d='M0,15 C30,5 40,25 60,15 C80,5 90,25 120,15 L120,28 L0,28 Z' fill='rgba(208, 66, 227, 0.95)'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 100px 100%;
    
    transform: translateY(100%);
    
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    animation: wave-scroll 2s linear infinite;
}

@keyframes wave-scroll {
    0% {
        background-position-x: 0;
    }
    100%{
        background-position-x: 100px;
    }
}

.profile-link:hover::before{
    transform: translateY(0);
}

.main-link {
    border-radius: 16px 50px 50px 16px;
    transition: background-color 0.4s ease-out, 
                border-radius 0.25s ease-out, 
                border-color 0.25s ease-out;
}

.main-link:hover {
    background-color: rgba(208, 66, 227, 0.877);
    border-radius: 50px;
    border-color: transparent;
}

.mobile{
    display: none !important;
}

/* Контейнер бургера */
.burger {
    position: relative;
    width: 40px;
    height: 40px;
    margin-right: 5%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Общие стили для обеих иконок: центрируем их строго в одной точке */
.openbtn,
.closebtn {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.openbtn {
    color: rgb(225, 225, 225);
    opacity: 1;
    pointer-events: auto;
    transform: rotate(0deg) scale(1);
}

.openbtn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: rotate(90deg) scale(0.7);
}

.closebtn {
    color: rgb(173, 173, 173);
    opacity: 0;
    pointer-events: none;
    transform: rotate(0deg) scale(0.7);
    z-index: 99999;
}

.closebtn.visible {
    opacity: 1;
    pointer-events: auto;
    transform: rotate(-90deg) scale(1);
}

.menu{
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;


    transform: translateX(100vw);
    transition: transform 0.4s ease, visibility 0.4s ease;
    pointer-events: none;
    visibility: hidden;
}

.menu.visible {
    display: flex;
    transform: translateX(0);
    pointer-events: auto;
    visibility: visible;
}

.links-m{
    display: flex;
    flex-direction: column;
    margin-top: 20%;
}

.moblink{
    color: rgb(173, 173, 173);
    font-size: 1.5rem;
    text-align: left;
    text-decoration: none;
    padding: 20px 5% 20px 5%;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgb(73, 73, 73);
}

.moblink:first-child{
    border-top: 1px solid rgb(73, 73, 73);
}

.moblink:hover{
    color: rgba(219, 143, 255, 0.86);
}

body.menu-open .navbar {
    background-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.menu-open .navbar-left {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.container{
    width: 100%;
    max-width: 82.75rem;
    display: flex;
    align-items: center;
    flex-direction: column;
    margin: 0 auto;
    justify-content: center;
}

.title-container{
    display: flex;
    align-items: center;
    justify-content: center;
    margin: clamp(4rem, 6vw, 6.5rem) auto 2rem auto;
    flex-direction: row;
    gap: clamp(1.5rem, 2vw, 2.25rem);
}

.title-h{
    margin: 0;
    color: rgb(225, 225, 225);
    font-size: clamp(1.3rem, 2.2vw, 2.5rem);
    line-height: 1.25;
    text-align: right;
    animation: titleFadeUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes titleFadeUp {
    0% {
        opacity: 0;
        transform: translateY(16px);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: none;
    }
}

.title-h span{
    color: rgb(208, 66, 227);
    font-size: clamp(2.2rem, 5vw, 5rem);
    font-family: 'Huninn', 'Open sans', 'Roboto';
    font-weight: 500;
    text-shadow: 0 0 20px rgba(208, 66, 227, 0.22);
}

.desc{
    font-size: clamp(1rem, 1.4vw, 1.45rem);
    line-height: 1.45;
    color: rgb(170, 170, 175);
    text-align: left;
    margin: 0;
    position: relative;
    padding: 0.5rem 0 0.5rem clamp(1.5rem, 2vw, 2.25rem);
    animation: descFadeUp 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

@keyframes descFadeUp {
    0% {
        opacity: 0;
        transform: translateY(16px);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: none;
    }
}

.desc::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    width: 2px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(255, 255, 255, 0.12) 20%,
        rgba(225, 225, 225, 0.5) 50%,
        rgba(255, 255, 255, 0.12) 80%,
        transparent 100%
    );
    opacity: 0;
    transform: scaleY(0.4);
    transform-origin: center;
    animation: dividerFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.22s forwards;
}

@keyframes dividerFadeIn {
    0% {
        opacity: 0;
        transform: scaleY(0.4);
    }
    100% {
        opacity: 1;
        transform: scaleY(1);
    }
}

.custom-cursor{
    position: fixed;
    top: 0;
    left: 0;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999999;

    border: 1px solid rgba(227, 227, 231, 0.55);
    background-color: transparent;

    transform: translate(-50%, -50%);

    transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        height 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.25s ease,
        background-color 0.25s ease,
        opacity 0.2s ease;
    opacity: 0;
}

.custom-cursor.interactive{
    border-color: rgba(208, 66, 227, 0.95);
    background: rgba(208, 66, 227, 0.08);
    transform: translate(-50%, -50%) scale(1.15);
}

.custom-cursor.is-card{
    width: var(--cursor-size, 90px);
    height: var(--cursor-size, 90px);
    border-color: rgba(208, 66, 227, 0.95);
    background-color: transparent;
    transform: translate(-50%, -50%);
}

.main-container{
    width: fit-content;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    margin: 0 auto;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    gap:  clamp(1.2rem, 2vw, 2.5rem);
    background-color: rgba(34, 34, 39, 0.6);
    padding: clamp(1rem, 1.8vw, 1.8rem);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.img-card{
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    cursor: pointer;
    flex-shrink: 0;
    width: clamp(16rem, 21vw, 22rem);
    border: 1px solid rgba(255, 255, 255, 0.12);
    animation: cardin 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardin {
    0% {
        opacity: 0;
        transform: translateY(32px) scale(0.96);
        filter: blur(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: none;
    }
}

.img-base{
    display: block;
    width: 100%;
    height: auto;
    border-radius: 14px;
}

.img-hover{
    position: absolute;
    inset: 0%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
    z-index: 2;
    opacity: 0;
    clip-path: circle(var(--r, 45px) at var(--x, 50%) var(--y, 50%));
    transition: opacity 0.25s ease;
    will-change: clip-path;
}

.img-card:hover .img-hover{
    opacity: 1;
}

/* mobile */

@media (max-width: 1024px) {
    .links.desktop {
        display: none !important;
    }
    .burger.mobile {
        display: flex !important;
    }
    .menu.mobile {
        display: flex;
    }
}

@media (max-width: 760px) {
    .desktop{
        display: none !important;
    }
    .mobile{
        display: flex !important;
    }
    .custom-cursor{
        display: none !important;
    }
    .title{
        font-size: 1.2rem;
    }
    .navbar{
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        box-sizing: border-box;
        padding-top: env(safe-area-inset-top, 0px);
        z-index: 10000;
        background-color: rgba(5, 5, 7, 0.6);

        transition: background-color 0.35s ease, 
                    backdrop-filter 0.35s ease, 
                    -webkit-backdrop-filter 0.35s ease;
    }

    .title-container {
        flex-direction: column !important;
        gap: 5rem !important;
        margin-top: 15rem !important;
        margin-bottom: 1.5rem !important;
        padding: 0 1.25rem !important;
        align-items: center !important;
        text-align: center !important;
    }

    .title-h {
        text-align: center !important;
        margin: 0 !important;
        font-size: clamp(1.4rem, 6vw, 1.85rem) !important;
        color: rgb(225, 225, 225);
    }

    .title-h span {
        font-size: clamp(2rem, 8.5vw, 3rem) !important;
    }

    .desc {
        text-align: center !important;
        padding: 0 !important;
        margin: 0 !important;
        font-size: clamp(0.95rem, 3.8vw, 1.15rem) !important;
    }

    .desc::before {
        display: none !important;
    }
    .main-container-m{
        position: relative;
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        height: 120vw;
        margin-top: 3rem;
        margin-bottom: 5rem;
        padding: 0;
    }
    .img-card-m{
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        width: 100vw;
        border-radius: 20px;

        opacity: 0;
        transform: translateY(50px);
        transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
        will-change: transform, opacity;
    }
    .img-card-m.visible{
        opacity: 1;
        transform: translateY(0);
    }
    .img-base-m{
        display: block;
        width: 100%;
        box-sizing: border-box;
        border-radius: 20px;
        border: 4px solid rgba(208, 66, 227, 0.8);
    }
    .img-card-m:nth-child(1){
        top: 0;
        z-index: 1;
    }
    .img-card-m:nth-child(2){
        top: 30%;
        z-index: 2;
    }
    .img-card-m:nth-child(3){
        top: 60%;
        z-index: 3;
    }

    /* блок при открытии карточек */

    body.modal-open {
        overflow: hidden !important;
    }

    .font-modal {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100dvh; 
        z-index: 100000;
        display: flex;
        flex-direction: column; 
        align-items: center;
        justify-content: center;
        padding: 1rem;
        box-sizing: border-box;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
        touch-action: none;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
    }

    .font-modal:not(.active),
    .font-modal:not(.active) * {
        pointer-events: none !important;
    }

    .font-modal.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .modal-backdrop {
        position: absolute;
        inset: 0;
        background: rgba(5, 5, 7, 0.88);
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        cursor: pointer;
        pointer-events: none;
        -webkit-tap-highlight-color: transparent;
    }

    .font-modal.active .modal-backdrop {
        pointer-events: auto;
    }

    .modal-close {
        position: absolute;
        top: max(1.25rem, env(safe-area-inset-top, 1.25rem));
        right: 1.25rem;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: 50%;
        color: #fff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 20;
        transition: opacity 0.3s ease, transform 0.25s ease, border-color 0.25s ease;
    }

    .modal-close:hover {
        border-color: rgba(208, 66, 227, 0.8);
        transform: scale(1.08);
    }

    /* Режим изучения: выбор из 2 карточек (study-mode) */
    .font-modal.study-mode:not(.zoomed-card) .modal-wrapper {
        padding-top: max(3.5rem, env(safe-area-inset-top, 3.5rem));
        padding-bottom: calc(max(1.5rem, env(safe-area-inset-bottom, 1.5rem)) + 72px);
    }
    .font-modal.study-mode:not(.zoomed-card) .modal-stack {
        width: min(62vw, calc((100dvh - 230px) * 0.39));
        transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .font-modal.study-mode:not(.zoomed-card) .modal-card.card-base {
        z-index: 1;
        opacity: 1;
        transform: translateY(-6%) scale(0.96);
        pointer-events: auto;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
    }
    .font-modal.study-mode:not(.zoomed-card) .modal-card.card-custom {
        z-index: 2;
        opacity: 1;
        transform: translateY(6%) scale(1);
        pointer-events: auto;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
    }
    .font-modal.study-mode:not(.zoomed-card) .bell-toggle {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translateX(-50%) translateY(12px) scale(0.95) !important;
    }

    /* Режим сравнения (compare-mode: слайдер до/после) */
    .font-modal.compare-mode .modal-wrapper {
        padding-top: max(3.5rem, env(safe-area-inset-top, 3.5rem));
        padding-bottom: calc(max(1.5rem, env(safe-area-inset-bottom, 1.5rem)) + 76px);
    }
    .font-modal.compare-mode .modal-stack {
        width: min(66vw, calc((100dvh - 215px) * 0.42));
        border-radius: 20px;
        overflow: hidden;
        border: 2px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
        touch-action: none;
        cursor: ew-resize;
        transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .font-modal.compare-mode .modal-card {
        border-radius: 0;
        border: none;
        box-shadow: none;
        cursor: ew-resize;
        touch-action: none;
    }
    .font-modal.compare-mode .modal-card::after {
        display: none !important;
    }
    .font-modal.compare-mode .modal-card.card-base {
        z-index: 1;
        opacity: 1;
        transform: translateY(0) scale(1) !important;
        pointer-events: none;
    }
    .font-modal.compare-mode .modal-card.card-custom {
        z-index: 2;
        opacity: 1;
        transform: translateY(0) scale(1) !important;
        pointer-events: none;
        clip-path: inset(0 0 0 var(--compare-pos, 50%));
        -webkit-clip-path: inset(0 0 0 var(--compare-pos, 50%));
        transition: none;
    }
    .font-modal.compare-mode .modal-card.card-base .modal-badge {
        position: absolute;
        top: 12px;
        left: 12px;
        right: auto;
        opacity: 1;
        z-index: 5;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    .font-modal.compare-mode .modal-card.card-custom .modal-badge {
        position: absolute;
        top: 12px;
        right: 12px;
        left: auto;
        opacity: 1;
        z-index: 5;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    .font-modal.compare-mode .bell-toggle {
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translateX(-50%) translateY(12px) scale(0.95) !important;
    }

    /* Разделитель режима сравнения (Before / After slider) */
    .compare-slider {
        position: absolute;
        top: 0;
        bottom: 0;
        left: var(--compare-pos, 50%);
        width: 44px;
        margin-left: -22px;
        z-index: 10;
        cursor: ew-resize;
        touch-action: none;
        display: none;
        align-items: center;
        justify-content: center;
        user-select: none;
        -webkit-user-select: none;
        pointer-events: auto;
    }

    .font-modal.compare-mode .compare-slider {
        display: flex;
    }

    .compare-divider-line {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: 2px;
        transform: translateX(-50%);
        background: #8e8e93;
        box-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
        pointer-events: none;
    }

    .compare-handle {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 32px;
        height: 20px;
        border-radius: 10px;
        background: rgba(24, 24, 28, 0.95);
        border: 1.5px solid #8e8e93;
        box-shadow: 0 3px 12px rgba(0, 0, 0, 0.7);
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
        transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    }

    .compare-slider:active .compare-handle,
    .compare-slider.is-dragging .compare-handle {
        transform: translate(-50%, -50%) scale(1.1);
        border-color: #d042e3;
        background: rgba(30, 24, 34, 0.98);
    }

    .compare-slider:active .compare-divider-line,
    .compare-slider.is-dragging .compare-divider-line {
        background: #d042e3;
        box-shadow: 0 0 8px rgba(208, 66, 227, 0.6);
    }

    .font-modal.study-mode.zoomed-card .modal-close {
        opacity: 0;
        pointer-events: none;
        transform: scale(0.7);
    }
    .font-modal.study-mode.zoomed-card .modal-wrapper {
        padding-top: max(1.5rem, env(safe-area-inset-top, 1.5rem));
        padding-bottom: calc(max(1.5rem, env(safe-area-inset-bottom, 1.5rem)) + 124px);
    }
    .font-modal.study-mode.zoomed-card .modal-stack {
        width: min(66vw, calc((100dvh - 215px) * 0.42));
        transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .font-modal.study-mode.zoomed-card .modal-card.card-base {
        z-index: 10;
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
    }
    .font-modal.study-mode.zoomed-card .modal-card.card-custom {
        z-index: 20;
        opacity: 0;
        pointer-events: none;
        transform: translateY(0) scale(1);
        transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .font-modal.study-mode.zoomed-card.toggle-on .modal-card.card-custom,
    .font-modal.study-mode.zoomed-card .modal-card.card-custom.is-zoomed {
        opacity: 1;
        pointer-events: auto;
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 35px rgba(208, 66, 227, 0.4);
    }
    .font-modal.study-mode.zoomed-card.toggle-on .modal-card.card-base .modal-badge {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .font-modal.study-mode.zoomed-card.toggle-on .modal-card.card-base::after {
        opacity: 0;
        transition: opacity 0.25s ease;
    }
    .font-modal.active .hold-btn {
        opacity: 1;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0) scale(1);
    }

    .font-modal.study-mode.zoomed-card .bell-toggle {
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: translateX(-50%) translateY(0) scale(1) !important;
    }

    .modal-wrapper {
        position: relative;
        z-index: 2;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        box-sizing: border-box;
        pointer-events: none;
    }

    .modal-stack {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
        width: min(56vw, calc((100dvh - 245px) * 0.38));
        margin: 0 auto;
        position: relative;
        pointer-events: auto;
        transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .modal-card {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        position: relative;
        box-sizing: border-box;
        border-radius: 20px;
        overflow: hidden;
        cursor: pointer;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85);
        touch-action: none;
        -webkit-touch-callout: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        will-change: transform;
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), 
            opacity 0.35s ease,
            box-shadow 0.35s ease;
    }

    .modal-card::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 20px;
        pointer-events: none;
        z-index: 5;
        box-sizing: border-box;
    }

    .modal-card.card-base::after {
        border: 3.5px solid rgba(255, 255, 255, 0.28);
    }

    .modal-card.card-custom::after {
        border: 3.5px solid rgba(208, 66, 227, 0.95);
    }

    .modal-img {
        display: block;
        width: 100%;
        height: auto;
        border-radius: 20px;
        pointer-events: none;
        -webkit-user-drag: none !important;
        -webkit-touch-callout: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
    }

    .modal-card.card-base {
        z-index: 1;
        transform: translateY(-10%) scale(0.96);
    }
    .modal-card.card-custom {
        z-index: 2;
        transform: translateY(10%) scale(1);
    }


    .modal-badge {
        position: absolute;
        top: 12px;
        left: 12px;
        padding: 4px 10px;
        border-radius: 8px;
        font-size: 0.78rem;
        font-weight: 600;
        background: rgba(15, 15, 18, 0.75);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: #e5e5e5;
        z-index: 6;
    }

    .modal-badge.badge-accent {
        background: rgba(208, 66, 227, 0.25);
        border-color: rgba(208, 66, 227, 0.7);
        color: #fff;
    }
    .modal-card.is-zoomed {
        z-index: 20;
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95), 0 0 35px rgba(208, 66, 227, 0.4);
    }
    .modal-card.touching {
        transition: none !important;
    }

    @keyframes cardSlideDown {
        0% {
            opacity: 0;
            transform: translateY(-35px) scale(0.98);
        }
        100% {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    .modal-card.card-custom.slide-in-down {
        animation: cardSlideDown 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
    }

    .bell-toggle {
        --bt-color: #f5f5f5;
        --bt-bg: #222227;
        --bt-on-color: #121215;
        --bt-on-bg: #f5f5f5;
        --bt-radius: 22px;
        --bt-fade: 200ms;
        --bt-h: 40px;
        --bt-fs: 13.5px;
        --bt-icon: 16px;
        --bt-px: 17px;
        --bt-gap: 8px;
        --bt-press: 0.96;
        --bt-ease-out: cubic-bezier(0.23, 1, 0.32, 1);

        position: absolute;
        bottom: calc(max(1.5rem, env(safe-area-inset-bottom, 1.5rem)) + 70px);
        left: 50%;
        transform: translateX(-50%) translateY(12px) scale(0.95);
        z-index: 50;
        opacity: 0;
        pointer-events: none;
        user-select: none !important;
        -webkit-user-select: none !important;
        -webkit-touch-callout: none !important;
        transition: opacity 0.25s ease,
                    transform 0.25s var(--bt-ease-out);
    }


    .bell-toggle[data-pressed] {
        transform: translateX(-50%) scale(var(--bt-press)) !important;
    }

    .bell-toggle__button {
        display: inline-flex;
        align-items: center;
        gap: var(--bt-gap);
        height: var(--bt-h);
        margin: 0;
        padding: 0 var(--bt-px);
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: var(--bt-radius);
        background: var(--bt-bg);
        color: var(--bt-color);
        font: inherit;
        font-size: var(--bt-fs);
        font-weight: 500;
        line-height: 1;
        letter-spacing: 0.01em;
        white-space: nowrap;
        cursor: pointer;
        outline: none;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1),
                    0 6px 20px rgba(0, 0, 0, 0.45);
        transition:
            background-color var(--bt-fade) ease,
            color var(--bt-fade) ease,
            border-color var(--bt-fade) ease,
            box-shadow var(--bt-fade) ease;
    }

    .bell-toggle[data-on='true'] .bell-toggle__button {
        background: var(--bt-on-bg);
        color: var(--bt-on-color);
        border-color: rgba(255, 255, 255, 0.9);
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.35),
                    0 4px 16px rgba(0, 0, 0, 0.3);
    }

    .bell-toggle__bell {
        position: relative;
        display: inline-grid;
        place-items: center;
        flex: none;
        width: var(--bt-icon);
        height: var(--bt-icon);
    }

    .bell-toggle__glyph {
        display: inline-grid;
        place-items: center;
        font-size: 14.5px;
        font-weight: 700;
        line-height: 1;
        transform-origin: 50% 50%;
        font-family: inherit;
    }

    .bell-toggle.wiggle .bell-toggle__glyph {
        animation: btWobble 0.5s ease-out;
    }

    @keyframes btWobble {
        0% { transform: rotate(0deg); }
        20% { transform: rotate(-16deg); }
        40% { transform: rotate(13deg); }
        60% { transform: rotate(-8deg); }
        80% { transform: rotate(4deg); }
        100% { transform: rotate(0deg); }
    }

    .bell-toggle__say {
        display: inline-grid;
        grid-template-columns: max-content;
        height: 18px;
        line-height: 18px;
    }

    .bell-toggle__face {
        grid-area: 1 / 1;
        justify-self: start;
        opacity: 0;
        filter: blur(2.5px);
        transform: translateY(3px);
        transition:
            opacity var(--bt-fade) ease,
            filter var(--bt-fade) ease,
            transform var(--bt-fade) cubic-bezier(0.23, 1, 0.32, 1);
    }

    .bell-toggle[data-on='false'] .bell-toggle__face--off {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }

    .bell-toggle[data-on='true'] .bell-toggle__face--on {
        opacity: 1;
        filter: blur(0);
        transform: translateY(0);
    }

    .bell-toggle[data-on='true'] .bell-toggle__face--off {
        opacity: 0;
        filter: blur(2.5px);
        transform: translateY(-3px);
    }

    .bell-toggle[data-on='false'] .bell-toggle__face--on {
        opacity: 0;
        filter: blur(2.5px);
        transform: translateY(3px);
    }

    /* кнопка удержания */
    .hold-btn {
        position: absolute;
        bottom: max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
        left: 50%;
        z-index: 50;
        padding: 0.82rem 1.65rem;
        background: #18181e;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 14px;
        color: #f4f4f5;
        font-family: inherit;
        font-size: 0.9rem;
        font-weight: 600;
        letter-spacing: -0.01em;
        cursor: pointer;
        overflow: hidden;
        outline: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        touch-action: none;
        -webkit-touch-callout: none !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        white-space: nowrap;
        box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.1), 
                    0 8px 24px rgba(0, 0, 0, 0.55);
        opacity: 0;
        pointer-events: none;
        transform: translateX(-50%) translateY(14px) scale(0.96);
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), 
            border-color 0.25s ease,
            box-shadow 0.25s ease,
            opacity 0.25s ease;
    }

    .hold-btn:active,
    .hold-btn.is-holding {
        transform: translateX(-50%) scale(0.96) !important;
        border-color: rgba(208, 66, 227, 0.65);
        box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.12),
            0 0 24px rgba(208, 66, 227, 0.4);
    }

    .hold-btn-fill {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 0%;
        background: linear-gradient(90deg, rgba(208, 66, 227, 0.85), #d042e3);
        pointer-events: none;
        z-index: 1;
        box-shadow: 0 0 16px rgba(208, 66, 227, 0.8);
    }

    .hold-wave {
        position: absolute;
        right: -7px;
        top: 0;
        width: 10px;
        height: 160px;
        fill: #d042e3;
        pointer-events: none;
        animation: holdWaveScroll 0.75s linear infinite;
    }

    @keyframes holdWaveScroll {
        0% {
            transform: translateY(0);
        }
        100% {
            transform: translateY(-40px);
        }
    }

    .hold-btn-content {
        position: relative;
        z-index: 2;
        display: inline-flex;
        align-items: center;
        gap: 0.55rem;
        pointer-events: none;
    }

    .hold-btn-icon {
        display: inline-block;
        opacity: 0.85;
    }
}