* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Стилизация скроллбара для Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #000;
}

::-webkit-scrollbar-thumb {
    background: #b1231d;
    border-radius: 0;
    border: none;
}

::-webkit-scrollbar-thumb:hover {
    background: #d31c1c;
}

::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
}

::-webkit-scrollbar-corner {
    background: #000;
}

/* Стилизация скроллбара для Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #b1231d #000;
}

/* Линия загрузки */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: #b1231d;
    z-index: 10000;
    transition: width 0.3s ease;
    width: 0%;
}

*:focus {
    outline: none;
    caret-color: transparent;
}

button, a, input {
    -webkit-tap-highlight-color: transparent;
    outline: none;
    cursor: pointer;
    pointer-events: auto;
}

button:focus, a:focus, input:focus {
    outline: none;
    caret-color: transparent;
}

img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    pointer-events: none;
    -webkit-touch-callout: none;
}

svg {
    pointer-events: none;
}

html {
    overflow: hidden;
    height: 100%;
}

html, body {
    max-width: 100%;
}

body {
    font-family: 'Unbounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #000;
    color: #fff;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("Assets/bg.png");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    opacity: 0.5;
    z-index: -1;
}

.main-wrapper {
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: visible;
}

.container {
    max-width: 680px;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.8s ease-in;
    will-change: opacity, transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    position: relative;
    z-index: 1;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shine {
    0% {
        left: -100%;
    }
    20% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

@keyframes popupSlide {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Критические стили для первого экрана */

.profile-header {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto 2rem;
    animation: fadeInUp 1s ease-out 0.1s both;
    will-change: opacity, transform;
}

.profile-image {
    width: 100%;
    height: auto;
    contain: layout style paint;
}

.profile-image img {
    width: 100%;
    height: auto;
    display: block;
    loading: eager;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    transform: scaleX(-1);
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 1) 70%, rgba(0, 0, 0, 0) 100%);
}

.profile-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, transparent 0%, rgba(0, 0, 0, 0) 100%);
    padding: 2rem 1rem 1rem;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 0.3rem;
    font-weight: 500;
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    color: #fff;
}

.subtitle {
    font-size: 0.7rem;
    color: #808080;
    margin-bottom: 0.2rem;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.age {
    font-size: 0.7rem;
    color: #808080;
    margin-bottom: 0;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.donate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    background: transparent;
    color: #fff;
    border: 3px solid #b1231d;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    animation: fadeInUp 1s ease-out 0.6s both;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.donate-btn:hover {
    background: #b1231d;
    color: #000;
    box-shadow: 0px 10px 40px -2px rgba(0, 11, 48, 0.3);
}

.donate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 4s infinite;
}

.donate-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    flex-wrap: nowrap;
    margin-bottom: 3rem;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.donate-btn, .prod-btn {
    flex: 0 1 auto;
    white-space: nowrap;
}

.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-in;
}

.popup-overlay.active {
    display: flex !important;
}

.popup-content {
    background: #1a1a1a;
    background-image:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50"><path d="M25 10l2 6h6l-5 4 2 6-5-4-5 4 2-6-5-4h6z" fill="%23666666" opacity="0.15"/></svg>');
    background-size: 50px 50px;
    border: 3px solid #b1231d;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: popupSlide 0.3s ease-out, starsMove 10s linear infinite;
}

@keyframes starsMove {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

.popup-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.popup-close:hover {
    color: #b1231d;
}

.popup-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: #fff;
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.popup-btn {
    padding: 1rem;
    background: #b1231d;
    color: #000;
    text-decoration: none;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    border: 3px solid #b1231d;
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.popup-btn:hover {
    background: transparent;
    color: #b1231d;
    box-shadow: 0px 10px 40px -2px rgba(0, 11, 48, 0.3);
}

.popup-btn-title {
    font-size: 1rem;
    font-weight: 500;
}

.popup-btn-subtitle {
    font-size: 0.75rem;
    opacity: 0.8;
}

.prod-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    background: transparent;
    color: #fff;
    border: 3px solid #b1231d;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    animation: fadeInUp 1s ease-out 0.6s both;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.prod-btn:hover {
    background: #b1231d;
    color: #000;
    box-shadow: 0px 10px 40px -2px rgba(0, 11, 48, 0.3);
}

.prod-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shine 4s infinite 2s;
}

.links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.link-item {
    background: #b1231d;
    padding: 0.75rem;
    border-radius: 0;
    text-decoration: none;
    color: #000;
    transition: all 0.2s ease-in-out;
    border: 3px solid #b1231d;
    box-shadow: 0px 2px 3px rgba(0, 11, 48, 0.25);
    animation: fadeInUp 0.7s ease-out both;
    display: block;
    will-change: transform, background, color;
}

.link-item:nth-child(1) { animation-delay: 0.5s; }
.link-item:nth-child(2) { animation-delay: 0.6s; }
.link-item:nth-child(3) { animation-delay: 0.7s; }
.link-item:nth-child(4) { animation-delay: 0.8s; }
.link-item:nth-child(5) { animation-delay: 0.9s; }

.link-item:hover {
    background: transparent;
    color: #b1231d;
    box-shadow: 0px 10px 40px -2px rgba(0, 11, 48, 0.3);
    transform: translateY(-2px);
}

.link-item strong {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.social-icon {
    width: 24px;
    height: 24px;
    fill: #000;
    transition: fill 0.2s ease-in-out;
    flex-shrink: 0;
}

.link-item:hover .social-icon {
    fill: #b1231d;
}

.link-item span {
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0.9;
}

footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: #808080;
    animation: fadeInUp 1s ease-out 1s both;
}

@media (max-width: 640px) {
    .main-wrapper {
        padding: 15px;
    }

    .profile-header {
        max-width: 250px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .subtitle, .age {
        font-size: 0.65rem;
    }

    .button-group {
        max-width: 250px;
        gap: 0.75rem;
    }

    .donate-btn, .prod-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .donate-icon {
        width: 16px;
        height: 16px;
    }

    .link-item {
        padding: 1rem;
    }

    .link-item strong {
        font-size: 1rem;
    }

    .link-item span {
        font-size: 0.85rem;
    }

    footer {
        font-size: 0.8rem;
        margin-top: 1.5rem;
    }

    .popup-content {
        width: 95%;
        padding: 1.5rem;
    }

    .popup-title {
        font-size: 1.25rem;
    }

    .popup-btn {
        padding: 0.85rem;
    }

    .popup-btn-title {
        font-size: 0.9rem;
    }

    .popup-btn-subtitle {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .main-wrapper {
        padding: 10px;
    }

    .profile-header {
        max-width: 220px;
    }

    h1 {
        font-size: 1.35rem;
    }

    .subtitle, .age {
        font-size: 0.6rem;
    }

    .button-group {
        max-width: 220px;
        flex-direction: column;
        gap: 0.5rem;
    }

    .donate-btn, .prod-btn {
        width: 100%;
        justify-content: center;
    }

    .link-item {
        padding: 0.85rem;
    }

    .link-item strong {
        font-size: 0.95rem;
    }

    .link-item span {
        font-size: 0.8rem;
    }

    footer {
        font-size: 0.75rem;
    }

    footer p {
        margin-bottom: 0.5rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .container {
        max-width: 600px;
    }

    .profile-header {
        max-width: 280px;
    }

    h1 {
        font-size: 1.65rem;
    }

    .button-group {
        max-width: 280px;
    }
}

@media (min-width: 1025px) {
    .container {
        max-width: 680px;
    }
}

@media (max-height: 700px) {
    .main-wrapper {
        padding: 10px;
    }

    .profile-header {
        margin-bottom: 1rem;
    }

    .button-group {
        margin-bottom: 2rem;
    }

    .links {
        gap: 0.75rem;
    }

    footer {
        margin-top: 1.5rem;
        padding-top: 1rem;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    .main-wrapper {
        padding: 10px 20px;
        min-height: auto;
    }

    .profile-header {
        max-width: 200px;
        margin-bottom: 0.75rem;
    }

    .button-group {
        margin-bottom: 1.5rem;
    }

    .links {
        gap: 0.5rem;
    }

    .link-item {
        padding: 0.6rem;
    }

    footer {
        margin-top: 1rem;
    }
}
